[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdenlive] src: Save widget style
From: Jean-Baptiste Mardelle <jb () kdenlive ! org>
Date: 2015-12-31 16:25:19
Message-ID: E1aEg2R-00011I-CJ () scm ! kde ! org
[Download RAW message or body]
Git commit 1b729d89e6a8893dca43f93a4aafee7e34ca6851 by Jean-Baptiste Mardelle.
Committed on 31/12/2015 at 16:25.
Pushed by mardelle into branch 'master'.
Save widget style
M +5 -0 src/kdenlivesettings.kcfg
M +26 -3 src/mainwindow.cpp
M +2 -0 src/mainwindow.h
http://commits.kde.org/kdenlive/1b729d89e6a8893dca43f93a4aafee7e34ca6851
diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg
index 5551bc2..0aca7f8 100644
--- a/src/kdenlivesettings.kcfg
+++ b/src/kdenlivesettings.kcfg
@@ -715,6 +715,11 @@
<default></default>
</entry>
+ <entry name="widgetstyle" type="String">
+ <label>Name of the chosen widget style.</label>
+ <default></default>
+ </entry>
+
<entry name="showslideshowthumbs" type="Bool">
<label>Show thumbnails in slideshow dialog.</label>
<default>false</default>
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 8eac21e..77e0036 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -149,13 +149,24 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, \
const QString &
// Widget themes for non KDE users
KActionMenu *stylesAction= new KActionMenu(i18n("Style"), this);
- QStringList availableStyles = QStyleFactory::keys();
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) {
QAction *a = new QAction(style, stylesGroup);
a->setCheckable(true);
a->setData(style);
+ if (KdenliveSettings::widgetstyle() == style) {
+ a->setChecked(true);
+ }
stylesAction->addAction(a);
}
connect(stylesGroup, &QActionGroup::triggered, this, \
&MainWindow::slotChangeStyle); @@ -165,7 +176,11 @@ MainWindow::MainWindow(const \
QString &MltPath, const QUrl &Url, const QString & \
ThemeManager::instance()->setThemeMenuAction(themeAction);
ThemeManager::instance()->setCurrentTheme(KdenliveSettings::colortheme());
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);
pCore->initialize();
@@ -3357,7 +3372,15 @@ void MainWindow::slotUpdateMonitorOverlays(int id, int code)
void MainWindow::slotChangeStyle(QAction *a)
{
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();
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 6ce53c0..2897981 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -251,6 +251,8 @@ private:
QListWidget *m_effectBasket;
/** @brief Update statusbar stylesheet (in case of color theme change). */
void setStatusBarStyleSheet(const QPalette &p);
+ /** @brief Update widget style. */
+ void doChangeStyle();
public slots:
void slotGotProgressInfo(const QString &message, int progress, MessageType type \
= DefaultMessage);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic