Save widget style

parent 0a0bc199
...@@ -705,6 +705,11 @@ ...@@ -705,6 +705,11 @@
<default></default> <default></default>
</entry> </entry>
<entry name="widgetstyle" type="String">
<label>Name of the chosen widget style.</label>
<default></default>
</entry>
<entry name="showslideshowthumbs" type="Bool"> <entry name="showslideshowthumbs" type="Bool">
<label>Show thumbnails in slideshow dialog.</label> <label>Show thumbnails in slideshow dialog.</label>
<default>false</default> <default>false</default>
......
...@@ -149,13 +149,24 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -149,13 +149,24 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
// Widget themes for non KDE users // Widget themes for non KDE users
KActionMenu *stylesAction= new KActionMenu(i18n("Style"), this); KActionMenu *stylesAction= new KActionMenu(i18n("Style"), this);
QStringList availableStyles = QStyleFactory::keys();
QActionGroup *stylesGroup = new QActionGroup(stylesAction); QActionGroup *stylesGroup = new QActionGroup(stylesAction);
// Add default style action
QAction *defaultStyle = new QAction(i18n("Default"), stylesGroup);
defaultStyle->setCheckable(true);
stylesAction->addAction(defaultStyle);
if (KdenliveSettings::widgetstyle().isEmpty()) {
defaultStyle->setChecked(true);
}
QStringList availableStyles = QStyleFactory::keys();
foreach(const QString &style, availableStyles) { foreach(const QString &style, availableStyles) {
QAction *a = new QAction(style, stylesGroup); QAction *a = new QAction(style, stylesGroup);
a->setCheckable(true); a->setCheckable(true);
a->setData(style); a->setData(style);
if (KdenliveSettings::widgetstyle() == style) {
a->setChecked(true);
}
stylesAction->addAction(a); stylesAction->addAction(a);
} }
connect(stylesGroup, &QActionGroup::triggered, this, &MainWindow::slotChangeStyle); connect(stylesGroup, &QActionGroup::triggered, this, &MainWindow::slotChangeStyle);
...@@ -165,7 +176,11 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -165,7 +176,11 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
ThemeManager::instance()->setThemeMenuAction(themeAction); ThemeManager::instance()->setThemeMenuAction(themeAction);
ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme()); ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme());
connect(ThemeManager::instance(), SIGNAL(signalThemeChanged(const QString &)), this, SLOT(slotThemeChanged(const QString &)), Qt::DirectConnection); connect(ThemeManager::instance(), SIGNAL(signalThemeChanged(const QString &)), this, SLOT(slotThemeChanged(const QString &)), Qt::DirectConnection);
ThemeManager::instance()->slotChangePalette(); if (!KdenliveSettings::widgetstyle().isEmpty()) {
// User wants a custom widget style, init
doChangeStyle();
}
else ThemeManager::instance()->slotChangePalette();
new RenderingAdaptor(this); new RenderingAdaptor(this);
pCore->initialize(); pCore->initialize();
...@@ -3313,7 +3328,15 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName ...@@ -3313,7 +3328,15 @@ QDockWidget *MainWindow::addDock(const QString &title, const QString &objectName
void MainWindow::slotChangeStyle(QAction *a) void MainWindow::slotChangeStyle(QAction *a)
{ {
QString style = a->data().toString(); QString style = a->data().toString();
QApplication::setStyle(QStyleFactory::create(style)); KdenliveSettings::setWidgetstyle(style);
doChangeStyle();
}
void MainWindow::doChangeStyle()
{
QApplication::setStyle(QStyleFactory::create(KdenliveSettings::widgetstyle()));
// Changing widget style resets color theme, so update color theme again
ThemeManager::instance()->slotChangePalette();
} }
......
...@@ -252,6 +252,8 @@ private: ...@@ -252,6 +252,8 @@ private:
QListWidget *m_effectBasket; QListWidget *m_effectBasket;
/** @brief Update statusbar stylesheet (in case of color theme change). */ /** @brief Update statusbar stylesheet (in case of color theme change). */
void setStatusBarStyleSheet(const QPalette &p); void setStatusBarStyleSheet(const QPalette &p);
/** @brief Update widget style. */
void doChangeStyle();
public slots: public slots:
void slotGotProgressInfo(const QString &message, int progress, MessageType type = DefaultMessage); void slotGotProgressInfo(const QString &message, int progress, MessageType type = DefaultMessage);
......
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