Subversion Repositories public

Rev

Rev 283 | Details | Compare with Previous | Last modification | View Log | RSS feed

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