[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdenlive] src: Testing new config option to change widget style (useful for non KDE users)
From:       Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date:       2015-12-31 15:42:17
Message-ID: E1aEfMn-0008Mh-4M () scm ! kde ! org
[Download RAW message or body]

Git commit 039cd8d15dbb87a42c278ed4514616710ef56540 by Jean-Baptiste Mardelle.
Committed on 31/12/2015 at 15:42.
Pushed by mardelle into branch 'master'.

Testing new config option to change widget style (useful for non KDE users)

M  +2    -1    src/kdenliveui.rc
M  +23   -0    src/mainwindow.cpp
M  +2    -0    src/mainwindow.h

http://commits.kde.org/kdenlive/039cd8d15dbb87a42c278ed4514616710ef56540

diff --git a/src/kdenliveui.rc b/src/kdenliveui.rc
index 50f5a22..5a4f813 100644
--- a/src/kdenliveui.rc
+++ b/src/kdenliveui.rc
@@ -1,5 +1,5 @@
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="kdenlive" version="104" translationDomain="kdenlive">
+<kpartgui name="kdenlive" version="106" translationDomain="kdenlive">
   <ToolBar name="extraToolBar" >
     <text>Extra Toolbar</text>
 	<Action name="project_render" />
@@ -209,6 +209,7 @@
       <Action name="get_new_titles" />
       <Action name="run_wizard" />
       <Action name="themes_menu" />
+      <Action name="styles_menu" />
     </Menu>
   </MenuBar>
 </kpartgui>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 35b8af4..8eac21e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -95,6 +95,7 @@
 #include <QBitmap>
 #include <QUndoGroup>
 #include <QFileDialog>
+#include <QStyleFactory>
 
 #include <stdlib.h>
 #include <QStandardPaths>
@@ -145,6 +146,21 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
     qRegisterMetaType<requestClipInfo> ("requestClipInfo");
 
     Core::build(this);
+
+    // Widget themes for non KDE users
+    KActionMenu *stylesAction= new KActionMenu(i18n("Style"), this);
+    QStringList availableStyles = QStyleFactory::keys();
+    QActionGroup *stylesGroup = new QActionGroup(stylesAction);
+
+    foreach(const QString &style, availableStyles) {
+        QAction *a = new QAction(style, stylesGroup);
+        a->setCheckable(true);
+        a->setData(style);
+        stylesAction->addAction(a);
+    }
+    connect(stylesGroup, &QActionGroup::triggered, this, &MainWindow::slotChangeStyle);
+
+    // Color schemes
     KActionMenu *themeAction= new KActionMenu(i18n("Theme"), this);
     ThemeManager::instance()->setThemeMenuAction(themeAction);
     ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme());
@@ -243,6 +259,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
     // Color and icon theme stuff
     addAction(QStringLiteral("themes_menu"), themeAction);
     connect(m_commandStack, SIGNAL(cleanChanged(bool)), m_saveAction, SLOT(setDisabled(bool)));
+    addAction(QStringLiteral("styles_menu"), stylesAction);
 
     // Close non-general docks for the initial layout
     // only show important ones
@@ -3337,6 +3354,12 @@ void MainWindow::slotUpdateMonitorOverlays(int id, int code)
     }
 }
 
+void MainWindow::slotChangeStyle(QAction *a)
+{
+    QString style = a->data().toString();
+    QApplication::setStyle(QStyleFactory::create(style));
+}
+
 
 #ifdef DEBUG_MAINW
 #undef DEBUG_MAINW
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 5bf4564..6ce53c0 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -445,6 +445,8 @@ private slots:
     /** @brief Update monitor overlay actions on monitor switch */
     void slotUpdateMonitorOverlays(int id, int code);
 
+    void slotChangeStyle(QAction *a);
+
 signals:
     Q_SCRIPTABLE void abortRenderJob(const QString &url);
     void configurationChanged();
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic