Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 800 → Rev 801

/QMK-Groundstation/tags/QMK-Tools v1.3.0/QMK-Maps/Classes/cSettings.cpp
0,0 → 1,88
/***************************************************************************
* 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();
 
}
/QMK-Groundstation/tags/QMK-Tools v1.3.0/QMK-Maps/Classes/cSettings.h
0,0 → 1,65
/***************************************************************************
* 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. *
***************************************************************************/
#ifndef CSETTINGS_H
#define CSETTINGS_H
 
#include <QSize>
#include <QPoint>
#include <QString>
 
#include "../Defines.h"
 
struct set_GUI
{
bool isMax;
QSize Size;
QPoint Point;
bool Toolbar;
};
 
struct set_CONFIG
{
bool cb_Goto;
bool cb_ShowRoute;
bool cb_ShowWPs;
bool cb_CenterPos;
};
 
struct set_NAVI
{
int StayTime;
double Latitude;
double Longitude;
};
 
class cSettings
{
public:
cSettings();
void read_Settings();
void write_Settings();
 
int Settings_ID;
 
set_GUI GUI;
set_CONFIG CONFIG;
set_NAVI NAVI;
};
 
#endif // CSETTINGS_H