Repository navigation
Expand file tree
/
Copy pathcsettingsdlg.cpp
More file actions
2610 lines (2288 loc) · 75.1 KB
/
Copy pathcsettingsdlg.cpp
File metadata and controls
2610 lines (2288 loc) · 75.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*********************** Information *************************\
| $HeadURL$
|
| Author: Jo2003
|
| Begin: 19.01.2010 / 15:43:08
|
| Last edited by: $Author$
|
| $Id$
\*************************************************************/
#include "csettingsdlg.h"
#include "ui_csettingsdlg.h"
#include <QRadioButton>
#include <QMessageBox>
#include "externals_inc.h"
/* -----------------------------------------------------------------\
| Method: CSettingsDlg / constructor
| Begin: 19.01.2010 / 15:43:38
| Author: Jo2003
| Description: construct dialog, init values
|
| Parameters: pointer to translater, pointer to parent widget
|
| Returns: --
\----------------------------------------------------------------- */
CSettingsDlg::CSettingsDlg(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::CSettingsDlg), bSettingsRead(false)
{
m_ui->setupUi(this);
pAccountInfo = NULL;
pShortApiServer = new CShortcutEx(QKeySequence("CTRL+ALT+A"), this);
pShortVerbLevel = new CShortcutEx(QKeySequence("CTRL+ALT+V"), this);
m_pStrStdDlg = new QStrStandardDlg(this, Qt::Tool);
m_pSpdTestDlg = new QSpeedTestDlg(this, Qt::Tool);
m_ulChgdMask = 0;
if (pShortApiServer)
{
connect(pShortApiServer, SIGNAL(activated()), this, SLOT(slotEnableApiServer()));
}
if (pShortVerbLevel)
{
connect(pShortVerbLevel, SIGNAL(activated()), this, SLOT(slotEnableVlcVerbLine()));
}
m_iServerBitrate = -1;
m_iServerTimeShift = -1;
// set company name for login data ...
QString s = m_ui->groupAccount->title();
m_ui->groupAccount->setTitle(s.arg(pCustomization->strVal("COMPANY_NAME")));
// fill in buffer values ...
vBuffs << 1.5 << 3 << 5 << 8 << 15 << 20 << 30 << 45 << 60 << 90;
qSort(vBuffs);
#ifdef ENABLE_AD_SWITCH
m_ui->checkAds->setEnabled(true);
#else
m_ui->checkAds->hide();
#endif // ENABLE_AD_SWITCH
#ifndef _HAS_VOD_MANAGER
/////////////////////////////////////////////////////////////////////////////
// Disable items if no VOD manager is supported //
/////////////////////////////////////////////////////////////////////////////
m_ui->groupChanMan->hide();
m_ui->groupVodMan->hide();
m_ui->vlSetPage->setStretch(0, 0); // hidden vod and channel manager
m_ui->vlSetPage->setStretch(1, 10); // parent code and erotik settings
m_ui->vlSetPage->setStretch(2, 5); // vertical spacer
m_ui->vlSetPage->setStretch(3, 0); // save button
// since parental manager is very reduced, there is no need
// to secure it using parental code ...
m_ui->stackedWidget->setCurrentIndex(1);
m_ui->btnSaveExitManager->setDisabled(true);
m_ui->btnSaveExitManager->hide();
#endif // _HAS_VOD_MANAGER
#ifdef _IS_OEM
if (m_ui->lineApiServer->isVisible())
{
m_ui->lineApiServer->setVisible(false);
}
#endif
#ifndef _EXT_EPG
m_ui->checkExtEPG->setVisible(false);
#endif // _EXT_EPG
// fill in values ...
readSettings();
}
/* -----------------------------------------------------------------\
| Method: ~CSettingsDlg / dstructor
| Begin: 19.01.2010 / 15:45:48
| Author: Jo2003
| Description: clean at destruction
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
CSettingsDlg::~CSettingsDlg()
{
delete m_ui;
}
/* -----------------------------------------------------------------\
| Method: setAccountInfo
| Begin: 06.06.2012
| Author: Jo2003
| Description: set account info struct
|
| Parameters: pointer to account info struct
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::setAccountInfo(const cparser::SAccountInfo *pInfo)
{
pAccountInfo = pInfo;
}
/* -----------------------------------------------------------------\
| Method: readSettings
| Begin: 13.09.2011 / 10:20
| Author: Jo2003
| Description: read settings from database
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::readSettings()
{
QString s;
int iErr;
QDir folder;
QStringList sl;
bool bUpdCase = false;
////////////////////////////////////////////////////////////////////////////////
// update case: Encrypted passwords ---->
// We added a simply password encryption. In case there is an update,
// we must make sure that the unencrypted password is converted
// into an encrypted one. To make our lives easier we'll use new
// keys for the encrypted passwords ...
if (((s = pDb->stringValue("Passwd")) != "")
&& (pDb->stringValue("PasswdEnc") == ""))
{
bUpdCase = true;
pDb->setPassword("PasswdEnc", s);
}
if (((s = pDb->stringValue("ErosPasswd")) != "")
&& (pDb->stringValue("ErosPasswdEnc") == ""))
{
pDb->setPassword("ErosPasswdEnc", s);
}
if (((s = pDb->stringValue("ProxyPasswd")) != "")
&& (pDb->stringValue("ProxyPasswdEnc") == ""))
{
pDb->setPassword("ProxyPasswdEnc", s);
}
// remove unused settings ...
if (bUpdCase)
{
pDb->removeSetting("Passwd");
pDb->removeSetting("ErosPasswd");
pDb->removeSetting("ProxyPasswd");
}
// update case: Encrypted passwords <----
////////////////////////////////////////////////////////////////////////////////
// line edits ...
m_ui->lineVLC->setText (pDb->stringValue("VLCPath"));
m_ui->lineDir->setText (pDb->stringValue("TargetDir"));
m_ui->lineUsr->setText (pDb->stringValue("User"));
m_ui->linePass->setText (pDb->password("PasswdEnc"));
m_ui->lineErosPass->setText(pDb->password("ErosPasswdEnc"));
m_ui->lineShutdown->setText(pDb->stringValue("ShutdwnCmd"));
m_ui->lineApiServer->setText(pDb->stringValue ("APIServer"));
m_ui->lineVlcVerbose->setText(pDb->stringValue ("libVlcLogLevel", &iErr));
if (iErr)
{
// default log level ...
m_ui->lineVlcVerbose->setText("0");
}
#ifdef Q_OS_WIN32
if (m_ui->lineShutdown->text() == "")
{
m_ui->lineShutdown->setText ("shutdown.exe -s -f -t 5");
}
#endif
if (m_ui->lineApiServer->text() == "")
{
m_ui->lineApiServer->setText (pCustomization->strVal("API_SERVER"));
}
// in case we use customization we should hide the API server name stuff ...
#ifdef _IS_OEM
m_ui->lineApiServer->setVisible(false);
#endif // _IS_OEM
m_ui->lineProxyHost->setText(pDb->stringValue("ProxyHost"));
m_ui->lineProxyPort->setText(pDb->stringValue("ProxyPort"));
m_ui->lineProxyUser->setText(pDb->stringValue("ProxyUser"));
m_ui->lineProxyPassword->setText(pDb->password("ProxyPasswdEnc"));
// check boxes ...
m_ui->useProxy->setCheckState((Qt::CheckState)pDb->intValue("UseProxy"));
m_ui->checkAdult->setCheckState((Qt::CheckState)pDb->intValue("AllowAdult"));
m_ui->checkHideToSystray->setCheckState((Qt::CheckState)pDb->intValue("TrayHide"));
m_ui->checkAskForName->setCheckState((Qt::CheckState)pDb->intValue("AskRecFile"));
m_ui->checkTranslit->setCheckState((Qt::CheckState)pDb->intValue("TranslitRecFile"));
m_ui->checkDetach->setCheckState((Qt::CheckState)pDb->intValue("DetachPlayer"));
m_ui->checkAdvanced->setCheckState((Qt::CheckState)pDb->intValue("AdvSet"));
m_ui->checkGPUAcc->setCheckState((Qt::CheckState)pDb->intValue("GPUAcc"));
m_ui->chkStrSrvAuto->setCheckState((Qt::CheckState)pDb->intValue("AutoStrSrv", &iErr));
// value doesn't exist in database ...
if (iErr)
{
// enable by default ...
m_ui->chkStrSrvAuto->setCheckState(Qt::Checked);
}
m_ui->checkAds->setCheckState((Qt::CheckState)pDb->intValue("AdsEnabled", &iErr));
// value doesn't exist in database ...
if (iErr)
{
// enable by default ...
m_ui->checkAds->setCheckState(Qt::Checked);
}
#ifdef _EXT_EPG
m_ui->checkExtEPG->setCheckState((Qt::CheckState)pDb->intValue("ExtEPG", &iErr));
// value doesn't exist in database ...
if (iErr)
{
// enable by default ...
m_ui->checkExtEPG->setCheckState(Qt::Checked);
}
#endif // _EXT_EPG
m_ui->check2ClicksToPlay->setCheckState((Qt::CheckState)pDb->intValue("2ClickPlay", &iErr));
// value doesn't exist in database ...
if (iErr)
{
// enable by default ...
m_ui->check2ClicksToPlay->setCheckState(Qt::Checked);
}
m_ui->tabWidget->setTabEnabled(2, pDb->intValue("AdvSet") ? true : false);
if (m_ui->checkAdvanced->isChecked())
{
vBuffs.prepend(0.5);
}
// fill player module box with available modules ...
folder.setPath(pFolders->getModDir());
m_ui->cbxPlayerMod->addItems(folder.entryList(QStringList("*.mod"), QDir::Files, QDir::Name));
// fill language box ...
folder.setPath(pFolders->getLangDir());
sl = folder.entryList(QStringList("lang_*.qm"), QDir::Files, QDir::Name);
// make sure english is part of list ...
sl.push_front("lang_en.qm");
QRegExp rx("^lang_([a-zA-Z]+).qm$");
for (int i = 0; i < sl.size(); i++)
{
// get out language from file name ...
if (sl.at(i).indexOf(rx) > -1)
{
m_ui->cbxLanguage->addItem(QIcon(QString(":/flags/%1").arg(rx.cap(1))), rx.cap(1));
}
}
// combo boxes ...
int iIdx;
iIdx = m_ui->cbxLanguage->findText(pDb->stringValue("Language"));
m_ui->cbxLanguage->setCurrentIndex((iIdx < 0) ? 0 : iIdx);
// fill buffer box with text in seconds, but data in msec ...
for (QVector<float>::const_iterator cit = vBuffs.constBegin(); cit != vBuffs.constEnd(); cit ++)
{
m_ui->cbxBufferSeconds->insertItem(vBuffs.count(), QString("%1").arg(*cit), (int)((*cit) * 1000.0));
}
iIdx = m_ui->cbxBufferSeconds->findData(pDb->intValue("HttpCache"));
m_ui->cbxBufferSeconds->setCurrentIndex((iIdx < 0) ? 0 : iIdx);
m_ui->cbxLogLevel->setCurrentIndex((int)pDb->intValue("LogLevel"));
// deinterlace mode ...
if ((s = pDb->stringValue("DeintlMode")) != "")
{
if ((iIdx = m_ui->cbxDeintlMode->findText(s)) != -1)
{
m_ui->cbxDeintlMode->setCurrentIndex(iIdx);
}
}
if ((s = pDb->stringValue("PlayerModule")) == "")
{
// no player module chosen yet ...
// default module in version 2.xx is 5_libvlc.mod
s = "5_libvlc.mod";
}
iIdx = m_ui->cbxPlayerMod->findText(s);
m_ui->cbxPlayerMod->setCurrentIndex((iIdx < 0) ? 0 : iIdx);
#ifndef Q_OS_MAC
// check if hide to systray is supported ...
// always disable on mac!
if (!QSystemTrayIcon::isSystemTrayAvailable())
#endif
{
m_ui->checkHideToSystray->setDisabled(true);
}
// font size ...
m_ui->spinBoxFontDelta->setValue(pDb->intValue("CustFontSz"));
// mark settings as read ...
bSettingsRead = true;
}
/* -----------------------------------------------------------------\
| Method: changeEvent
| Begin: 19.01.2010 / 15:46:10
| Author: Jo2003
| Description: catch event when language changes
|
| Parameters: pointer to event
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type())
{
case QEvent::LanguageChange:
{
// take care for combo boxes filled from
// out side ..
int i;
QVariantMap::ConstIterator cit;
QVariantMap vmRates;
QVariantMap vmServers;
QVariant vCurSrv;
QVariant vCurBr;
for (i = 0; i < m_ui->cbxBitRate->count(); i++)
{
vmRates.insert(m_ui->cbxBitRate->itemText(i), m_ui->cbxBitRate->itemData(i));
if (i == m_ui->cbxBitRate->currentIndex())
{
vCurBr = m_ui->cbxBitRate->itemData(i);
}
}
for (i = 0; i < m_ui->cbxStreamServer->count(); i++)
{
vmServers.insert(m_ui->cbxStreamServer->itemText(i), m_ui->cbxStreamServer->itemData(i));
if (i == m_ui->cbxStreamServer->currentIndex())
{
vCurSrv = m_ui->cbxStreamServer->itemData(i);
}
}
// save current index from comboboxes ...
int iLanIdx = m_ui->cbxLanguage->currentIndex();
int iLogIdx = m_ui->cbxLogLevel->currentIndex();
int iBufIdx = m_ui->cbxBufferSeconds->currentIndex();
int iModIdx = m_ui->cbxPlayerMod->currentIndex();
int iDeiIdx = m_ui->cbxDeintlMode->currentIndex();
m_ui->retranslateUi(this);
// clear content of stream server and bitrates ...
m_ui->cbxBitRate->clear();
m_ui->cbxStreamServer->clear();
// re-fill bitrates and stream servers ...
for (cit = vmRates.constBegin(); cit != vmRates.constEnd(); cit ++)
{
m_ui->cbxBitRate->addItem(cit.key(), cit.value());
}
for (cit = vmServers.constBegin(); cit != vmServers.constEnd(); cit ++)
{
m_ui->cbxStreamServer->addItem(cit.key(), cit.value());
}
// re-set index to comboboxes ...
m_ui->cbxLanguage->setCurrentIndex(iLanIdx);
m_ui->cbxLogLevel->setCurrentIndex(iLogIdx);
m_ui->cbxBufferSeconds->setCurrentIndex(iBufIdx);
m_ui->cbxPlayerMod->setCurrentIndex(iModIdx);
m_ui->cbxDeintlMode->setCurrentIndex(iDeiIdx);
m_ui->cbxBitRate->setCurrentIndex(m_ui->cbxBitRate->findData(vCurBr));
m_ui->cbxStreamServer->setCurrentIndex(m_ui->cbxStreamServer->findData(vCurSrv));
// set company name ...
QString s = m_ui->groupAccount->title();
m_ui->groupAccount->setTitle(s.arg(pCustomization->strVal("COMPANY_NAME")));
// stream standard
handleStrStdDeps();
}
break;
default:
break;
}
}
//---------------------------------------------------------------------------
//
//! \brief set some data triggered by show event
//
//! \author Jo2003
//! \date 16.09.2015
//
//! \param e [in] (QShowEvent*) event pointer
//---------------------------------------------------------------------------
void CSettingsDlg::showEvent(QShowEvent *e)
{
handleStrStdDeps();
QDialog::showEvent(e);
}
//---------------------------------------------------------------------------
//
//! \brief check if chosen bitrate and timeshift makes sende
//
//! \author Jo2003
//! \date 14.09.2014
//
//! \param iBitRate [in] (int) chosen bitrate
//! \param iTimeShift [in] (int) chosen timeshift
//! \param what [in] (const QString &) what to check
//
//! \return true -> emit changed signal; false -> don't emit
//---------------------------------------------------------------------------
bool CSettingsDlg::checkBitrateAndTimeShift(int iBitRate, int iTimeShift, const QString &what)
{
bool bSendSig = true;
if ((showInfo.playState() == IncPlay::PS_PLAY)
&& (showInfo.showType() == ShowInfo::Archive))
{
// get informaion about the channel from showinfo
int cid = showInfo.channelId();
bool bArchHasTs = false;
QString msg;
QMap<int, QString> brMap;
getBrMap(brMap);
if (pChanMap->contains(cid))
{
cparser::SChan chan = pChanMap->value(cid);
for (int i = 0; ((i < chan.vTs.count()) && !bArchHasTs); i ++)
{
if ((chan.vTs.at(i).iTimeShift == iTimeShift)
&& (chan.vTs.at(i).iBitRate == iBitRate))
{
bArchHasTs = true;
}
}
if (!bArchHasTs)
{
QMessageBox::StandardButton btn;
msg = tr("The archive for channel '%1' isn't available in your combination of bitrate (%2) and timeshift (%3)!")
.arg(showInfo.chanName()).arg(brMap[iBitRate]).arg(iTimeShift);
msg += "<br>";
msg += tr("Following table shows the available combinations:");
msg += pHtml->createBitrateTsTable(chan.vTs);
msg += "<br> <br>";
msg += pHtml->htmlTag("b", tr("Do you want to activate the new %1? The player will switch to 'Live' then.").arg(what));
btn = QMessageBox::information(this, tr("Information"), msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
if (btn == QMessageBox::No)
{
bSendSig = false;
}
else if (btn == QMessageBox::Yes)
{
// emulate Live show ...
showInfo.setShowType(ShowInfo::Live);
}
}
}
}
return bSendSig;
}
//---------------------------------------------------------------------------
//
//! \brief enable / disable bitrate and buffer settings dependend on
//! stream standard
//
//! \author Jo2003
//! \date 04.11.2015
//
//---------------------------------------------------------------------------
void CSettingsDlg::handleStrStdDeps()
{
// update button text
m_ui->pushStrStd->setText(m_pStrStdDlg->getCurrName());
// enable / disable different dialog items dependend on new stream standard...
QString ssVal = m_pStrStdDlg->getCurrVal();
// make fuzzy compare since in stream standard values might be some typos ...
if (ssVal.contains("dash", Qt::CaseInsensitive) || ssVal.contains("hls", Qt::CaseInsensitive))
{
m_ui->cbxBitRate->setEnabled(false);
m_ui->cbxBufferSeconds->setEnabled(false);
}
else
{
m_ui->cbxBitRate->setEnabled(true);
m_ui->cbxBufferSeconds->setEnabled(true);
}
}
/* -----------------------------------------------------------------\
| Method: slotEnableApiServer [slot]
| Begin: 02.02.2011 / 12:00
| Author: Jo2003
| Description: enable / disable API server line
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::slotEnableApiServer()
{
#ifdef _IS_OEM
if (!m_ui->lineApiServer->isVisible())
{
m_ui->lineApiServer->setVisible(true);
m_ui->lineApiServer->setEnabled(true);
}
else
{
m_ui->lineApiServer->setEnabled(false);
m_ui->lineApiServer->setVisible(false);
}
#else
if (m_ui->lineApiServer->isEnabled())
{
m_ui->lineApiServer->setEnabled(false);
}
else
{
m_ui->lineApiServer->setEnabled(true);
}
#endif // _IS_OEM
}
/* -----------------------------------------------------------------\
| Method: slotEnableVlcVerbLine [slot]
| Begin: 08.02.2012
| Author: Jo2003
| Description: enable / disable libVLC verbose level server line
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::slotEnableVlcVerbLine()
{
if (m_ui->lineVlcVerbose->isEnabled())
{
m_ui->lineVlcVerbose->setEnabled(false);
}
else
{
m_ui->lineVlcVerbose->setEnabled(true);
}
}
/* -----------------------------------------------------------------\
| Method: on_pushVLC_clicked
| Begin: 19.01.2010 / 15:46:47
| Author: Jo2003
| Description: open file dialog to choose vlc binary
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_pushVLC_clicked()
{
#ifdef WIN32
QString sFilter = tr("Executables (*.exe)");
#else
QString sFilter = tr("Executables (*)");
#endif
QString sVLCPath = QFileDialog::getOpenFileName(this, tr("VLC Media Player"),
m_ui->lineVLC->text(), sFilter);
#ifdef Q_OS_MAC
// on mac get executable file name from application bundle ...
QFileInfo fInfo (sVLCPath);
// quick 'n' dirty check for application bundle ...
if (fInfo.isDir() && (fInfo.suffix().toLower() == "app"))
{
QFile bundleInfo (sVLCPath + QString("/Contents/Info.plist"));
if (bundleInfo.open(QIODevice::ReadOnly))
{
QString infoString = bundleInfo.readAll();
QRegExp rx("<key>CFBundleExecutable</key>[^<]*<string>([^<]*)</string>");
// use reg. expressions instead of xml stream parser ...
if (rx.indexIn(infoString) > -1)
{
sVLCPath += QString("/Contents/MacOS/%1").arg(rx.cap(1));
}
}
}
#endif // Q_OS_MAC
m_ui->lineVLC->setText(sVLCPath);
}
/* -----------------------------------------------------------------\
| Method: on_pushDir_clicked
| Begin: 19.01.2010 / 15:47:19
| Author: Jo2003
| Description: open dir dialog to choose target dir for records
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_pushDir_clicked()
{
QString sTargetDir = QFileDialog::getExistingDirectory(this, tr("Target Folder"),
m_ui->lineDir->text());
m_ui->lineDir->setText(sTargetDir);
}
/* -----------------------------------------------------------------\
| Method: on_pushSave_clicked
| Begin: 19.01.2010 / 15:47:50
| Author: Jo2003
| Description: save all settings to ini file
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_pushSave_clicked()
{
checkChanges();
// line edits ...
pDb->setValue("VLCPath", m_ui->lineVLC->text());
pDb->setValue("User", m_ui->lineUsr->text());
pDb->setValue("TargetDir", m_ui->lineDir->text());
pDb->setPassword("PasswdEnc", m_ui->linePass->text());
pDb->setValue("ProxyHost", m_ui->lineProxyHost->text());
pDb->setValue("ProxyPort", m_ui->lineProxyPort->text());
pDb->setValue("ProxyUser", m_ui->lineProxyUser->text());
pDb->setPassword("ProxyPasswdEnc", m_ui->lineProxyPassword->text());
pDb->setValue("ShutdwnCmd", m_ui->lineShutdown->text());
pDb->setValue("APIServer", m_ui->lineApiServer->text());
pDb->setValue("libVlcLogLevel", m_ui->lineVlcVerbose->text());
// check boxes ...
pDb->setValue("UseProxy", (int)m_ui->useProxy->checkState());
pDb->setValue("TrayHide", (int)m_ui->checkHideToSystray->checkState());
pDb->setValue("AskRecFile", (int)m_ui->checkAskForName->checkState());
pDb->setValue("TranslitRecFile", (int)m_ui->checkTranslit->checkState());
pDb->setValue("DetachPlayer", (int)m_ui->checkDetach->checkState());
pDb->setValue("AdvSet", (int)m_ui->checkAdvanced->checkState());
pDb->setValue("2ClickPlay", (int)m_ui->check2ClicksToPlay->checkState());
pDb->setValue("GPUAcc", (int)m_ui->checkGPUAcc->checkState());
pDb->setValue("AdsEnabled", (int)m_ui->checkAds->checkState());
pDb->setValue("ExtEPG", (int)m_ui->checkExtEPG->checkState());
pDb->setValue("AutoStrSrv", (int)m_ui->chkStrSrvAuto->checkState());
#ifndef _HAS_VOD_MANAGER
/////////////////////////////////////////////////////////////////////////////
// no VOD manager is supported //
/////////////////////////////////////////////////////////////////////////////
// These values are normally stored when leaving parental manager.
// Since this button is disabled here we save it using the normal
// save button.
pDb->setValue("AllowAdult", (int)m_ui->checkAdult->checkState());
pDb->setPassword("ErosPasswdEnc", m_ui->lineErosPass->text());
#endif // _HAS_VOD_MANAGER
// combo boxes ...
pDb->setValue("Language", m_ui->cbxLanguage->currentText());
int idx = m_ui->cbxBufferSeconds->currentIndex();
pDb->setValue("HttpCache", m_ui->cbxBufferSeconds->itemData((idx == -1) ? 0 : idx).toInt());
pDb->setValue("LogLevel", m_ui->cbxLogLevel->currentIndex());
pDb->setValue("PlayerModule", m_ui->cbxPlayerMod->currentText());
pDb->setValue("DeintlMode", m_ui->cbxDeintlMode->currentText());
// short cuts ...
CShortCutGrabber *pGrab;
for (int i = 0; i < m_ui->tableShortCuts->rowCount(); i++)
{
pGrab = (CShortCutGrabber *)m_ui->tableShortCuts->cellWidget(i, 1);
pDb->setShortCut(pGrab->target(), pGrab->slot(), pGrab->shortCutString());
}
}
/* -----------------------------------------------------------------\
| Method: on_checkAdvanced_clicked
| Begin: 14.09.2011 / 08:45
| Author: Jo2003
| Description: enable advanced settings tab
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_checkAdvanced_clicked(bool checked)
{
m_ui->tabWidget->setTabEnabled(2, checked);
int iIdx = m_ui->cbxBufferSeconds->findData(500);
if (checked)
{
if (iIdx < 0)
{
m_ui->cbxBufferSeconds->insertItem(-1, QString("%1").arg(0.5), 500);
}
}
else
{
if (iIdx > -1)
{
m_ui->cbxBufferSeconds->removeItem(iIdx);
}
}
}
/* -----------------------------------------------------------------\
| Method: on_pushDelLogos_clicked
| Begin: 19.01.2010 / 15:48:39
| Author: Jo2003
| Description: delete all former downloaded channel logos
|
| Parameters: --
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_pushDelLogos_clicked()
{
// get directory, where logos are located ...
QDir logoDir(pFolders->getLogoDir());
// get all files inside this dir ...
QStringList fileList = logoDir.entryList(QDir::Files);
// delete all files inside logo dir ...
for (int i = 0; i < fileList.size(); i++)
{
QFile::remove(QString("%1/%2").arg(pFolders->getLogoDir()).arg(fileList[i]));
}
emit sigReloadLogos();
}
/* -----------------------------------------------------------------\
| Method: SetStreamServerCbx
| Begin: 28.02.2010 / 16:55:39
| Author: Jo2003
| Description: fill / mark combobox for stream server
|
| Parameters: ref. to server list, act server
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::SetStreamServerCbx (const QVector<cparser::SSrv> &vSrvList, const QString &sActSrv)
{
int iActIdx = 0;
int iCount = 0;
QVector<cparser::SSrv>::const_iterator cit;
if (!vSrvList.isEmpty())
{
m_ui->cbxStreamServer->clear();
// add all servers ...
for (cit = vSrvList.constBegin(); cit != vSrvList.constEnd(); cit++)
{
m_ui->cbxStreamServer->addItem((*cit).sName, QVariant((*cit).sIp));
if ((*cit).sIp == sActSrv)
{
iActIdx = iCount;
}
iCount ++;
}
// mark active server ...
m_ui->cbxStreamServer->setCurrentIndex(iActIdx);
}
// make sure the box isn't touched if there is only one entry ...
if ((vSrvList.count() < 2) || m_ui->chkStrSrvAuto->isChecked())
{
m_ui->cbxStreamServer->setDisabled(true);
}
else
{
m_ui->cbxStreamServer->setEnabled(true);
}
}
/* -----------------------------------------------------------------\
| Method: SetBitrateCbx
| Begin: 14.01.2011 / 14:15
| Author: Jo2003
| Description: fill / mark combobox for bitrate
|
| Parameters: ref. to bitrate map, act bitrate
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::SetBitrateCbx (const cparser::QBitratesMap &mBitRates, int iActrate)
{
int iActIdx = 0;
int iCount = 0;
cparser::QBitratesMap::const_iterator cit;
// backup bitrate ...
m_iServerBitrate = iActrate;
if (!mBitRates.isEmpty())
{
m_ui->cbxBitRate->clear();
// add all available bitrates ...
for (cit = mBitRates.constBegin(); cit != mBitRates.constEnd(); cit++)
{
m_ui->cbxBitRate->addItem(cit.value(), cit.key());
if (cit.key() == iActrate)
{
iActIdx = iCount;
}
iCount ++;
}
// mark active rate ...
m_ui->cbxBitRate->setCurrentIndex(iActIdx);
}
// make sure the box isn't touched if there is only one entry ...
if (mBitRates.count() < 2)
{
m_ui->cbxBitRate->setDisabled(true);
}
else
{
m_ui->cbxBitRate->setEnabled(true);
}
}
/* -----------------------------------------------------------------\
| Method: fillTimeShiftCbx
| Begin: 14.09.2011 / 09:30
| Author: Jo2003
| Description: fill / mark combobox for timeshift
|
| Parameters: ref. to timeshift vector, act timeshift
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::fillTimeShiftCbx(const QVector<int> &vVals, int iAct)
{
int iActIdx = 0;
int iCount = 0;
QVector<int>::const_iterator cit;
m_iServerTimeShift = iAct;
if (!vVals.isEmpty())
{
m_ui->cbxTimeShift->clear();
// add all available timeshift values ...
for (cit = vVals.constBegin(); cit != vVals.constEnd(); cit++)
{
m_ui->cbxTimeShift->addItem(QString::number(*cit), QVariant(*cit));
if (*cit == iAct)
{
iActIdx = iCount;
}
iCount ++;
}
// mark active rate ...
m_ui->cbxTimeShift->setCurrentIndex(iActIdx);
}
// make sure the box isn't touched if there is only one entry ...
if (vVals.count() < 2)
{
m_ui->cbxTimeShift->setDisabled(true);
}
else
{
m_ui->cbxTimeShift->setEnabled(true);
}
}
/* -----------------------------------------------------------------\
| Method: on_cbxStreamServer_activated
| Begin: 14.09.2011 / 09:40
| Author: Jo2003
| Description: signal set of stream server
|
| Parameters: current index
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_cbxStreamServer_activated(int index)
{
emit sigSetServer(m_ui->cbxStreamServer->itemData(index).toString());
}
/* -----------------------------------------------------------------\
| Method: on_cbxBitRate_activated
| Begin: 14.09.2011 / 09:40
| Author: Jo2003
| Description: set bitrate
|
| Parameters: actual index
|
| Returns: --
\----------------------------------------------------------------- */
void CSettingsDlg::on_cbxBitRate_activated(int index)
{
int br = m_ui->cbxBitRate->itemData(index).toInt();
int i;
bool bSendSig = true;
if ((showInfo.playState() == IncPlay::PS_PLAY)
&& (showInfo.showType() == ShowInfo::Archive))
{
// get informaion about the channel from showinfo
int cid = showInfo.channelId();
bool bArchHasBitrate = false;
QString msg;
QVector<int> brAvail;
QMap<int, QString> brMap;
// create map from values in cbx ...
getBrMap(brMap);