From 09d3c81cf2a582a71fd19cba534cca082e57d75a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Fri, 13 Mar 2009 10:51:12 +0000 Subject: [PATCH] Show Config wizard if Kdenlive version changed svn path=/trunk/kdenlive/; revision=3149 --- src/mainwindow.cpp | 32 ++++++++++++++++++++++---------- src/wizard.cpp | 10 +++++++--- src/wizard.h | 2 +- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6c57b060..ea630232 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -49,6 +49,7 @@ #include "markerdialog.h" #include "clipitem.h" #include "interfaces.h" +#include "kdenlive-config.h" #include #include @@ -85,6 +86,8 @@ #include +static const char version[] = VERSION; + static const int ID_STATUS_MSG = 1; static const int ID_EDITMODE_MSG = 2; static const int ID_TIMELINE_MSG = 3; @@ -1072,23 +1075,32 @@ void MainWindow::readOptions() { KSharedConfigPtr config = KGlobal::config(); m_fileOpenRecent->loadEntries(KConfigGroup(config, "Recent Files")); KConfigGroup initialGroup(config, "version"); - if (!initialGroup.exists()) { + bool upgrade = false; + if (initialGroup.exists()) { + if (initialGroup.readEntry("version", QString()).section(' ', 0, 0) != QString(version).section(' ', 0, 0)) + upgrade = true; + + if (initialGroup.readEntry("version") == "0.7") { + //Add new settings from 0.7.1 + if (KdenliveSettings::defaultprojectfolder().isEmpty()) { + QString path = QDir::homePath() + "/kdenlive"; + if (KStandardDirs::makeDir(path) == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path; + KdenliveSettings::setDefaultprojectfolder(path); + } + } + + } + + if (!initialGroup.exists() || upgrade) { // this is our first run, show Wizard - Wizard *w = new Wizard(this); + Wizard *w = new Wizard(upgrade, this); if (w->exec() == QDialog::Accepted && w->isOk()) { w->adjustSettings(); - initialGroup.writeEntry("version", "0.7"); + initialGroup.writeEntry("version", version); delete w; } else { ::exit(1); } - } else if (initialGroup.readEntry("version") == "0.7") { - //Add new settings from 0.7.1 - if (KdenliveSettings::defaultprojectfolder().isEmpty()) { - QString path = QDir::homePath() + "/kdenlive"; - if (KStandardDirs::makeDir(path) == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path; - KdenliveSettings::setDefaultprojectfolder(path); - } } KConfigGroup treecolumns(config, "Project Tree"); const QByteArray state = treecolumns.readEntry("columns", QByteArray()); diff --git a/src/wizard.cpp b/src/wizard.cpp index 5444d210..375e4f7c 100644 --- a/src/wizard.cpp +++ b/src/wizard.cpp @@ -33,12 +33,16 @@ const double recommendedMltVersion = 36; -Wizard::Wizard(QWidget *parent): QWizard(parent) { +Wizard::Wizard(bool upgrade, QWidget *parent): QWizard(parent) { setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png"))); QWizardPage *page1 = new QWizardPage; page1->setTitle(i18n("Welcome")); - QLabel *label = new QLabel(i18n("This is the first time you run Kdenlive. This wizard will let you adjust some basic settings, you will be ready to edit your first movie in a few seconds...")); + QLabel *label; + if (upgrade) + label = new QLabel(i18n("Your Kdenlive version was upgraded. Please take some time to review the basic settings")); + else + label = new QLabel(i18n("This is the first time you run Kdenlive. This wizard will let you adjust some basic settings, you will be ready to edit your first movie in a few seconds...")); label->setWordWrap(true); m_startLayout = new QVBoxLayout; m_startLayout->addWidget(label); @@ -99,7 +103,6 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) { QWizardPage *page5 = new QWizardPage; page5->setTitle(i18n("Checking system")); m_check.setupUi(page5); - slotCheckPrograms(); addPage(page5); listViewDelegate = new WizardDelegate(m_check.programList); @@ -490,6 +493,7 @@ void Wizard::slotCheckMlt() { } else m_systemCheckIsOk = true; if (m_systemCheckIsOk) checkMltComponents(); + slotCheckPrograms(); } bool Wizard::isOk() const { diff --git a/src/wizard.h b/src/wizard.h index 39bf35d2..4b922028 100644 --- a/src/wizard.h +++ b/src/wizard.h @@ -73,7 +73,7 @@ public: class Wizard : public QWizard { Q_OBJECT public: - Wizard(QWidget * parent = 0); + Wizard(bool upgrade, QWidget * parent = 0); void installExtraMimes(QString baseName, QStringList globs); void runUpdateMimeDatabase(); void adjustSettings(); -- 2.39.2