Commit b2a97323 authored by luyikei's avatar luyikei

MainWindow: QActions for the toolbar and the statusbar to show or hide

parent 161f10a7
......@@ -84,9 +84,9 @@ MainWindow::MainWindow( Backend::IBackend* backend, QWidget *parent )
// GUI
createGlobalPreferences();
initializeDockWidgets();
initToolbar();
createStatusBar();
initializeDockWidgets();
checkFolders();
loadGlobalProxySettings();
createProjectPreferences();
......@@ -323,6 +323,26 @@ MainWindow::initVlmcPreferences()
VLMC_CREATE_PRIVATE_PREFERENCE_STRING( "private/ImportPreviouslySelectPath", QDir::homePath() );
VLMC_CREATE_PRIVATE_PREFERENCE_BYTEARRAY( "private/MainWindowGeometry", "" );
VLMC_CREATE_PRIVATE_PREFERENCE_BYTEARRAY( "private/MainWindowState", "" );
// Toolbar
auto toolbarSetting = VLMC_CREATE_PRIVATE_PREFERENCE_BOOL( "private/ShowToolbar", false );
connect( toolbarSetting, &SettingValue::changed, this, [this]( const QVariant& var )
{
bool v = var.toBool();
m_ui.toolBar->setVisible( v );
m_ui.actionToolbar->setChecked( v );
} );
connect( m_ui.actionToolbar, &QAction::toggled, toolbarSetting, &SettingValue::set );
// Statusbar
auto statusbarSetting = VLMC_CREATE_PRIVATE_PREFERENCE_BOOL( "private/ShowStatusbar", false );
connect( statusbarSetting, &SettingValue::changed, this, [this]( const QVariant& var )
{
bool v = var.toBool();
m_ui.statusbar->setVisible( v );
m_ui.actionStatusbar->setChecked( v );
} );
connect( m_ui.actionStatusbar, &QAction::toggled, statusbarSetting, &SettingValue::set );
}
#undef CREATE_MENU_SHORTCUT
......@@ -721,7 +741,7 @@ MainWindow::on_actionFullscreen_triggered( bool checked )
void
MainWindow::registerWidgetInWindowMenu( QDockWidget* widget )
{
m_ui.menuWindow->addAction( widget->toggleViewAction() );
m_ui.menuView->insertAction( m_ui.actionFullscreen, widget->toggleViewAction() );
}
void
......
......@@ -71,15 +71,12 @@
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuWindow">
<property name="title">
<string>&amp;Window</string>
</property>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
<string>&amp;View</string>
</property>
<addaction name="actionToolbar"/>
<addaction name="actionStatusbar"/>
<addaction name="actionFullscreen"/>
</widget>
<widget class="QMenu" name="menuTools">
......@@ -91,7 +88,6 @@
<addaction name="menuEdit"/>
<addaction name="menuTools"/>
<addaction name="menuView"/>
<addaction name="menuWindow"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
......@@ -362,7 +358,23 @@
</property>
<property name="statusTip">
<string>Use the Scissor Tool to cut regions in the timeline</string>
</property>
</property>
</action>
<action name="actionStatusbar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Statusbar</string>
</property>
</action>
<action name="actionToolbar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Toolbar</string>
</property>
</action>
</widget>
<resources>
......
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