summaryrefslogtreecommitdiff
path: root/src/plugins/coreplugin/themesettings.h
diff options
context:
space:
mode:
authorThorben Kroeger <thorbenkroeger@gmail.com>2014-10-14 19:09:48 +0200
committerhjk <hjk121@nokiamail.com>2014-10-15 17:21:10 +0200
commit84f5585b5d958c3cdad4cce93244d43a360352c2 (patch)
treebeee12b956afd5cb86ad0cc03d73e3144a426f61 /src/plugins/coreplugin/themesettings.h
parentfd8fcd29a1d70a10864fc5a6e5c6dc5cf1c96ecf (diff)
downloadqt-creator-84f5585b5d958c3cdad4cce93244d43a360352c2.tar.gz
Implement theming for QtCreator
Adds a 'Theme' tab to the environment settings and a '-theme' command line option. A theme is a combination of colors, gradients, flags and style information. There are two themes: - 'default': preserves the current default look - 'dark': uses a more flat for many widgets, dark color theme for everything This does not use a stylesheet (too limited), but rather sets the palette via C++ and modifies drawing behavior. Overall, the look is more flat (removed some gradients and bevels). Tested on Ubuntu 14.04 using Qt 5.4 and running on a KDE Desktop (Oxygen base style). For a screenshot, see https://gist.github.com/thorbenk/5ab06bea726de0aa7473 Changes: - Introduce class Theme, defining the interface how to access theme specific settings. The class reads a .creatortheme file (INI file, via QSettings) - Define named colors in the [Palette] section (see dark.creatortheme for example usage) - Use either named colors of AARRGGBB (hex) in the [Colors] section - A file ending with .creatortheme may be supplied to the '-theme' command line option - A global Theme instance can be accessed via creatorTheme() - Query colors, gradients, icons and flags from the theme were possible (TODO: use this in more places...) - There are very many color roles. It seems better to me to describe the role clearly, and then to consolidate later in the actual theme by assigning the same color. For example, one can set the text color of the output pane button individualy. - Many elements are also drawn differently. For the dark theme, I wanted to have a flatter look. - Introduce Theme::WidgetStyle enum, for now {Original, Flat}. - The theme specifies which kind of widget style it wants. - The drawing code queries the theme's style flag and switches between the original, gradient based look and the new, flat look. - Create some custom icons which look better on dark background (wip, currently folder/file icons) - Let ManhattanStyle draw some elements for non-panelwidgets, too (open/close arrows in QTreeView, custom folder/file icons) - For the welcomescreen, pass the WelcomeTheme class. WelcomeTheme exposes theme colors as Q_PROPERTY accessible from .qml - Themes can be modified via the 'Themes' tab in the environment settings. TODO: * Unify image handling * Avoid style name references * Fix gradients Change-Id: I92c2050ab0fb327649ea1eff4adec973d2073944 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/coreplugin/themesettings.h')
-rw-r--r--src/plugins/coreplugin/themesettings.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/plugins/coreplugin/themesettings.h b/src/plugins/coreplugin/themesettings.h
new file mode 100644
index 0000000000..a204acd7a1
--- /dev/null
+++ b/src/plugins/coreplugin/themesettings.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Thorben Kroeger <thorbenkroeger@gmail.com>.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://www.qt.io/licensing. For further information
+** use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef THEMESETTINGS_H
+#define THEMESETTINGS_H
+
+#include <coreplugin/dialogs/ioptionspage.h>
+
+namespace Core {
+namespace Internal {
+
+class ThemeSettingsPrivate;
+
+class ThemeSettings : public IOptionsPage
+{
+ Q_OBJECT
+
+public:
+ ThemeSettings();
+ ~ThemeSettings();
+
+ QWidget *widget();
+ void apply();
+ void finish();
+
+ static QString defaultThemeFileName(const QString &fileName = QString());
+
+private slots:
+ void themeSelected(int index);
+ void copyTheme();
+ void renameTheme();
+ void copyThemeByName(const QString &);
+ void confirmDeleteTheme();
+ void deleteTheme();
+ void maybeSaveTheme();
+
+private:
+ void refreshThemeList();
+ ThemeSettingsPrivate *d;
+};
+
+} // namespace Internal
+} // namespace Core
+
+#endif // THEMESETTINGS_H