Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

GUI for change razor theme.

  • Loading branch information...
commit a1ec038147e5f8c2cdc5333eb7de5b088fb55256 1 parent 93875fb
@SokoloffA SokoloffA authored
Showing with 546 additions and 127 deletions.
  1. +9 −11 libraries/razorqt/razorapplication.cpp
  2. +12 −3 libraries/razorqt/razorapplication.h
  3. +184 −72 libraries/razorqt/razorsettings.cpp
  4. +42 −19 libraries/razorqt/razorsettings.h
  5. +1 −1  razorqt-appswitcher/src/application.cpp
  6. +3 −0  razorqt-config/razor-config-appearance/CMakeLists.txt
  7. +7 −0 razorqt-config/razor-config-appearance/main.cpp
  8. +92 −0 razorqt-config/razor-config-appearance/razorthemeconfig.cpp
  9. +59 −0 razorqt-config/razor-config-appearance/razorthemeconfig.h
  10. +61 −0 razorqt-config/razor-config-appearance/razorthemeconfig.ui
  11. +1 −1  razorqt-desktop/desktop-razor/workspacemanager.cpp
  12. +1 −1  razorqt-desktop/desktop-wm_native/razordeskman.cpp
  13. +1 −1  razorqt-desktop/src/razordesktopapplication.cpp
  14. +3 −14 razorqt-panel/panel/razorpanel.cpp
  15. +1 −2  razorqt-panel/panel/razorpanel_p.h
  16. +1 −1  razorqt-power/src/main.cpp
  17. BIN  razorqt-resources/themes/a-mego/preview.png
  18. BIN  razorqt-resources/themes/ambiance/preview.png
  19. BIN  razorqt-resources/themes/green/preview.png
  20. BIN  razorqt-resources/themes/light/preview.png
  21. +1 −1  razorqt-runner/main.cpp
  22. +67 −0 scripts/updateThemeScreenshots.sh
View
20 libraries/razorqt/razorapplication.cpp
@@ -87,7 +87,7 @@ void dbgMessageOutput(QtMsgType type, const char *msg)
}
#endif
-RazorApplication::RazorApplication(int &argc, char** argv, const QString &stylesheetKey)
+RazorApplication::RazorApplication(int &argc, char** argv)
: QApplication(argc, argv)
{
#ifdef DEBUG
@@ -96,16 +96,14 @@ RazorApplication::RazorApplication(int &argc, char** argv, const QString &styles
XdgIcon::setThemeName(RazorSettings::globalSettings()->value("icon_theme").toString());
setWindowIcon(QIcon(QString(SHARE_DIR) + "/graphics/razor_logo.png"));
+ connect(RazorSettings::globalSettings(), SIGNAL(razorThemeChanged()), this, SLOT(updateTheme()));
+ updateTheme();
+}
- QString styleSheet;
- if (!stylesheetKey.isEmpty())
- {
- styleSheet = razorTheme->qss(stylesheetKey);
- }
- // TODO/FIXME: maybe move it into global config? RazorSettings::globalSettings()?
- RazorSettings s("desktop");
- bool singleClick = s.value("icon-launch-mode", "singleclick").toString() == "singleclick";
- styleSheet += QString("QAbstractItemView {activate-on-singleclick : %1; }").arg(singleClick ? 1 : 0);
- setStyleSheet(styleSheet);
+void RazorApplication::updateTheme()
+{
+ QString styleSheetKey = QFileInfo(applicationFilePath()).fileName();
+ setStyleSheet(razorTheme.qss(styleSheetKey));
+ emit themeChanged();
}
View
15 libraries/razorqt/razorapplication.h
@@ -31,7 +31,6 @@
#include <QtGui/QApplication>
#include <QtGui/QProxyStyle>
-
/*! \brief Razor-qt wrapper around QApplication.
* It loads various Razor-qt related stuff by default (window icon, icon theme...)
*
@@ -50,9 +49,19 @@ class RazorApplication : public QApplication
* \param argv standard argv as in QApplication
* \param stylesheetKey optional QString. It can load QSS theme module as in \see RazorTheme::qss()
*/
- RazorApplication(int &argc, char **argv, const QString &stylesheetKey = QString());
- virtual ~RazorApplication() {};
+ RazorApplication(int &argc, char **argv);
+ virtual ~RazorApplication() {}
+
+private slots:
+ void updateTheme();
+signals:
+ void themeChanged();
};
+#if defined(razorApp)
+#undef razorApp
+#endif
+#define razorApp (static_cast<RazorApplication *>(qApp))
+
#endif
View
256 libraries/razorqt/razorsettings.cpp
@@ -35,6 +35,7 @@
#include <QtCore/QStringList>
#include <QtCore/QMutex>
#include <QtCore/QFileSystemWatcher>
+#include <QtCore/QSharedData>
class RazorSettingsPrivate
{
@@ -53,39 +54,35 @@ class RazorSettingsPrivate
RazorTheme* RazorTheme::mInstance = 0;
-class RazorThemePrivate
-{
+class RazorThemeData: public QSharedData {
public:
- RazorThemePrivate(RazorTheme* parent):
- mParent(parent)
- {
- }
-
+ RazorThemeData(): mValid(false) {}
QString loadQss(const QString& qssFile) const;
- QString mThemeName;
- RazorTheme* mParent;
-};
+ QString findTheme(const QString &themeName);
+ QString mName;
+ QString mPath;
+ QString mPreviewImg;
+ bool mValid;
+};
-/************************************************
- This looks in all the usual paths for file
- ************************************************/
-QString findFile(const QString& fileName)
-{
- QStringList paths;
- paths << XdgDirs::dataHome(false);
- paths << XdgDirs::dataDirs();
- foreach(QString path, paths)
+class GlobalRazorSettingsPrivate
+{
+public:
+ GlobalRazorSettingsPrivate(GlobalRazorSettings *parent):
+ mParent(parent)
{
- QString file = QString("%1/%2").arg(path, fileName);
- if (QFile::exists(file))
- return file;
+
}
- return QString();
-}
+ GlobalRazorSettings *mParent;
+ QFileSystemWatcher mWatcher;
+ QString mIconTheme;
+ QString mRazorTheme;
+
+};
/************************************************
@@ -151,7 +148,7 @@ bool RazorSettings::event(QEvent *event)
/************************************************
************************************************/
-const RazorSettings *RazorSettings::globalSettings()
+const GlobalRazorSettings *RazorSettings::globalSettings()
{
static QMutex mutex;
static GlobalRazorSettings *instance = 0;
@@ -269,38 +266,121 @@ void RazorSettings::setLocalizedValue(const QString &key, const QVariant &value)
************************************************/
RazorTheme::RazorTheme():
- QObject(),
- d_ptr(new RazorThemePrivate(this))
+ d(new RazorThemeData)
{
- RazorSettings settings("razor");
- // the "light" theme is the default one for razor
- d_ptr->mThemeName = settings.value("theme", "light").toString();
}
-RazorTheme::~RazorTheme()
+
+/************************************************
+
+ ************************************************/
+RazorTheme::RazorTheme(const QString &path):
+ d(new RazorThemeData)
{
- delete d_ptr;
+ if (path.isEmpty())
+ return;
+
+ QFileInfo fi(path);
+ if (fi.isAbsolute())
+ {
+ d->mPath = path;
+ d->mName = fi.fileName();
+ d->mValid = fi.isDir();
+ }
+ else
+ {
+ d->mName = path;
+ d->mPath = d->findTheme(path);
+ d->mValid = !(d->mPath.isEmpty());
+ }
+
+ if (QDir(path).exists("preview.png"))
+ d->mPreviewImg = path + "/preview.png";
}
/************************************************
************************************************/
-RazorTheme* RazorTheme::instance()
+QString RazorThemeData::findTheme(const QString &themeName)
{
- static QMutex mutex;
+ if (themeName.isEmpty())
+ return "";
+
+ QStringList paths;
+ paths << XdgDirs::dataHome(false);
+ paths << XdgDirs::dataDirs();
- if (!mInstance)
+ foreach(QString path, paths)
{
- mutex.lock();
+ QDir dir(QString("%1/razor/themes/%2").arg(path, themeName));
+ if (dir.isReadable())
+ return dir.absolutePath();
+ }
- if (!mInstance)
- mInstance = new RazorTheme();
+ return QString();
+}
- mutex.unlock();
- }
- return mInstance;
+/************************************************
+
+ ************************************************/
+RazorTheme::RazorTheme(const RazorTheme &other):
+ d(other.d)
+{
+}
+
+
+/************************************************
+
+ ************************************************/
+RazorTheme::~RazorTheme()
+{
+}
+
+
+/************************************************
+
+ ************************************************/
+RazorTheme& RazorTheme::operator=(const RazorTheme &other)
+{
+ d = other.d;
+ return *this;
+}
+
+
+/************************************************
+
+ ************************************************/
+bool RazorTheme::isValid() const
+{
+ return d->mValid;
+}
+
+
+/************************************************
+
+ ************************************************/
+QString RazorTheme::name() const
+{
+ return d->mName;
+}
+
+/************************************************
+
+ ************************************************/
+QString RazorTheme::path() const
+{
+ return d->mPath;
+}
+
+
+/************************************************
+
+ ************************************************/
+QString RazorTheme::previewImage() const
+{
+ return d->mPreviewImg;
}
@@ -309,21 +389,27 @@ RazorTheme* RazorTheme::instance()
************************************************/
QString RazorTheme::qss(const QString& module) const
{
- Q_D(const RazorTheme);
+ QString path = QString("%1/%2.qss").arg(d->mPath, module);
- QString path(findFile(QString("razor/themes/%1/%2.qss").arg(d->mThemeName, module)));
+ QString styleSheet;
if (!path.isEmpty())
- return d->loadQss(path);
+ styleSheet = d->loadQss(path);
+ else
+ qWarning() << QString("QSS file %1 cannot be found").arg(path);
- qWarning() << "QSS file cannot be found in any location:" << QString("%1/%2.qss").arg(d->mThemeName, module);
- return QString();
+ // Single/double click ...........................
+ RazorSettings s("desktop");
+ bool singleClick = s.value("icon-launch-mode", "singleclick").toString() == "singleclick";
+ styleSheet += QString("QAbstractItemView {activate-on-singleclick : %1; }").arg(singleClick ? 1 : 0);
+
+ return styleSheet;
}
/************************************************
************************************************/
-QString RazorThemePrivate::loadQss(const QString& qssFile) const
+QString RazorThemeData::loadQss(const QString& qssFile) const
{
QFile f(qssFile);
if (! f.open(QIODevice::ReadOnly | QIODevice::Text))
@@ -351,8 +437,7 @@ QString RazorThemePrivate::loadQss(const QString& qssFile) const
************************************************/
QString RazorTheme::desktopBackground(int screen) const
{
- Q_D(const RazorTheme);
- QString wallpapperCfgFileName = findFile(QString("razor/themes/%1/wallpapper.cfg").arg(d->mThemeName));
+ QString wallpapperCfgFileName = QString("%1/%2.qss").arg(d->mPath, "wallpapper.cfg");
if (wallpapperCfgFileName.isEmpty())
return QString();
@@ -378,6 +463,53 @@ QString RazorTheme::desktopBackground(int screen) const
/************************************************
************************************************/
+const RazorTheme &RazorTheme::currentTheme()
+{
+ static RazorTheme theme;
+ QString name = RazorSettings::globalSettings()->value("theme").toString();
+ if (theme.name() != name)
+ {
+ theme = RazorTheme(name);
+ }
+ return theme;
+}
+
+
+/************************************************
+
+ ************************************************/
+QList<RazorTheme> RazorTheme::allThemes()
+{
+ QList<RazorTheme> ret;
+ QSet<QString> processed;
+
+ QStringList paths;
+ paths << XdgDirs::dataHome(false);
+ paths << XdgDirs::dataDirs();
+
+ foreach(QString path, paths)
+ {
+ QDir dir(QString("%1/razor/themes").arg(path));
+ QFileInfoList dirs = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
+
+ foreach(QFileInfo dir, dirs)
+ {
+ if (!processed.contains(dir.fileName()))
+ {
+ processed << dir.fileName();
+ ret << RazorTheme(dir.absoluteFilePath());
+ }
+
+ }
+ }
+
+ return ret;
+}
+
+
+/************************************************
+
+ ************************************************/
RazorSettingsCache::RazorSettingsCache(QSettings &settings) :
mSettings(settings)
{
@@ -427,26 +559,6 @@ void RazorSettingsCache::loadToSettings()
/************************************************
************************************************/
-class GlobalRazorSettingsPrivate
-{
-public:
- GlobalRazorSettingsPrivate(GlobalRazorSettings *parent):
- mParent(parent)
- {
-
- }
-
- GlobalRazorSettings *mParent;
- QFileSystemWatcher mWatcher;
- QString mIconTheme;
- QString mRazorTheme;
-
-};
-
-
-/************************************************
-
- ************************************************/
GlobalRazorSettings::GlobalRazorSettings():
RazorSettings("razor"),
d_ptr(new GlobalRazorSettingsPrivate(this))
@@ -498,9 +610,8 @@ void GlobalRazorSettings::fileChanged()
emit iconThemeChanged();
}
-
- QString rt = value("razor_theme").toString();
- if (d->mIconTheme != rt)
+ QString rt = value("theme").toString();
+ if (d->mRazorTheme != rt)
{
d->mRazorTheme = rt;
emit razorThemeChanged();
@@ -508,3 +619,4 @@ void GlobalRazorSettings::fileChanged()
emit settingsChanged();
}
+
View
61 libraries/razorqt/razorsettings.h
@@ -31,12 +31,12 @@
#include <QtCore/QObject>
#include <QtCore/QSettings>
-
+#include <QtCore/QSharedDataPointer>
class QEvent;
class RazorSettingsPrivate;
-
+class GlobalRazorSettings;
/*! \brief User settings handling */
class RazorSettings : public QSettings
@@ -60,7 +60,7 @@ class RazorSettings : public QSettings
explicit RazorSettings(const QSettings& parentSettings, const QString& subGroup, QObject* parent=0);
~RazorSettings();
- static const RazorSettings *globalSettings();
+ static const GlobalRazorSettings *globalSettings();
/*! Returns the localized value for key. In the desktop file keys may be postfixed by [LOCALE]. If the
@@ -88,18 +88,40 @@ class RazorSettings : public QSettings
};
-class RazorThemePrivate;
+class RazorThemeData;
+
/*! \brief QSS theme handling */
-class RazorTheme : public QObject
+class RazorTheme
{
- Q_OBJECT
public:
- /// \brief Returns a pointer to the RazorTheme instance.
- static RazorTheme* instance();
+ /// Constructs a null theme.
+ RazorTheme();
+
+ /*! Constructs an theme from the dir with the given path. If path not absolute
+ (i.e. the theme name only) the relevant dir must be found relative to the
+ $XDG_DATA_HOME + $XDG_DATA_DIRS directories. */
+ RazorTheme(const QString &path);
+
+ /// Constructs a copy of other. This is very fast.
+ RazorTheme(const RazorTheme &other);
+
+ RazorTheme& operator=(const RazorTheme &other);
+ ~RazorTheme();
+
+ /// Returns the name of the theme.
+ QString name() const;
- /*! \brief Return StyleSheet text (not file name, but real text) of the module called module.
- Paths in url() C/QSS functions are parsed to be real values for the theme,
- relative to full path */
+ QString path() const;
+
+ QString previewImage() const;
+
+ /// Returns true if this theme is valid; otherwise returns false.
+ bool isValid() const;
+
+ /*! \brief Returns StyleSheet text (not file name, but real text) of the module called module.
+ Paths in url() C/QSS functions are parsed to be real values for the theme,
+ relative to full path
+ */
QString qss(const QString& module) const;
/*! \brief A full path to image used as a wallpaper
@@ -110,15 +132,15 @@ class RazorTheme : public QObject
*/
QString desktopBackground(int screen=-1) const;
-private:
- RazorTheme();
- RazorTheme(const RazorTheme &);
- RazorTheme& operator=(const RazorTheme &);
- ~RazorTheme();
+ /// Returns the current razor theme.
+ static const RazorTheme &currentTheme();
+
+ /// Returns the all themes found in the system.
+ static QList<RazorTheme> allThemes();
+private:
static RazorTheme* mInstance;
- RazorThemePrivate* const d_ptr;
- Q_DECLARE_PRIVATE(RazorTheme)
+ QSharedDataPointer<RazorThemeData> d;
};
/*!
@@ -126,7 +148,8 @@ A global pointer referring to the unique RazorTheme object.
It is equivalent to the pointer returned by the RazorTheme::instance() function.
Only one theme object can be created. !*/
-#define razorTheme RazorTheme::instance()
+#define razorTheme RazorTheme::currentTheme()
+
class RazorSettingsCache
{
View
2  razorqt-appswitcher/src/application.cpp
@@ -31,7 +31,7 @@
RazorAppSwitcher::Application::Application(int & argc, char ** argv)
- : RazorApplication(argc, argv, "appswitcher"),
+ : RazorApplication(argc, argv),
m_as(0)
{
m_as = new RazorAppSwitcher::AppSwitcher();
View
3  razorqt-config/razor-config-appearance/CMakeLists.txt
@@ -13,16 +13,19 @@ set(H_FILES
set(MOC_FILES
iconthemeconfig.h
+ razorthemeconfig.h
)
set(CPP_FILES
main.cpp
iconthemeconfig.cpp
iconthemeinfo.cpp
+ razorthemeconfig.cpp
)
set(UI_FILES
mainwindow.ui
+ razorthemeconfig.ui
)
set(QRC_FILES
View
7 razorqt-config/razor-config-appearance/main.cpp
@@ -32,6 +32,7 @@
#include <razorqt/razorconfigdialog.h>
#include "iconthemeconfig.h"
#include "razortranslate.h"
+#include "razorthemeconfig.h"
int main (int argc, char **argv)
{
@@ -40,9 +41,15 @@ int main (int argc, char **argv)
RazorSettings* settings = new RazorSettings("razor");
RazorConfigDialog* dialog = new RazorConfigDialog(QObject::tr("Razor Appearance Configuration"), settings);
+
IconThemeConfig* iconPage = new IconThemeConfig(settings);
dialog->addPage(iconPage, QObject::tr("Icons Theme"), QStringList() << "preferences-desktop-icons" << "preferences-desktop");
QObject::connect(dialog, SIGNAL(reset()), iconPage, SLOT(initControls()));
+
+ RazorThemeConfig* themePage = new RazorThemeConfig(settings);
+ dialog->addPage(themePage, QObject::tr("Razor Theme"), QStringList() << "preferences-desktop-color" << "preferences-desktop");
+ QObject::connect(dialog, SIGNAL(reset()), themePage, SLOT(initControls()));
+
dialog->show();
return app.exec();
View
92 razorqt-config/razor-config-appearance/razorthemeconfig.cpp
@@ -0,0 +1,92 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Alexander Sokoloff <sokoloff.a@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#include "razorthemeconfig.h"
+#include "ui_razorthemeconfig.h"
+#include <QtGui/QTreeWidget>
+#include <QDebug>
+
+RazorThemeConfig::RazorThemeConfig(RazorSettings *settings, QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::RazorThemeConfig),
+ mSettings(settings)
+{
+ ui->setupUi(this);
+ //ui->razorThemeList->setStyleSheet("QTreeView::item { height: 32px;}");
+
+ connect(ui->razorThemeList, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
+ this, SLOT(razorThemeSelected(QTreeWidgetItem*,int)));
+
+
+ QList<RazorTheme> themes = RazorTheme::allThemes();
+ foreach(RazorTheme theme, themes)
+ {
+ QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(theme.name()));
+ if (!theme.previewImage().isEmpty())
+ {
+ item->setIcon(0, QIcon(theme.previewImage()));
+ }
+ item->setSizeHint(0, QSize(42,42)); // make icons non-cropped
+ item->setData(0, Qt::UserRole, theme.name());
+ ui->razorThemeList->addTopLevelItem(item);
+ }
+
+ initControls();
+}
+
+
+RazorThemeConfig::~RazorThemeConfig()
+{
+ delete ui;
+}
+
+
+void RazorThemeConfig::initControls()
+{
+ QString currentTheme = mSettings->value("theme").toString();
+
+ QTreeWidgetItemIterator it(ui->razorThemeList);
+ while (*it) {
+ if ((*it)->data(0, Qt::UserRole).toString() == currentTheme)
+ {
+ ui->razorThemeList->setCurrentItem((*it));
+ break;
+ }
+ ++it;
+ }
+
+ update();
+}
+
+
+void RazorThemeConfig::razorThemeSelected(QTreeWidgetItem* item, int column)
+{
+ Q_UNUSED(column);
+ if (!item)
+ return;
+ mSettings->setValue("theme", item->data(0, Qt::UserRole));
+}
View
59 razorqt-config/razor-config-appearance/razorthemeconfig.h
@@ -0,0 +1,59 @@
+/* BEGIN_COMMON_COPYRIGHT_HEADER
+ * (c)LGPL2+
+ *
+ * Razor - a lightweight, Qt based, desktop toolset
+ * http://razor-qt.org
+ *
+ * Copyright: 2012 Razor team
+ * Authors:
+ * Alexander Sokoloff <sokoloff.a@gmail.com>
+ *
+ * This program or library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * END_COMMON_COPYRIGHT_HEADER */
+
+#ifndef RAZORTHEMECONFIG_H
+#define RAZORTHEMECONFIG_H
+
+#include <QWidget>
+#include <razorqt/razorsettings.h>
+
+class QTreeWidgetItem;
+
+namespace Ui {
+ class RazorThemeConfig;
+}
+
+class RazorThemeConfig : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit RazorThemeConfig(RazorSettings *settings, QWidget *parent = 0);
+ ~RazorThemeConfig();
+
+public slots:
+ void initControls();
+
+private slots:
+ void razorThemeSelected(QTreeWidgetItem* item, int column);
+
+private:
+ Ui::RazorThemeConfig *ui;
+ RazorSettings *mSettings;
+};
+
+#endif // RAZORTHEMECONFIG_H
View
61 razorqt-config/razor-config-appearance/razorthemeconfig.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>RazorThemeConfig</class>
+ <widget class="QWidget" name="RazorThemeConfig">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Razor Theme</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTreeWidget" name="razorThemeList">
+ <property name="alternatingRowColors">
+ <bool>true</bool>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>100</width>
+ <height>32</height>
+ </size>
+ </property>
+ <property name="rootIsDecorated">
+ <bool>false</bool>
+ </property>
+ <property name="uniformRowHeights">
+ <bool>true</bool>
+ </property>
+ <attribute name="headerVisible">
+ <bool>false</bool>
+ </attribute>
+ <column>
+ <property name="text">
+ <string notr="true">1</string>
+ </property>
+ </column>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
View
2  razorqt-desktop/desktop-razor/workspacemanager.cpp
@@ -76,7 +76,7 @@ void RazorWorkSpaceManager::setup()
break;
m_config->setArrayIndex(desktop);
- QString themeWallpaper = razorTheme->desktopBackground(desktop + 1);
+ QString themeWallpaper = razorTheme.desktopBackground(desktop + 1);
desktops[screen][desktop] = WorkspaceConfig (
strToBackgroundType(m_config->value("wallpaper_type", themeWallpaper.isEmpty() ? "color" : "pixmap").toString(), RazorWorkSpaceManager::BackgroundColor),
View
2  razorqt-desktop/desktop-wm_native/razordeskman.cpp
@@ -176,7 +176,7 @@ RazorDeskManager::RazorDeskManager(const QString & configId, RazorSettings * con
if (finalPixmap.isEmpty() || !QFile::exists(finalPixmap))
{
//now we want to use the system default - we still need to find that one out though
- finalPixmap = razorTheme->desktopBackground();
+ finalPixmap = razorTheme.desktopBackground();
qDebug() << "trying to get system-defaults" << finalPixmap;
}
View
2  razorqt-desktop/src/razordesktopapplication.cpp
@@ -32,7 +32,7 @@
RazorDesktopApplication::RazorDesktopApplication(int& argc, char** argv)
- : RazorApplication(argc, argv, "desktop")
+ : RazorApplication(argc, argv)
, m_desktopPlugin(0L)
{
}
View
17 razorqt-panel/panel/razorpanel.cpp
@@ -152,6 +152,7 @@ RazorPanelPrivate::RazorPanelPrivate(RazorPanel* parent):
//connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(screensChangeds()));
connect(RazorSettings::globalSettings(), SIGNAL(settingsChanged()), q_ptr, SLOT(update()));
+ connect(razorApp, SIGNAL(themeChanged()), this, SLOT(realign()));
}
@@ -187,7 +188,6 @@ void RazorPanelPrivate::init()
q->setLayout(mLayout);
loadPlugins();
- reTheme();
updatePluginsMinSize();
realign();
}
@@ -351,24 +351,13 @@ RazorPanelPlugin* RazorPanelPrivate::loadPlugin(const RazorPluginInfo& pluginInf
/************************************************
************************************************/
-void RazorPanelPrivate::reTheme()
-{
- qApp->setStyleSheet(razorTheme->qss("panel"));
- realign();
-}
-
-
-
-/************************************************
-
- ************************************************/
void RazorPanelPrivate::realign()
{
Q_Q(RazorPanel);
/*
qDebug() << "Realign: DesktopNum" << mScreenNum;
qDebug() << "Realign: Position " << positionToStr(mPosition);
- qDebug() << "Realign: Theme " << mTheme;
+ //qDebug() << "Realign: Theme " << mTheme;
qDebug() << "Realign: SizeHint " << q->sizeHint();
qDebug() << "Realign: Screen " << QApplication::desktop()->screenGeometry(mScreenNum);
*/
@@ -691,7 +680,6 @@ void RazorPanelPrivate::updatePluginsMinSize()
}
mHeight = -1;
- reTheme();
}
else
{
@@ -711,6 +699,7 @@ void RazorPanelPrivate::updatePluginsMinSize()
}
}
+
/************************************************
************************************************/
View
3  razorqt-panel/panel/razorpanel_p.h
@@ -59,12 +59,11 @@ class RazorPanelPrivate: QObject {
QMenu* popupMenu(QWidget *parent) const;
- void realign();
-
virtual void contextMenuEvent( QContextMenuEvent* event);
void saveSettings();
public slots:
+ void realign();
void switchPosition();
void pluginMoved(QWidget* pluginWidget);
void screensChangeds();
View
2  razorqt-power/src/main.cpp
@@ -56,7 +56,7 @@ void help()
int main(int argc, char *argv[])
{
- RazorApplication app(argc, argv, "razor-power/razor-power");
+ RazorApplication app(argc, argv);
bool check=false;
bool actionSet=false;
RazorPower::Action action;
View
BIN  razorqt-resources/themes/a-mego/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  razorqt-resources/themes/ambiance/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  razorqt-resources/themes/green/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  razorqt-resources/themes/light/preview.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  razorqt-runner/main.cpp
@@ -33,7 +33,7 @@
int main(int argc, char *argv[])
{
- RazorApplication a(argc, argv, "razor-runner/razor-runner");
+ RazorApplication a(argc, argv);
a.setQuitOnLastWindowClosed(false);
TRANSLATE_APP;
View
67 scripts/updateThemeScreenshots.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+PROJECT_ID=razor-qt
+TMP_DIR=/tmp
+
+DIR=$1
+if [ -z "$DIR" ]; then
+ DIR='../'
+fi
+
+DIR=`readlink -m "$DIR"`
+
+
+function prepareConfig()
+{
+ local THEME=$1
+ mkdir -p $TMP_DIR/razor/razor-panel
+ cat > $TMP_DIR/razor/razor-panel/screenshot.conf << PANEL_COFIG
+[panel]
+width=100
+width-percent=true
+height=32
+alignment=0
+theme-size=false
+desktop=0
+position=Bottom
+plugins=mainmenu, clock
+plugins=mainmenu
+
+[mainmenu]
+alignment=Left
+type=mainmenu
+
+[clock]
+alignment=Left
+type=clock
+PANEL_COFIG
+
+ echo "[General]" > $TMP_DIR/razor/razor.conf
+ echo "theme=${THEME}" >> $TMP_DIR/razor/razor.conf
+}
+
+function makeScreenshot()
+{
+ local PID=$1
+ local OUT_FILE=$2
+ local WIN_ID=`wmctrl -l -p | grep ${PID} | awk '{print $1}'`
+ if [ -z "$WIN_ID" ]; then
+ echo "Can't find window ID for ${PID}"
+ return
+ fi
+ import -window ${WIN_ID} ${TMP_DIR}/${PID}.png
+ convert -crop 100x200+0+0 ${TMP_DIR}/${PID}.png ${OUT_FILE}
+
+}
+
+
+for THEME_DIR in `ls -d ${DIR}/razorqt-resources/themes/*/`; do
+ echo $THEME_DIR
+ prepareConfig `basename $THEME_DIR`
+ LANG=C XDG_CONFIG_HOME=${TMP_DIR} razor-panel screenshot >/dev/null 2>&1 & PANEL_PID=$!
+ sleep 1
+ makeScreenshot $PANEL_PID $THEME_DIR/preview.png
+
+ kill $PANEL_PID
+done
+
Please sign in to comment.
Something went wrong with that request. Please try again.