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

Diff Legend

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