Subversion Repositories Projects

Rev

Rev 674 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/***************************************************************************
 *   Copyright (C) 2008 by Manuel Schrape                                  *
 *   manuel.schrape@gmx.de                                                 *
 *                                                                         *
 *   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; either version 2 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 <QSettings>
#include <QDir>

#include "cSettings.h"

cSettings::cSettings()
{
    Settings_ID = 1;

    read_Settings();
}

void cSettings::read_Settings()
{
    QSettings Setting("QMK", QA_NAME);

    Setting.beginGroup("Global");
        Settings_ID  = Setting.value("Settings ID", Settings_ID).toInt();
    Setting.endGroup();

    Setting.beginGroup("GUI");
        GUI.isMax       = Setting.value("IsMax",false).toBool();
        GUI.Size        = Setting.value("Size", QSize(500, 350)).toSize();
        GUI.Point       = Setting.value("Point",QPoint(1,1)).toPoint();
        GUI.Toolbar     = Setting.value("Toolbar",true).toBool();
    Setting.endGroup();

    Setting.beginGroup("CONFIG");
        CONFIG.cb_CenterPos   = Setting.value("cb_CenterPos",true).toBool();
        CONFIG.cb_ShowRoute   = Setting.value("cb_ShowRoute",true).toBool();
        CONFIG.cb_ShowWPs     = Setting.value("cb_ShowWPs",true).toBool();
        CONFIG.cb_Goto        = Setting.value("cb_Goto",true).toBool();
    Setting.endGroup();

    Setting.beginGroup("Navi");
        NAVI.StayTime  = Setting.value("StayTime", 500).toInt();
        NAVI.Latitude  = Setting.value("Latitude", 52.5).toDouble();
        NAVI.Longitude = Setting.value("Longitude", 13.5).toDouble();
    Setting.endGroup();
}

void cSettings::write_Settings()
{
    QSettings Setting("QMK", QA_NAME);

    Setting.beginGroup("Global");
        Setting.setValue("Settings ID", Settings_ID);
    Setting.endGroup();

    Setting.beginGroup("GUI");
        Setting.setValue("IsMax", GUI.isMax);
        Setting.setValue("Size", GUI.Size);
        Setting.setValue("Point", GUI.Point);
        Setting.setValue("Toolbar", GUI.Toolbar);
    Setting.endGroup();

    Setting.beginGroup("CONFIG");
        Setting.setValue("cb_CenterPos", CONFIG.cb_CenterPos);
        Setting.setValue("cb_ShowRoute", CONFIG.cb_ShowRoute);
        Setting.setValue("cb_ShowWPs",   CONFIG.cb_ShowWPs);
        Setting.setValue("cb_Goto",      CONFIG.cb_Goto);
    Setting.endGroup();

    Setting.beginGroup("NAVI");
        Setting.setValue("StayTime",  NAVI.StayTime);
        Setting.setValue("Latitude",  NAVI.Latitude);
        Setting.setValue("Longitude", NAVI.Longitude);
    Setting.endGroup();

}