Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings dialog redesign take 2! #159

Merged
merged 1 commit into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions src/frontend/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
ui->setupUi(this);
autoCorrectDialog = new AutoCorrectDialog(this);

this->setFixedSize(QSize(this->width(), this->height()));
ui->cmbOrientation->insertItems(0, {"Horizontal", "Vertical"});

implementSignals();
Expand All @@ -41,16 +40,14 @@ SettingsDialog::~SettingsDialog() {

void SettingsDialog::implementSignals() {
// Phonetic Keyboard Layout Group.
connect(ui->btnShowPrevWin, &QPushButton::toggled, [=](bool checked) {
ui->btnShowPrevWin->setText(checked ? "On" : "Off");
connect(ui->btnSuggestionPhonetic, &QPushButton::toggled, [=](bool checked) {
ui->btnSuggestionPhonetic->setText(checked ? "On" : "Off");
// Control other Preview window related settings.
ui->btnClosePrevWin->setEnabled(checked);
ui->cmbOrientation->setEnabled(checked);
ui->btnIncludeEnglishPrevWin->setEnabled(checked);
ui->btnACUpdate->setEnabled(checked);
});
connect(ui->btnClosePrevWin, &QPushButton::toggled, [=](bool checked) {
ui->btnClosePrevWin->setText(checked ? "On" : "Off");
connect(ui->btnEnterClosePW, &QPushButton::toggled, [=](bool checked) {
ui->btnEnterClosePW->setText(checked ? "On" : "Off");
});
connect(ui->btnIncludeEnglishPrevWin, &QPushButton::toggled, [=](bool checked) {
ui->btnIncludeEnglishPrevWin->setText(checked ? "On" : "Off");
Expand All @@ -60,8 +57,8 @@ void SettingsDialog::implementSignals() {
});

// Fixed Keyboard Layout Group.
connect(ui->btnShowPrevWinFixed, &QPushButton::toggled, [=](bool checked) {
ui->btnShowPrevWinFixed->setText(checked ? "On" : "Off");
connect(ui->btnSuggestionFixed, &QPushButton::toggled, [=](bool checked) {
ui->btnSuggestionFixed->setText(checked ? "On" : "Off");
});
connect(ui->btnAutoVowel, &QPushButton::toggled, [=](bool checked) {
ui->btnAutoVowel->setText(checked ? "On" : "Off");
Expand All @@ -87,13 +84,13 @@ void SettingsDialog::implementSignals() {

void SettingsDialog::updateSettings() {
// Phonetic Keyboard Layout Group.
ui->btnClosePrevWin->setChecked(gSettings->getEnterKeyClosesPrevWin());
ui->btnShowPrevWin->setChecked(gSettings->getShowCWPhonetic());
ui->btnEnterClosePW->setChecked(gSettings->getEnterKeyClosesPrevWin());
ui->btnSuggestionPhonetic->setChecked(gSettings->getShowCWPhonetic());
ui->cmbOrientation->setCurrentIndex(gSettings->getCandidateWinHorizontal() ? 0 : 1);
ui->btnIncludeEnglishPrevWin->setChecked(gSettings->getIncludeEnglishPrevWin());

// Fixed Keyboard Layout Group.
ui->btnShowPrevWinFixed->setChecked(gSettings->getShowPrevWinFixed());
ui->btnSuggestionFixed->setChecked(gSettings->getShowPrevWinFixed());
ui->btnAutoVowel->setChecked(gSettings->getAutoVowelFormFixed());
ui->btnAutoChandra->setChecked(gSettings->getAutoChandraPosFixed());
ui->btnOldReph->setChecked(gSettings->getOldReph());
Expand All @@ -105,13 +102,13 @@ void SettingsDialog::updateSettings() {

void SettingsDialog::on_buttonBox_accepted() {
// Phonetic Keyboard Layout Group.
gSettings->setEnterKeyClosesPrevWin(ui->btnClosePrevWin->isChecked());
gSettings->setShowCWPhonetic(ui->btnShowPrevWin->isChecked());
gSettings->setEnterKeyClosesPrevWin(ui->btnEnterClosePW->isChecked());
gSettings->setShowCWPhonetic(ui->btnSuggestionPhonetic->isChecked());
gSettings->setCandidateWinHorizontal((ui->cmbOrientation->currentIndex() == 0));
gSettings->setIncludeEnglishPrevWin(ui->btnIncludeEnglishPrevWin->isChecked());

// Fixed Keyboard Layout Group.
gSettings->setShowPrevWinFixed(ui->btnShowPrevWinFixed->isChecked());
gSettings->setShowPrevWinFixed(ui->btnSuggestionFixed->isChecked());
gSettings->setAutoVowelFormFixed(ui->btnAutoVowel->isChecked());
gSettings->setAutoChandraPosFixed(ui->btnAutoChandra->isChecked());
gSettings->setOldReph(ui->btnOldReph->isChecked());
Expand Down
Loading