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

parent bde55412
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="101" translationDomain="kdenlive"> <kpartgui name="kdenlive" version="102" translationDomain="kdenlive">
<ToolBar name="extraToolBar" > <ToolBar name="extraToolBar" >
<text>Extra Toolbar</text> <text>Extra Toolbar</text>
<Action name="project_render" /> <Action name="project_render" />
...@@ -203,6 +203,7 @@ ...@@ -203,6 +203,7 @@
<Action name="get_new_titles" /> <Action name="get_new_titles" />
<Action name="run_wizard" /> <Action name="run_wizard" />
<Action name="themes_menu" /> <Action name="themes_menu" />
<Action name="styles_menu" />
</Menu> </Menu>
</MenuBar> </MenuBar>
</kpartgui> </kpartgui>
......
...@@ -95,6 +95,7 @@ ...@@ -95,6 +95,7 @@
#include <QBitmap> #include <QBitmap>
#include <QUndoGroup> #include <QUndoGroup>
#include <QFileDialog> #include <QFileDialog>
#include <QStyleFactory>
#include <stdlib.h> #include <stdlib.h>
#include <QStandardPaths> #include <QStandardPaths>
...@@ -145,6 +146,21 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -145,6 +146,21 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
qRegisterMetaType<requestClipInfo> ("requestClipInfo"); qRegisterMetaType<requestClipInfo> ("requestClipInfo");
Core::build(this); 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); KActionMenu *themeAction= new KActionMenu(i18n("Theme"), this);
ThemeManager::instance()->setThemeMenuAction(themeAction); ThemeManager::instance()->setThemeMenuAction(themeAction);
ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme()); ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme());
...@@ -243,6 +259,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -243,6 +259,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
// Color and icon theme stuff // Color and icon theme stuff
addAction("themes_menu", themeAction); addAction("themes_menu", themeAction);
connect(m_commandStack, SIGNAL(cleanChanged(bool)), m_saveAction, SLOT(setDisabled(bool))); connect(m_commandStack, SIGNAL(cleanChanged(bool)), m_saveAction, SLOT(setDisabled(bool)));
addAction(QStringLiteral("styles_menu"), stylesAction);
// Close non-general docks for the initial layout // Close non-general docks for the initial layout
// only show important ones // only show important ones
...@@ -3293,6 +3310,12 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName ...@@ -3293,6 +3310,12 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName
return dockWidget; return dockWidget;
} }
void MainWindow::slotChangeStyle(QAction *a)
{
QString style = a->data().toString();
QApplication::setStyle(QStyleFactory::create(style));
}
#ifdef DEBUG_MAINW #ifdef DEBUG_MAINW
#undef DEBUG_MAINW #undef DEBUG_MAINW
......
...@@ -444,6 +444,8 @@ private slots: ...@@ -444,6 +444,8 @@ private slots:
void slotRestart(); void slotRestart();
void triggerKey(QKeyEvent* ev); void triggerKey(QKeyEvent* ev);
void slotChangeStyle(QAction *a);
signals: signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url); Q_SCRIPTABLE void abortRenderJob(const QString &url);
void configurationChanged(); void configurationChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment