Subversion Repositories Projects

Rev

Rev 674 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
674 KeyOz 1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
#include <QSettings>
20
#include <QDir>
21
 
22
#include "cSettings.h"
23
 
24
cSettings::cSettings()
25
{
26
    Settings_ID = 1;
27
 
28
    read_Settings();
29
}
30
 
31
void cSettings::read_DebugLabels(int ID)
32
{
33
    QBitArray Def_View;
34
    Def_View.fill(true,MAX_DebugData);
35
 
36
    QString Hardware = HardwareType[ID];
37
 
38
    QSettings Setting("QMK", "Debug-Labels");
39
 
40
    Setting.beginGroup("Debug-Labels-" + Hardware);
41
 
42
        DebugData.Version  = Setting.value(("Version"), "0").toString();
43
        for (int a=0; a<MAX_DebugData; a++)
44
        {
45
            DebugData.Label[a]  = Setting.value(("Label_" + QString("%1").arg(a)), "-" + DEF_DebugNames[a]).toString();
46
        }
47
        DebugData.Show_Plotter = Setting.value("Show_Plotter", QBitArray(Def_View)).value<QBitArray>();
48
 
49
    Setting.endGroup();
50
}
51
 
52
void cSettings::write_DebugLabels(int ID)
53
{
54
    QString Hardware = HardwareType[ID];
55
 
56
    QSettings Setting("QMK", "Debug-Labels");
57
 
58
    Setting.beginGroup("Debug-Labels-" + Hardware);
59
 
60
        Setting.setValue("Version", DebugData.Version);
61
        for (int a=0; a<MAX_DebugData; a++)
62
        {
63
            Setting.setValue("Label_" + QString("%1").arg(a), DebugData.Label[a]);
64
        }
65
        Setting.setValue("Show_Plotter", QBitArray(DebugData.Show_Plotter));
66
 
67
    Setting.endGroup();
68
}
69
 
70
void cSettings::read_Settings()
71
{
72
    QSettings Setting("QMK", QA_NAME);
73
 
74
    Setting.beginGroup("Global");
75
        Settings_ID  = Setting.value("Settings ID", Settings_ID).toInt();
76
    Setting.endGroup();
77
 
78
    Setting.beginGroup("DATA");
750 KeyOz 79
//        DATA.Debug_Intervall  = Setting.value("Debug-Intervall", 500).toInt();
674 KeyOz 80
        DATA.Plotter_Count    = Setting.value("Plotter-Count", 100).toInt();
81
    Setting.endGroup();
82
 
83
    Setting.beginGroup("GUI");
84
        GUI.isMax       = Setting.value("IsMax",false).toBool();
85
        GUI.Size        = Setting.value("Size", QSize(700, 300)).toSize();
86
        GUI.Point       = Setting.value("Point",QPoint(1,1)).toPoint();
87
    Setting.endGroup();
750 KeyOz 88
/*
674 KeyOz 89
    Setting.beginGroup("SERVER");
90
        SERVER.Password = Setting.value("Password", QString("")).toString();
91
        SERVER.IP_MAX = Setting.value("IP_MAX", 1).toInt();
92
        SERVER.IP_ID  = Setting.value("IP_ID",  0).toInt();
93
 
94
        for (int z = 0; z < SERVER.IP_MAX; z++)
95
        {
96
            SERVER.IP[z] = Setting.value("IP_" + QString("%1").arg(z), QString("127.0.0.1:64400")).toString();
97
        }
98
    Setting.endGroup();
750 KeyOz 99
*/
674 KeyOz 100
}
101
 
102
void cSettings::write_Settings()
103
{
104
    QSettings Setting("QMK", QA_NAME);
105
 
106
    Setting.beginGroup("Global");
107
        Setting.setValue("Settings ID", Settings_ID);
108
    Setting.endGroup();
109
 
110
    Setting.beginGroup("DATA");
111
        Setting.setValue("Plotter-Count", DATA.Plotter_Count);
750 KeyOz 112
//        Setting.setValue("Debug-Intervall", DATA.Debug_Intervall);
674 KeyOz 113
    Setting.endGroup();
114
 
115
    Setting.beginGroup("GUI");
116
        Setting.setValue("IsMax", GUI.isMax);
117
        Setting.setValue("Size", GUI.Size);
118
        Setting.setValue("Point", GUI.Point);
119
    Setting.endGroup();
750 KeyOz 120
/*
674 KeyOz 121
    Setting.beginGroup("SERVER");
122
        Setting.setValue("Password", SERVER.Password);
123
        Setting.setValue("IP_MAX", SERVER.IP_MAX);
124
        Setting.setValue("IP_ID",  SERVER.IP_ID);
125
 
126
        for (int z = 0; z < SERVER.IP_MAX; z++)
127
        {
128
            Setting.setValue("IP_" + QString("%1").arg(z), SERVER.IP[z]);
129
        }
130
    Setting.endGroup();
750 KeyOz 131
*/
674 KeyOz 132
}
133
 
134