mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kcontrol: implement option to disable/enable plasma theme cache and change its size
site note: 100 MB pixmap cache is more than enough Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
814e6314ea
commit
574846b9da
3 changed files with 71 additions and 7 deletions
|
@ -55,7 +55,47 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="cacheThemeLabel">
|
||||
<property name="text">
|
||||
<string>Cache Theme:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="cacheTheme">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="themeCacheSizeLabel">
|
||||
<property name="text">
|
||||
<string>Theme Cache Size:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KIntNumInput" name="themeCacheSize">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
|
@ -70,5 +110,12 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KIntNumInput</class>
|
||||
<extends></extends>
|
||||
<header>knuminput.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -41,7 +41,9 @@ WorkspaceOptionsModule::WorkspaceOptionsModule(QWidget *parent, const QVariantLi
|
|||
m_ownConfig( KSharedConfig::openConfig("workspaceoptionsrc")),
|
||||
m_plasmaDesktopAutostart("plasma-desktop"),
|
||||
m_krunnerAutostart("krunner"),
|
||||
m_ui(new Ui_MainPage)
|
||||
m_currentlyIsDesktop(false),
|
||||
m_plasmaFound(false),
|
||||
m_ui(new Ui_MainPage())
|
||||
{
|
||||
KAboutData *about =
|
||||
new KAboutData("kcmworkspaceoptions", 0, ki18n("Global options for the Plasma Workspace"),
|
||||
|
@ -54,14 +56,21 @@ WorkspaceOptionsModule::WorkspaceOptionsModule(QWidget *parent, const QVariantLi
|
|||
|
||||
setButtons(Help|Apply);
|
||||
|
||||
m_plasmaFound = KStandardDirs::findExe("plasma-desktop").isNull();
|
||||
|
||||
m_ui->setupUi(this);
|
||||
m_ui->themeCacheSize->setSuffix(i18n("%1 MB", ""));
|
||||
|
||||
connect(m_ui->formFactor, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->showToolTips, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(m_ui->formFactor, SIGNAL(currentIndexChanged(int)), this, SLOT(formFactorChanged(int)));
|
||||
connect(m_ui->cacheTheme, SIGNAL(toggled(bool)), this, SLOT(changed()));
|
||||
connect(m_ui->cacheTheme, SIGNAL(toggled(bool)), this, SLOT(cacheThemeChanged(bool)));
|
||||
connect(m_ui->themeCacheSize, SIGNAL(valueChanged(int)), this, SLOT(changed()));
|
||||
|
||||
if (KStandardDirs::findExe("plasma-desktop").isNull()) {
|
||||
if (m_plasmaFound) {
|
||||
m_ui->formFactor->setEnabled(false);
|
||||
m_ui->cacheTheme->setEnabled(false);
|
||||
m_ui->themeCacheSize->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,13 +79,15 @@ WorkspaceOptionsModule::~WorkspaceOptionsModule()
|
|||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void WorkspaceOptionsModule::save()
|
||||
{
|
||||
{
|
||||
KConfig config("plasmarc");
|
||||
KConfigGroup cg(&config, "PlasmaToolTips");
|
||||
cg.writeEntry("Delay", m_ui->showToolTips->isChecked() ? 0.7 : -1);
|
||||
KConfigGroup cg2(&config, "CachePolicies");
|
||||
cg2.writeEntry("CacheTheme", m_ui->cacheTheme->isChecked());
|
||||
cg2.writeEntry("ThemeCacheKb", m_ui->themeCacheSize->value() * 1024);
|
||||
}
|
||||
|
||||
const bool isDesktop = m_ui->formFactor->currentIndex() == 0;
|
||||
|
@ -201,6 +212,10 @@ void WorkspaceOptionsModule::load()
|
|||
KConfig config("plasmarc");
|
||||
KConfigGroup cg(&config, "PlasmaToolTips");
|
||||
m_ui->showToolTips->setChecked(cg.readEntry("Delay", 0.7) > 0);
|
||||
KConfigGroup cg2(&config, "CachePolicies");
|
||||
m_ui->cacheTheme->setChecked(cg2.readEntry("CacheTheme", true));
|
||||
const int themeCacheKb = cg2.readEntry("ThemeCacheKb", 81920);
|
||||
m_ui->themeCacheSize->setValue(themeCacheKb / 1024);
|
||||
}
|
||||
|
||||
void WorkspaceOptionsModule::defaults()
|
||||
|
@ -208,9 +223,10 @@ void WorkspaceOptionsModule::defaults()
|
|||
m_ui->formFactor->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void WorkspaceOptionsModule::formFactorChanged(int newFormFactorIndex)
|
||||
void WorkspaceOptionsModule::cacheThemeChanged(bool cacheTheme)
|
||||
{
|
||||
Q_UNUSED(newFormFactorIndex);
|
||||
Q_ASSERT(m_plasmaFound);
|
||||
m_ui->themeCacheSize->setEnabled(cacheTheme);
|
||||
}
|
||||
|
||||
#include "moc_workspaceoptions.cpp"
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void defaults();
|
||||
|
||||
private Q_SLOTS:
|
||||
void formFactorChanged(int newFormFactorIndex);
|
||||
void cacheThemeChanged(bool cacheTheme);
|
||||
|
||||
private:
|
||||
KSharedConfigPtr m_kwinConfig;
|
||||
|
@ -47,6 +47,7 @@ private:
|
|||
KAutostart m_plasmaDesktopAutostart;
|
||||
KAutostart m_krunnerAutostart;
|
||||
bool m_currentlyIsDesktop;
|
||||
bool m_plasmaFound;
|
||||
|
||||
Ui_MainPage *m_ui;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue