summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2019-06-03 16:57:03 +0200
committerSimon Rettberg2019-06-03 16:57:03 +0200
commit5490d1acbde7014ec0f3d2255984bff49e5af079 (patch)
treed6eb65a70a00a4926ac52636ad225c88b6f1786d
parentRemove debug spam (diff)
downloadvmchooser2-5490d1acbde7014ec0f3d2255984bff49e5af079.tar.gz
vmchooser2-5490d1acbde7014ec0f3d2255984bff49e5af079.tar.xz
vmchooser2-5490d1acbde7014ec0f3d2255984bff49e5af079.zip
Remember whether help/news was open
-rw-r--r--src/dialog.cpp13
-rw-r--r--src/userconfig.cpp13
-rw-r--r--src/userconfig.h2
3 files changed, 23 insertions, 5 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 08af827..5e68e10 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -55,8 +55,10 @@ Dialog::Dialog(QWidget *parent)
// ui->filterEdit->installEventFilter(this);
QCoreApplication::instance()->installEventFilter(this);
- ui->helpBox->hide();
- ui->newsBox->hide();
+ if (!UserConfig::isNewsHelpOpen()) {
+ ui->helpBox->hide();
+ ui->newsBox->hide();
+ }
ui->lblAutoQuit->hide();
this->addStatusString(STR_LOADING);
@@ -194,6 +196,7 @@ void Dialog::on_treeView_doubleClicked(const QModelIndex& index)
}
UserConfig::addLastSession(s->uuid().isEmpty() ? s->shortDescription() : s->uuid());
UserConfig::setLastTab(activeTab_);
+ UserConfig::setNewsHelpOpen(!ui->helpBox->isHidden());
centerTimer_->stop(); // Stop the auto-center/auto-quit timer, so we don't kill the session :>
setVisible(false);
} else {
@@ -422,7 +425,7 @@ void Dialog::onCenterTimer() {
} else if (autoQuit_ < 60) {
ui->lblAutoQuit->setText(trUtf8("Auto logout in %1").arg(autoQuit_));
ui->lblAutoQuit->show();
- } else if (ui->lblAutoQuit->isVisible()) {
+ } else if (!ui->lblAutoQuit->isHidden()) {
ui->lblAutoQuit->hide();
}
}
@@ -550,7 +553,7 @@ void Dialog::downloadData(const QString& locationIds) {
+ infoNode.text() + "</p>"));
}
- if (UserConfig::getLastNewsTime() < timestamp.toTime_t()) {
+ if (ui->helpBox->isHidden() && UserConfig::getLastNewsTime() < timestamp.toTime_t()) {
// show news if not seen before
on_helpNewsButton_clicked();
}
@@ -797,7 +800,7 @@ void Dialog::setListModel(SessionTreeModel *model) {
}
void Dialog::on_helpNewsButton_clicked() {
- if (ui->helpBox->isVisible()) {
+ if (!ui->helpBox->isHidden()) {
ui->helpBox->hide();
ui->newsBox->hide();
} else {
diff --git a/src/userconfig.cpp b/src/userconfig.cpp
index 7f79015..c801b70 100644
--- a/src/userconfig.cpp
+++ b/src/userconfig.cpp
@@ -9,6 +9,7 @@ static const QString PREVIOUS_SESSION_USER(QDir::homePath() + "/.config/openslx/
static const QString KEY_LAST_SESSIONS("last-sessions");
static const QString KEY_LAST_TAB("last-tab");
static const QString KEY_LAST_NEWS("last-news");
+static const QString KEY_NEWS_OPEN("news-open");
static QSettings *settings = nullptr;
@@ -77,3 +78,15 @@ uint UserConfig::getLastNewsTime()
init();
return settings->value(KEY_LAST_NEWS).toUInt();
}
+
+void UserConfig::setNewsHelpOpen(bool b)
+{
+ init();
+ settings->setValue(KEY_NEWS_OPEN, b);
+}
+
+bool UserConfig::isNewsHelpOpen()
+{
+ init();
+ return settings->value(KEY_NEWS_OPEN).toBool();
+}
diff --git a/src/userconfig.h b/src/userconfig.h
index 7f27e1b..213c4c2 100644
--- a/src/userconfig.h
+++ b/src/userconfig.h
@@ -9,9 +9,11 @@ public:
static QStringList getLastSessions();
static int getLastTab();
static uint getLastNewsTime();
+ static bool isNewsHelpOpen();
static void addLastSession(QString nameOrId);
static void setLastTab(int tab);
static void setLastNewsTime(uint t);
+ static void setNewsHelpOpen(bool b);
private:
UserConfig() {}