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