Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfixes and added preferences dialog
- Loading branch information
Showing
15 changed files
with
395 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "settingsdialog.h" | ||
#include "ui_settingsdialog.h" | ||
|
||
#include <QSettings> | ||
|
||
SettingsDialog::SettingsDialog(QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::SettingsDialog) | ||
{ | ||
ui->setupUi(this); | ||
|
||
// populate themese | ||
ui->theme->addItem("Default"); | ||
ui->theme->addItem("Dark"); | ||
|
||
// load settings | ||
QSettings settings; | ||
|
||
QString theme = settings.value("theme", "Default").toString(); | ||
ui->theme->setCurrentIndex(theme == "Default" ? 0 : 1); | ||
// ints | ||
ui->fontSize->setValue(settings.value("fontSize", 10).toInt()); | ||
ui->indentSize->setValue(settings.value("indentSize", 4).toInt()); | ||
ui->autoCompThresh->setValue(settings.value("autoCompleteThreshold", 5).toInt()); | ||
// bools | ||
ui->autoComp->setChecked(settings.value("autoCompleteEnabled", true).toBool()); | ||
ui->saveOnRun->setChecked(settings.value("saveOnRun", true).toBool()); | ||
ui->confirmSave->setChecked(settings.value("confirmSave", true).toBool()); | ||
ui->stringEOLHighlight->setChecked(settings.value("stringEOLHighlight", false).toBool()); | ||
} | ||
|
||
void SettingsDialog::accept() { | ||
QSettings settings; | ||
|
||
settings.setValue("theme",ui->theme->currentText()); | ||
// ints | ||
settings.setValue("fontSize",ui->fontSize->value()); | ||
settings.setValue("indentSize",ui->indentSize->value()); | ||
settings.setValue("autoCompleteThreshold",ui->autoCompThresh->value()); | ||
// bools | ||
settings.setValue("autoCompleteEnabled",(ui->autoComp->checkState() == Qt::Checked)); | ||
settings.setValue("saveOnRun",(ui->saveOnRun->checkState() == Qt::Checked)); | ||
settings.setValue("confirmSave",(ui->confirmSave->checkState() == Qt::Checked)); | ||
settings.setValue("stringEOLHighlight",(ui->stringEOLHighlight->checkState() == Qt::Checked)); | ||
|
||
done(QDialog::Accepted); | ||
} | ||
|
||
SettingsDialog::~SettingsDialog() | ||
{ | ||
delete ui; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef SETTINGSDIALOG_H | ||
#define SETTINGSDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class SettingsDialog; | ||
} | ||
|
||
class SettingsDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit SettingsDialog(QWidget *parent = 0); | ||
~SettingsDialog(); | ||
|
||
virtual void accept(); | ||
|
||
private: | ||
Ui::SettingsDialog *ui; | ||
}; | ||
|
||
#endif // SETTINGSDIALOG_H |
Oops, something went wrong.