Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 andreas 1
/*
141 andreas 2
 * Copyright (C) 2020, 2022 by Andreas Theofilu <andreas@theosys.at>
2 andreas 3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
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 Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
22 andreas 18
#include <QFileDialog>
122 andreas 19
#include <QComboBox>
20
#include <QMessageBox>
141 andreas 21
#include <QAudioOutput>
22 andreas 22
 
23 andreas 23
#include <unistd.h>
24
 
2 andreas 25
#include "tqtsettings.h"
141 andreas 26
#include "tdirectory.h"
27
#include "tresources.h"
28
#include "tpagemanager.h"
2 andreas 29
#include "terror.h"
30
#include "ui_tqtsettings.h"
31
 
23 andreas 32
#ifdef __ANDROID__
43 andreas 33
#include <QtAndroidExtras/QAndroidJniObject>
34
#include <QtAndroid>
23 andreas 35
#include <QtQml/QQmlFile>
36
#include <android/log.h>
37
#endif
38
 
22 andreas 39
#include "tconfig.h"
122 andreas 40
#include "ttpinit.h"
22 andreas 41
 
59 andreas 42
#define RLOG_INFO           0x00fe
43
#define RLOG_WARNING        0x00fd
44
#define RLOG_ERROR          0x00fb
45
#define RLOG_TRACE          0x00f7
46
#define RLOG_DEBUG          0x00ef
47
#define RLOG_PROTOCOL       0x00f8
48
#define RLOG_ALL            0x00e0
49
 
122 andreas 50
using std::string;
51
using std::vector;
141 andreas 52
using std::sort;
122 andreas 53
 
141 andreas 54
extern TPageManager *gPageManager;
55
 
2 andreas 56
TQtSettings::TQtSettings(QWidget *parent)
57
	: QDialog(parent),
58
	  ui(new Ui::TQtSettings)
59
{
3 andreas 60
	DECL_TRACER("TQtSettings::TQtSettings(QWidget *parent)");
22 andreas 61
 
59 andreas 62
    mInitRun = true;
2 andreas 63
	ui->setupUi(this);
22 andreas 64
 
43 andreas 65
    ui->lineEdit_logFile->setText(TConfig::getLogFile().c_str());
22 andreas 66
    ui->lineEdit_Controller->setText(TConfig::getController().c_str());
67
    ui->lineEdit_PType->setText(TConfig::getPanelType().c_str());
68
    ui->spinBox_Port->setValue(TConfig::getPort());
69
    ui->spinBox_Channel->setValue(TConfig::getChannel());
118 andreas 70
    ui->lineEdit_FTPuser->setText(TConfig::getFtpUser().c_str());
71
    ui->lineEdit_FTPpassword->setText(TConfig::getFtpPassword().c_str());
122 andreas 72
 
73
    TTPInit tinit;
74
    tinit.setPath(TConfig::getProjectPath());
75
    vector<string> list = tinit.getFileList(".tp4");
76
    ui->comboBox_FTPsurface->clear();
77
    string curSurface = TConfig::getFtpSurface();
78
 
79
    if (list.size() == 0)
80
        ui->comboBox_FTPsurface->addItem(curSurface.c_str());
81
    else
82
    {
83
        ui->comboBox_FTPsurface->clear();
84
        vector<string>::iterator iter;
85
        int idx = 0;
86
        int newIdx = -1;
87
 
88
        for (iter = list.begin(); iter != list.end(); ++iter)
89
        {
90
            ui->comboBox_FTPsurface->addItem(iter->c_str());
91
 
92
            if (iter->compare(curSurface) == 0)
93
                newIdx = idx;
94
 
95
            idx++;
96
        }
97
 
98
        if (newIdx != -1)
99
            ui->comboBox_FTPsurface->setCurrentIndex(newIdx);
100
    }
101
 
118 andreas 102
    ui->checkBox_FTPpassive->setCheckState((TConfig::getFtpPassive() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
59 andreas 103
 
104
    mLogLevel = TConfig::getLogLevelBits();
105
    ui->checkBox_LogInfo->setCheckState((mLogLevel & HLOG_INFO) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
106
    ui->checkBox_LogWarning->setCheckState((mLogLevel & HLOG_WARNING) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
107
    ui->checkBox_LogError->setCheckState((mLogLevel & HLOG_ERROR) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
108
    ui->checkBox_LogTrace->setCheckState((mLogLevel & HLOG_TRACE) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
109
    ui->checkBox_LogDebug->setCheckState((mLogLevel & HLOG_DEBUG) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
110
    ui->checkBox_LogProtocol->setCheckState(((mLogLevel & HLOG_PROTOCOL) == HLOG_PROTOCOL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
111
    ui->checkBox_LogAll->setCheckState(((mLogLevel & HLOG_ALL) == HLOG_ALL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
112
 
23 andreas 113
    ui->checkBox_Format->setCheckState((TConfig::isLongFormat() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
24 andreas 114
    ui->checkBox_Scale->setCheckState((TConfig::getScale() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
120 andreas 115
#ifndef __ANDROID__
116
    ui->checkBox_Scale->setDisabled(true);
117
#endif
118 andreas 118
    ui->checkBox_Banner->setCheckState((TConfig::showBanner() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
120 andreas 119
#ifdef __ANDROID__
120
    ui->checkBox_Banner->setDisabled(true);
121
#endif
122
    ui->checkBox_Toolbar->setCheckState((TConfig::getToolbarForce() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
118 andreas 123
 
124
    ui->lineEdit_SIPproxy->setText(TConfig::getSIPproxy().c_str());
125
    ui->spinBox_SIPport->setValue(TConfig::getSIPport());
127 andreas 126
    ui->spinBox_SIPportTLS->setValue(TConfig::getSIPportTLS());
118 andreas 127
    ui->lineEdit_SIPstun->setText(TConfig::getSIPstun().c_str());
128
    ui->lineEdit_SIPdomain->setText(TConfig::getSIPdomain().c_str());
129
    ui->lineEdit_SIPuser->setText(TConfig::getSIPuser().c_str());
130
    ui->lineEdit_SIPpassword->setText(TConfig::getSIPpassword().c_str());
127 andreas 131
    ui->checkBox_SIPnetworkIPv4->setCheckState(TConfig::getSIPnetworkIPv4() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
132
    ui->checkBox_SIPnetworkIPv6->setCheckState(TConfig::getSIPnetworkIPv6() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
140 andreas 133
    ui->checkBox_SIPiphone->setCheckState(TConfig::getSIPiphone() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
127 andreas 134
 
135
    int fwIdx = 0;
136
 
137
    switch(TConfig::getSIPfirewall())
138
    {
139
        case TConfig::SIP_NO_FIREWALL:  fwIdx = 0; break;
140
        case TConfig::SIP_STUN:         fwIdx = 1; break;
141
        case TConfig::SIP_ICE:          fwIdx = 2; break;
142
        case TConfig::SIP_UPNP:         fwIdx = 3; break;
143
 
144
        default:
145
            fwIdx = 0;
146
    }
147
 
148
    ui->comboBox_SIPfirewall->setCurrentIndex(fwIdx);
118 andreas 149
    ui->checkBox_SIPenabled->setCheckState((TConfig::getSIPstatus() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
141 andreas 150
 
151
    // Sound settings
152
    string sySound = TConfig::getSystemSound();
153
    size_t pos = sySound.find_last_of(".");
154
    int numpos;
155
 
156
    if (pos != string::npos)
157
        numpos = atoi(sySound.substr(pos - 2, 2).c_str());
158
 
159
    dir::TDirectory dir;
160
    int num = dir.readDir(TConfig::getProjectPath() + "/__system/graphics/sounds");
161
    vector<string> tmpFiles;
162
 
163
    for (int i = 0; i < num; i++)
164
    {
165
        dir::DFILES_T entry = dir.getEntry(i);
166
        pos = entry.name.find_last_of("/");
167
        string file;
168
 
169
        if (pos != string::npos)
170
            file = entry.name.substr(pos + 1);
171
 
172
        if ((pos = file.find_last_of(".")) != string::npos)
173
            file = file.substr(0, pos);
174
 
175
        if (startsWith(file, "singleBeep"))
176
            tmpFiles.push_back(file);
177
    }
178
 
179
    sort(tmpFiles.begin(), tmpFiles.end());
180
    vector<string>::iterator iter;
181
 
182
    for (iter = tmpFiles.begin(); iter != tmpFiles.end(); ++iter)
183
        ui->comboBox_SystemSound->addItem(iter->c_str());
184
 
185
    ui->comboBox_SystemSound->setCurrentIndex(numpos);
186
 
187
    string siBeep = TConfig::getSingleBeepSound();
188
    pos = siBeep.find_last_of(".");
189
 
190
    if (pos != string::npos)
191
    {
192
        int num = atoi(siBeep.substr(pos - 2, 2).c_str());
193
 
194
        if (num > 0)
195
            siBeep = "Single Beep " + std::to_string(num);
196
    }
197
 
198
    int sel = 0;
199
 
200
    for (int i = 1; i <= 10; i++)
201
    {
202
        QString e = QString("Single Beep %1").arg(i);
203
        ui->comboBox_SingleBeep->addItem(e);
204
 
205
        if (e == QString(siBeep.c_str()))
206
            sel = i - 1;
207
    }
208
 
209
    ui->comboBox_SingleBeep->setCurrentIndex(sel);
210
 
211
    string siDBeep = TConfig::getDoubleBeepSound();
212
    pos = siDBeep.find_last_of(".");
213
 
214
    if (pos != string::npos)
215
    {
216
        int num = atoi(siDBeep.substr(pos - 2, 2).c_str());
217
 
218
        if (num > 0)
219
            siBeep = "Double Beep " + std::to_string(num);
220
    }
221
 
222
    sel = 0;
223
 
224
    for (int i = 1; i <= 10; i++)
225
    {
226
        QString e = QString("Double Beep %1").arg(i);
227
        ui->comboBox_DoubleBeep->addItem(e);
228
 
229
        if (e == QString(siBeep.c_str()))
230
            sel = i - 1;
231
    }
232
 
233
    ui->comboBox_DoubleBeep->setCurrentIndex(sel);
234
    ui->checkBox_SystemSound->setCheckState((TConfig::getSystemSoundState() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
235
 
236
    int volume = TConfig::getSystemVolume();
237
    int gain = TConfig::getSystemGain();
238
    ui->horizontalSlider_Volume->setValue(volume);
239
    ui->horizontalSlider_Gain->setValue(gain);
240
 
120 andreas 241
#ifdef __ANDROID__
242
    ui->tabWidget->setPalette(qt_fusionPalette());
243
    ui->tabCtrl->setPalette(qt_fusionPalette());
244
    ui->tabLog->setPalette(qt_fusionPalette());
245
    ui->tabSIP->setPalette(qt_fusionPalette());
246
    ui->tabView->setPalette(qt_fusionPalette());
247
#endif
59 andreas 248
    mInitRun = false;
249
    mSetChanged = false;
2 andreas 250
}
251
 
252
TQtSettings::~TQtSettings()
253
{
3 andreas 254
	DECL_TRACER("TQtSettings::~TQtSettings()");
2 andreas 255
	delete ui;
256
}
43 andreas 257
 
120 andreas 258
#ifdef __ANDROID__
259
QPalette TQtSettings::qt_fusionPalette()
260
{
261
    QColor backGround(239, 239, 239);
262
    QColor light = backGround.lighter(150);
263
    QColor mid(backGround.darker(130));
264
    QColor midLight = mid.lighter(110);
265
    QColor base = Qt::white;
266
    QColor disabledBase(backGround);
267
    QColor dark = backGround.darker(150);
268
    QColor darkDisabled = QColor(209, 209, 209).darker(110);
269
    QColor text = Qt::black;
126 andreas 270
    QColor hightlightedText = Qt::darkGray;
120 andreas 271
    QColor disabledText = QColor(190, 190, 190);
272
    QColor button = backGround;
273
    QColor shadow = dark.darker(135);
274
    QColor disabledShadow = shadow.lighter(150);
275
 
276
    QPalette fusionPalette(Qt::black,backGround,light,dark,mid,text,base);
277
    fusionPalette.setBrush(QPalette::Midlight, midLight);
278
    fusionPalette.setBrush(QPalette::Button, button);
279
    fusionPalette.setBrush(QPalette::Shadow, shadow);
280
    fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText);
281
 
282
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText);
283
    fusionPalette.setBrush(QPalette::Disabled, QPalette::WindowText, disabledText);
284
    fusionPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledText);
285
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase);
286
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
287
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow);
288
 
289
    fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198));
290
    fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(48, 140, 198));
291
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 145, 145));
292
    return fusionPalette;
293
}
294
#endif
295
 
22 andreas 296
void TQtSettings::on_kiconbutton_logFile_clicked()
297
{
41 andreas 298
    DECL_TRACER("TQtSettings::on_kiconbutton_logFile_clicked()");
299
 
22 andreas 300
    std::string pt = TConfig::getLogFile();
301
    size_t pos = pt.find_last_of("/");
302
 
303
    if (pos != std::string::npos)
304
        pt = pt.substr(0, pos);
305
    else
23 andreas 306
    {
307
        char hv0[4096];
308
        getcwd(hv0, sizeof(hv0));
309
        pt = hv0;
310
    }
22 andreas 311
 
312
    QString actPath(pt.c_str());
43 andreas 313
    QFileDialog fdialog(this, tr("Logfile"), actPath, tr("TPanel.log (*.log)"));
23 andreas 314
    fdialog.setAcceptMode(QFileDialog::AcceptSave);
315
    fdialog.setDefaultSuffix("log");
316
    fdialog.setOption(QFileDialog::DontConfirmOverwrite);
317
    QString fname;
318
 
319
    if (fdialog.exec())
320
    {
321
        QDir dir = fdialog.directory();
322
        QStringList list = fdialog.selectedFiles();
323
 
324
        if (list.size() > 0)
325
            fname = dir.absoluteFilePath(list.at(0));
326
        else
327
            return;
328
    }
329
    else
330
        return;
331
 
43 andreas 332
#ifdef __ANDROID__
333
    QString fileName = fname;
334
 
335
    if (fileName.contains("content://"))
336
    {
337
        QAndroidJniObject uri = QAndroidJniObject::callStaticObjectMethod(
338
              "android/net/Uri", "parse", "(Ljava/lang/String;)Landroid/net/Uri;",
339
              QAndroidJniObject::fromString(fileName).object<jstring>());
340
 
341
        fileName =
342
              QAndroidJniObject::callStaticObjectMethod(
343
                  "org/qtproject/theosys/UriToPath", "getFileName",
344
                  "(Landroid/net/Uri;Landroid/content/Context;)Ljava/lang/String;",
345
                  uri.object(), QtAndroid::androidContext().object()).toString();
346
 
347
        if (fileName.length() > 0)
348
            fname = fileName;
349
    }
350
    else
351
    {
352
        MSG_WARNING("Not an Uri? (" << fname.toStdString() << ")");
353
    }
354
#endif
23 andreas 355
    ui->lineEdit_logFile->setText(fname);
356
 
357
    if (TConfig::getLogFile().compare(fname.toStdString()) != 0)
358
    {
359
        mSetChanged = true;
360
        TConfig::saveLogFile(fname.toStdString());
361
    }
22 andreas 362
}
43 andreas 363
 
120 andreas 364
template<typename T>
365
void TQtSettings::scaleObject(T *obj)
366
{
367
    DECL_TRACER("TQtSettings::scaleObject(T *obj)");
368
 
369
    QSize size = obj->size();
370
    size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
371
    obj->resize(size);
372
    QRect rect = obj->geometry();
373
    obj->move(scale(rect.left()), scale(rect.top()));
374
}
375
 
40 andreas 376
void TQtSettings::doResize()
377
{
41 andreas 378
    DECL_TRACER("TQtSettings::doResize()");
379
 
40 andreas 380
    // The main dialog window
381
    QSize size = this->size();
41 andreas 382
    QRect rect = this->geometry();
40 andreas 383
    size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
384
    this->resize(size);
41 andreas 385
    this->move(scale(rect.left()), scale(rect.top()));
386
    QWidget *parent = this->parentWidget();
387
 
388
    if (parent)
389
    {
390
        rect = parent->geometry();
391
        this->move(rect.center() - this->rect().center());
392
    }
393
 
59 andreas 394
    // Layout
118 andreas 395
    // Iterate through childs and resize them
396
    QObjectList childs = children();
397
    QList<QObject *>::Iterator iter;
59 andreas 398
 
118 andreas 399
    for (iter = childs.begin(); iter != childs.end(); ++iter)
400
    {
401
        QString name = iter.i->t()->objectName();
402
        QObject *obj = iter.i->t();
59 andreas 403
 
120 andreas 404
        if (name.startsWith("tabWidget"))
118 andreas 405
        {
120 andreas 406
            scaleObject(dynamic_cast<QTabWidget *>(obj));
407
 
408
            QObjectList childsTab = obj->children();
409
            QList<QObject *>::Iterator iterTab;
410
 
411
            for (iterTab = childsTab.begin(); iterTab != childsTab.end(); ++iterTab)
412
            {
413
                QString namet = iterTab.i->t()->objectName();
414
                QObject *objt = iterTab.i->t();
415
 
416
                if (namet.startsWith("qt_tabwidget_stackedwidget"))
417
                {
418
                    QObjectList childsStack = objt->children();
419
                    QList<QObject *>::Iterator iterStack;
420
 
421
                    for (iterStack = childsStack.begin(); iterStack != childsStack.end(); ++iterStack)
422
                    {
423
                        QObjectList tabStack = iterStack.i->t()->children();
424
                        QList<QObject *>::Iterator tabIter;
425
 
426
                        for (tabIter = tabStack.begin(); tabIter != tabStack.end(); ++tabIter)
427
                        {
428
                            QString n = tabIter.i->t()->objectName();
429
                            QObject *on = tabIter.i->t();
430
 
126 andreas 431
                            if (n.startsWith("kiconbutton") || n.startsWith("toolButton"))
120 andreas 432
                                scaleObject(dynamic_cast<QToolButton *>(on));
433
                            else if (n.startsWith("checkBox"))
434
                            {
435
                                scaleObject(dynamic_cast<QCheckBox *>(on));
436
#ifdef __ANDROID__
437
                                QCheckBox *cb = dynamic_cast<QCheckBox *>(on);
438
                                cb->setPalette(qt_fusionPalette());
439
#endif
440
                            }
441
                            else if (n.startsWith("lineEdit"))
442
                                scaleObject(dynamic_cast<QLineEdit *>(on));
443
                            else if (n.startsWith("spinBox"))
444
                                scaleObject(dynamic_cast<QSpinBox *>(on));
122 andreas 445
                            else if (n.startsWith("comboBox"))
446
                                scaleObject(dynamic_cast<QComboBox *>(on));
141 andreas 447
                            else if (n.startsWith("horizontalSlider") || n.startsWith("verticalSlider"))
448
                                scaleObject(dynamic_cast<QSlider *>(on));
120 andreas 449
                            else if (n.startsWith("label"))
450
                            {
451
                                scaleObject(dynamic_cast<QLabel *>(on));
452
#ifdef __ANDROID__
453
                                QLabel *lb = dynamic_cast<QLabel *>(on);
454
                                lb->setPalette(qt_fusionPalette());
455
#endif
456
                            }
457
                        }
458
                    }
459
 
460
//                    if (namet.startsWith("tab"))
461
//                        scaleObject(dynamic_cast<QWidget *>(objt));
462
                }
463
            }
118 andreas 464
        }
120 andreas 465
        else if (name.startsWith("buttonBox"))
466
            scaleObject(dynamic_cast<QDialogButtonBox *>(obj));
118 andreas 467
    }
40 andreas 468
}
41 andreas 469
 
23 andreas 470
void TQtSettings::on_lineEdit_logFile_textChanged(const QString &arg1)
471
{
41 andreas 472
    DECL_TRACER("TQtSettings::on_lineEdit_logFile_textChanged(const QString &arg1)");
473
 
23 andreas 474
    if (arg1.compare(TConfig::getLogFile().c_str()) == 0)
475
        return;
476
 
477
    mSetChanged = true;
478
    TConfig::saveLogFile(arg1.toStdString());
479
}
43 andreas 480
 
23 andreas 481
void TQtSettings::on_lineEdit_Controller_textChanged(const QString &arg1)
482
{
41 andreas 483
    DECL_TRACER("TQtSettings::on_lineEdit_Controller_textChanged(const QString &arg1)");
484
 
23 andreas 485
    if (arg1.compare(TConfig::getController().c_str()) == 0)
486
        return;
487
 
488
    mSetChanged = true;
489
    TConfig::saveController(arg1.toStdString());
490
}
491
 
492
void TQtSettings::on_spinBox_Port_valueChanged(int arg1)
493
{
41 andreas 494
    DECL_TRACER("TQtSettings::on_spinBox_Port_valueChanged(int arg1)");
495
 
23 andreas 496
    if (arg1 == TConfig::getPort())
497
        return;
498
 
499
    mSetChanged = true;
500
    TConfig::savePort(arg1);
501
}
502
 
503
void TQtSettings::on_spinBox_Channel_valueChanged(int arg1)
504
{
41 andreas 505
    DECL_TRACER("TQtSettings::on_spinBox_Channel_valueChanged(int arg1)");
506
 
23 andreas 507
    if (arg1 == TConfig::getChannel())
508
        return;
509
 
510
    mSetChanged = true;
511
    TConfig::saveChannel(arg1);
512
}
513
 
514
void TQtSettings::on_lineEdit_PType_textChanged(const QString &arg1)
515
{
41 andreas 516
    DECL_TRACER("TQtSettings::on_lineEdit_PType_textChanged(const QString &arg1)");
517
 
23 andreas 518
    if (arg1.compare(TConfig::getPanelType().c_str()) == 0)
519
        return;
520
 
521
    mSetChanged = true;
522
    TConfig::savePanelType(arg1.toStdString());
523
}
524
 
525
void TQtSettings::on_checkBox_Format_toggled(bool checked)
526
{
41 andreas 527
    DECL_TRACER("TQtSettings::on_checkBox_Format_toggled(bool checked)");
528
 
23 andreas 529
    if (TConfig::isLongFormat() == checked)
530
        return;
531
 
532
    mSetChanged = true;
533
    TConfig::saveFormat(checked);
534
}
24 andreas 535
 
536
void TQtSettings::on_checkBox_Scale_toggled(bool checked)
537
{
41 andreas 538
    DECL_TRACER("TQtSettings::on_checkBox_Scale_toggled(bool checked)");
539
 
24 andreas 540
    if (TConfig::getScale() == checked)
541
        return;
542
 
543
    mSetChanged = true;
544
    TConfig::saveScale(checked);
545
}
35 andreas 546
 
118 andreas 547
void TQtSettings::on_checkBox_Banner_toggled(bool checked)
548
{
549
    DECL_TRACER("TQtSettings::on_checkBox_Banner_toggled(bool checked)");
550
 
551
    if (TConfig::showBanner() == checked)
552
        return;
553
 
554
    mSetChanged = true;
555
    TConfig::saveBanner(!checked);
556
}
557
 
120 andreas 558
void TQtSettings::on_checkBox_Toolbar_toggled(bool checked)
559
{
560
    DECL_TRACER("TQtSettings::on_checkBox_Toolbar_toggled(bool checked)");
561
 
562
    if (TConfig::getToolbarForce() == checked)
563
        return;
564
 
565
    mSetChanged = true;
566
    TConfig::saveToolbarForce(checked);
567
}
568
 
134 andreas 569
void TQtSettings::on_checkBox_Rotation_toggled(bool checked)
570
{
571
    DECL_TRACER("TQtSettings::on_checkBox_Rotation_toggled(bool checked)");
572
 
573
    if (TConfig::getRotationFixed() == checked)
574
        return;
575
 
576
    mSetChanged = true;
577
    TConfig::setRotationFixed(checked);
578
}
579
 
35 andreas 580
void TQtSettings::on_checkBox_Profiling_toggled(bool checked)
581
{
41 andreas 582
    DECL_TRACER("TQtSettings::on_checkBox_Profiling_toggled(bool checked)");
583
 
35 andreas 584
    if (TConfig::getProfiling() == checked)
585
        return;
586
 
587
    mSetChanged = true;
588
    TConfig::saveProfiling(checked);
589
}
40 andreas 590
 
59 andreas 591
void TQtSettings::on_checkBox_LogInfo_toggled(bool checked)
592
{
593
    DECL_TRACER("TQtSettings::on_checkBox_LogInfo_toggled(bool checked)");
594
 
595
    if (mInitRun)
596
        return;
597
 
598
    if (checked && !(mLogLevel & HLOG_INFO))
599
    {
600
        mLogLevel |= HLOG_INFO;
601
        mSetChanged = true;
602
    }
603
    else if (!checked && (mLogLevel & HLOG_INFO))
604
    {
605
        mSetChanged = true;
606
        mLogLevel &= RLOG_INFO;
607
    }
608
 
609
    mInitRun = true;
610
    if ((mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
611
        ui->checkBox_LogProtocol->setCheckState(Qt::CheckState::Unchecked);
612
 
613
    if ((mLogLevel & HLOG_ALL) != HLOG_ALL)
614
        ui->checkBox_LogAll->setCheckState(Qt::CheckState::Unchecked);
615
 
616
    mInitRun = false;
617
    TConfig::saveLogLevel(mLogLevel);
618
}
619
 
620
void TQtSettings::on_checkBox_LogWarning_toggled(bool checked)
621
{
622
    DECL_TRACER("TQtSettings::on_checkBox_LogWarning_toggled(bool checked)");
623
 
624
    if (mInitRun)
625
        return;
626
 
627
    if (checked && !(mLogLevel & HLOG_WARNING))
628
    {
629
        mLogLevel |= HLOG_WARNING;
630
        mSetChanged = true;
631
    }
632
    else if (!checked && (mLogLevel & HLOG_WARNING))
633
    {
634
        mLogLevel &= RLOG_WARNING;
635
        mSetChanged = true;
636
    }
637
 
638
    mInitRun = true;
639
    if ((mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
640
        ui->checkBox_LogProtocol->setCheckState(Qt::CheckState::Unchecked);
641
 
642
    if ((mLogLevel & HLOG_ALL) != HLOG_ALL)
643
        ui->checkBox_LogAll->setCheckState(Qt::CheckState::Unchecked);
644
 
645
    mInitRun = false;
646
    TConfig::saveLogLevel(mLogLevel);
647
}
648
 
649
void TQtSettings::on_checkBox_LogError_toggled(bool checked)
650
{
651
    DECL_TRACER("TQtSettings::on_checkBox_LogError_toggled(bool checked)");
652
 
653
    if (mInitRun)
654
        return;
655
 
656
    if (checked && !(mLogLevel & HLOG_ERROR))
657
    {
658
        mSetChanged = true;
659
        mLogLevel |= HLOG_ERROR;
660
    }
661
    else if (!checked && (mLogLevel & HLOG_ERROR))
662
    {
663
        mLogLevel &= RLOG_ERROR;
664
        mSetChanged = true;
665
    }
666
 
667
    mInitRun = true;
668
    if ((mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
669
        ui->checkBox_LogProtocol->setCheckState(Qt::CheckState::Unchecked);
670
 
671
    if ((mLogLevel & HLOG_ALL) != HLOG_ALL)
672
        ui->checkBox_LogAll->setCheckState(Qt::CheckState::Unchecked);
673
 
674
    mInitRun = false;
675
    TConfig::saveLogLevel(mLogLevel);
676
}
677
 
678
void TQtSettings::on_checkBox_LogTrace_toggled(bool checked)
679
{
680
    DECL_TRACER("TQtSettings::on_checkBox_LogTrace_toggled(bool checked)");
681
 
682
    if (mInitRun)
683
        return;
684
 
685
    if (checked && !(mLogLevel & HLOG_TRACE))
686
    {
687
        mLogLevel |= HLOG_TRACE;
688
        mSetChanged = true;
689
    }
690
    else if (!checked && (mLogLevel & HLOG_TRACE))
691
    {
692
        mLogLevel &= RLOG_TRACE;
693
        mSetChanged = true;
694
    }
695
 
696
    mInitRun = true;
697
    if ((mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
698
        ui->checkBox_LogProtocol->setCheckState(Qt::CheckState::Unchecked);
699
 
700
    if ((mLogLevel & HLOG_ALL) != HLOG_ALL)
701
        ui->checkBox_LogAll->setCheckState(Qt::CheckState::Unchecked);
702
 
703
    mInitRun = false;
704
    TConfig::saveLogLevel(mLogLevel);
705
}
706
 
707
void TQtSettings::on_checkBox_LogDebug_toggled(bool checked)
708
{
709
    DECL_TRACER("TQtSettings::on_checkBox_LogDebug_toggled(bool checked)");
710
 
711
    if (mInitRun)
712
        return;
713
 
714
    if (checked && !(mLogLevel & HLOG_DEBUG))
715
    {
716
        mLogLevel |= HLOG_DEBUG;
717
        mSetChanged = true;
718
    }
719
    else if (!checked && (mLogLevel & HLOG_DEBUG))
720
    {
721
        mLogLevel &= RLOG_DEBUG;
722
        mSetChanged = true;
723
    }
724
 
725
    mInitRun = true;
726
    if ((mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
727
        ui->checkBox_LogProtocol->setCheckState(Qt::CheckState::Unchecked);
728
 
729
    if ((mLogLevel & HLOG_ALL) != HLOG_ALL)
730
        ui->checkBox_LogAll->setCheckState(Qt::CheckState::Unchecked);
731
 
732
    mInitRun = false;
733
    TConfig::saveLogLevel(mLogLevel);
734
}
735
 
736
void TQtSettings::on_checkBox_LogProtocol_toggled(bool checked)
737
{
738
    DECL_TRACER("TQtSettings::on_checkBox_LogProtocol_toggled(bool checked)");
739
 
740
    if (mInitRun)
741
        return;
742
 
743
    if (checked && (mLogLevel & HLOG_PROTOCOL) != HLOG_PROTOCOL)
744
    {
745
        mLogLevel = HLOG_PROTOCOL;
746
        mInitRun = true;
747
        ui->checkBox_LogInfo->setCheckState(Qt::CheckState::Checked);
748
        ui->checkBox_LogWarning->setCheckState(Qt::CheckState::Checked);
749
        ui->checkBox_LogError->setCheckState(Qt::CheckState::Checked);
750
        ui->checkBox_LogTrace->setCheckState(Qt::CheckState::Unchecked);
751
        ui->checkBox_LogDebug->setCheckState(Qt::CheckState::Unchecked);
752
        TConfig::saveLogLevel(mLogLevel);
753
        mInitRun = false;
754
        mSetChanged = true;
755
    }
756
}
757
 
758
void TQtSettings::on_checkBox_LogAll_toggled(bool checked)
759
{
760
    DECL_TRACER("TQtSettings::on_checkBox_LogAll_toggled(bool checked)");
761
 
762
    if (mInitRun)
763
        return;
764
 
765
    if (checked && (mLogLevel & HLOG_ALL) != HLOG_ALL)
766
    {
767
        mLogLevel = HLOG_ALL;
768
        mInitRun = true;
769
        ui->checkBox_LogInfo->setCheckState(Qt::CheckState::Checked);
770
        ui->checkBox_LogWarning->setCheckState(Qt::CheckState::Checked);
771
        ui->checkBox_LogError->setCheckState(Qt::CheckState::Checked);
772
        ui->checkBox_LogTrace->setCheckState(Qt::CheckState::Checked);
773
        ui->checkBox_LogDebug->setCheckState(Qt::CheckState::Checked);
774
        TConfig::saveLogLevel(mLogLevel);
775
        mInitRun = false;
776
        mSetChanged = true;
777
    }
778
}
779
 
40 andreas 780
int TQtSettings::scale(int value)
781
{
118 andreas 782
    DECL_TRACER("TQtSettings::scale(int value)");
783
 
40 andreas 784
    if (value <= 0 || mScaleFactor == 1.0)
785
        return value;
786
 
787
    return (int)((double)value * mScaleFactor);
788
}
43 andreas 789
 
790
void TQtSettings::on_kiconbutton_reset_clicked()
791
{
118 andreas 792
    DECL_TRACER("TQtSettings::on_kiconbutton_reset_clicked()");
793
 
43 andreas 794
    char *HOME = getenv("HOME");
795
    QString logFile = TConfig::getLogFile().c_str();
796
 
797
    if (HOME)
798
    {
799
        logFile = HOME;
800
        logFile += "/tpanel/tpanel.log";
801
    }
802
 
803
    ui->lineEdit_logFile->setText(logFile);
804
}
118 andreas 805
 
806
void TQtSettings::on_lineEdit_FTPuser_textChanged(const QString& arg1)
807
{
808
    DECL_TRACER("TQtSettings::on_lineEdit_FTPuser_textChanged(const QString& arg1)");
809
 
810
    if (arg1.compare(TConfig::getFtpUser().c_str()) == 0)
811
        return;
812
 
813
    mSetChanged = true;
814
    TConfig::saveFtpUser(arg1.toStdString());
815
}
816
 
817
void TQtSettings::on_lineEdit_FTPpassword_textChanged(const QString& arg1)
818
{
819
    DECL_TRACER("TQtSettings::on_lineEdit_FTPpassword_textChanged(const QString& arg1)");
820
 
821
    if (arg1.compare(TConfig::getFtpPassword().c_str()) == 0)
822
        return;
823
 
824
    mSetChanged = true;
825
    TConfig::saveFtpPassword(arg1.toStdString());
826
}
827
 
122 andreas 828
void TQtSettings::on_comboBox_FTPsurface_currentIndexChanged(const QString& arg1)
118 andreas 829
{
122 andreas 830
    DECL_TRACER("TQtSettings::on_comboBox_FTPsurface_currentIndexChanged(const QString& arg1)");
118 andreas 831
 
832
    if (arg1.compare(TConfig::getFtpSurface().c_str()) == 0)
833
        return;
834
 
835
    mSetChanged = true;
836
    TConfig::saveFtpSurface(arg1.toStdString());
122 andreas 837
    MSG_DEBUG("Surface was set to " << arg1.toStdString());
118 andreas 838
}
839
 
122 andreas 840
void TQtSettings::on_toolButton_Download_clicked()
841
{
842
    DECL_TRACER("TQtSettings::on_toolButton_Download_clicked()");
843
 
844
    QMessageBox box(this);
845
    QString text = ui->comboBox_FTPsurface->currentText();
846
 
847
    box.setText("Do you realy want to download and install the surface <b>" + text + "</b>?");
848
    box.addButton(QMessageBox::Yes);
849
    box.addButton(QMessageBox::No);
850
    int ret = box.exec();
851
 
852
    if (ret == QMessageBox::Yes)
853
    {
854
        mDownloadForce = true;
855
        QString qss = QString("background-color: rgba(250, 0, 0, 0.9)");
856
        ui->toolButton_Download->setStyleSheet(qss);
857
    }
858
    else
859
    {
860
        mDownloadForce = false;
861
        QString qss = QString("background-color: rgba(209, 209, 209, 0.9)");
862
        ui->toolButton_Download->setStyleSheet(qss);
863
    }
864
 
865
    MSG_DEBUG("mDownloadForce=" << (mDownloadForce ? "YES" : "NO"));
866
}
867
 
118 andreas 868
void TQtSettings::on_checkBox_FTPpassive_toggled(bool checked)
869
{
870
    DECL_TRACER("TQtSettings::on_checkBox_FTPpassive_toggled(bool checked)");
871
 
872
    if (TConfig::getFtpPassive() == checked)
873
        return;
874
 
875
    mSetChanged = true;
876
    TConfig::saveFtpPassive(checked);
877
}
878
 
879
void TQtSettings::on_lineEdit_SIPproxy_textChanged(const QString& arg1)
880
{
881
    DECL_TRACER("TQtSettings::on_lineEdit_SIPproxy_textChanged(const QString& arg1)");
882
 
883
    if (arg1.compare(TConfig::getSIPproxy().c_str()) == 0)
884
        return;
885
 
886
    mSetChanged = true;
887
    TConfig::setSIPproxy(arg1.toStdString());
888
}
889
 
890
void TQtSettings::on_spinBox_SIPport_valueChanged(int arg1)
891
{
892
    DECL_TRACER("TQtSettings::on_spinBox_SIPport_valueChanged(int arg1)");
893
 
894
    if (TConfig::getSIPport() == arg1)
895
        return;
896
 
897
    mSetChanged = true;
898
    TConfig::setSIPport(arg1);
899
}
900
 
127 andreas 901
void TQtSettings::on_spinBox_SIPportTLS_valueChanged(int arg1)
902
{
903
    DECL_TRACER("TQtSettings::on_spinBoxTLS_SIPport_valueChanged(int arg1)");
904
 
905
    if (TConfig::getSIPportTLS() == arg1)
906
        return;
907
 
908
    mSetChanged = true;
909
    TConfig::setSIPportTLS(arg1);
910
}
911
 
118 andreas 912
void TQtSettings::on_lineEdit_SIPstun_textChanged(const QString& arg1)
913
{
914
    DECL_TRACER("TQtSettings::on_lineEdit_SIPstun_textChanged(const QString& arg1)");
915
 
916
    if (arg1.compare(TConfig::getSIPstun().c_str()) == 0)
917
        return;
918
 
919
    mSetChanged = true;
920
    TConfig::setSIPstun(arg1.toStdString());
921
}
922
 
923
void TQtSettings::on_lineEdit_SIPdomain_textChanged(const QString& arg1)
924
{
925
    DECL_TRACER("TQtSettings::on_lineEdit_SIPdomain_textChanged(const QString& arg1)");
926
 
927
    if (arg1.compare(TConfig::getSIPdomain().c_str()) == 0)
928
        return;
929
 
930
    mSetChanged = true;
931
    TConfig::setSIPdomain(arg1.toStdString());
932
}
933
 
934
void TQtSettings::on_lineEdit_SIPuser_textChanged(const QString& arg1)
935
{
936
    DECL_TRACER("TQtSettings::on_lineEdit_SIPuser_textChanged(const QString& arg1)");
937
 
938
    if (arg1.compare(TConfig::getSIPuser().c_str()) == 0)
939
        return;
940
 
941
    mSetChanged = true;
942
    TConfig::setSIPuser(arg1.toStdString());
943
}
944
 
945
void TQtSettings::on_lineEdit_SIPpassword_textChanged(const QString& arg1)
946
{
947
    DECL_TRACER("TQtSettings::on_lineEdit_SIPpassword_textChanged(const QString& arg1)");
948
 
949
    if (arg1.compare(TConfig::getSIPpassword().c_str()) == 0)
950
        return;
951
 
952
    mSetChanged = true;
953
    TConfig::setSIPpassword(arg1.toStdString());
954
}
955
 
127 andreas 956
void TQtSettings::on_checkBox_SIPnetworkIPv4_toggled(bool checked)
957
{
958
    DECL_TRACER("TQtSettings::on_checkBox_SIPnetworkIPv4_toggled(bool checked)");
959
 
960
    if (TConfig::getSIPnetworkIPv4() == checked)
961
        return;
962
 
963
    mSetChanged = true;
964
    TConfig::setSIPnetworkIPv4(checked);
965
}
966
 
967
void TQtSettings::on_checkBox_SIPnetworkIPv6_toggled(bool checked)
968
{
969
    DECL_TRACER("TQtSettings::on_checkBox_SIPnetworkIPv6_toggled(bool checked)");
970
 
971
    if (TConfig::getSIPnetworkIPv6() == checked)
972
        return;
973
 
974
    mSetChanged = true;
975
    TConfig::setSIPnetworkIPv6(checked);
976
}
977
 
978
void TQtSettings::on_comboBox_SIPfirewall_currentIndexChanged(int index)
979
{
980
    DECL_TRACER("TQtSettings::on_comboBox_SIPfirewall_currentIndexChanged(const QString& arg1)");
981
 
982
    TConfig::SIP_FIREWALL_t fw;
983
 
984
    switch(index)
985
    {
986
        case 0: fw = TConfig::SIP_NO_FIREWALL; break;
987
        case 1: fw = TConfig::SIP_STUN; break;
988
        case 2: fw = TConfig::SIP_ICE; break;
989
        case 3: fw = TConfig::SIP_UPNP; break;
990
 
991
        default:
992
            fw = TConfig::SIP_NO_FIREWALL;
993
    }
994
 
995
    if (TConfig::getSIPfirewall() == fw)
996
        return;
997
 
998
    mSetChanged = true;
999
    TConfig::setSIPfirewall(fw);
1000
}
1001
 
118 andreas 1002
void TQtSettings::on_checkBox_SIPenabled_toggled(bool checked)
1003
{
1004
    DECL_TRACER("TQtSettings::on_checkBox_SIPenabled_toggled(bool checked)");
1005
 
1006
    if (TConfig::getSIPstatus() == checked)
1007
        return;
1008
 
1009
    mSetChanged = true;
1010
    TConfig::setSIPstatus(checked);
1011
}
139 andreas 1012
 
1013
void TQtSettings::on_checkBox_SIPiphone_toggled(bool checked)
1014
{
1015
    DECL_TRACER("TQtSettings::on_checkBox_SIPiphone_toggled(bool checked)");
1016
 
1017
    if (TConfig::getSIPiphone() == checked)
1018
        return;
1019
 
1020
    mSetChanged = true;
1021
    TConfig::setSIPiphone(checked);
1022
}
141 andreas 1023
 
1024
void TQtSettings::on_comboBox_SystemSound_currentIndexChanged(const QString& arg1)
1025
{
1026
    DECL_TRACER("TQtSettings::on_comboBox_SystemSound_currentIndexChanged(const QString& arg1)");
1027
 
1028
    if (arg1.compare(TConfig::getSystemSound().c_str()) == 0)
1029
        return;
1030
 
1031
    mSetChanged = true;
1032
    TConfig::saveSystemSoundFile(arg1.toStdString() + ".wav");
1033
}
1034
 
1035
void TQtSettings::on_toolButton_SystemSound_clicked()
1036
{
1037
    DECL_TRACER("TQtSettings::on_toolButton_SystemSound_clicked()");
1038
 
1039
    QString selected = ui->comboBox_SystemSound->currentText();
1040
    string file = TConfig::getProjectPath() + "/__system/graphics/sounds/" + selected.toStdString() + ".wav";
1041
 
1042
    if (gPageManager)
1043
        gPageManager->getCallPlaySound()(file);
1044
}
1045
 
1046
void TQtSettings::on_comboBox_SingleBeep_currentIndexChanged(const QString& arg1)
1047
{
1048
    DECL_TRACER("TQtSettings::on_comboBox_SingleBeep_currentIndexChanged(const QString& arg1)");
1049
 
1050
    if (arg1.compare(TConfig::getSingleBeepSound().c_str()) == 0)
1051
        return;
1052
 
1053
    string file = arg1.toStdString();
1054
    size_t pos = file.find_last_of(" ");
1055
 
1056
    if (pos != string::npos)
1057
    {
1058
        int num = atoi(file.substr(pos).c_str());
1059
        file = "singleBeep";
1060
 
1061
        if (num > 0)
1062
        {
1063
            if (num < 10)
1064
                file += "0" + std::to_string(num);
1065
            else
1066
                file += std::to_string(num);
1067
        }
1068
 
1069
        file += ".wav";
1070
    }
1071
 
1072
    mSetChanged = true;
1073
    TConfig::saveSingleBeepFile(file);
1074
}
1075
 
1076
void TQtSettings::on_toolButton_SingleBeep_clicked()
1077
{
1078
    DECL_TRACER("TQtSettings::on_toolButton_SingleBeep_clicked()");
1079
 
1080
    QString selected = ui->comboBox_SingleBeep->currentText();
1081
    string file = selected.toStdString();
1082
    size_t pos = file.find_last_of(" ");
1083
 
1084
    if (pos != string::npos)
1085
    {
1086
        int num = atoi(file.substr(pos).c_str());
1087
        file = TConfig::getProjectPath() + "/__system/graphics/sounds/singleBeep";
1088
 
1089
        if (num > 0)
1090
        {
1091
            if (num < 10)
1092
                file += "0" + std::to_string(num);
1093
            else
1094
                file += std::to_string(num);
1095
        }
1096
 
1097
        file += ".wav";
1098
    }
1099
 
1100
//    playFile(file);
1101
 
1102
    if (gPageManager)
1103
        gPageManager->getCallPlaySound()(file);
1104
}
1105
 
1106
void TQtSettings::on_comboBox_DoubleBeep_currentIndexChanged(const QString& arg1)
1107
{
1108
    DECL_TRACER("TQtSettings::on_comboBox_DoubleBeep_currentIndexChanged(const QString& arg1)");
1109
 
1110
    if (arg1.compare(TConfig::getDoubleBeepSound().c_str()) == 0)
1111
        return;
1112
 
1113
    string file = arg1.toStdString();
1114
    size_t pos = file.find_last_of(" ");
1115
 
1116
    if (pos != string::npos)
1117
    {
1118
        int num = atoi(file.substr(pos).c_str());
1119
        file = "doubleBeep";
1120
 
1121
        if (num > 0)
1122
        {
1123
            if (num < 10)
1124
                file += "0" + std::to_string(num);
1125
            else
1126
                file += std::to_string(num);
1127
        }
1128
 
1129
        file += ".wav";
1130
    }
1131
 
1132
    mSetChanged = true;
1133
    TConfig::saveDoubleBeepFile(file);
1134
}
1135
 
1136
void TQtSettings::on_toolButton_DoubleBeep_clicked()
1137
{
1138
    DECL_TRACER("TQtSettings::on_toolButton_DoubleBeep_clicked()");
1139
 
1140
    QString selected = ui->comboBox_DoubleBeep->currentText();
1141
    string file = selected.toStdString();
1142
    size_t pos = file.find_last_of(" ");
1143
 
1144
    if (pos != string::npos)
1145
    {
1146
        int num = atoi(file.substr(pos).c_str());
1147
        file = TConfig::getProjectPath() + "/__system/graphics/sounds/doubleBeep";
1148
 
1149
        if (num > 0)
1150
        {
1151
            if (num < 10)
1152
                file += "0" + std::to_string(num);
1153
            else
1154
                file += std::to_string(num);
1155
        }
1156
 
1157
        file += ".wav";
1158
    }
1159
 
1160
 
1161
//    playFile(file);
1162
 
1163
    if (gPageManager)
1164
        gPageManager->getCallPlaySound()(file);
1165
}
1166
 
1167
void TQtSettings::on_checkBox_SystemSound_toggled(bool checked)
1168
{
1169
    DECL_TRACER("TQtSettings::on_checkBox_SystemSound_toggled(bool checked)");
1170
 
1171
    if (TConfig::getSystemSoundState() == checked)
1172
        return;
1173
 
1174
    mSetChanged = true;
1175
    TConfig::saveSystemSoundState(checked);
1176
}
1177
 
1178
void TQtSettings::on_toolButton_TestSound_clicked()
1179
{
1180
    DECL_TRACER("TQtSettings::on_toolButton_TestSound_clicked()");
1181
 
1182
    if (gPageManager)
1183
        gPageManager->getCallPlaySound()(TConfig::getProjectPath() + "/__system/graphics/sounds/audioTest.wav");
1184
}
1185
 
1186
void TQtSettings::on_horizontalSlider_Volume_valueChanged(int value)
1187
{
1188
    DECL_TRACER("TQtSettings::on_horizontalSlider_Volume_valueChanged(int value)");
1189
 
1190
    if (TConfig::getSystemVolume() == value)
1191
        return;
1192
 
1193
    TConfig::saveSystemVolume(value);
1194
}
1195
 
1196
void TQtSettings::on_horizontalSlider_Gain_valueChanged(int value)
1197
{
1198
    DECL_TRACER("TQtSettings::on_horizontalSlider_Gain_valueChanged(int value)");
1199
 
1200
    if (TConfig::getSystemGain() == value)
1201
        return;
1202
 
1203
    TConfig::saveSystemGain(value);
1204
}