Subversion Repositories public

Rev

Rev 158 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 158 Rev 232
Line 1... Line 1...
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
2
 *   Copyright (C) 2007 - 2009 by Andreas Theofilu                         *
3
 *   andreas@theosys.at                                                    *
3
 *   andreas@theosys.at                                                    *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
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  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
7
 *   the Free Software Foundation version 3 of the License.                *
Line 15... Line 15...
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
 
19
 
20
 
20
/*
-
 
21
 * Ported to KDE4 on Jul. 7 2009 by Andreas Theofilu.
-
 
22
 */
21
#include <ksimpleconfig.h>
23
#include <KConfig>
22
#include <knuminput.h>
24
#include <knuminput.h>
23
#include <kcombobox.h>
25
#include <kcombobox.h>
24
#include <kurlrequester.h>
26
#include <kurlrequester.h>
25
#include <klineedit.h>
27
#include <klineedit.h>
26
#include <qdir.h>
28
#include <qdir.h>
27
#include <qcheckbox.h>
29
#include <qcheckbox.h>
28
#include "coordinateswidget.h"
-
 
29
#include <iostream>
30
#include <iostream>
30
 
31
 
-
 
32
#include "coordinateswidget.h"
-
 
33
 
31
using std::cout;
34
using std::cout;
32
using std::endl;
35
using std::endl;
33
 
36
 
34
coordinatesWidget::coordinatesWidget(QWidget* parent, const char* name, bool modal, WFlags fl)
37
coordinatesWidget::coordinatesWidget(QWidget* parent, Qt::WFlags fl)
35
		: coordinatesWidgetBase(parent, name, modal, fl)
38
		: QDialog(parent, fl), Ui::coordinatesWidgetBase()
36
{
39
{
37
QDir dir = QDir::home();
40
QDir dir = QDir::home();
38
QString path = dir.absPath();
41
QString path = dir.absolutePath();
39
 
42
 
-
 
43
	setupUi (this);
40
	// Load the config parameters
44
	// Load the config parameters
41
	KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"), true);
45
	KConfig cfg(QString("sportwatcher.rc"), KConfig::SimpleConfig);
42
	cfg->setGroup(QString("ImageCoords"));
46
	KConfigGroup ic (&cfg, "ImageCoords");
43
	edLeftLon->setValue (cfg->readDoubleNumEntry("LeftLon", 0.0));
47
	edLeftLon->setValue (ic.readEntry("LeftLon", 0.0));
44
	edLeftLat->setValue (cfg->readDoubleNumEntry("LeftLat", 0.0));
48
	edLeftLat->setValue (ic.readEntry("LeftLat", 0.0));
45
	edRightLon->setValue (cfg->readDoubleNumEntry("RightLon", 0.0));
49
	edRightLon->setValue (ic.readEntry("RightLon", 0.0));
46
	edRightLat->setValue (cfg->readDoubleNumEntry("RightLat", 0.0));
50
	edRightLat->setValue (ic.readEntry("RightLat", 0.0));
47
	cbDate->setCurrentItem(cfg->readNumEntry("SRS", 0));
51
	cbDate->setCurrentIndex(ic.readEntry("SRS", 0));
48
	delete cfg;
-
 
49
}
52
}
50
 
53
 
51
coordinatesWidget::~coordinatesWidget()
54
coordinatesWidget::~coordinatesWidget()
52
{
55
{
53
}
56
}
Line 58... Line 61...
58
	done(QDialog::Rejected);
61
	done(QDialog::Rejected);
59
}
62
}
60
 
63
 
61
void coordinatesWidget::pbSaveSlot()
64
void coordinatesWidget::pbSaveSlot()
62
{
65
{
63
	KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"));
66
	KConfig cfg(QString("sportwatcher.rc"), KConfig::SimpleConfig);
64
	cfg->setGroup(QString("ImageCoords"));
67
	KConfigGroup ic (&cfg, "ImageCoords");
65
	// Put the data into the config file
68
	// Put the data into the config file
66
	cfg->writeEntry("LeftLon", edLeftLon->value());
69
	ic.writeEntry("LeftLon", edLeftLon->value());
67
	cfg->writeEntry("LeftLat", edLeftLat->value());
70
	ic.writeEntry("LeftLat", edLeftLat->value());
68
	cfg->writeEntry("RightLon", edRightLon->value());
71
	ic.writeEntry("RightLon", edRightLon->value());
69
	cfg->writeEntry("RightLat", edRightLat->value());
72
	ic.writeEntry("RightLat", edRightLat->value());
70
	cfg->writeEntry("SRS", cbDate->currentItem());
73
	ic.writeEntry("SRS", cbDate->currentIndex());
71
	cfg->sync();
74
	ic.sync();
72
	delete cfg;
-
 
73
	done(QDialog::Accepted);
75
	done(QDialog::Accepted);
74
}
76
}
75
 
77
 
76
 
78
 
77
 
79