153 |
andreas |
1 |
/***************************************************************************
|
|
|
2 |
* Copyright (C) 2007, 2008 by Andreas Theofilu *
|
|
|
3 |
* andreas@theosys.at *
|
|
|
4 |
* *
|
|
|
5 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
6 |
* it under the terms of the GNU General Public License as published by *
|
|
|
7 |
* the Free Software Foundation version 3 of the License. *
|
|
|
8 |
* *
|
|
|
9 |
* This program is distributed in the hope that it will be useful, *
|
|
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
12 |
* GNU General Public License for more details. *
|
|
|
13 |
* *
|
|
|
14 |
* You should have received a copy of the GNU General Public License *
|
|
|
15 |
* along with this program; if not, write to the *
|
|
|
16 |
* Free Software Foundation, Inc., *
|
|
|
17 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
18 |
***************************************************************************/
|
|
|
19 |
|
|
|
20 |
#include <ksimpleconfig.h>
|
|
|
21 |
#include <knuminput.h>
|
|
|
22 |
#include <kcombobox.h>
|
|
|
23 |
#include <kurlrequester.h>
|
|
|
24 |
#include <klineedit.h>
|
|
|
25 |
#include <qdir.h>
|
|
|
26 |
#include <qcheckbox.h>
|
|
|
27 |
#include "wmsbase.h"
|
|
|
28 |
|
|
|
29 |
wmsbase::wmsbase ( QWidget* parent, const char* name, bool modal, WFlags fl )
|
|
|
30 |
: wmswidgetbase ( parent,name, modal,fl )
|
|
|
31 |
{
|
|
|
32 |
QDir dir = QDir::home();
|
|
|
33 |
QString path = dir.absPath();
|
|
|
34 |
|
|
|
35 |
// Load the config parameters
|
|
|
36 |
|
|
|
37 |
KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"), true);
|
|
|
38 |
cfg->setGroup(QString("WMS"));
|
|
|
39 |
edServerURL->setURL (cfg->readEntry("ServerURL", "http://localhost/cgi-bin/mapnik"));
|
|
|
40 |
edLayer->setText (cfg->readEntry("Layer"));
|
|
|
41 |
cbSRS->setCurrentItem (cfg->readNumEntry("SRS", 0));
|
|
|
42 |
cbCRS->setCurrentItem (cfg->readNumEntry("CRS", 0));
|
|
|
43 |
edBands->setValue (cfg->readNumEntry("Bands", 3));
|
|
|
44 |
cbImage->setCurrentItem (cfg->readNumEntry("Image", 2));
|
|
|
45 |
cbVersion->setCurrentItem (cfg->readNumEntry("Version", 0));
|
|
|
46 |
edStyles->setText (cfg->readEntry("Styles"));
|
|
|
47 |
cbTile->setCurrentItem (cfg->readNumEntry("Tile", 2));
|
|
|
48 |
edDepth->setValue (cfg->readNumEntry("Depth", 2));
|
|
|
49 |
edOverview->setValue (cfg->readNumEntry("Overview", 10));
|
157 |
andreas |
50 |
chSquare->setChecked (cfg->readBoolEntry("Square", false));
|
153 |
andreas |
51 |
chOffline->setChecked (cfg->readBoolEntry("Offline", false));
|
|
|
52 |
chAdvice->setChecked (cfg->readBoolEntry("Advice", false));
|
|
|
53 |
chVerify->setChecked (cfg->readBoolEntry("Verify", true));
|
157 |
andreas |
54 |
edCorrX->setValue (cfg->readNumEntry("CorrX", 0));
|
|
|
55 |
edCorrY->setValue (cfg->readNumEntry("CorrY", 0));
|
153 |
andreas |
56 |
delete cfg;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
wmsbase::~wmsbase()
|
|
|
60 |
{
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/*$SPECIALIZATION$*/
|
|
|
64 |
void wmsbase::bpCancelSlot()
|
|
|
65 |
{
|
|
|
66 |
done(QDialog::Rejected);
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
void wmsbase::bpSaveSlot()
|
|
|
70 |
{
|
|
|
71 |
KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"));
|
|
|
72 |
cfg->setGroup(QString("WMS"));
|
|
|
73 |
// Put the data into the config file
|
|
|
74 |
cfg->writeEntry("ServerURL", edServerURL->url());
|
|
|
75 |
cfg->writeEntry("Layer", edLayer->text());
|
|
|
76 |
cfg->writeEntry("SRS", cbSRS->currentItem());
|
|
|
77 |
cfg->writeEntry("CRS", cbCRS->currentItem());
|
|
|
78 |
cfg->writeEntry("Bands", edBands->value());
|
|
|
79 |
cfg->writeEntry("Image", cbImage->currentItem());
|
|
|
80 |
cfg->writeEntry("Version", cbVersion->currentItem());
|
|
|
81 |
cfg->writeEntry("Styles", edStyles->text());
|
|
|
82 |
cfg->writeEntry("Tile", cbTile->currentItem());
|
|
|
83 |
cfg->writeEntry("Depth", edDepth->value());
|
|
|
84 |
cfg->writeEntry("Overview", edOverview->value());
|
157 |
andreas |
85 |
cfg->writeEntry("Square", chSquare->isChecked());
|
153 |
andreas |
86 |
cfg->writeEntry("Offline", chOffline->isChecked());
|
|
|
87 |
cfg->writeEntry("Advice", chAdvice->isChecked());
|
|
|
88 |
cfg->writeEntry("Verify", chVerify->isChecked());
|
157 |
andreas |
89 |
cfg->writeEntry("CorrX", edCorrX->value());
|
|
|
90 |
cfg->writeEntry("CorrY", edCorrY->value());
|
153 |
andreas |
91 |
cfg->sync();
|
|
|
92 |
delete cfg;
|
|
|
93 |
done(QDialog::Accepted);
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
#include "wmsbase.moc"
|
|
|
99 |
|