[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: gui/qt: add method to check if advanced widget exists

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Thu Dec 9 09:44:28 UTC 2021



Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC


Commits:
a0f2b981 by Marvin Scholz at 2021-12-09T09:20:08+00:00
gui/qt: add method to check if advanced widget exists

- - - - -
b6b66552 by Marvin Scholz at 2021-12-09T09:20:08+00:00
gui/qt: disable "Advanced controls" item if none availble

If the user disabled the advanced controls widgets in the
interface customization options, it would still show the
menu item for them, but interactions with the menu item
would just do nothing.

Instead properly disable the menu item when there is no
advanced buttons widget to show/hide.

Ref: #14217

- - - - -


5 changed files:

- modules/gui/qt/components/controller.cpp
- modules/gui/qt/components/controller.hpp
- modules/gui/qt/main_interface.cpp
- modules/gui/qt/main_interface.hpp
- modules/gui/qt/menus.cpp


Changes:

=====================================
modules/gui/qt/components/controller.cpp
=====================================
@@ -741,6 +741,11 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
     controlLayout->addLayout( controlLayout2 );
 }
 
+bool ControlsWidget::advancedAvailable()
+{
+    return advControls != nullptr;
+}
+
 void ControlsWidget::toggleAdvanced()
 {
     if( !advControls ) return;


=====================================
modules/gui/qt/components/controller.hpp
=====================================
@@ -217,6 +217,7 @@ public:
 protected:
     friend class MainInterface;
 
+    bool advancedAvailable();
     bool b_advancedVisible;
 
 private:


=====================================
modules/gui/qt/main_interface.cpp
=====================================
@@ -1213,6 +1213,15 @@ int MainInterface::getControlsVisibilityStatus()
             + CONTROLS_ADVANCED * controls->b_advancedVisible );
 }
 
+/* Get whether the advanced buttons widget is available
+ * (if its actually present in any of the configurable locations).
+ */
+bool MainInterface::isAdvancedWidgetAvailable()
+{
+    if( !controls) return false;
+    return controls->advancedAvailable();
+}
+
 StandardPLPanel *MainInterface::getPlaylistView()
 {
     if( !playlistWidget ) return NULL;


=====================================
modules/gui/qt/main_interface.hpp
=====================================
@@ -93,6 +93,7 @@ public:
         RAISE_AUDIOVIDEO,
     };
     int getControlsVisibilityStatus();
+    bool isAdvancedWidgetAvailable();
     bool isPlDocked() { return ( b_plDocked != false ); }
     bool isInterfaceFullScreen() { return b_interfaceFullScreen; }
     bool isInterfaceAlwaysOnTop() { return b_interfaceOnTop; }


=====================================
modules/gui/qt/menus.cpp
=====================================
@@ -529,6 +529,7 @@ QMenu *VLCMenuBar::ViewMenu( intf_thread_t *p_intf, QMenu *current, MainInterfac
     action->setCheckable( true );
     if( mi->getControlsVisibilityStatus() & MainInterface::CONTROLS_ADVANCED )
         action->setChecked( true );
+    action->setEnabled(mi->isAdvancedWidgetAvailable());
 
     action = menu->addAction( qtr( "Status Bar" ) );
     action->setCheckable( true );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aac177eea60de1fc4498abc7e1a998723ac04e32...b6b665522cf56f6622fd85b1ce341172e29c7799

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/aac177eea60de1fc4498abc7e1a998723ac04e32...b6b665522cf56f6622fd85b1ce341172e29c7799
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list