Don't expose color properties in c++ api

the color properties are remotely useful only when used from QML
and risk to explode in number in the future,
it's not a good thing for a public c++ api.

Also, they will become kinda deprecated as in largely replaced by
the ColorRole api. Too late to remove those properties completely,
but still last days to move them at least out of c++ api.
(and in qml they could be removed in the future in a 2.1 version
of the import while still being present in 2.0 if needed)

This moves the color properties is a theme subclass available only from QML

REVIEW:118972
This commit is contained in:
Marco Martin 2014-06-27 15:06:52 +02:00
parent 6754c86cae
commit 6c54fb596d
4 changed files with 4 additions and 210 deletions

View File

@ -24,6 +24,7 @@ set(corebindings_SRCS
svgitem.cpp
fadingnode.cpp
framesvgitem.cpp
quicktheme.cpp
tooltip.cpp
tooltipdialog.cpp
serviceoperationstatus.cpp

View File

@ -39,6 +39,7 @@
#include "iconitem.h"
#include "serviceoperationstatus.h"
#include "colorscope.h"
#include "quicktheme.h"
#include "tooltip.h"
#include "units.h"
@ -55,7 +56,7 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
QQmlContext *context = engine->rootContext();
Plasma::Theme *theme = new Plasma::Theme(engine);
Plasma::QuickTheme *theme = new Plasma::QuickTheme(engine);
context->setContextProperty("theme", theme);
Units *units = new Units(context);
@ -81,7 +82,7 @@ void CoreBindingsPlugin::registerTypes(const char *uri)
qmlRegisterType<Plasma::FrameSvgItem>(uri, 2, 0, "FrameSvgItem");
//qmlRegisterType<ThemeProxy>(uri, 2, 0, "Theme");
qmlRegisterUncreatableType<Plasma::Theme>(uri, 2, 0, "Theme", "It is not possible to instantiate Theme directly.");
qmlRegisterUncreatableType<Plasma::QuickTheme>(uri, 2, 0, "Theme", "It is not possible to instantiate Theme directly.");
qmlRegisterType<ColorScope>(uri, 2, 0, "ColorScope");
qmlRegisterType<Plasma::DataSource>(uri, 2, 0, "DataSource");

View File

@ -467,91 +467,6 @@ QFont Theme::smallestFont() const
return QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
}
QColor Theme::textColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor);
}
QColor Theme::highlightColor() const
{
return Plasma::Theme::color(Plasma::Theme::HighlightColor);
}
QColor Theme::backgroundColor() const
{
return Plasma::Theme::color(Plasma::Theme::BackgroundColor);
}
QColor Theme::buttonTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ButtonColorGroup);
}
QColor Theme::buttonBackgroundColor() const
{
return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ButtonColorGroup);
}
QColor Theme::linkColor() const
{
return Plasma::Theme::color(Plasma::Theme::LinkColor);
}
QColor Theme::visitedLinkColor() const
{
return Plasma::Theme::color(Plasma::Theme::VisitedLinkColor);
}
QColor Theme::buttonHoverColor() const
{
return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ButtonColorGroup);
}
QColor Theme::buttonFocusColor() const
{
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ButtonColorGroup);
}
QColor Theme::viewTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ViewColorGroup);
}
QColor Theme::viewBackgroundColor() const
{
return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ViewColorGroup);
}
QColor Theme::viewHoverColor() const
{
return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ViewColorGroup);
}
QColor Theme::viewFocusColor() const
{
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ViewColorGroup);
}
QColor Theme::complementaryTextColor() const
{
return Plasma::Theme::color(Plasma::Theme::TextColor, Plasma::Theme::ComplementaryColorGroup);
}
QColor Theme::complementaryBackgroundColor() const
{
return Plasma::Theme::color(Plasma::Theme::BackgroundColor, Plasma::Theme::ComplementaryColorGroup);
}
QColor Theme::complementaryHoverColor() const
{
return Plasma::Theme::color(Plasma::Theme::HoverColor, Plasma::Theme::ComplementaryColorGroup);
}
QColor Theme::complementaryFocusColor() const
{
return Plasma::Theme::color(Plasma::Theme::FocusColor, Plasma::Theme::ComplementaryColorGroup);
}
QSizeF Theme::mSize(const QFont &font) const
{
return QFontMetrics(font).boundingRect("M").size();

View File

@ -65,27 +65,6 @@ class PLASMA_EXPORT Theme : public QObject
// stylesheet
Q_PROPERTY(QString styleSheet READ styleSheet NOTIFY themeChanged)
// colors
Q_PROPERTY(QColor textColor READ textColor NOTIFY themeChanged)
Q_PROPERTY(QColor highlightColor READ highlightColor NOTIFY themeChanged)
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY themeChanged)
Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY themeChanged)
Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY themeChanged)
Q_PROPERTY(QColor linkColor READ linkColor NOTIFY themeChanged)
Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChanged)
Q_PROPERTY(QColor visitedLinkColor READ visitedLinkColor NOTIFY themeChanged)
Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY themeChanged)
Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY themeChanged)
Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY themeChanged)
Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY themeChanged)
Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChanged)
Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged)
Q_PROPERTY(QColor complementaryTextColor READ complementaryTextColor NOTIFY themeChanged)
Q_PROPERTY(QColor complementaryBackgroundColor READ complementaryBackgroundColor NOTIFY themeChanged)
Q_PROPERTY(QColor complementaryHoverColor READ viewHoverColor NOTIFY themeChanged)
Q_PROPERTY(QColor complementaryFocusColor READ viewFocusColor NOTIFY themeChanged)
public:
enum ColorRole {
TextColor = 0, /**< the text color to be used by items resting on the background */
@ -349,108 +328,6 @@ public:
*/
QFont smallestFont() const;
/**
* @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;
/** This method allows Plasma to enable and disable the background
* contrast effect for a given theme, improving readability. The
* value is read from the "enabled" key in the "ContrastEffect"