ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/preferences.cpp
(Generate patch)

Comparing:
Vago/trunk/Vago/preferences.cpp (file contents), Revision 771 by s10k, Sun Mar 31 19:02:16 2013 UTC vs.
s10k/Vago/preferences.cpp (file contents), Revision 1092 by s10k, Sat Dec 30 13:43:28 2017 UTC

# Line 12 | Line 12 | Preferences::Preferences(QWidget *parent
12  
13      ui->leAEfolder->setText(this->vagoSettings->value("AeFolder").toString());
14      ui->leWorkspace->setText(this->vagoSettings->value("Workspace").toString());
15 +    ui->leWidth->setText(this->vagoSettings->value("WindowWidth").toString());
16 +    ui->leHeight->setText(this->vagoSettings->value("WindowHeight").toString());
17      ui->cbOniWindow->setChecked(this->vagoSettings->value("OniWindow").toBool());
18      ui->cbSeparate->setChecked(this->vagoSettings->value("SeparateInWorkspace").toBool());
19 <    ui->cbVagoExit->setChecked(this->vagoSettings->value("ConfirmExit").toBool());
19 >    ui->cbAskSaveProject->setChecked(this->vagoSettings->value("AskSaveProject").toBool());
20 >    ui->cbAskOpenLastProject->setChecked(this->vagoSettings->value("AskToOpenLastProject").toBool());
21 > #ifdef Q_OS_MAC
22 >    ui->cbUseYesAsDefaultWhenRemovingItems->setChecked(this->vagoSettings->value("useYesAsDefaultWhenRemovingItems").toBool());
23 > #endif
24 >
25 > #ifdef Q_OS_WIN
26 >    ui->cbUseYesAsDefaultWhenRemovingItems->hide(); // don't display this mac os only option in windows
27 > #endif
28  
29   }
30  
# Line 23 | Line 33 | Preferences::~Preferences()
33      delete ui;
34   }
35  
36 < void Preferences::on_buttonBox_accepted()
37 < {
36 > // Need to override to do the verification
37 > // http://stackoverflow.com/questions/3261676/how-to-make-qdialogbuttonbox-not-close-its-parent-qdialog
38 > void Preferences::accept (){
39 >    QStringList options;
40 >    QRect screenRes = Util::getScreenResolution();
41 >
42 >    options << ui->leAEfolder->text() << ui->leWorkspace->text() << ui->leWidth->text() << ui->leHeight->text();
43 >
44 >    if(Util::checkEmptySpaces(options)){
45 >        Util::showErrorPopUp("Setting not saved! There are empty settings.");
46 >        return;
47 >    }
48 >
49 >    if(Util::checkIfIntegers(QStringList() << ui->leWidth->text() << ui->leHeight->text() )){
50 >        Util::showErrorPopUp("Setting not saved! Width and Height must be numbers.");
51 >        return;
52 >    }
53 >
54 >    if(ui->leWidth->text().toInt() > screenRes.width() || ui->leHeight->text().toInt() > screenRes.height()){
55 >        Util::showErrorPopUp("Setting not saved! Width or Height specified are greater than actual screen resolution.");
56 >        return;
57 >    }
58 >
59 >    if(ui->leWidth->text().toInt() <= 0  || ui->leHeight->text().toInt() <= 0 ){
60 >        Util::showErrorPopUp("Settings not saved! Width and Height must be greater than 0.");
61 >        return;
62 >    }
63 >
64      this->vagoSettings->setValue("AeFolder",ui->leAEfolder->text());
65      this->vagoSettings->setValue("Workspace",ui->leWorkspace->text());
66 +    this->vagoSettings->setValue("WindowWidth",ui->leWidth->text());
67 +    this->vagoSettings->setValue("WindowHeight",ui->leHeight->text());
68      this->vagoSettings->setValue("OniWindow",ui->cbOniWindow->isChecked());
69      this->vagoSettings->setValue("SeparateInWorkspace",ui->cbSeparate->isChecked());
70 <    this->vagoSettings->setValue("ConfirmExit",ui->cbVagoExit->isChecked());
70 >    this->vagoSettings->setValue("AskSaveProject",ui->cbAskSaveProject->isChecked());
71 >    this->vagoSettings->setValue("AskToOpenLastProject",ui->cbAskOpenLastProject->isChecked());
72 > #ifdef Q_OS_MAC
73 >    this->vagoSettings->setValue("useYesAsDefaultWhenRemovingItems",ui->cbUseYesAsDefaultWhenRemovingItems->isChecked());
74 > #endif
75  
76      Util::showPopUp("You need to restart the application to all changes take effect.");
77 +
78 +    QDialog::accept();
79   }
80  
81   void Preferences::on_pbChooseWorkspace_clicked()

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)