If initial settings wizard is canceled, ensure that it is shown at next start.

This commit is contained in:
craig.p.drummond
2014-09-26 16:50:35 +00:00
committed by craig.p.drummond
parent 952aa5cc2e
commit bab9f00255
5 changed files with 33 additions and 8 deletions

View File

@@ -91,6 +91,8 @@
21. Fix setting of played state for podcasts.
22. Fix display of unplayed podcast episode counts.
23. Check if downloading podcasts in closeEvent() as well as quit()
24. If initial settings wizard is canceled, ensure that it is shown at next
start.
1.4.1
-----

View File

@@ -225,3 +225,10 @@ void InitialSettingsWizard::accept()
Settings::self()->save();
QDialog::accept();
}
void InitialSettingsWizard::reject()
{
// Clear version number - so that wizard is shown next time Cantata is started.
Settings::self()->clearVersion();
QDialog::reject();
}

View File

@@ -47,6 +47,7 @@ private Q_SLOTS:
void showError(const QString &message, bool showActions);
void pageChanged(int p);
void accept();
void reject();
void controlNextButton();
private:

View File

@@ -136,13 +136,13 @@ static Settings::StartupState getStartupState(const QString &str)
}
Settings::Settings()
: isFirstRun(false)
: state(AP_Configured)
, ver(-1)
#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET
, wallet(0)
#endif
{
// Call 'version' so that it initialises 'ver' and 'isFirstRun'
// Call 'version' so that it initialises 'ver' and 'state'
version();
// Only need to read system defaults if we have not previously been configured...
if (!cfg.hasGroup(MPDConnectionDetails::configGroupName())) {
@@ -540,7 +540,7 @@ int Settings::searchView()
int Settings::version()
{
if (-1==ver) {
isFirstRun=!cfg.hasEntry("version");
state=cfg.hasEntry("version") ? AP_Configured : AP_FirstRun;
QStringList parts=cfg.get("version", QLatin1String(PACKAGE_VERSION_STRING)).split('.');
if (3==parts.size()) {
ver=CANTATA_MAKE_VERSION(parts.at(0).toInt(), parts.at(1).toInt(), parts.at(2).toInt());
@@ -1415,13 +1415,21 @@ void Settings::saveRetinaSupport(bool v)
void Settings::save()
{
if (version()!=PACKAGE_VERSION || isFirstRun) {
cfg.set("version", PACKAGE_VERSION_STRING);
ver=PACKAGE_VERSION;
if (AP_NotConfigured!=state) {
if (version()!=PACKAGE_VERSION || AP_FirstRun==state) {
cfg.set("version", PACKAGE_VERSION_STRING);
ver=PACKAGE_VERSION;
}
}
cfg.sync();
}
void Settings::clearVersion()
{
cfg.removeEntry("version");
state=AP_NotConfigured;
}
int Settings::getBoolAsInt(const QString &key, int def)
{
// Old config, sometimes bool was used - which has now been converted

View File

@@ -299,19 +299,26 @@ public:
void saveInfoTooltips(bool v);
void saveRetinaSupport(bool v);
void save();
void clearVersion();
#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET
bool openWallet();
#else
QString iconTheme();
#endif
bool firstRun() const { return isFirstRun; }
bool firstRun() const { return AP_Configured!=state; }
private:
int getBoolAsInt(const QString &key, int def);
private:
bool isFirstRun;
enum AppState {
AP_FirstRun,
AP_NotConfigured,
AP_Configured
};
AppState state;
int ver;
#if defined ENABLE_KDE_SUPPORT && defined ENABLE_KWALLET
KWallet::Wallet *wallet;