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);
connect(m_showTimer, &QTimer::timeout, this, &ToolTip::showToolTip);
settingsChanged();
loadSettings();
const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "plasmarc";
KDirWatch::self()->addFile(configFile);
@ -71,10 +71,13 @@ ToolTip::~ToolTip()
void ToolTip::settingsChanged()
{
KConfig config("plasmarc");
KConfigGroup cg(&config, "PlasmaToolTips");
KSharedConfig::openConfig("plasmarc")->reparseConfiguration();
}
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);
}

View File

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

View File

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

View File

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