Subversion Repositories Projects

Rev

Rev 306 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 306 Rev 361
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
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  *
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.        *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
#include "dlg_Preferences.h"
19
#include "dlg_Preferences.h"
20
 
20
 
21
dlg_Preferences::dlg_Preferences(QWidget *parent) : QDialog(parent)
21
dlg_Preferences::dlg_Preferences(QWidget *parent) : QDialog(parent)
22
{
22
{
23
    setupUi(this);
23
    setupUi(this);
24
    connect(pb_DIR_CVS,      SIGNAL(clicked()), this, SLOT(slot_DIR_CVS()));
24
    connect(pb_DIR_CVS,      SIGNAL(clicked()), this, SLOT(slot_DIR_CVS()));
25
    connect(pb_DIR_SET,      SIGNAL(clicked()), this, SLOT(slot_DIR_SET()));
25
    connect(pb_DIR_SET,      SIGNAL(clicked()), this, SLOT(slot_DIR_SET()));
26
    connect(pb_DIR_CACHE,    SIGNAL(clicked()), this, SLOT(slot_DIR_CACHE()));
26
    connect(pb_DIR_CACHE,    SIGNAL(clicked()), this, SLOT(slot_DIR_CACHE()));
27
    connect(pb_PATH_AVRDUDE, SIGNAL(clicked()), this, SLOT(slot_PATH_AVRDUDE()));
27
    connect(pb_PATH_AVRDUDE, SIGNAL(clicked()), this, SLOT(slot_PATH_AVRDUDE()));
28
}
28
}
29
 
29
 
30
void dlg_Preferences::set_Settings(cSettings *Set)
30
void dlg_Preferences::set_Settings(cSettings *Set)
31
{
31
{
32
    Settings = Set;
32
    Settings = Set;
33
 
33
 
34
    le_DIR_CVS->setText(Settings->DIR.Logging);
34
    le_DIR_CVS->setText(Settings->DIR.Logging);
35
    le_DIR_SET->setText(Settings->DIR.Parameter);
35
    le_DIR_SET->setText(Settings->DIR.Parameter);
36
    le_DIR_CACHE->setText(Settings->DIR.Cache);
36
    le_DIR_CACHE->setText(Settings->DIR.Cache);
37
    le_PATH_AVRDUDE->setText(Settings->DIR.AVRDUDE);
37
    le_PATH_AVRDUDE->setText(Settings->DIR.AVRDUDE);
38
    le_TTY->setText(Settings->TTY.Port);
38
    le_TTY->setText(Settings->TTY.Port);
39
    sp_Plotter_Count->setValue(Settings->Data.Plotter_Count);
39
    sp_Plotter_Count->setValue(Settings->Data.Plotter_Count);
40
    sp_Debug_Fast->setValue(Settings->Data.Debug_Fast);
40
    sp_Debug_Fast->setValue(Settings->Data.Debug_Fast);
41
    sp_Debug_Slow->setValue(Settings->Data.Debug_Slow);
41
    sp_Debug_Slow->setValue(Settings->Data.Debug_Slow);
42
    sp_Debug_Off->setValue(Settings->Data.Debug_Off);
42
    sp_Debug_Off->setValue(Settings->Data.Debug_Off);
43
    sp_Navi_Fast->setValue(Settings->Data.Navi_Fast);
43
    sp_Navi_Fast->setValue(Settings->Data.Navi_Fast);
44
    sp_Navi_Slow->setValue(Settings->Data.Navi_Slow);
44
    sp_Navi_Slow->setValue(Settings->Data.Navi_Slow);
45
    sp_Navi_Off->setValue(Settings->Data.Navi_Off);
45
    sp_Navi_Off->setValue(Settings->Data.Navi_Off);
46
    le_ServerPort->setText(Settings->Server.Port);
46
    le_ServerPort->setText(Settings->Server.Port);
47
    cb_StartServer->setChecked(Settings->Server.StartServer);
47
    cb_StartServer->setChecked(Settings->Server.StartServer);
48
    cb_ToGround->setChecked(Settings->Server.ToGround);
48
    cb_ToGround->setChecked(Settings->Server.ToGround);
49
    le_Login->setText(Settings->Server.QMKS_Login);
49
    le_Login->setText(Settings->Server.QMKS_Login);
50
    le_Password->setText(Settings->Server.QMKS_Password);
50
    le_Password->setText(Settings->Server.QMKS_Password);
51
    le_QMKS_Host->setText(Settings->Server.QMKS_Host);
51
    le_QMKS_Host->setText(Settings->Server.QMKS_Host);
52
    le_QMKS_Port->setText(Settings->Server.QMKS_Port);
52
    le_QMKS_Port->setText(Settings->Server.QMKS_Port);
53
}
53
}
54
 
54
 
55
cSettings *dlg_Preferences::get_Settings()
55
cSettings *dlg_Preferences::get_Settings()
56
{
56
{
57
    Settings->TTY.Port             = le_TTY->text();
57
    Settings->TTY.Port             = le_TTY->text();
58
    Settings->Data.Plotter_Count   = sp_Plotter_Count->value();
58
    Settings->Data.Plotter_Count   = sp_Plotter_Count->value();
59
    Settings->Data.Debug_Fast      = sp_Debug_Fast->value();
59
    Settings->Data.Debug_Fast      = sp_Debug_Fast->value();
60
    Settings->Data.Debug_Slow      = sp_Debug_Slow->value();
60
    Settings->Data.Debug_Slow      = sp_Debug_Slow->value();
61
    Settings->Data.Debug_Off       = sp_Debug_Off->value();
61
    Settings->Data.Debug_Off       = sp_Debug_Off->value();
62
    Settings->Data.Navi_Fast       = sp_Navi_Fast->value();
62
    Settings->Data.Navi_Fast       = sp_Navi_Fast->value();
63
    Settings->Data.Navi_Slow       = sp_Navi_Slow->value();
63
    Settings->Data.Navi_Slow       = sp_Navi_Slow->value();
64
    Settings->Data.Navi_Off        = sp_Navi_Off->value();
64
    Settings->Data.Navi_Off        = sp_Navi_Off->value();
65
    Settings->Server.Port          = le_ServerPort->text();
65
    Settings->Server.Port          = le_ServerPort->text();
66
    Settings->Server.StartServer   = cb_StartServer->isChecked();
66
    Settings->Server.StartServer   = cb_StartServer->isChecked();
67
    Settings->Server.ToGround      = cb_ToGround->isChecked();
67
    Settings->Server.ToGround      = cb_ToGround->isChecked();
68
    Settings->Server.QMKS_Login    = le_Login->text();
68
    Settings->Server.QMKS_Login    = le_Login->text();
69
    Settings->Server.QMKS_Password = le_Password->text();
69
    Settings->Server.QMKS_Password = le_Password->text();
70
    Settings->Server.QMKS_Host     = le_QMKS_Host->text();
70
    Settings->Server.QMKS_Host     = le_QMKS_Host->text();
71
    Settings->Server.QMKS_Port     = le_QMKS_Port->text();
71
    Settings->Server.QMKS_Port     = le_QMKS_Port->text();
72
 
72
 
73
    return Settings;
73
    return Settings;
74
}
74
}
75
 
75
 
76
// Configuration -> Verzeichnisse
76
// Configuration -> Verzeichnisse
77
/////////////////////////////////
77
/////////////////////////////////
78
void dlg_Preferences::slot_DIR_CVS()
78
void dlg_Preferences::slot_DIR_CVS()
79
{
79
{
80
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für CSV-Logdateien"), Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
80
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Daten"), Settings->DIR.Logging, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
81
 
81
 
82
    if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory))
82
    if ((!directory.isEmpty()) && (Settings->DIR.Logging != directory))
83
    {
83
    {
84
        Settings->DIR.Logging = directory;
84
        Settings->DIR.Logging = directory;
85
        le_DIR_CVS->setText(Settings->DIR.Logging);
85
        le_DIR_CVS->setText(Settings->DIR.Logging);
86
    }
86
    }
87
}
87
}
88
 
88
 
89
void dlg_Preferences::slot_DIR_SET()
89
void dlg_Preferences::slot_DIR_SET()
90
{
90
{
91
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Settings-Dateien"), Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
91
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Settings-Dateien"), Settings->DIR.Parameter, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
92
 
92
 
93
    if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory))
93
    if ((!directory.isEmpty()) && (Settings->DIR.Parameter != directory))
94
    {
94
    {
95
        Settings->DIR.Parameter = directory;
95
        Settings->DIR.Parameter = directory;
96
        le_DIR_SET->setText(Settings->DIR.Parameter);
96
        le_DIR_SET->setText(Settings->DIR.Parameter);
97
    }
97
    }
98
 
98
 
99
}
99
}
100
void dlg_Preferences::slot_DIR_CACHE()
100
void dlg_Preferences::slot_DIR_CACHE()
101
{
101
{
102
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Karten-Cache"), Settings->DIR.Cache, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
102
    QString directory = QFileDialog::getExistingDirectory(this, trUtf8("Verzeichniss für Karten-Cache"), Settings->DIR.Cache, QFileDialog::DontResolveSymlinks | QFileDialog::ShowDirsOnly);
103
 
103
 
104
    if ((!directory.isEmpty()) && (Settings->DIR.Cache != directory))
104
    if ((!directory.isEmpty()) && (Settings->DIR.Cache != directory))
105
    {
105
    {
106
        Settings->DIR.Cache = directory;
106
        Settings->DIR.Cache = directory;
107
        le_DIR_CACHE->setText(Settings->DIR.Cache);
107
        le_DIR_CACHE->setText(Settings->DIR.Cache);
108
    }
108
    }
109
}
109
}
110
 
110
 
111
void dlg_Preferences::slot_PATH_AVRDUDE()
111
void dlg_Preferences::slot_PATH_AVRDUDE()
112
{
112
{
113
    QString directory = QFileDialog::getOpenFileName(this, trUtf8("Pfad zu AVRDUDE"), Settings->DIR.AVRDUDE, tr("AVRDUDE (*)"));
113
    QString directory = QFileDialog::getOpenFileName(this, trUtf8("Pfad zu AVRDUDE"), Settings->DIR.AVRDUDE, tr("AVRDUDE (*)"));
114
 
114
 
115
 
115
 
116
    if ((!directory.isEmpty()) && (Settings->DIR.AVRDUDE != directory))
116
    if ((!directory.isEmpty()) && (Settings->DIR.AVRDUDE != directory))
117
    {
117
    {
118
        Settings->DIR.AVRDUDE = directory;
118
        Settings->DIR.AVRDUDE = directory;
119
        le_PATH_AVRDUDE->setText(Settings->DIR.AVRDUDE);
119
        le_PATH_AVRDUDE->setText(Settings->DIR.AVRDUDE);
120
    }
120
    }
121
}
121
}
122
 
122
 
123
dlg_Preferences::~dlg_Preferences()
123
dlg_Preferences::~dlg_Preferences()
124
{
124
{
125
}
125
}
126
 
126
 
127
 
127
 
128
 
128