diff --git a/src/declarativeimports/core/quicktheme.cpp b/src/declarativeimports/core/quicktheme.cpp new file mode 100644 index 000000000..3ef5b8821 --- /dev/null +++ b/src/declarativeimports/core/quicktheme.cpp @@ -0,0 +1,124 @@ +/* + * Copyright 2006-2007 Aaron Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program 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 General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "quicktheme.h" + + + +namespace Plasma +{ + +QuickTheme::QuickTheme(QObject *parent) + : Theme(parent) +{ + connect(this, &Theme::themeChanged, this, &QuickTheme::themeChangedProxy); +} + +QuickTheme::~QuickTheme() +{ +} + +QColor QuickTheme::textColor() const +{ + return Plasma::Theme::color(Plasma::Theme::TextColor); +} + +QColor QuickTheme::highlightColor() const +{ + return Plasma::Theme::color(Plasma::Theme::HighlightColor); +} + +QColor QuickTheme::backgroundColor() const +{ + return Plasma::Theme::color(Plasma::Theme::BackgroundColor); +} + +QColor QuickTheme::buttonTextColor() const +{ + return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup); +} + +QColor QuickTheme::buttonBackgroundColor() const +{ + return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ButtonColorGroup); +} + +QColor QuickTheme::linkColor() const +{ + return Plasma::Theme::color(Plasma::Theme::LinkColor); +} + +QColor QuickTheme::visitedLinkColor() const +{ + return Plasma::Theme::color(Plasma::Theme::VisitedLinkColor); +} + +QColor QuickTheme::buttonHoverColor() const +{ + return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ButtonColorGroup); +} + +QColor QuickTheme::buttonFocusColor() const +{ + return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ButtonColorGroup); +} + +QColor QuickTheme::viewTextColor() const +{ + return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup); +} + +QColor QuickTheme::viewBackgroundColor() const +{ + return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ViewColorGroup); +} + +QColor QuickTheme::viewHoverColor() const +{ + return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ViewColorGroup); +} + +QColor QuickTheme::viewFocusColor() const +{ + return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ViewColorGroup); +} + +QColor QuickTheme::complementaryTextColor() const +{ + return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup); +} + +QColor QuickTheme::complementaryBackgroundColor() const +{ + return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ComplementaryColorGroup); +} + +QColor QuickTheme::complementaryHoverColor() const +{ + return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ComplementaryColorGroup); +} + +QColor QuickTheme::complementaryFocusColor() const +{ + return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ComplementaryColorGroup); +} + +} + +#include "moc_quicktheme.cpp" diff --git a/src/declarativeimports/core/quicktheme.h b/src/declarativeimports/core/quicktheme.h new file mode 100644 index 000000000..8d5eafaf9 --- /dev/null +++ b/src/declarativeimports/core/quicktheme.h @@ -0,0 +1,185 @@ +/* + * Copyright 2006-2007 Aaron Seigo + * Copyright 2013 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program 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 General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PLASMA_QUICKTHEME_H +#define PLASMA_QUICKTHEME_H + +#include + +#include + +namespace Plasma +{ + +/** + * @class Theme plasma/theme.h + * + * @short Interface to the Plasma theme + * + * + * Plasma::Theme provides access to a common and standardized set of graphic + * elements stored in SVG format. This allows artists to create single packages + * of SVGs that will affect the look and feel of all workspace components. + * + * Plasma::Svg uses Plasma::Theme internally to locate and load the appropriate + * SVG data. Alternatively, Plasma::Theme can be used directly to retrieve + * file system paths to SVGs by name. + */ +class QuickTheme : public Plasma::Theme +{ + Q_OBJECT + + // colors + Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChangedProxy) + + Q_PROPERTY(QColor complementaryTextColor READ complementaryTextColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor complementaryBackgroundColor READ complementaryBackgroundColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor complementaryHoverColor READ viewHoverColor NOTIFY themeChangedProxy) + Q_PROPERTY(QColor complementaryFocusColor READ viewFocusColor NOTIFY themeChangedProxy) + +public: + explicit QuickTheme(QObject *parent = 0); + ~QuickTheme(); + + + + /** + * @return The theme's colorscheme's text color + * @since 5.0 + */ + QColor textColor() const; + + /** + * @return The theme's colorscheme's highlight color + * @since 5.0 + */ + QColor highlightColor() const; + + /** + * @return The theme's colorscheme's background color + * @since 5.0 + */ + QColor backgroundColor() const; + + /** + * @return The theme's colorscheme's color for text on buttons + * @since 5.0 + */ + QColor buttonTextColor() const; + + /** + * @return The theme's colorscheme's background color color of buttons + * @since 5.0 + */ + QColor buttonBackgroundColor() const; + + /** + * @return The theme's colorscheme's link color + * @since 5.0 + */ + QColor linkColor() const; + + /** + * @return The theme's colorscheme's text color for visited links + * @since 5.0 + */ + QColor visitedLinkColor() const; + + /** + * @return The theme's colorscheme's color of hovered buttons + * @since 5.0 + */ + QColor buttonHoverColor() const; + + /** + * @return The theme's colorscheme's color of focused buttons + * @since 5.0 + */ + QColor buttonFocusColor() const; + + /** + * @return The theme's colorscheme's text color in views + * @since 5.0 + */ + QColor viewTextColor() const; + + /** + * @return The theme's colorscheme's background color of views + * @since 5.0 + */ + QColor viewBackgroundColor() const; + + /** + * @return The theme's colorscheme's color of hovered views + * @since 5.0 + */ + QColor viewHoverColor() const; + + /** + * @return The theme's colorscheme's color of focused views + * @since 5.0 + */ + QColor viewFocusColor() const; + + /** + * @return The theme's colorscheme's text color of "complementary" areas + * @since 5.0 + */ + QColor complementaryTextColor() const; + + /** + * @return The theme's colorscheme's background color of "complementary" areas + * @since 5.0 + */ + QColor complementaryBackgroundColor() const; + + /** + * @return The theme's colorscheme's color of hovered "complementary" areas + * @since 5.0 + */ + QColor complementaryHoverColor() const; + + /** + * @return The theme's colorscheme's color of focused "complementary" areas + * @since 5.0 + */ + QColor complementaryFocusColor() const; + +Q_SIGNALS: + void themeChangedProxy(); +}; + +} // Plasma namespace + +#endif // multiple inclusion guard +