[vlmc-devel] MainWindow: Implement layout lock

Yikai Lu git at videolan.org
Fri Aug 12 18:16:09 CEST 2016


vlmc | branch: master | Yikai Lu <luyikei.qmltu at gmail.com> | Fri Aug 12 10:55:02 2016 -0500| [a8a77e45313c9b6d3adc912840cf0dbbd67d7580] | committer: Yikai Lu

MainWindow: Implement layout lock

> https://code.videolan.org/videolan/vlmc/commit/a8a77e45313c9b6d3adc912840cf0dbbd67d7580
---

 src/Gui/MainWindow.cpp   | 19 ++++++++++++++++++-
 src/Gui/ui/MainWindow.ui |  8 ++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 90ff678..e7e104a 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -343,6 +343,20 @@ MainWindow::initVlmcPreferences()
         m_ui.actionStatusbar->setChecked( v );
     } );
     connect( m_ui.actionStatusbar, &QAction::toggled, statusbarSetting, &SettingValue::set );
+
+    // Layout Lock
+    auto lockSetting = VLMC_CREATE_PRIVATE_PREFERENCE_BOOL( "private/LayoutLock", true );
+    connect( lockSetting, &SettingValue::changed, this, [this]( const QVariant& var )
+    {
+        bool v = var.toBool();
+        for ( auto w : findChildren<QDockWidget *>() )
+            if ( v == true )
+                w->setTitleBarWidget( new QWidget );
+            else
+                w->setTitleBarWidget( 0 );
+         m_ui.actionLock->setChecked( v );
+    } );
+    connect( m_ui.actionLock, &QAction::toggled, lockSetting, &SettingValue::set );
 }
 
 #undef CREATE_MENU_SHORTCUT
@@ -648,8 +662,11 @@ MainWindow::dockWidget( QWidget* widget, Qt::DockWidgetArea startArea )
     dock->setAllowedAreas( Qt::AllDockWidgetAreas );
     widget->setParent( dock );
     dock->setWidget( widget );
-    dock->setTitleBarWidget( new QWidget );
     dock->setObjectName( widget->objectName() );
+    if ( VLMC_GET_BOOL( "private/LayoutLock" ) == true )
+        dock->setTitleBarWidget( new QWidget );
+    else
+        dock->setTitleBarWidget( 0 );
     addDockWidget( startArea, dock );
     registerWidgetInWindowMenu( dock );
     return dock;
diff --git a/src/Gui/ui/MainWindow.ui b/src/Gui/ui/MainWindow.ui
index c1d194d..92a7cc9 100644
--- a/src/Gui/ui/MainWindow.ui
+++ b/src/Gui/ui/MainWindow.ui
@@ -376,6 +376,14 @@
     <string>Toolbar</string>
    </property>
   </action>
+  <action name="actionLock">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Lock</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="../../../resources.qrc"/>



More information about the Vlmc-devel mailing list