158 |
andreas |
1 |
/***************************************************************************
|
232 |
andreas |
2 |
* Copyright (C) 2007 - 2009 by Andreas Theofilu *
|
158 |
andreas |
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 |
|
232 |
andreas |
20 |
/*
|
|
|
21 |
* Ported to KDE4 on Jul. 7 2009 by Andreas Theofilu.
|
|
|
22 |
*/
|
|
|
23 |
#include <KConfig>
|
158 |
andreas |
24 |
#include <knuminput.h>
|
|
|
25 |
#include <kcombobox.h>
|
|
|
26 |
#include <kurlrequester.h>
|
|
|
27 |
#include <klineedit.h>
|
|
|
28 |
#include <qdir.h>
|
|
|
29 |
#include <qcheckbox.h>
|
|
|
30 |
#include <iostream>
|
|
|
31 |
|
232 |
andreas |
32 |
#include "coordinateswidget.h"
|
|
|
33 |
|
158 |
andreas |
34 |
using std::cout;
|
|
|
35 |
using std::endl;
|
|
|
36 |
|
232 |
andreas |
37 |
coordinatesWidget::coordinatesWidget(QWidget* parent, Qt::WFlags fl)
|
|
|
38 |
: QDialog(parent, fl), Ui::coordinatesWidgetBase()
|
158 |
andreas |
39 |
{
|
|
|
40 |
QDir dir = QDir::home();
|
232 |
andreas |
41 |
QString path = dir.absolutePath();
|
158 |
andreas |
42 |
|
232 |
andreas |
43 |
setupUi (this);
|
158 |
andreas |
44 |
// Load the config parameters
|
232 |
andreas |
45 |
KConfig cfg(QString("sportwatcher.rc"), KConfig::SimpleConfig);
|
|
|
46 |
KConfigGroup ic (&cfg, "ImageCoords");
|
|
|
47 |
edLeftLon->setValue (ic.readEntry("LeftLon", 0.0));
|
|
|
48 |
edLeftLat->setValue (ic.readEntry("LeftLat", 0.0));
|
|
|
49 |
edRightLon->setValue (ic.readEntry("RightLon", 0.0));
|
|
|
50 |
edRightLat->setValue (ic.readEntry("RightLat", 0.0));
|
|
|
51 |
cbDate->setCurrentIndex(ic.readEntry("SRS", 0));
|
158 |
andreas |
52 |
}
|
|
|
53 |
|
|
|
54 |
coordinatesWidget::~coordinatesWidget()
|
|
|
55 |
{
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
/*$SPECIALIZATION$*/
|
|
|
59 |
void coordinatesWidget::bpCancelSlot()
|
|
|
60 |
{
|
|
|
61 |
done(QDialog::Rejected);
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
void coordinatesWidget::pbSaveSlot()
|
|
|
65 |
{
|
232 |
andreas |
66 |
KConfig cfg(QString("sportwatcher.rc"), KConfig::SimpleConfig);
|
|
|
67 |
KConfigGroup ic (&cfg, "ImageCoords");
|
158 |
andreas |
68 |
// Put the data into the config file
|
232 |
andreas |
69 |
ic.writeEntry("LeftLon", edLeftLon->value());
|
|
|
70 |
ic.writeEntry("LeftLat", edLeftLat->value());
|
|
|
71 |
ic.writeEntry("RightLon", edRightLon->value());
|
|
|
72 |
ic.writeEntry("RightLat", edRightLat->value());
|
|
|
73 |
ic.writeEntry("SRS", cbDate->currentIndex());
|
|
|
74 |
ic.sync();
|
158 |
andreas |
75 |
done(QDialog::Accepted);
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
#include "coordinateswidget.moc"
|
|
|
81 |
|