[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdetoys/amor
From: Gerardo Puga <gpuga () gioia ! ing ! unlp ! edu ! ar>
Date: 2004-03-06 3:13:37
Message-ID: 20040306031337.922799959 () office ! kde ! org
[Download RAW message or body]
CVS commit by gpuga:
Patch sent by Ryan Stutsman to add an option to load a random character
every time amor is started. Closes bugzilla report 19485, 1130 days after
it was opened.
M +9 -0 amor.cpp 1.33
M +2 -0 amorconfig.cpp 1.8
M +1 -0 amorconfig.h 1.5
M +13 -0 amordialog.cpp 1.14
M +1 -0 amordialog.h 1.8
--- kdetoys/amor/amor.cpp #1.32:1.33
@@ -40,4 +40,5 @@
#include <kwin.h>
#include <kwinmodule.h>
+#include <kstandarddirs.h>
#include "amor.h"
@@ -302,4 +303,12 @@ bool Amor::readConfig()
}
+ // Select a random theme if user requested it
+ if (mConfig.mRandomTheme)
+ {
+ QStringList files(KGlobal::dirs()->findAllResources("appdata", "*rc"));
+ int randomTheme = kapp->random() % files.count();
+ mConfig.mTheme = (QString)*files.at(randomTheme);
+ }
+
// read selected theme
if (!mTheme.setTheme(mConfig.mTheme))
--- kdetoys/amor/amorconfig.cpp #1.7:1.8
@@ -56,4 +56,5 @@ void AmorConfig::read()
mTheme = config->readEntry("Theme", "blobrc");
mTips = config->readBoolEntry("Tips", false);
+ mRandomTheme = config->readBoolEntry("RandomTheme", false);
mAppTips = config->readBoolEntry("ApplicationTips", true);
mStaticPos = config->readNumEntry("StaticPosition", 20);
@@ -73,4 +74,5 @@ void AmorConfig::write()
config->writeEntry("Theme", mTheme);
config->writeEntry("Tips", mTips);
+ config->writeEntry("RandomTheme", mRandomTheme);
config->writeEntry("ApplicationTips", mAppTips);
config->writeEntry("StaticPosition", mStaticPos);
--- kdetoys/amor/amorconfig.h #1.4:1.5
@@ -50,4 +50,5 @@ public:
int mOffset;
bool mTips;
+ bool mRandomTheme;
bool mAppTips;
int mStaticPos;
--- kdetoys/amor/amordialog.cpp #1.13:1.14
@@ -87,4 +87,8 @@ AmorDialog::AmorDialog()
checkBox->setChecked(mConfig.mTips);
+ checkBox = new QCheckBox(i18n("Use a random character"), mainwidget);
+ connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotRandomTheme(bool)));
+ checkBox->setChecked(mConfig.mRandomTheme);
+
checkBox = new QCheckBox(i18n("Allow application tips"), mainwidget);
connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotApplicationTips(bool)));
@@ -198,4 +202,13 @@ void AmorDialog::slotRandomTips(bool tip
//---------------------------------------------------------------------------
//
+// User toggled random character
+//
+void AmorDialog::slotRandomTheme(bool randomTheme)
+{
+ mConfig.mRandomTheme = randomTheme;
+}
+
+//---------------------------------------------------------------------------
+//
// User toggled application tips
//
--- kdetoys/amor/amordialog.h #1.7:1.8
@@ -64,4 +64,5 @@ protected slots:
void slotOnTop(bool);
void slotRandomTips(bool);
+ void slotRandomTheme(bool);
void slotApplicationTips(bool);
void slotOffset(int);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic