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