SVN checkout 11/12/2010
[monav:monav.git] / plugins / osmrenderer / brsettingsdialog.cpp
1 /*
2 Copyright 2010  Christian Vetter veaac.fdirct@gmail.com
3
4 This file is part of MoNav.
5
6 MoNav is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MoNav is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with MoNav.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "brsettingsdialog.h"
21 #include "ui_brsettingsdialog.h"
22 #include <QSettings>
23
24 BRSettingsDialog::BRSettingsDialog(QWidget *parent) :
25     QDialog(parent),
26     ui(new Ui::BRSettingsDialog)
27 {
28         ui->setupUi(this);
29          QSettings settings( "MoNavClient" );
30          settings.beginGroup( "Renderer Base" );
31          ui->antiAliasing->setChecked( settings.value( "antiAliasing", true ).toBool() );
32          ui->hqAntiAliasing->setChecked( settings.value( "hqAntiAliasing", false ).toBool() );
33          ui->filtering->setChecked( settings.value( "filtering", false ).toBool() );
34          ui->cacheSize->setValue( settings.value( "cacheSize", 1 ).toInt() );
35 }
36
37 BRSettingsDialog::~BRSettingsDialog()
38 {
39         QSettings settings( "MoNavClient" );
40         settings.beginGroup( "Renderer Base" );
41         settings.setValue( "antiAliasing", ui->antiAliasing->isChecked() );
42         settings.setValue( "hqAntiAliasing", ui->hqAntiAliasing->isChecked() );
43         settings.setValue( "filtering", ui->filtering->isChecked() );
44         settings.setValue( "cacheSize", ui->cacheSize->value() );
45         delete ui;
46 }
47
48 bool BRSettingsDialog::getSettings( Settings* settings )
49 {
50         if ( settings == NULL )
51                 return false;
52         settings->antiAliasing = ui->antiAliasing->isChecked();
53         settings->hqAntiAliasing = ui->hqAntiAliasing->isChecked();
54         settings->filter = ui->filtering->isChecked();
55         settings->cacheSize = ui->cacheSize->value();
56         return true;
57 }