Merge changes Ibb130779,I68521f90,Ica6ba027

* changes:
  Reparse settings when they change
  Use a shared config in tooltip
  Save SVGs only when a theme is unloaded, not on each theme proxy
This commit is contained in:
David Edmundson 2014-12-11 12:40:43 +01:00 committed by Gerrit Code Review
commit 2afeb22f42
4 changed files with 11 additions and 8 deletions

View File

@ -49,7 +49,7 @@ ToolTip::ToolTip(QQuickItem *parent)
m_showTimer->setSingleShot(true); m_showTimer->setSingleShot(true);
connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip); connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip);
settingsChanged(); loadSettings();
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "plasmarc"; const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "plasmarc";
KDirWatch::self()->addFile(configFile); KDirWatch::self()->addFile(configFile);
@ -71,10 +71,13 @@ ToolTip::~ToolTip()
void ToolTip::settingsChanged() void ToolTip::settingsChanged()
{ {
KConfig config("plasmarc"); KSharedConfig::openConfig("plasmarc")->reparseConfiguration();
KConfigGroup cg(&config, "PlasmaToolTips"); }
m_interval = cg.readEntry("Delay", 700); void ToolTip::loadSettings()
{
KConfigGroup cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), "PlasmaToolTips");
m_interval = cfg.readEntry("Delay", 700);
m_tooltipsEnabledGlobally = (m_interval > 0); m_tooltipsEnabledGlobally = (m_interval > 0);
} }

View File

@ -180,6 +180,7 @@ private Q_SLOTS:
void settingsChanged(); void settingsChanged();
private: private:
void loadSettings();
bool m_tooltipsEnabledGlobally; bool m_tooltipsEnabledGlobally;
bool m_containsMouse; bool m_containsMouse;
Plasma::Types::Location m_location; Plasma::Types::Location m_location;

View File

@ -115,7 +115,8 @@ ThemePrivate::ThemePrivate(QObject *parent)
ThemePrivate::~ThemePrivate() ThemePrivate::~ThemePrivate()
{ {
if (FrameSvgPrivate::s_sharedFrames.contains(this)) { saveSvgElementsCache();
if (FrameSvgPrivate::s_sharedFrames.contains(this)) {
foreach (FrameData *data, FrameSvgPrivate::s_sharedFrames[this].values()) { foreach (FrameData *data, FrameSvgPrivate::s_sharedFrames[this].values()) {
delete data; delete data;
} }
@ -633,7 +634,7 @@ QColor ThemePrivate::color(Theme::ColorRole role, Theme::ColorGroup group) const
break; break;
} }
} }
switch (role) { switch (role) {

View File

@ -91,8 +91,6 @@ Theme::Theme(const QString &themeName, QObject *parent)
Theme::~Theme() Theme::~Theme()
{ {
d->saveSvgElementsCache();
if (d == ThemePrivate::globalTheme) { if (d == ThemePrivate::globalTheme) {
if (!ThemePrivate::globalThemeRefCount.deref()) { if (!ThemePrivate::globalThemeRefCount.deref()) {
disconnect(ThemePrivate::globalTheme, 0, this, 0); disconnect(ThemePrivate::globalTheme, 0, this, 0);