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 897 by s10k, Wed Jan 8 11:32:55 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());
# Line 23 | Line 25 | Preferences::~Preferences()
25      delete ui;
26   }
27  
28 < void Preferences::on_buttonBox_accepted()
29 < {
28 > // Need to override to do the verification
29 > // http://stackoverflow.com/questions/3261676/how-to-make-qdialogbuttonbox-not-close-its-parent-qdialog
30 > void Preferences::accept (){
31 >    QStringList options;
32 >    QRect screenRes = Util::getScreenResolution();
33 >
34 >    options << ui->leAEfolder->text() << ui->leWorkspace->text() << ui->leWidth->text() << ui->leHeight->text();
35 >
36 >    if(Util::checkEmptySpaces(options)){
37 >        Util::showErrorPopUp("Setting not saved! There are empty settings.");
38 >        return;
39 >    }
40 >
41 >    if(Util::checkIfIntegers(QStringList() << ui->leWidth->text() << ui->leHeight->text() )){
42 >        Util::showErrorPopUp("Setting not saved! Width and Height must be numbers.");
43 >        return;
44 >    }
45 >
46 >    if(ui->leWidth->text().toInt() > screenRes.width() || ui->leHeight->text().toInt() > screenRes.height()){
47 >        Util::showErrorPopUp("Setting not saved! Width or Height specified are greater than actual screen resolution.");
48 >        return;
49 >    }
50 >
51 >    if(ui->leWidth->text().toInt() <= 0  || ui->leHeight->text().toInt() <= 0 ){
52 >        Util::showErrorPopUp("Settings not saved! Width and Height must be greater than 0.");
53 >        return;
54 >    }
55 >
56      this->vagoSettings->setValue("AeFolder",ui->leAEfolder->text());
57      this->vagoSettings->setValue("Workspace",ui->leWorkspace->text());
58 +    this->vagoSettings->setValue("WindowWidth",ui->leWidth->text());
59 +    this->vagoSettings->setValue("WindowHeight",ui->leHeight->text());
60      this->vagoSettings->setValue("OniWindow",ui->cbOniWindow->isChecked());
61      this->vagoSettings->setValue("SeparateInWorkspace",ui->cbSeparate->isChecked());
62      this->vagoSettings->setValue("ConfirmExit",ui->cbVagoExit->isChecked());
63  
64      Util::showPopUp("You need to restart the application to all changes take effect.");
65 +
66 +    QDialog::accept();
67   }
68  
69   void Preferences::on_pbChooseWorkspace_clicked()

Diff Legend

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