Subversion Repositories public

Rev

Rev 153 | Rev 283 | 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 "wmsbase.h"

wmsbase::wmsbase ( QWidget* parent, const char* name, bool modal, WFlags fl )
                : wmswidgetbase ( 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("WMS"));
        edServerURL->setURL (cfg->readEntry("ServerURL", "http://localhost/cgi-bin/mapnik"));
        edLayer->setText (cfg->readEntry("Layer"));
        cbSRS->setCurrentItem (cfg->readNumEntry("SRS", 0));
        cbCRS->setCurrentItem (cfg->readNumEntry("CRS", 0));
        edBands->setValue (cfg->readNumEntry("Bands", 3));
        cbImage->setCurrentItem (cfg->readNumEntry("Image", 2));
        cbVersion->setCurrentItem (cfg->readNumEntry("Version", 0));
        edStyles->setText (cfg->readEntry("Styles"));
        cbTile->setCurrentItem (cfg->readNumEntry("Tile", 2));
        edDepth->setValue (cfg->readNumEntry("Depth", 2));
        edOverview->setValue (cfg->readNumEntry("Overview", 10));
        chSquare->setChecked (cfg->readBoolEntry("Square", false));
        chOffline->setChecked (cfg->readBoolEntry("Offline", false));
        chAdvice->setChecked (cfg->readBoolEntry("Advice", false));
        chVerify->setChecked (cfg->readBoolEntry("Verify", true));
        edCorrX->setValue (cfg->readNumEntry("CorrX", 0));
        edCorrY->setValue (cfg->readNumEntry("CorrY", 0));
        delete cfg;
}

wmsbase::~wmsbase()
{
}

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

void wmsbase::bpSaveSlot()
{
        KSimpleConfig *cfg = new KSimpleConfig(QString("sportwatcher.rc"));
        cfg->setGroup(QString("WMS"));
        // Put the data into the config file
        cfg->writeEntry("ServerURL", edServerURL->url());
        cfg->writeEntry("Layer", edLayer->text());
        cfg->writeEntry("SRS", cbSRS->currentItem());
        cfg->writeEntry("CRS", cbCRS->currentItem());
        cfg->writeEntry("Bands", edBands->value());
        cfg->writeEntry("Image", cbImage->currentItem());
        cfg->writeEntry("Version", cbVersion->currentItem());
        cfg->writeEntry("Styles", edStyles->text());
        cfg->writeEntry("Tile", cbTile->currentItem());
        cfg->writeEntry("Depth", edDepth->value());
        cfg->writeEntry("Overview", edOverview->value());
        cfg->writeEntry("Square", chSquare->isChecked());
        cfg->writeEntry("Offline", chOffline->isChecked());
        cfg->writeEntry("Advice", chAdvice->isChecked());
        cfg->writeEntry("Verify", chVerify->isChecked());
        cfg->writeEntry("CorrX", edCorrX->value());
        cfg->writeEntry("CorrY", edCorrY->value());
        cfg->sync();
        delete cfg;
        done(QDialog::Accepted);
}



#include "wmsbase.moc"