Commit 4f3398aa authored by Jan Möbius's avatar Jan Möbius

Reduced Menubar system

Scripting function to expand Toolboxes
Splash screen on top

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16997 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8fe60f9b
......@@ -245,7 +245,7 @@ Core::init() {
if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
QPixmap splashPixmap(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "splash.png");
splash_ = new QSplashScreen(splashPixmap);
splash_ = new QSplashScreen(splashPixmap, Qt::WindowStaysOnTopHint);
splash_->show();
splash_->showMessage(tr("Initializing mainwindow") ,
......@@ -675,7 +675,8 @@ Core::init() {
}
if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) {
splash_->finish(coreWidget_);
splash_->raise();
QTimer::singleShot(2000, this, SLOT(finishSplash()));
}
// start checking for scenegraph changes
......@@ -1925,6 +1926,13 @@ bool Core::checkOpenGLCapabilities() {
return ok;
}
void Core::showReducedMenuBar(bool reduced) {
coreWidget_->showReducedMenuBar(reduced);
}
void Core::finishSplash() {
splash_->finish(coreWidget_);
}
//=============================================================================
......@@ -773,7 +773,7 @@ public slots:
* @param _active Activate or deactivate
*/
void setToolBoxActive(QString _toolBoxName, bool _active);
/** @} */
//===========================================================================
......@@ -988,6 +988,8 @@ private slots:
*/
QWidget *getToolbox(QString _pluginName, QString _toolboxName);
void activateToolbox(QString _pluginName, QString _toolboxName, bool activate);
private :
//===========================================================================
......@@ -1224,6 +1226,8 @@ private slots:
/// Move selected toolbox to bottom of side area
void moveToolBoxToBottom(QString _name);
void showReducedMenuBar(bool reduced);
private :
/// Core scripting engine
QScriptEngine scriptEngine_;
......@@ -1436,6 +1440,8 @@ private slots:
*/
void exitFailure();
void finishSplash();
/** @} */
......
......@@ -235,6 +235,11 @@ QWidget *Core::getToolbox(QString _pluginName, QString _toolboxName) {
return 0;
}
void Core::activateToolbox(QString _pluginName, QString _toolboxName, bool activate) {
QWidget *toolbox = Core::getToolbox(_pluginName, _toolboxName);
coreWidget_->expandToolBoxWidget(toolbox, activate);
}
void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1;
......
......@@ -486,9 +486,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
connect( viewerLayoutBox_,SIGNAL( activated(int) ), this, SLOT( setViewerLayout(int) ) );
viewerToolbar_->addWidget( viewerLayoutBox_ );
extended_actions.push_back(viewerToolbar_->addWidget( viewerLayoutBox_ ));
viewerToolbar_->addSeparator();
extended_actions.push_back(viewerToolbar_->addSeparator());
if (OpenFlipper::Options::stereo())
{
......@@ -509,7 +509,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
connect( stereoButton_, SIGNAL( clicked() ), this , SLOT( slotToggleStereoMode() ) );
// Custom context menu
connect( stereoButton_, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(stereoButtonContextMenu(const QPoint &)));
viewerToolbar_->addWidget( stereoButton_ )->setText( tr("Stereo"));
QAction *stereoAction = viewerToolbar_->addWidget( stereoButton_ );
stereoAction->setText( tr("Stereo"));
extended_actions.push_back(stereoAction);
}
......@@ -554,8 +556,11 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
vLayout->addWidget(viewModeControlBox_);
vLayout->addWidget(toolBoxScroll_);
if ( OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() )
if ( OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() ) {
viewModeControlBox_->hide();
if (viewModeButton_)
viewModeButton_->setVisible(false);
}
toolBoxArea_->setLayout (vLayout);
......@@ -695,8 +700,10 @@ CoreWidget::showViewModeControls(bool _show) {
if ( _show ) {
viewModeControlBox_->show();
viewModeButton_->setVisible(true);
} else {
viewModeControlBox_->hide();
viewModeButton_->setVisible(false);
}
}
......
......@@ -420,6 +420,8 @@ public:
///Store current key assignments to a given INI file
void saveKeyBindings(INIFile& _ini);
void showReducedMenuBar(bool reduced);
private:
/// Store the state of the shift key
bool shiftPressed_;
......@@ -563,7 +565,7 @@ public:
private:
QPushButton* viewModeButton_;
QAction* viewModeButton_;
/// Submenu holding all ViewMode actions
QMenu* viewModeMenu_;
......@@ -1461,6 +1463,8 @@ public:
*/
void pickMode( int _id );
void expandToolBoxWidget(QWidget *widget, bool expand);
public slots:
/** Switch to given picking mode
......@@ -1533,6 +1537,11 @@ public:
*/
int pick_mode_idx_;
/**
* Actions that are hidden in reduced mode.
*/
std::vector<QAction*> extended_actions;
/// update pick mode menu
void updatePickMenu();
......
......@@ -123,6 +123,12 @@ bool CoreWidget::eventFilter(QObject *_obj, QEvent *_event)
//=============================================================================
void CoreWidget::showReducedMenuBar(bool reduced) {
for (std::vector<QAction*>::iterator it = extended_actions.begin(); it != extended_actions.end(); ++it) {
(*it)->setVisible(!reduced);
}
}
void CoreWidget::setupMenuBar()
{
......@@ -158,8 +164,8 @@ void CoreWidget::setupMenuBar()
AC_AddEmpty->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"add-empty-object.png"));
connect(AC_AddEmpty, SIGNAL(triggered()), this, SIGNAL(addEmptyObjectMenu()));
fileMenu_->addAction(AC_AddEmpty);
fileMenu_->addSeparator();
extended_actions.push_back(AC_AddEmpty);
extended_actions.push_back(fileMenu_->addSeparator());
//Save object
QAction* AC_Save = new QAction(tr("Save Objects"), this);
......@@ -169,6 +175,7 @@ void CoreWidget::setupMenuBar()
AC_Save->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"document-save.png"));
connect(AC_Save, SIGNAL(triggered()), this, SIGNAL(saveMenu()));
fileMenu_->addAction(AC_Save);
extended_actions.push_back(AC_Save);
//Save object to
QAction* AC_Save_to = new QAction(tr("Save Objects to"), this);
......@@ -178,7 +185,7 @@ void CoreWidget::setupMenuBar()
connect(AC_Save_to, SIGNAL(triggered()), this, SIGNAL(saveToMenu()));
fileMenu_->addAction(AC_Save_to);
fileMenu_->addSeparator();
extended_actions.push_back(fileMenu_->addSeparator());
//Load ini
QAction* AC_load_ini = new QAction(tr("Load Settings"), this);
......@@ -187,6 +194,7 @@ void CoreWidget::setupMenuBar()
AC_load_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"load-settings.png"));
connect(AC_load_ini, SIGNAL(triggered()), this, SIGNAL(loadIniMenu()));
fileMenu_->addAction(AC_load_ini);
extended_actions.push_back(AC_load_ini);
//Save ini
QAction* AC_save_ini = new QAction(tr("Save Settings"), this);
......@@ -195,8 +203,9 @@ void CoreWidget::setupMenuBar()
AC_save_ini->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"save-settings.png"));
connect(AC_save_ini, SIGNAL(triggered()), this, SIGNAL(saveIniMenu()));
fileMenu_->addAction(AC_save_ini);
extended_actions.push_back(AC_save_ini);
fileMenu_->addSeparator();
extended_actions.push_back(fileMenu_->addSeparator());
//Options
QAction* AC_Options = new QAction(tr("Options"), this);
......@@ -235,7 +244,8 @@ void CoreWidget::setupMenuBar()
menus_[tr("View")] = viewMenu_;
slotUpdateGlobalDrawMenu();
viewMenu_->addMenu(globalDrawMenu_);
extended_actions.push_back(
viewMenu_->addMenu(globalDrawMenu_));
//============================================================================================================
// Rendering options Menu
......@@ -243,7 +253,8 @@ void CoreWidget::setupMenuBar()
QMenu* renderingOptionsMenu = new QMenu(tr("Global Rendering Options"),viewMenu_);
renderingOptionsMenu->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"core_renderingOptions.png") );
viewMenu_->addMenu(renderingOptionsMenu);
extended_actions.push_back(
viewMenu_->addMenu(renderingOptionsMenu));
orthogonalProjectionAction_ = new QAction( tr("Switch Viewers to Orthogonal Projection"), renderingOptionsMenu );;
orthogonalProjectionAction_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"orthogonal.png") );
......@@ -320,6 +331,7 @@ void CoreWidget::setupMenuBar()
connect( navigationSwitchAction, SIGNAL( toggled(bool) ), this, SLOT( slotSwitchNavigation(bool) ) );
viewMenu_->addAction( navigationSwitchAction);
extended_actions.push_back(navigationSwitchAction);
viewMenu_->addSeparator();
......@@ -425,6 +437,7 @@ void CoreWidget::setupMenuBar()
QObject::connect( sceneGraphAction, SIGNAL( triggered() ),
this, SLOT( slotShowSceneGraphDialog() ) );
toolsMenu_->addAction( sceneGraphAction);
extended_actions.push_back(sceneGraphAction);
toolsMenu_->addSeparator();
......@@ -445,6 +458,9 @@ void CoreWidget::setupMenuBar()
toolsMenu_->addAction( stopVideoCaptureAction);
connect(stopVideoCaptureAction, SIGNAL(triggered()), this, SIGNAL(stopVideoCapture()) );
extended_actions.push_back(startVideoCaptureAction);
extended_actions.push_back(stopVideoCaptureAction);
toolsMenu_->addSeparator();
//show plugins
......@@ -472,6 +488,7 @@ void CoreWidget::setupMenuBar()
AC_ShowViewModeControls_->setChecked( ! OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() );
connect(AC_ShowViewModeControls_, SIGNAL(toggled( bool )), this, SLOT(showViewModeControls(bool)));
windowMenu_->addAction(AC_ShowViewModeControls_);
extended_actions.push_back(AC_ShowViewModeControls_);
// Show or Hide the View Mode Controls
QAction* AC_ShowToolbox = new QAction(tr("Show Toolboxes"), this);
......@@ -503,6 +520,7 @@ void CoreWidget::setupMenuBar()
connect(AC_ShowMenuBar,SIGNAL(triggered()),this,SLOT(toggleMenuBar()));
connect(this,SIGNAL(menuBarVisChanged(bool)),AC_ShowMenuBar,SLOT(setChecked(bool)));
windowMenu_->addAction(AC_ShowMenuBar);
extended_actions.push_back(AC_ShowMenuBar);
// Show or Hide the Tool bar
QAction* AC_ShowToolBar = new QAction(tr("Show Toolbar"), this);
......@@ -711,7 +729,7 @@ void CoreWidget::slotUpdateRendererMenu() {
rendererMenu_ = new QMenu(tr("Global Renderer"),viewMenu_);
rendererMenu_->setIcon(QIcon(iconPath+"renderers.png"));
viewMenu_->addMenu(rendererMenu_);
extended_actions.push_back(viewMenu_->addMenu(rendererMenu_));
connect(rendererMenu_,SIGNAL(aboutToShow () ) , this, SLOT(slotUpdateRendererMenu() ) );
......@@ -781,7 +799,7 @@ void CoreWidget::slotUpdatePostProcessorMenu() {
postprocessorMenu_ = new QMenu(tr("Global Post Processor"),viewMenu_);
postprocessorMenu_->setIcon(QIcon(iconPath+"postprocessors.png"));
viewMenu_->addMenu(postprocessorMenu_);
extended_actions.push_back(viewMenu_->addMenu(postprocessorMenu_));
connect(postprocessorMenu_,SIGNAL(aboutToShow () ) , this, SLOT(slotUpdatePostProcessorMenu() ) );
}
......
......@@ -480,6 +480,10 @@ void CoreWidget::clearPickModes()
//-----------------------------------------------------------------------------
void CoreWidget::expandToolBoxWidget(QWidget *widget, bool expand) {
toolBox_->expand(widget, expand);
}
const std::string& CoreWidget::pickMode() const
{
......
......@@ -56,7 +56,7 @@ void CoreWidget::initViewModes(){
//init viewMode subMenu
if (!viewModeMenu_){
viewModeMenu_ = new QMenu(tr("View Modes"));
viewMenu_->addMenu(viewModeMenu_);
viewModeButton_ = viewMenu_->addMenu(viewModeMenu_);
viewGroup_ = new QActionGroup(0);
viewGroup_->setExclusive(true);
connect( viewGroup_, SIGNAL( triggered( QAction* ) ), this, SLOT( slotSetViewMode( QAction* ) ) );
......@@ -85,6 +85,10 @@ void CoreWidget::initViewModes(){
viewModeMenu_->addSeparator();
}
if ( OpenFlipperSettings().value("Core/Gui/TaskSwitcher/Hide",false).toBool() ) {
viewModeButton_->setVisible(false);
}
}
void CoreWidget::slotAddViewModeToolboxes(QString _mode, QStringList _usedWidgets){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment