Subversion Repositories public

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/***************************************************************************
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
 *   andreas@theosys.at                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation version 3 of the License.                *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


#include <ksimpleconfig.h>
#include <knuminput.h>
#include <kcombobox.h>
#include <kurlrequester.h>
#include <klineedit.h>
#include <qdir.h>
#include <qcheckbox.h>
#include "coordinateswidget.h"
#include <iostream>

using std::cout;
using std::endl;

coordinatesWidget::coordinatesWidget(QWidget* parent, const char* name, bool modal, WFlags fl)
                : coordinatesWidgetBase(parent, name, modal, fl)
{
QDir dir = QDir::home();
QString path = dir.absPath();

        // Load the config parameters
        KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"), true);
        cfg->setGroup(QString("ImageCoords"));
        edLeftLon->setValue (cfg->readDoubleNumEntry("LeftLon", 0.0));
        edLeftLat->setValue (cfg->readDoubleNumEntry("LeftLat", 0.0));
        edRightLon->setValue (cfg->readDoubleNumEntry("RightLon", 0.0));
        edRightLat->setValue (cfg->readDoubleNumEntry("RightLat", 0.0));
        cbDate->setCurrentItem(cfg->readNumEntry("SRS", 0));
        delete cfg;
}

coordinatesWidget::~coordinatesWidget()
{
}

/*$SPECIALIZATION$*/
void coordinatesWidget::bpCancelSlot()
{
        done(QDialog::Rejected);
}

void coordinatesWidget::pbSaveSlot()
{
        KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"));
        cfg->setGroup(QString("ImageCoords"));
        // Put the data into the config file
        cfg->writeEntry("LeftLon", edLeftLon->value());
        cfg->writeEntry("LeftLat", edLeftLat->value());
        cfg->writeEntry("RightLon", edRightLon->value());
        cfg->writeEntry("RightLat", edRightLat->value());
        cfg->writeEntry("SRS", cbDate->currentItem());
        cfg->sync();
        delete cfg;
        done(QDialog::Accepted);
}



#include "coordinateswidget.moc"