[vlc-devel] [PATCH 24/38] qt: remove controlbar widget sizing

Fatih Uzunoglu fuzun54 at outlook.com
Thu Aug 20 19:55:33 CEST 2020


---
 .../gui/qt/player/playercontrolbarmodel.cpp   | 30 ++++---------------
 .../gui/qt/player/playercontrolbarmodel.hpp   | 10 +------
 2 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp
index 99b959b0f1..75e3434e34 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.cpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.cpp
@@ -20,7 +20,7 @@
 #include "qt.hpp"
 #include "playercontrolbarmodel.hpp"
 
-#define MAIN_TB1_DEFAULT "20;21;65;17;3;0-2;1-2;4;18;65;33;7"
+#define MAIN_TB1_DEFAULT "20;21;65;17;3;0;1;4;18;65;33;7"
 #define MINI_TB_DEFAULT "65;17;3;0;1;4;18;65;33;7"
 
 PlayerControlBarModel::PlayerControlBarModel(QObject *_parent) : QAbstractListModel(_parent)
@@ -39,8 +39,6 @@ QString PlayerControlBarModel::getConfig()
     QString config="";
     for (IconToolButton it: mButtons) {
         config += QString::number(it.id);
-        if(it.size != WIDGET_NORMAL)
-            config += "-" + QString::number(it.size);
         config += ";";
     }
     return config;
@@ -78,25 +76,15 @@ void PlayerControlBarModel::parseAndAdd(QString &config)
             continue;
         }
         bool ok;
-        int i_option = WIDGET_NORMAL;
-        ButtonType_e i_type = static_cast<ButtonType_e>(list2.at( 0 ).toInt( &ok ));
+        ButtonType_e i_type = static_cast<ButtonType_e>(iconPropertyTxt.contains("-") ? iconPropertyTxt.split("-").at( 0 ).toInt( &ok ) : iconPropertyTxt.toInt( &ok));
         if( !ok )
         {
             msg_Warn( p_intf, "Parsing error 2. Please, report this." );
             continue;
         }
 
-        if( list2.count() > 1 )
-        {
-            i_option = list2.at( 1 ).toInt( &ok );
-            if( !ok )
-            {
-                msg_Warn( p_intf, "Parsing error 3. Please, report this." );
-                continue;
-            }
-        }
-
-        mButtons.append({ i_type , i_option});
+        IconToolButton itButton = {i_type};
+        mButtons.append(itButton);
     }
 
     endInsertRows();
@@ -120,9 +108,6 @@ QVariant PlayerControlBarModel::data(const QModelIndex &index, int role) const
     switch (role) {
     case ID_ROLE:
         return QVariant(button.id);
-
-    case SIZE_ROLE:
-        return QVariant(button.size);
     }
     return QVariant();
 }
@@ -134,8 +119,6 @@ bool PlayerControlBarModel::setData(const QModelIndex &index, const QVariant &va
     case ID_ROLE:
         button.id = value.toInt();
         break;
-    case SIZE_ROLE:
-        button.size = value.toInt();
     }
 
     if (setButtonAt(index.row(),button)) {
@@ -158,7 +141,6 @@ QHash<int, QByteArray> PlayerControlBarModel::roleNames() const
     QHash<int, QByteArray> names;
 
     names[ID_ROLE] = "id";
-    names[SIZE_ROLE] = "size";
 
     return names;
 }
@@ -168,7 +150,7 @@ bool PlayerControlBarModel::setButtonAt(int index, const IconToolButton &button)
         return false;
     const IconToolButton &oldButton = mButtons.at(index);
 
-    if (button.size == oldButton.size && button.id == oldButton.id)
+    if (button.id == oldButton.id)
         return false;
 
     mButtons[index] = button;
@@ -203,7 +185,7 @@ void PlayerControlBarModel::setConfigName(QString name)
 void PlayerControlBarModel::insert(int index, QVariantMap bdata)
 {
     beginInsertRows(QModelIndex(),index,index);
-    mButtons.insert(index,{bdata.value("id").toInt(),bdata.value("size").toInt()});
+    mButtons.insert(index, { bdata.value("id").toInt() });
     endInsertRows();
 }
 void PlayerControlBarModel::move(int src, int dest)
diff --git a/modules/gui/qt/player/playercontrolbarmodel.hpp b/modules/gui/qt/player/playercontrolbarmodel.hpp
index 7f3319cb54..6fe9c153cd 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.hpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.hpp
@@ -35,11 +35,9 @@ public:
     struct IconToolButton
     {
         int id;
-        int size;
     };
     enum{
-        ID_ROLE,
-        SIZE_ROLE
+        ID_ROLE
     };
     enum ButtonType_e
     {
@@ -82,12 +80,6 @@ public:
     };
     Q_ENUM(ButtonType_e)
 
-    enum ButtonSize
-    {
-        WIDGET_NORMAL = 0x0,
-        WIDGET_BIG    = 0x2,
-    };
-    Q_ENUM(ButtonSize)
     // Basic functionality:
     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
 
-- 
2.25.1



More information about the vlc-devel mailing list