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