|
From: Tapio V. <aa...@us...> - 2011-02-01 09:54:45
|
Module: editor
Branch: master
Commit: fb1fdce7663eda2dfb23ff8e32ea923049898fab
Author: Tapio Vierros <tap...@gm...>
Date: Tue Feb 1 11:21:23 2011 +0200
Basic functionality to GettingStarted.
* Show on first application startup
* Allow toggling startup behaviour
* Close button works
---
editorapp.cc | 4 ++++
gettingstarted.hh | 26 ++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/editorapp.cc b/editorapp.cc
index 48acf21..7e03dba 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -93,6 +93,10 @@ EditorApp::EditorApp(QWidget *parent): QMainWindow(parent), projectFileName(), h
connect(player, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(playerStateChanged(Phonon::State,Phonon::State)));
connect(player, SIGNAL(metaDataChanged()), this, SLOT(metaDataChanged()));
connect(noteGraph, SIGNAL(seeked(qint64)), player, SLOT(seek(qint64)));
+
+ QSettings settings;
+ if (settings.value("showhelp", true).toBool())
+ on_actionGettingStarted_triggered();
}
void EditorApp::operationDone(const Operation &op)
diff --git a/gettingstarted.hh b/gettingstarted.hh
index 89154da..1b4b753 100644
--- a/gettingstarted.hh
+++ b/gettingstarted.hh
@@ -1,12 +1,34 @@
+#include <QSettings>
#include "ui_gettingstarted.h"
+#include "editorapp.hh"
class GettingStartedDialog: public QDialog, private Ui::GettingStarted
{
Q_OBJECT
public:
- GettingStartedDialog(QWidget* parent = 0)
- : QDialog(parent)
+ GettingStartedDialog(QWidget* parent)
+ : QDialog(parent), m_editorApp(qobject_cast<EditorApp*>(parent))
{
+ if (!m_editorApp) throw std::runtime_error("Couldn't open help dialog.");
setupUi(this);
+ QSettings settings;
+ chkShowOnStartup->setChecked(settings.value("showhelp", false).toBool());
}
+
+public slots:
+ void on_cmdClose_clicked(bool) { close(); }
+
+ void on_chkShowOnStartup_stateChanged(int state) {
+ QSettings settings;
+ settings.setValue("showhelp", state != Qt::Unchecked);
+ }
+
+protected:
+ void closeEvent(QCloseEvent*) {
+ QSettings settings;
+ settings.setValue("showhelp", chkShowOnStartup->isChecked());
+ }
+
+private:
+ EditorApp *m_editorApp;
};
|