Blame |
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 <QCoreApplication>
#include <QSettings>
#include <QDir>
#include "cSettings.h"
cSettings::cSettings()
{
}
void cSettings::read_Settings()
{
QBitArray Def_TabViews;
Def_TabViews.fill(true, 6);
QDir Dir;
QString HomeDir = (QString(Dir.homePath() + "/"));
QSettings Setting("KeyOz-Net", "QMK-Groundstation");
Setting.beginGroup("Port");
TTY.Port = Setting.value("TTY", QString("/dev/ttyUSB0")).toString();
Setting.endGroup();
Setting.beginGroup("GUI");
GUI.isMax = Setting.value("IsMax",false).toBool();
GUI.Size = Setting.value("Size", QSize(700, 300)).toSize();
GUI.Point = Setting.value("Point",QPoint(1,1)).toPoint();
GUI.TabViews = Setting.value("TabViews", QBitArray(Def_TabViews)).value<QBitArray>();
Setting.endGroup();
Setting.beginGroup("Dirs");
DIR.Logging = Setting.value("LogDir", HomeDir).toString();
DIR.Parameter = Setting.value("ParDir", HomeDir).toString();
Setting.endGroup();
}
void cSettings::write_Settings()
{
QSettings Setting("KeyOz-Net", "QMK-Groundstation");
Setting.beginGroup("Port");
// Setting.setValue("TTY", le_Port->text());
Setting.endGroup();
Setting.beginGroup("Dirs");
Setting.setValue("LogDir", DIR.Logging);
Setting.setValue("ParDir", DIR.Parameter);
Setting.endGroup();
Setting.beginGroup("GUI");
// Setting.setValue("IsMax", isMaximized());
// Setting.setValue("Size", size());
// Setting.setValue("Point", pos());
Setting.endGroup();
}
void cSettings::read_Settings_FC()
{
QDir Dir;
QString HomeDir = (QString(Dir.homePath() + "/"));
QSettings Setting("KeyOz-Net", "QMK-Groundstation");
Setting.beginGroup("AnalogWerte-FC");
for (int a = 0; a < MaxAnalog; a++)
{
Analog[a].Name = Setting.value(("Analog_" + QString("%1").arg(a)), Def_AnalogNames[a]).toString();
Analog[a].Plot = Setting.value(("Analog_" + QString("%1").arg(a) + "_Plot"), Def_Plot_Show[a]).toBool();
Analog[a].Color = Setting.value(("Analog_" + QString("%1").arg(a) + "_Color"), QColor(Def_Colors[a])).value<QColor>();
Analog[a].Log = Setting.value(("Analog_" + QString("%1").arg(a) + "_Log"), Def_Log[a]).toBool();
}
Setting.endGroup();
}
void cSettings::write_Settings_FC()
{
QSettings Setting("KeyOz-Net", "QMK-Groundstation");
Setting.beginGroup("AnalogWerte-FC");
for (int a=0; a<MaxAnalog; a++)
{
Setting.setValue("Analog_" + QString("%1").arg(a), Analog[a].Name);
Setting.setValue("Analog_" + QString("%1").arg(a) + "_Plot", Analog[a].Plot);
Setting.setValue("Analog_" + QString("%1").arg(a) + "_Log", Analog[a].Log);
Setting.setValue("Analog_" + QString("%1").arg(a) + "_Color", QColor(Analog[a].Color));
}
Setting.endGroup();
}
cSettings::~cSettings()
{
}