Re-enalbe delayed save, destroying window foces ave to be called
This commit is contained in:
@@ -907,7 +907,7 @@ MainWindow::~MainWindow()
|
||||
}
|
||||
Settings::self()->saveHiddenPages(hiddenPages);
|
||||
streamsPage->save();
|
||||
Settings::self()->save();
|
||||
Settings::self()->save(true);
|
||||
disconnect(MPDConnection::self(), 0, 0, 0);
|
||||
if (Settings::self()->stopOnExit()) {
|
||||
emit stop();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "kwallet.h"
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
K_GLOBAL_STATIC(Settings, instance)
|
||||
#endif
|
||||
@@ -52,7 +53,8 @@ Settings * Settings::self()
|
||||
}
|
||||
|
||||
Settings::Settings()
|
||||
: ver(-1)
|
||||
: timer(0)
|
||||
, ver(-1)
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
, cfg(KGlobal::config(), "General")
|
||||
, wallet(0)
|
||||
@@ -507,13 +509,28 @@ void Settings::saveStopFadeDuration(int v)
|
||||
SET_VALUE("stopFadeDuration", v);
|
||||
}
|
||||
|
||||
void Settings::save()
|
||||
void Settings::save(bool force)
|
||||
{
|
||||
SET_VALUE("version", PACKAGE_VERSION);
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
KGlobal::config()->sync();
|
||||
#else
|
||||
cfg.sync();
|
||||
#endif
|
||||
if (force) {
|
||||
SET_VALUE("version", PACKAGE_VERSION);
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
KGlobal::config()->sync();
|
||||
#else
|
||||
cfg.sync();
|
||||
#endif
|
||||
if (timer) {
|
||||
timer->stop();
|
||||
}
|
||||
} else {
|
||||
if (!timer) {
|
||||
timer=new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(actualSave()));
|
||||
}
|
||||
timer->start(30*1000);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::actualSave()
|
||||
{
|
||||
save(true);
|
||||
}
|
||||
|
||||
@@ -36,8 +36,12 @@ class Wallet;
|
||||
|
||||
#define CANTATA_MAKE_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))
|
||||
|
||||
class QTimer;
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Constants
|
||||
{
|
||||
@@ -125,13 +129,17 @@ public:
|
||||
void saveDevicesView(int v);
|
||||
#endif
|
||||
void saveStopFadeDuration(int v);
|
||||
void save();
|
||||
void save(bool force=false);
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
bool openWallet();
|
||||
#endif
|
||||
|
||||
private Q_SLOTS:
|
||||
void actualSave();
|
||||
|
||||
private:
|
||||
QString mpdDirSetting;
|
||||
QTimer *timer;
|
||||
int ver;
|
||||
#ifdef ENABLE_KDE_SUPPORT
|
||||
KConfigGroup cfg;
|
||||
|
||||
Reference in New Issue
Block a user