make a few settings into pajlada::Settings::Settings

Add setting to hide badges

Give focus to text input if you click anywhere in a chat widget
This commit is contained in:
Rasmus Karlsson
2017-06-11 20:53:43 +02:00
parent 945ca5d17a
commit 7c3cd930f3
11 changed files with 71 additions and 27 deletions
+18
View File
@@ -5,6 +5,7 @@
#include "windowmanager.hpp"
#include <QComboBox>
#include <QDebug>
#include <QFile>
#include <QFormLayout>
#include <QGroupBox>
@@ -166,6 +167,7 @@ void SettingsDialog::addTabs()
auto v = new QVBoxLayout();
v->addWidget(createCheckbox("Show timestamp", settings.showTimestamps));
v->addWidget(createCheckbox("Show seconds in timestamp", settings.showTimestampSeconds));
v->addWidget(createCheckbox("Show badges", settings.showBadges));
v->addWidget(createCheckbox("Allow sending duplicate messages (add a space at the end)",
settings.allowDouplicateMessages));
v->addWidget(createCheckbox("Seperate messages", settings.seperateMessages));
@@ -323,6 +325,22 @@ QCheckBox *SettingsDialog::createCheckbox(const QString &title, Setting<bool> &s
return checkbox;
}
QCheckBox *SettingsDialog::createCheckbox(const QString &title,
pajlada::Settings::Setting<bool> &setting)
{
auto checkbox = new QCheckBox(title);
// Set checkbox initial state
checkbox->setChecked(setting.getValue());
QObject::connect(checkbox, &QCheckBox::toggled, this, [&setting](bool state) {
qDebug() << "update checkbox value";
setting = state; //
});
return checkbox;
}
void SettingsDialog::okButtonClicked()
{
this->close();