Subversion Repositories tpanel

Rev

Rev 118 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 118 Rev 120
Line 68... Line 68...
68
    ui->checkBox_LogProtocol->setCheckState(((mLogLevel & HLOG_PROTOCOL) == HLOG_PROTOCOL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
68
    ui->checkBox_LogProtocol->setCheckState(((mLogLevel & HLOG_PROTOCOL) == HLOG_PROTOCOL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
69
    ui->checkBox_LogAll->setCheckState(((mLogLevel & HLOG_ALL) == HLOG_ALL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
69
    ui->checkBox_LogAll->setCheckState(((mLogLevel & HLOG_ALL) == HLOG_ALL) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
70
 
70
 
71
    ui->checkBox_Format->setCheckState((TConfig::isLongFormat() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
71
    ui->checkBox_Format->setCheckState((TConfig::isLongFormat() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
72
    ui->checkBox_Scale->setCheckState((TConfig::getScale() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
72
    ui->checkBox_Scale->setCheckState((TConfig::getScale() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
-
 
73
#ifndef __ANDROID__
-
 
74
    ui->checkBox_Scale->setDisabled(true);
-
 
75
#endif
73
    ui->checkBox_Banner->setCheckState((TConfig::showBanner() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
76
    ui->checkBox_Banner->setCheckState((TConfig::showBanner() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
-
 
77
#ifdef __ANDROID__
-
 
78
    ui->checkBox_Banner->setDisabled(true);
-
 
79
#endif
-
 
80
    ui->checkBox_Toolbar->setCheckState((TConfig::getToolbarForce() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
74
 
81
 
75
    ui->lineEdit_SIPproxy->setText(TConfig::getSIPproxy().c_str());
82
    ui->lineEdit_SIPproxy->setText(TConfig::getSIPproxy().c_str());
76
    ui->spinBox_SIPport->setValue(TConfig::getSIPport());
83
    ui->spinBox_SIPport->setValue(TConfig::getSIPport());
77
    ui->lineEdit_SIPstun->setText(TConfig::getSIPstun().c_str());
84
    ui->lineEdit_SIPstun->setText(TConfig::getSIPstun().c_str());
78
    ui->lineEdit_SIPdomain->setText(TConfig::getSIPdomain().c_str());
85
    ui->lineEdit_SIPdomain->setText(TConfig::getSIPdomain().c_str());
79
    ui->lineEdit_SIPuser->setText(TConfig::getSIPuser().c_str());
86
    ui->lineEdit_SIPuser->setText(TConfig::getSIPuser().c_str());
80
    ui->lineEdit_SIPpassword->setText(TConfig::getSIPpassword().c_str());
87
    ui->lineEdit_SIPpassword->setText(TConfig::getSIPpassword().c_str());
81
    ui->checkBox_SIPenabled->setCheckState((TConfig::getSIPstatus() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
88
    ui->checkBox_SIPenabled->setCheckState((TConfig::getSIPstatus() ? Qt::CheckState::Checked : Qt::CheckState::Unchecked));
-
 
89
#ifdef __ANDROID__
-
 
90
    ui->tabWidget->setPalette(qt_fusionPalette());
-
 
91
    ui->tabCtrl->setPalette(qt_fusionPalette());
-
 
92
    ui->tabLog->setPalette(qt_fusionPalette());
-
 
93
    ui->tabSIP->setPalette(qt_fusionPalette());
-
 
94
    ui->tabView->setPalette(qt_fusionPalette());
82
 
95
#endif
83
    mInitRun = false;
96
    mInitRun = false;
84
    mSetChanged = false;
97
    mSetChanged = false;
85
}
98
}
86
 
99
 
87
TQtSettings::~TQtSettings()
100
TQtSettings::~TQtSettings()
88
{
101
{
89
	DECL_TRACER("TQtSettings::~TQtSettings()");
102
	DECL_TRACER("TQtSettings::~TQtSettings()");
90
	delete ui;
103
	delete ui;
91
}
104
}
92
 
105
 
-
 
106
#ifdef __ANDROID__
-
 
107
QPalette TQtSettings::qt_fusionPalette()
-
 
108
{
-
 
109
    QColor backGround(239, 239, 239);
-
 
110
    QColor light = backGround.lighter(150);
-
 
111
    QColor mid(backGround.darker(130));
-
 
112
    QColor midLight = mid.lighter(110);
-
 
113
    QColor base = Qt::white;
-
 
114
    QColor disabledBase(backGround);
-
 
115
    QColor dark = backGround.darker(150);
-
 
116
    QColor darkDisabled = QColor(209, 209, 209).darker(110);
-
 
117
    QColor text = Qt::black;
-
 
118
    QColor hightlightedText = Qt::white;
-
 
119
    QColor disabledText = QColor(190, 190, 190);
-
 
120
    QColor button = backGround;
-
 
121
    QColor shadow = dark.darker(135);
-
 
122
    QColor disabledShadow = shadow.lighter(150);
-
 
123
 
-
 
124
    QPalette fusionPalette(Qt::black,backGround,light,dark,mid,text,base);
-
 
125
    fusionPalette.setBrush(QPalette::Midlight, midLight);
-
 
126
    fusionPalette.setBrush(QPalette::Button, button);
-
 
127
    fusionPalette.setBrush(QPalette::Shadow, shadow);
-
 
128
    fusionPalette.setBrush(QPalette::HighlightedText, hightlightedText);
-
 
129
 
-
 
130
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Text, disabledText);
-
 
131
    fusionPalette.setBrush(QPalette::Disabled, QPalette::WindowText, disabledText);
-
 
132
    fusionPalette.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledText);
-
 
133
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Base, disabledBase);
-
 
134
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Dark, darkDisabled);
-
 
135
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Shadow, disabledShadow);
-
 
136
 
-
 
137
    fusionPalette.setBrush(QPalette::Active, QPalette::Highlight, QColor(48, 140, 198));
-
 
138
    fusionPalette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(48, 140, 198));
-
 
139
    fusionPalette.setBrush(QPalette::Disabled, QPalette::Highlight, QColor(145, 145, 145));
-
 
140
    return fusionPalette;
-
 
141
}
-
 
142
#endif
-
 
143
 
93
void TQtSettings::on_kiconbutton_logFile_clicked()
144
void TQtSettings::on_kiconbutton_logFile_clicked()
94
{
145
{
95
    DECL_TRACER("TQtSettings::on_kiconbutton_logFile_clicked()");
146
    DECL_TRACER("TQtSettings::on_kiconbutton_logFile_clicked()");
96
 
147
 
97
    std::string pt = TConfig::getLogFile();
148
    std::string pt = TConfig::getLogFile();
Line 156... Line 207...
156
        mSetChanged = true;
207
        mSetChanged = true;
157
        TConfig::saveLogFile(fname.toStdString());
208
        TConfig::saveLogFile(fname.toStdString());
158
    }
209
    }
159
}
210
}
160
 
211
 
-
 
212
template<typename T>
-
 
213
void TQtSettings::scaleObject(T *obj)
-
 
214
{
-
 
215
    DECL_TRACER("TQtSettings::scaleObject(T *obj)");
-
 
216
 
-
 
217
    QSize size = obj->size();
-
 
218
    size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
-
 
219
    obj->resize(size);
-
 
220
    QRect rect = obj->geometry();
-
 
221
    obj->move(scale(rect.left()), scale(rect.top()));
-
 
222
}
-
 
223
 
161
void TQtSettings::doResize()
224
void TQtSettings::doResize()
162
{
225
{
163
    DECL_TRACER("TQtSettings::doResize()");
226
    DECL_TRACER("TQtSettings::doResize()");
164
 
227
 
165
    // The main dialog window
228
    // The main dialog window
Line 184... Line 247...
184
    for (iter = childs.begin(); iter != childs.end(); ++iter)
247
    for (iter = childs.begin(); iter != childs.end(); ++iter)
185
    {
248
    {
186
        QString name = iter.i->t()->objectName();
249
        QString name = iter.i->t()->objectName();
187
        QObject *obj = iter.i->t();
250
        QObject *obj = iter.i->t();
188
 
251
 
189
        if (name.startsWith("kiconbutton"))
252
        if (name.startsWith("tabWidget"))
190
        {
253
        {
191
            QToolButton *bt = dynamic_cast<QToolButton *>(obj);
254
            scaleObject(dynamic_cast<QTabWidget *>(obj));
-
 
255
 
192
            size = bt->size();
256
            QObjectList childsTab = obj->children();
193
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
-
 
194
            bt->resize(size);
-
 
195
            rect = bt->geometry();
257
            QList<QObject *>::Iterator iterTab;
196
            bt->move(scale(rect.left()), scale(rect.top()));
-
 
197
        }
258
 
198
        else if (name.startsWith("tabWidget"))
259
            for (iterTab = childsTab.begin(); iterTab != childsTab.end(); ++iterTab)
199
        {
260
            {
200
            QTabWidget *bt = dynamic_cast<QTabWidget *>(obj);
261
                QString namet = iterTab.i->t()->objectName();
201
            size = bt->size();
262
                QObject *objt = iterTab.i->t();
-
 
263
 
202
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
264
                if (namet.startsWith("qt_tabwidget_stackedwidget"))
203
            bt->resize(size);
265
                {
204
            rect = bt->geometry();
266
                    QObjectList childsStack = objt->children();
205
            bt->move(scale(rect.left()), scale(rect.top()));
267
                    QList<QObject *>::Iterator iterStack;
206
        }
268
 
207
        else if (name.startsWith("tab"))
269
                    for (iterStack = childsStack.begin(); iterStack != childsStack.end(); ++iterStack)
208
        {
270
                    {
209
            QWidget *bt = dynamic_cast<QWidget *>(obj);
271
                        QObjectList tabStack = iterStack.i->t()->children();
210
            size = bt->size();
272
                        QList<QObject *>::Iterator tabIter;
-
 
273
 
211
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
274
                        for (tabIter = tabStack.begin(); tabIter != tabStack.end(); ++tabIter)
212
            bt->resize(size);
275
                        {
213
            rect = bt->geometry();
276
                            QString n = tabIter.i->t()->objectName();
214
            bt->move(scale(rect.left()), scale(rect.top()));
277
                            QObject *on = tabIter.i->t();
215
        }
278
 
216
        else if (name.startsWith("checkBox"))
279
                            if (n.startsWith("kiconbutton"))
217
        {
-
 
218
            QCheckBox *bt = dynamic_cast<QCheckBox *>(obj);
280
                                scaleObject(dynamic_cast<QToolButton *>(on));
-
 
281
                            else if (n.startsWith("checkBox"))
219
            size = bt->size();
282
                            {
220
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
283
                                scaleObject(dynamic_cast<QCheckBox *>(on));
221
            bt->resize(size);
284
#ifdef __ANDROID__
222
            rect = bt->geometry();
285
                                QCheckBox *cb = dynamic_cast<QCheckBox *>(on);
223
            bt->move(scale(rect.left()), scale(rect.top()));
286
                                cb->setPalette(qt_fusionPalette());
224
        }
287
#endif
-
 
288
                            }
225
        else if (name.startsWith("lineEdit"))
289
                            else if (n.startsWith("lineEdit"))
226
        {
-
 
227
            QLineEdit *bt = dynamic_cast<QLineEdit *>(obj);
290
                                scaleObject(dynamic_cast<QLineEdit *>(on));
228
            size = bt->size();
291
                            else if (n.startsWith("spinBox"))
229
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
292
                                scaleObject(dynamic_cast<QSpinBox *>(on));
230
            bt->resize(size);
293
                            else if (n.startsWith("label"))
231
            rect = bt->geometry();
294
                            {
232
            bt->move(scale(rect.left()), scale(rect.top()));
295
                                scaleObject(dynamic_cast<QLabel *>(on));
233
        }
296
#ifdef __ANDROID__
234
        else if (name.startsWith("spinBox"))
297
                                QLabel *lb = dynamic_cast<QLabel *>(on);
235
        {
-
 
236
            QSpinBox *bt = dynamic_cast<QSpinBox *>(obj);
298
                                lb->setPalette(qt_fusionPalette());
-
 
299
#endif
237
            size = bt->size();
300
                            }
238
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
-
 
239
            bt->resize(size);
301
                        }
240
            rect = bt->geometry();
302
                    }
241
            bt->move(scale(rect.left()), scale(rect.top()));
-
 
242
        }
303
 
243
        else if (name.startsWith("label"))
304
//                    if (namet.startsWith("tab"))
244
        {
-
 
245
            QLabel *lb = dynamic_cast<QLabel *>(obj);
305
//                        scaleObject(dynamic_cast<QWidget *>(objt));
246
            size = lb->size();
306
                }
247
            size.scale(scale(size.width()), scale(size.height()), Qt::KeepAspectRatio);
-
 
248
            lb->resize(size);
307
            }
249
            rect = lb->geometry();
-
 
250
            lb->move(scale(rect.left()), scale(rect.top()));
-
 
251
        }
308
        }
-
 
309
        else if (name.startsWith("buttonBox"))
-
 
310
            scaleObject(dynamic_cast<QDialogButtonBox *>(obj));
252
    }
311
    }
253
}
312
}
254
 
313
 
255
void TQtSettings::on_lineEdit_logFile_textChanged(const QString &arg1)
314
void TQtSettings::on_lineEdit_logFile_textChanged(const QString &arg1)
256
{
315
{
Line 338... Line 397...
338
 
397
 
339
    mSetChanged = true;
398
    mSetChanged = true;
340
    TConfig::saveBanner(!checked);
399
    TConfig::saveBanner(!checked);
341
}
400
}
342
 
401
 
-
 
402
void TQtSettings::on_checkBox_Toolbar_toggled(bool checked)
-
 
403
{
-
 
404
    DECL_TRACER("TQtSettings::on_checkBox_Toolbar_toggled(bool checked)");
-
 
405
 
-
 
406
    if (TConfig::getToolbarForce() == checked)
-
 
407
        return;
-
 
408
 
-
 
409
    mSetChanged = true;
-
 
410
    TConfig::saveToolbarForce(checked);
-
 
411
}
-
 
412
 
343
void TQtSettings::on_checkBox_Profiling_toggled(bool checked)
413
void TQtSettings::on_checkBox_Profiling_toggled(bool checked)
344
{
414
{
345
    DECL_TRACER("TQtSettings::on_checkBox_Profiling_toggled(bool checked)");
415
    DECL_TRACER("TQtSettings::on_checkBox_Profiling_toggled(bool checked)");
346
 
416
 
347
    if (TConfig::getProfiling() == checked)
417
    if (TConfig::getProfiling() == checked)