Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
159 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 "dlg_Preferences.h"
20
 
21
dlg_Preferences::dlg_Preferences(QWidget *parent) : QDialog(parent)
22
{
23
    setupUi(this);
163 KeyOz 24
    connect(pb_DIR_CVS,   SIGNAL(clicked()), this, SLOT(slot_DIR_CVS()));
25
    connect(pb_DIR_SET,   SIGNAL(clicked()), this, SLOT(slot_DIR_SET()));
159 KeyOz 26
}
27
 
163 KeyOz 28
void dlg_Preferences::set_Settings(cSettings *Set)
29
{
30
    Settings = Set;
159 KeyOz 31
 
163 KeyOz 32
    le_DIR_CVS->setText(Settings->DIR.Logging);
33
    le_DIR_SET->setText(Settings->DIR.Parameter);
166 KeyOz 34
    le_TTY->setText(Settings->TTY.Port);
35
    sp_Plotter_Count->setValue(Settings->Data.Plotter_Count);
36
    sp_Debug_Fast->setValue(Settings->Data.Debug_Fast);
37
    sp_Debug_Slow->setValue(Settings->Data.Debug_Slow);
199 KeyOz 38
    sp_Debug_Off->setValue(Settings->Data.Debug_Off);
39
    sp_Navi_Fast->setValue(Settings->Data.Navi_Fast);
40
    sp_Navi_Slow->setValue(Settings->Data.Navi_Slow);
41
    sp_Navi_Off->setValue(Settings->Data.Navi_Off);
42
    le_ServerPort->setText(Settings->Server.Port);
43
    cb_StartServer->setChecked(Settings->Server.StartServer);
44
    cb_ToGround->setChecked(Settings->Server.ToGround);
227 KeyOz 45
    le_Login->setText(Settings->Server.QMKS_Login);
46
    le_Password->setText(Settings->Server.QMKS_Password);
163 KeyOz 47
}
48
 
49
cSettings *dlg_Preferences::get_Settings()
50
{
227 KeyOz 51
    Settings->TTY.Port             = le_TTY->text();
52
    Settings->Data.Plotter_Count   = sp_Plotter_Count->value();
53
    Settings->Data.Debug_Fast      = sp_Debug_Fast->value();
54
    Settings->Data.Debug_Slow      = sp_Debug_Slow->value();
55
    Settings->Data.Debug_Off       = sp_Debug_Off->value();
56
    Settings->Data.Navi_Fast       = sp_Navi_Fast->value();
57
    Settings->Data.Navi_Slow       = sp_Navi_Slow->value();
58
    Settings->Data.Navi_Off        = sp_Navi_Off->value();
59
    Settings->Server.Port          = le_ServerPort->text();
60
    Settings->Server.StartServer   = cb_StartServer->isChecked();
61
    Settings->Server.ToGround      = cb_ToGround->isChecked();
62
    Settings->Server.QMKS_Login    = le_Login->text();
63
    Settings->Server.QMKS_Password = le_Password->text();
166 KeyOz 64
 
163 KeyOz 65
    return Settings;
66
}
67
 
68
// Configuration -> Verzeichnisse
69
/////////////////////////////////
70
void dlg_Preferences::slot_DIR_CVS()
71
{
166 KeyOz 72
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für CSV-Logdateien"), Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
163 KeyOz 73
 
74
    if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory))
75
    {
76
        Settings->DIR.Logging = directory;
77
        le_DIR_CVS->setText(Settings->DIR.Logging);
78
//        Settings->write_Settings();
79
    }
80
}
81
 
82
void dlg_Preferences::slot_DIR_SET()
83
{
166 KeyOz 84
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Settings-Dateien"), Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
163 KeyOz 85
 
86
    if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory))
87
    {
88
        Settings->DIR.Parameter = directory;
89
        le_DIR_SET->setText(Settings->DIR.Parameter);
90
//        Settings->write_Settings();
91
    }
92
 
93
}
166 KeyOz 94
 
159 KeyOz 95
dlg_Preferences::~dlg_Preferences()
96
{
97
}
98
 
99