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 |
|
232 |
andreas |
29 |
wmsbase::wmsbase ( QWidget* parent, Qt::WFlags fl )
|
|
|
30 |
: QDialog(parent, fl), Ui::wmsWidgetBase ()
|
153 |
andreas |
31 |
{
|
|
|
32 |
QDir dir = QDir::home();
|
232 |
andreas |
33 |
QString path = dir.absolutePath();
|
153 |
andreas |
34 |
|
232 |
andreas |
35 |
setupUi (this);
|
153 |
andreas |
36 |
// Load the config parameters
|
232 |
andreas |
37 |
KConfig cfg (QString("sportwatcher.rc"), KConfig::SimpleConfig);
|
|
|
38 |
KConfigGroup ic (&cfg, "WMS");
|
|
|
39 |
edServerURL->setUrl (ic.readEntry("ServerURL", "http://onearth.jpl.nasa.gov/wms.cgi"));
|
|
|
40 |
edLayer->setText (ic.readEntry("Layer", QString("")));
|
|
|
41 |
cbSRS->setCurrentIndex (ic.readEntry("SRS", 0));
|
|
|
42 |
cbCRS->setCurrentIndex (ic.readEntry("CRS", 0));
|
|
|
43 |
edBands->setValue (ic.readEntry("Bands", 3));
|
|
|
44 |
cbImage->setCurrentIndex (ic.readEntry("Image", 2));
|
|
|
45 |
cbVersion->setCurrentIndex (ic.readEntry("Version", 0));
|
|
|
46 |
edStyles->setText (ic.readEntry("Styles", QString("")));
|
|
|
47 |
cbTile->setCurrentIndex (ic.readEntry("Tile", 2));
|
|
|
48 |
edDepth->setValue (ic.readEntry("Depth", 2));
|
|
|
49 |
edOverview->setValue (ic.readEntry("Overview", 10));
|
|
|
50 |
chSquare->setChecked (ic.readEntry("Square", false));
|
|
|
51 |
chOffline->setChecked (ic.readEntry("Offline", false));
|
|
|
52 |
chAdvice->setChecked (ic.readEntry("Advice", false));
|
|
|
53 |
chVerify->setChecked (ic.readEntry("Verify", true));
|
|
|
54 |
edCorrX->setValue (ic.readEntry("CorrX", 0));
|
|
|
55 |
edCorrY->setValue (ic.readEntry("CorrY", 0));
|
153 |
andreas |
56 |
}
|
|
|
57 |
|
|
|
58 |
wmsbase::~wmsbase()
|
|
|
59 |
{
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
/*$SPECIALIZATION$*/
|
|
|
63 |
void wmsbase::bpCancelSlot()
|
|
|
64 |
{
|
|
|
65 |
done(QDialog::Rejected);
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
void wmsbase::bpSaveSlot()
|
|
|
69 |
{
|
232 |
andreas |
70 |
KConfig cfg (QString("sportwatcher.rc"), KConfig::SimpleConfig);
|
|
|
71 |
KConfigGroup ic (&cfg, "WMS");
|
153 |
andreas |
72 |
// Put the data into the config file
|
232 |
andreas |
73 |
ic.writeEntry("ServerURL", edServerURL->url());
|
|
|
74 |
ic.writeEntry("Layer", edLayer->text());
|
|
|
75 |
ic.writeEntry("SRS", cbSRS->currentIndex());
|
|
|
76 |
ic.writeEntry("CRS", cbCRS->currentIndex());
|
|
|
77 |
ic.writeEntry("Bands", edBands->value());
|
|
|
78 |
ic.writeEntry("Image", cbImage->currentIndex());
|
|
|
79 |
ic.writeEntry("Version", cbVersion->currentIndex());
|
|
|
80 |
ic.writeEntry("Styles", edStyles->text());
|
|
|
81 |
ic.writeEntry("Tile", cbTile->currentIndex());
|
|
|
82 |
ic.writeEntry("Depth", edDepth->value());
|
|
|
83 |
ic.writeEntry("Overview", edOverview->value());
|
|
|
84 |
ic.writeEntry("Square", chSquare->isChecked());
|
|
|
85 |
ic.writeEntry("Offline", chOffline->isChecked());
|
|
|
86 |
ic.writeEntry("Advice", chAdvice->isChecked());
|
|
|
87 |
ic.writeEntry("Verify", chVerify->isChecked());
|
|
|
88 |
ic.writeEntry("CorrX", edCorrX->value());
|
|
|
89 |
ic.writeEntry("CorrY", edCorrY->value());
|
153 |
andreas |
90 |
done(QDialog::Accepted);
|
|
|
91 |
}
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
#include "wmsbase.moc"
|
|
|
96 |
|