158 |
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 |
|
|
|
21 |
#include <ksimpleconfig.h>
|
|
|
22 |
#include <knuminput.h>
|
|
|
23 |
#include <kcombobox.h>
|
|
|
24 |
#include <kurlrequester.h>
|
|
|
25 |
#include <klineedit.h>
|
|
|
26 |
#include <qdir.h>
|
|
|
27 |
#include <qcheckbox.h>
|
|
|
28 |
#include "coordinateswidget.h"
|
|
|
29 |
#include <iostream>
|
|
|
30 |
|
|
|
31 |
using std::cout;
|
|
|
32 |
using std::endl;
|
|
|
33 |
|
|
|
34 |
coordinatesWidget::coordinatesWidget(QWidget* parent, const char* name, bool modal, WFlags fl)
|
|
|
35 |
: coordinatesWidgetBase(parent, name, modal, fl)
|
|
|
36 |
{
|
|
|
37 |
QDir dir = QDir::home();
|
|
|
38 |
QString path = dir.absPath();
|
|
|
39 |
|
|
|
40 |
// Load the config parameters
|
|
|
41 |
KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"), true);
|
|
|
42 |
cfg->setGroup(QString("ImageCoords"));
|
|
|
43 |
edLeftLon->setValue (cfg->readDoubleNumEntry("LeftLon", 0.0));
|
|
|
44 |
edLeftLat->setValue (cfg->readDoubleNumEntry("LeftLat", 0.0));
|
|
|
45 |
edRightLon->setValue (cfg->readDoubleNumEntry("RightLon", 0.0));
|
|
|
46 |
edRightLat->setValue (cfg->readDoubleNumEntry("RightLat", 0.0));
|
|
|
47 |
cbDate->setCurrentItem(cfg->readNumEntry("SRS", 0));
|
|
|
48 |
delete cfg;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
coordinatesWidget::~coordinatesWidget()
|
|
|
52 |
{
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
/*$SPECIALIZATION$*/
|
|
|
56 |
void coordinatesWidget::bpCancelSlot()
|
|
|
57 |
{
|
|
|
58 |
done(QDialog::Rejected);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
void coordinatesWidget::pbSaveSlot()
|
|
|
62 |
{
|
|
|
63 |
KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"));
|
|
|
64 |
cfg->setGroup(QString("ImageCoords"));
|
|
|
65 |
// Put the data into the config file
|
|
|
66 |
cfg->writeEntry("LeftLon", edLeftLon->value());
|
|
|
67 |
cfg->writeEntry("LeftLat", edLeftLat->value());
|
|
|
68 |
cfg->writeEntry("RightLon", edRightLon->value());
|
|
|
69 |
cfg->writeEntry("RightLat", edRightLat->value());
|
|
|
70 |
cfg->writeEntry("SRS", cbDate->currentItem());
|
|
|
71 |
cfg->sync();
|
|
|
72 |
delete cfg;
|
|
|
73 |
done(QDialog::Accepted);
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
#include "coordinateswidget.moc"
|
|
|
79 |
|