[vlc-commits] qt: remove controlbar widget sizing

Fatih Uzunoglu git at videolan.org
Thu Aug 27 12:44:54 CEST 2020


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Tue Aug  4 21:18:32 2020 +0300| [be93efdf29829c31b3f431af91b051c92289aba5] | committer: Pierre Lamot

qt: remove controlbar widget sizing

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be93efdf29829c31b3f431af91b051c92289aba5
---

 modules/gui/qt/player/playercontrolbarmodel.cpp | 28 +++++--------------------
 modules/gui/qt/player/playercontrolbarmodel.hpp | 10 +--------
 2 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp
index 99b959b0f1..42169168fb 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,7 +76,6 @@ 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 ));
         if( !ok )
         {
@@ -86,17 +83,8 @@ void PlayerControlBarModel::parseAndAdd(QString &config)
             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;
 



More information about the vlc-commits mailing list