summaryrefslogtreecommitdiffstats
path: root/abs/core/mythtv/stable-30/mythtv/revertQTsettingsForMythinstall.patch
blob: a760da857d7128861b56564bc9e6df681f3b4af4 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
diff --git a/mythtv/libs/libmyth/libmyth.pro b/mythtv/libs/libmyth/libmyth.pro
index 592437f3e6..cb936c0500 100644
--- a/mythtv/libs/libmyth/libmyth.pro
+++ b/mythtv/libs/libmyth/libmyth.pro
@@ -128,8 +128,8 @@ LIBS += -L../libmythservicecontracts         -lmythservicecontracts-$${LIBVERSIO
 # Install headers so that plugins can compile independently
 inc.path = $${PREFIX}/include/mythtv/
 inc.files  = dialogbox.h mythcontext.h
-inc.files += mythwidgets.h remotefile.h volumecontrol.h
-inc.files += mythdialogs.h
+inc.files += mythwidgets.h remotefile.h oldsettings.h volumecontrol.h
+inc.files += settings.h mythdialogs.h
 inc.files += audio/audiooutput.h audio/audiosettings.h
 inc.files += audio/audiooutputsettings.h audio/audiooutpututil.h
 inc.files += audio/audioconvert.h
diff --git a/mythtv/libs/libmyth/mythdialogs.cpp b/mythtv/libs/libmyth/mythdialogs.cpp
index 734ece2f84..f3c08ff525 100644
--- a/mythtv/libs/libmyth/mythdialogs.cpp
+++ b/mythtv/libs/libmyth/mythdialogs.cpp
@@ -72,6 +72,7 @@ MythDialog::MythDialog(MythMainWindow *parent, const char *name, bool setsize)
     {
         move(0, 0);
         setFixedSize(QSize(screenwidth, screenheight));
+        GetMythUI()->ThemeWidget(this);
     }
 
     setAutoFillBackground(true);
@@ -313,6 +314,8 @@ MythPopupBox::MythPopupBox(MythMainWindow *parent, bool graphicPopup,
         palette.setColor(backgroundRole(), popupBackground);
         setPalette(palette);
     }
+    else
+        GetMythUI()->ThemeWidget(this);
 
     QPalette palette;
     palette.setColor(foregroundRole(), popupHighlight);
@@ -805,6 +808,8 @@ MythProgressDialog::MythProgressDialog(
 
     setFont(GetMythUI()->GetMediumFont());
 
+    GetMythUI()->ThemeWidget(this);
+
     int yoff = screenheight / 3;
     int xoff = screenwidth / 10;
     setGeometry(xoff, yoff, screenwidth - xoff * 2, yoff);
diff --git a/mythtv/libs/libmythbase/libmythbase.pro b/mythtv/libs/libmythbase/libmythbase.pro
index ea066af67e..64fae06d27 100644
--- a/mythtv/libs/libmythbase/libmythbase.pro
+++ b/mythtv/libs/libmythbase/libmythbase.pro
@@ -12,7 +12,7 @@ QMAKE_CLEAN += $(TARGET) $(TARGETA) $(TARGETD) $(TARGET0) $(TARGET1) $(TARGET2)
 # Input
 HEADERS += mthread.h mthreadpool.h
 HEADERS += mythsocket.h mythsocket_cb.h
-HEADERS += mythbaseexp.h mythdbcon.h mythdb.h mythdbparams.h
+HEADERS += mythbaseexp.h mythdbcon.h mythdb.h mythdbparams.h oldsettings.h
 HEADERS += verbosedefs.h mythversion.h compat.h mythconfig.h
 HEADERS += mythobservable.h mythevent.h
 HEADERS += mythtimer.h mythsignalingtimer.h mythdirs.h exitcodes.h
@@ -38,7 +38,7 @@ HEADERS += mythsorthelper.h
 
 SOURCES += mthread.cpp mthreadpool.cpp
 SOURCES += mythsocket.cpp
-SOURCES += mythdbcon.cpp mythdb.cpp mythdbparams.cpp
+SOURCES += mythdbcon.cpp mythdb.cpp mythdbparams.cpp oldsettings.cpp
 SOURCES += mythobservable.cpp mythevent.cpp
 SOURCES += mythtimer.cpp mythsignalingtimer.cpp mythdirs.cpp
 SOURCES += lcddevice.cpp mythstorage.cpp remotefile.cpp
diff --git a/mythtv/libs/libmythbase/oldsettings.cpp b/mythtv/libs/libmythbase/oldsettings.cpp
new file mode 100644
index 0000000000..8bdd106551
--- /dev/null
+++ b/mythtv/libs/libmythbase/oldsettings.cpp
@@ -0,0 +1,167 @@
+
+/***************************************************************************
+                          settings.cpp  -  description
+                             -------------------
+    begin                : Tuesday, October 03, 2000
+    copyright            : (C) 2000 by Relatable, LLC
+    written by           : Sean Ward
+    email                : sward@relatable.com
+ ***************************************************************************/
+
+#include "compat.h"
+
+#include <cstdlib>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+
+#include <fstream>
+#include <map>
+#include <string>
+using namespace std;
+
+#include <QDir>
+
+#include "oldsettings.h"
+#include "mythlogging.h"
+
+Settings::Settings(QString strSettingsFile)
+{
+    if (strSettingsFile.length() == 0)
+        strSettingsFile = "settings.txt";
+    m_pSettings = new map<QString, QString>;
+
+    ReadSettings(strSettingsFile);
+}
+
+Settings::~Settings()
+{
+    delete m_pSettings;
+}
+
+// Setting retrieval functions
+/** Generic Setting Retrieval functions */
+QString Settings::GetSetting(QString strSetting, QString defaultvalue)
+{
+    map<QString, QString>::iterator i;
+    if ((!m_pSettings->empty()) &&
+        ((i = m_pSettings->find(strSetting)) != m_pSettings->end()))
+    {
+        return (*i).second;
+    }
+    return defaultvalue; // property doesn't exist
+}
+
+/** Generic Setting Retrieval function for numeric values */
+int Settings::GetNumSetting(QString strSetting, int defaultvalue)
+{
+    int retval = defaultvalue;
+    map<QString, QString>::iterator i;
+    if ((!m_pSettings->empty()) &&
+        ((i = m_pSettings->find(strSetting)) != m_pSettings->end()))
+    {
+        bool ok = false;
+        retval = (*i).second.toInt(&ok);
+        if (!ok)
+            retval = defaultvalue;
+    }
+    return retval; // property doesn't exist
+}
+
+/** Generic Setting Retrieval function for float values */
+float Settings::GetFloatSetting(QString strSetting, float defaultvalue)
+{
+    float retval = defaultvalue;
+
+    map<QString, QString>::iterator i;
+    if ((!m_pSettings->empty()) &&
+        ((i = m_pSettings->find(strSetting)) != m_pSettings->end()))
+    {
+        bool ok = false;
+        retval = ((*i).second).toFloat(&ok);
+        if (!ok)
+            retval = defaultvalue;
+    }
+
+    return retval; // property doesn't exist
+}
+
+// Setting Setting functions
+/** Generic Setting Setting function */
+void Settings::SetSetting(QString strSetting, QString strNewVal)
+{
+    (*m_pSettings)[strSetting] = strNewVal;
+}
+
+/** Generic Setting Setting function for int values */
+void Settings::SetSetting(QString strSetting, int nNewVal)
+{
+    QString tmp;
+    tmp = tmp.setNum(nNewVal);
+    (*m_pSettings)[strSetting] = tmp;
+}
+
+/** Generic Setting Setting function for float values */
+void Settings::SetSetting(QString strSetting, float fNewVal)
+{
+    QString tmp;
+    tmp = tmp.setNum(fNewVal);
+    (*m_pSettings)[strSetting] = tmp;
+}
+
+bool Settings::LoadSettingsFiles(QString filename, QString prefix,
+                                 QString confdir)
+{
+    int result = ReadSettings(prefix + "/share/mythtv/" + filename);
+    result += ReadSettings(prefix + "/etc/mythtv/" + filename);
+    result += ReadSettings(confdir + '/' + filename);
+    result += ReadSettings("./" + filename);
+    return result;
+}
+
+bool Settings::ReadSettings(QString pszFile)
+{
+    QString LOC = "(old)Settings::ReadSettings(" + pszFile + ") - ";
+    fstream fin(pszFile.toLocal8Bit().constData(), ios::in);
+
+    if (!fin.is_open())
+    {
+        LOG(VB_FILE, LOG_ERR, LOC + "No such file " + pszFile);
+        return false;
+    }
+
+    string strLine;
+    QString strKey;
+    QString strVal;
+    QString strType;
+    QString line;
+    int nSplitPoint = 0;
+
+    while(!fin.eof())
+    {
+        getline(fin,strLine);
+        line = strLine.c_str();
+
+        if ((line[0] != '#') && (!line.isEmpty()))
+        {
+            nSplitPoint = strLine.find('=');
+            if (nSplitPoint != -1)
+            {
+                strType = line.mid(0, 3);
+
+                if (strType == "flt" || strType == "int" || strType == "str")
+                    strKey = line.mid(4, nSplitPoint - 4);
+                else
+                    strKey = line.mid(0, nSplitPoint);
+
+                strVal = line.mid(nSplitPoint + 1, strLine.size());
+
+                (*m_pSettings)[strKey] = strVal;
+
+                LOG(VB_FILE, LOG_DEBUG, LOC + QString("'%1' = '%2'.")
+                        .arg(strKey) .arg(strVal));
+            }
+        }
+    } // wend
+    return true;
+}
diff --git a/mythtv/libs/libmythbase/oldsettings.h b/mythtv/libs/libmythbase/oldsettings.h
new file mode 100644
index 0000000000..85157b599c
--- /dev/null
+++ b/mythtv/libs/libmythbase/oldsettings.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+                          settings.h  -  description
+                             -------------------
+    begin                : Tuesday, October 03, 2000
+    copyright            : (C) 2000 by Relatable, LLC
+    written by           : Sean Ward
+    email                : sward@relatable.com
+ ***************************************************************************/
+
+#ifndef OLDSETTINGS_H
+#define OLDSETTINGS_H
+
+#include <QString>
+#include <QPixmap>
+
+#include "mythbaseexp.h"
+
+/**This class contains configuration information.
+  *This object is threadsafe.
+  *@author Sean Ward
+  */
+
+class QPixmap;
+class MBASE_PUBLIC Settings {
+public:
+        explicit Settings(QString strSettingFile = "settings.txt");
+        ~Settings();
+
+        // Setting retrieval functions
+        /** Generic Setting Retrieval functions */
+        QString GetSetting(QString strSetting, QString defaultvalue = "");
+        /** Generic Setting Retrieval function for numeric values */
+        int GetNumSetting(QString strSetting, int defaultvalue = 0);
+        /** Generic Setting Retrieval function for float values */
+        float GetFloatSetting(QString strSetting, float defaultvalue = 0);
+
+        // Setting Setting functions
+        /** Generic Setting Setting function */
+        void SetSetting(QString strSetting, QString strNewVal);
+        /** Generic Setting Setting function for int values */
+        void SetSetting(QString strSetting, int nNewVal);
+        /** Generic Setting Setting function for float values */
+        void SetSetting(QString strSetting, float fNewVal);
+
+        bool LoadSettingsFiles(QString filename, QString prefix, QString confdir);
+        /** parse settings file */
+        bool ReadSettings(QString pszFile);
+private: // Private attributes
+        /** main property-value mapping for strings */
+        std::map<QString, QString> *m_pSettings;
+};
+
+void LoadSettingsFile(Settings *settings, QString filename);
+
+#endif
diff --git a/mythtv/libs/libmythui/mythmainwindow.cpp b/mythtv/libs/libmythui/mythmainwindow.cpp
index f7aa3d0ac1..16ce84a553 100644
--- a/mythtv/libs/libmythui/mythmainwindow.cpp
+++ b/mythtv/libs/libmythui/mythmainwindow.cpp
@@ -1029,6 +1029,12 @@ void MythMainWindow::Init(QString forcedpainter, bool mayReInit)
     setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
     resize(d->screenwidth, d->screenheight);
 
+    GetMythUI()->ThemeWidget(this);
+#ifdef Q_OS_MAC
+    // QPalette inheritance appears broken on mac, so there's no point setting the palette
+    // to the top widget each time. Instead we apply the default palette to the whole application
+    qApp->setPalette(palette());
+#endif
     Show();
 
     if (!GetMythDB()->GetBoolSetting("HideMouseCursor", false))
diff --git a/mythtv/libs/libmythui/myththemebase.cpp b/mythtv/libs/libmythui/myththemebase.cpp
index 27cb93c567..d9559a9ff8 100644
--- a/mythtv/libs/libmythui/myththemebase.cpp
+++ b/mythtv/libs/libmythui/myththemebase.cpp
@@ -9,6 +9,8 @@
 #include "mythdirs.h"
 #include "mythuihelper.h"
 
+#include "oldsettings.h" // Deprecated
+
 class MythThemeBasePrivate
 {
   public:
@@ -37,6 +39,9 @@ MythThemeBase::~MythThemeBase()
 
 void MythThemeBase::Reload(void)
 {
+    MythMainWindow *mainWindow = GetMythMainWindow();
+    QRect uiSize = mainWindow->GetUIScreenRect();
+
     GetGlobalFontMap()->Clear();
     XMLParseBase::ClearGlobalObjectStore();
     GetGlobalFontManager()->ReleaseFonts("UI");
@@ -50,7 +55,14 @@ void MythThemeBase::Reload(void)
     if (!XMLParseBase::CopyWindowFromBase("backgroundwindow",
                                           d->backgroundscreen))
     {
-        // Nada. All themes should use the MythUI code now.
+        QString backgroundname = GetMythUI()->qtconfig()->GetSetting("BackgroundPixmap");
+        backgroundname = GetMythUI()->GetThemeDir() + backgroundname;
+
+        d->backimg = new MythUIImage(backgroundname, d->backgroundscreen,
+                                     "backimg");
+        d->backimg->SetPosition(mainWindow->NormPoint(QPoint(0, 0)));
+        d->backimg->SetSize(uiSize.width(), uiSize.height());
+        d->backimg->Load();
     }
 
     d->background->AddScreen(d->backgroundscreen, false);
@@ -59,6 +71,7 @@ void MythThemeBase::Reload(void)
 void MythThemeBase::Init(void)
 {
     MythMainWindow *mainWindow = GetMythMainWindow();
+    QRect uiSize = mainWindow->GetUIScreenRect();
 
     d->background = new MythScreenStack(mainWindow, "background");
     d->background->DisableEffects();
@@ -71,7 +84,14 @@ void MythThemeBase::Init(void)
     if (!XMLParseBase::CopyWindowFromBase("backgroundwindow",
                                           d->backgroundscreen))
     {
-        // Nada. All themes should use the MythUI code now.
+        QString backgroundname = GetMythUI()->qtconfig()->GetSetting("BackgroundPixmap");
+        backgroundname = GetMythUI()->GetThemeDir() + backgroundname;
+
+        d->backimg = new MythUIImage(backgroundname, d->backgroundscreen,
+                                     "backimg");
+        d->backimg->SetPosition(mainWindow->NormPoint(QPoint(0, 0)));
+        d->backimg->SetSize(uiSize.width(), uiSize.height());
+        d->backimg->Load();
     }
 
     d->background->AddScreen(d->backgroundscreen, false);
diff --git a/mythtv/libs/libmythui/mythuihelper.cpp b/mythtv/libs/libmythui/mythuihelper.cpp
index 95eaacff66..0cb2d81d86 100644
--- a/mythtv/libs/libmythui/mythuihelper.cpp
+++ b/mythtv/libs/libmythui/mythuihelper.cpp
@@ -24,6 +24,7 @@
 #include "mythdirs.h"
 #include "mythlogging.h"
 #include "mythdownloadmanager.h"
+#include "oldsettings.h"
 #include "mythdb.h"
 #include "remotefile.h"
 #include "mythcorecontext.h"
@@ -103,6 +104,8 @@ public:
     double GetPixelAspectRatio(void);
     void WaitForScreenChange(void) const;
 
+    Settings *m_qtThemeSettings;   ///< Text/button/background colours, etc
+
     bool      m_themeloaded;       ///< Do we have a palette and pixmap to use?
     QString   m_menuthemepathname;
     QString   m_themepathname;
@@ -174,7 +177,8 @@ int MythUIHelperPrivate::w_override = -1;
 int MythUIHelperPrivate::h_override = -1;
 
 MythUIHelperPrivate::MythUIHelperPrivate(MythUIHelper *p)
-    : m_themeloaded(false),
+    : m_qtThemeSettings(new Settings()),
+      m_themeloaded(false),
       m_wmult(1.0), m_hmult(1.0), m_pixelAspectRatio(-1.0),
       m_xbase(0), m_ybase(0), m_height(0), m_width(0),
       m_baseWidth(800), m_baseHeight(600), m_isWide(false),
@@ -208,6 +212,7 @@ MythUIHelperPrivate::~MythUIHelperPrivate()
 
     delete m_cacheLock;
     delete m_imageThreadPool;
+    delete m_qtThemeSettings;
     delete screensaver;
 
     if (display_res)
@@ -500,6 +505,10 @@ void MythUIHelper::LoadQtConfig(void)
     // Note the possibly changed screen settings
     d->GetScreenBounds();
 
+    delete d->m_qtThemeSettings;
+
+    d->m_qtThemeSettings = new Settings;
+
     qApp->setStyle("Windows");
 
     QString themename = GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME);
@@ -525,6 +534,11 @@ void MythUIHelper::LoadQtConfig(void)
     d->m_themepathname = themedir + '/';
     d->m_searchPaths.clear();
 
+    QString qtlook = "qtlook.txt";
+    if (!FindThemeFile(qtlook))
+        LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to find any qtlook.txt in the theme search path");
+
+    d->m_qtThemeSettings->ReadSettings(qtlook);
     d->m_themeloaded = false;
 
     themename = GetMythDB()->GetSetting("MenuTheme", "defaultmenu");
@@ -535,6 +549,11 @@ void MythUIHelper::LoadQtConfig(void)
     d->m_menuthemepathname = FindMenuThemeDir(themename);
 }
 
+Settings *MythUIHelper::qtconfig(void)
+{
+    return d->m_qtThemeSettings;
+}
+
 void MythUIHelper::UpdateImageCache(void)
 {
     QMutexLocker locker(d->m_cacheLock);
@@ -1364,6 +1383,114 @@ QList<ThemeInfo> MythUIHelper::GetThemes(ThemeType type)
     return themeList;
 }
 
+void MythUIHelper::SetPalette(QWidget *widget)
+{
+    QPalette pal = widget->palette();
+
+    const QString names[] = { "Foreground", "Button", "Light", "Midlight",
+                              "Dark", "Mid", "Text", "BrightText", "ButtonText",
+                              "Base", "Background", "Shadow", "Highlight",
+                              "HighlightedText"
+                            };
+
+    QString type = "Active";
+
+    for (int i = 0; i < 13; i++)
+    {
+        QString color = d->m_qtThemeSettings->GetSetting(type + names[i]);
+
+        if (!color.isEmpty())
+            pal.setColor(QPalette::Active, (QPalette::ColorRole) i,
+                         createColor(color));
+    }
+
+    type = "Disabled";
+
+    for (int i = 0; i < 13; i++)
+    {
+        QString color = d->m_qtThemeSettings->GetSetting(type + names[i]);
+
+        if (!color.isEmpty())
+            pal.setColor(QPalette::Disabled, (QPalette::ColorRole) i,
+                         createColor(color));
+    }
+
+    type = "Inactive";
+
+    for (int i = 0; i < 13; i++)
+    {
+        QString color = d->m_qtThemeSettings->GetSetting(type + names[i]);
+
+        if (!color.isEmpty())
+            pal.setColor(QPalette::Inactive, (QPalette::ColorRole) i,
+                         createColor(color));
+    }
+
+    widget->setPalette(pal);
+}
+
+void MythUIHelper::ThemeWidget(QWidget *widget)
+{
+    if (d->m_themeloaded)
+    {
+        widget->setPalette(d->m_palette);
+        return;
+    }
+
+    SetPalette(widget);
+    d->m_palette = widget->palette();
+
+    QPixmap *bgpixmap = NULL;
+
+    if (!d->m_qtThemeSettings->GetSetting("BackgroundPixmap").isEmpty())
+    {
+        QString pmapname = d->m_qtThemeSettings->GetSetting("BackgroundPixmap");
+        if (!FindThemeFile(pmapname))
+            LOG(VB_GENERAL, LOG_ERR, QString(LOC + "Failed to find '%1' in the theme search path")
+                .arg(d->m_qtThemeSettings->GetSetting("BackgroundPixmap")));
+
+        bgpixmap = LoadScalePixmap(pmapname);
+
+        if (bgpixmap)
+        {
+            d->m_palette.setBrush(widget->backgroundRole(), QBrush(*bgpixmap));
+            widget->setPalette(d->m_palette);
+        }
+    }
+    else if (!d->m_qtThemeSettings
+             ->GetSetting("TiledBackgroundPixmap").isEmpty())
+    {
+        QString pmapname = d->m_qtThemeSettings->GetSetting("TiledBackgroundPixmap");
+
+        if (!FindThemeFile(pmapname))
+            LOG(VB_GENERAL, LOG_ERR, QString(LOC + "Failed to find '%1' in the theme search path")
+                .arg(d->m_qtThemeSettings->GetSetting("TiledBackgroundPixmap")));
+
+        int width, height;
+        float wmult, hmult;
+
+        GetScreenSettings(width, wmult, height, hmult);
+
+        bgpixmap = LoadScalePixmap(pmapname);
+
+        if (bgpixmap)
+        {
+            QPixmap background(width, height);
+            QPainter tmp(&background);
+
+            tmp.drawTiledPixmap(0, 0, width, height, *bgpixmap);
+            tmp.end();
+
+            d->m_palette.setBrush(widget->backgroundRole(), QBrush(background));
+            widget->setPalette(d->m_palette);
+        }
+    }
+
+    d->m_themeloaded = true;
+
+    delete bgpixmap;
+}
+
 bool MythUIHelper::FindThemeFile(QString &path)
 {
     QFileInfo fi(path);
diff --git a/mythtv/libs/libmythui/mythuihelper.cpp b/mythtv/libs/libmythui/mythuihelper.cpp
index 95eaacff66..fbcb6f955a 100644
--- a/mythtv/libs/libmythui/mythuihelper.cpp
+++ b/mythtv/libs/libmythui/mythuihelper.cpp
@@ -1402,6 +1402,188 @@ bool MythUIHelper::FindThemeFile(QString &path)
     return foundit;
 }
 
+QImage *MythUIHelper::LoadScaleImage(QString filename)
+{
+    LOG(VB_GUI | VB_FILE, LOG_INFO,  LOC +
+        QString("LoadScaleImage(%1)").arg(filename));
+
+    if (filename.isEmpty())
+        return NULL;
+
+    if ((!filename.startsWith("http://")) &&
+        (!filename.startsWith("https://")) &&
+        (!filename.startsWith("ftp://")) &&
+        (!filename.startsWith("myth://")) &&
+        (!FindThemeFile(filename)))
+    {
+        LOG(VB_GENERAL, LOG_ERR, LOC + QString("LoadScaleImage(%1) ")
+            .arg(filename) + "Unable to find image file");
+
+        return NULL;
+    }
+
+    QImage *ret = NULL;
+    QImage tmpimage;
+    int width, height;
+    float wmult, hmult;
+
+    GetScreenSettings(width, wmult, height, hmult);
+
+    if (filename.startsWith("myth://"))
+    {
+        RemoteFile *rf = new RemoteFile(filename, false, false, 0);
+
+        QByteArray data;
+        bool loaded = rf->SaveAs(data);
+        delete rf;
+
+        if (loaded)
+            tmpimage.loadFromData(data);
+        else
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScaleImage(%1) failed to load remote image")
+                .arg(filename));
+        }
+    }
+    else if ((filename.startsWith("http://")) ||
+             (filename.startsWith("https://")) ||
+             (filename.startsWith("ftp://")))
+    {
+        QByteArray data;
+
+        if (GetMythDownloadManager()->download(filename, &data))
+            tmpimage.loadFromData(data);
+        else
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScaleImage(%1) failed to load remote image")
+                .arg(filename));
+        }
+    }
+    else
+    {
+        tmpimage.load(filename);
+    }
+
+    if (tmpimage.isNull())
+    {
+        LOG(VB_GENERAL, LOG_ERR, LOC +
+            QString("LoadScaleImage(%1) failed to load image")
+            .arg(filename));
+
+        return NULL;
+    }
+
+    if (width != d->m_baseWidth || height != d->m_baseHeight)
+    {
+        QImage tmp2 = tmpimage.scaled(
+                          (int)(tmpimage.width() * wmult),
+                          (int)(tmpimage.height() * hmult),
+                          Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+
+        ret = new QImage(tmp2);
+    }
+    else
+    {
+        ret = new QImage(tmpimage);
+
+        if (!ret->width() || !ret->height())
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScaleImage(%1) invalid image dimensions")
+                .arg(filename));
+
+            delete ret;
+            return NULL;
+        }
+    }
+
+    return ret;
+}
+
+QPixmap *MythUIHelper::LoadScalePixmap(QString filename)
+{
+    LOG(VB_GUI | VB_FILE, LOG_INFO, LOC +
+        QString("LoadScalePixmap(%1)").arg(filename));
+
+    if (filename.isEmpty())
+        return NULL;
+
+    if (!FindThemeFile(filename) && (!filename.startsWith("myth:")))
+    {
+        LOG(VB_GENERAL, LOG_ERR, LOC + QString("LoadScalePixmap(%1)")
+            .arg(filename) + "Unable to find image file");
+
+        return NULL;
+    }
+
+    QPixmap *ret = NULL;
+    QImage tmpimage;
+    int width, height;
+    float wmult, hmult;
+
+    GetScreenSettings(width, wmult, height, hmult);
+
+    if (filename.startsWith("myth://"))
+    {
+        RemoteFile *rf = new RemoteFile(filename, false, false, 0);
+
+        QByteArray data;
+        bool loaded = rf->SaveAs(data);
+        delete rf;
+
+        if (loaded)
+        {
+            tmpimage.loadFromData(data);
+        }
+        else
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScalePixmap(%1): failed to load remote image")
+                .arg(filename));
+        }
+    }
+    else
+    {
+        tmpimage.load(filename);
+    }
+
+    if (width != d->m_baseWidth || height != d->m_baseHeight)
+    {
+        if (tmpimage.isNull())
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScalePixmap(%1) failed to load image")
+                .arg(filename));
+
+            return NULL;
+        }
+
+        QImage tmp2 = tmpimage.scaled((int)(tmpimage.width() * wmult),
+                                      (int)(tmpimage.height() * hmult),
+                                      Qt::IgnoreAspectRatio,
+                                      Qt::SmoothTransformation);
+        ret = new QPixmap(QPixmap::fromImage(tmp2));
+    }
+    else
+    {
+        ret = new QPixmap(QPixmap::fromImage(tmpimage));
+
+        if (!ret->width() || !ret->height())
+        {
+            LOG(VB_GENERAL, LOG_ERR, LOC +
+                QString("LoadScalePixmap(%1) invalid image dimensions")
+                .arg(filename));
+
+            delete ret;
+            return NULL;
+        }
+    }
+
+    return ret;
+}
+
 MythImage *MythUIHelper::LoadCacheImage(QString srcfile, QString label,
                                         MythPainter *painter,
                                         ImageCacheMode cacheMode)
diff --git a/mythtv/libs/libmythui/mythuihelper.h b/mythtv/libs/libmythui/mythuihelper.h
index d4f87b2242..805fbf3536 100644
--- a/mythtv/libs/libmythui/mythuihelper.h
+++ b/mythtv/libs/libmythui/mythuihelper.h
@@ -18,6 +18,7 @@ class MythPainter;
 class MythImage;
 class QImage;
 class QWidget;
+class Settings;
 class QPixmap;
 class QSize;
 
@@ -63,6 +64,8 @@ class MUI_PUBLIC MythUIHelper
     void IncludeInCacheSize(MythImage *im);
     void ExcludeFromCacheSize(MythImage *im);
 
+    Settings *qtconfig(void);
+
     bool IsScreenSetup(void);
     bool IsTopScreenInitialized(void);
 
@@ -80,12 +83,16 @@ class MUI_PUBLIC MythUIHelper
     static void ParseGeometryOverride(const QString &geometry);
     bool IsGeometryOverridden(void);
 
+    QPixmap *LoadScalePixmap(QString filename);
+    QImage *LoadScaleImage(QString filename);
     /// Returns a reference counted image from the cache.
     /// \note The reference count is set for one use call DecrRef() to delete.
     MythImage *LoadCacheImage(QString srcfile, QString label,
                               MythPainter *painter,
                               ImageCacheMode cacheMode = kCacheNormal);
 
+    void ThemeWidget(QWidget *widget);
+
     QString FindThemeDir(const QString &themename, bool doFallback = true);
     QString FindMenuThemeDir(const QString &menuname);
     QString GetThemeDir(void);
@@ -141,6 +148,7 @@ class MUI_PUBLIC MythUIHelper
    ~MythUIHelper();
 
   private:
+    void SetPalette(QWidget *widget);
     void InitializeScreenSettings(void);
 
     void ClearOldImageCache(void);
diff --git a/mythtv/themes/MythCenter-wide/qtlook.txt b/mythtv/themes/MythCenter-wide/qtlook.txt
new file mode 100644
index 0000000000..17b2a40a90
--- /dev/null
+++ b/mythtv/themes/MythCenter-wide/qtlook.txt
@@ -0,0 +1,98 @@
+# Color of the background
+str BackgroundColor=SteelBlue
+# Color of lines, text, etc
+str ForegroundColor=white
+# Pixmap to use for the background
+str BackgroundPixmap=ui/background.png
+
+# Colors for the different program categories
+str Cat_Comedy=DarkOrchid
+str Cat_Animals=ForestGreen
+str Cat_Nature=SprintGreen
+str Cat_SciFi=DarkBlue
+str Cat_Horror=firebrick3
+str Cat_Action=maroon
+str Cat_Game=orchid
+str Cat_Children's=MediumSlateBlue
+str Cat_Edu=CornflowerBlue
+str Cat_Adult=thistle3
+str Cat_Musical=turquoise3
+str Cat_News=DarkOrange3
+str Cat_Reality=sienna
+str Cat_Cooking=tan3
+str Cat_Doc=goldenrod
+str Cat_Sports=DarkCyan
+str Cat_Mystery=SlateGrey
+str Cat_Drama=rosybrown3
+str Cat_Classic=grey62
+str Cat_Crime=MediumVioletRed
+str Cat_Talk=MediumTurquoise
+
+str ActiveForeground=#ffffff
+str ActiveButton=#38689c
+str ActiveLight=#5788c3
+str ActiveMidlight=#4871a2
+str ActiveDark=#162231
+str ActiveMid=#37567b
+str ActiveText=#dcdcdc
+str ActiveBrightText=#5788c3
+str ActiveButtonText=#ffffff
+str ActiveBase=#002a4e
+str ActiveBackground=#426794
+str ActiveShadow=#000000
+str ActiveHighlight=#70a0d8
+str ActiveHighlightedText=#000000
+
+str InactiveForeground=#ffffff
+str InactiveButton=#426794
+str InactiveLight=#5788c3
+str InactiveMidlight=#4871a2
+str InactiveDark=#162231
+str InactiveMid=#37567b
+str InactiveText=#dcdcdc
+str InactiveBrightText=#5788c3
+str InactiveButtonText=#ffffff
+str InactiveBase=#002a4e
+str InactiveBackground=#426794
+str InactiveShadow=#000000
+str InactiveHighlight=#5cb3ff
+str InactiveHighlightedText=#000000
+
+str DisabledForeground=#555555
+str DisabledButton=#426794
+str DisabledLight=#5788c3
+str DisabledMidlight=#4871a2
+str DisabledDark=#162231
+str DisabledMid=#37567b
+str DisabledText=#37567b
+str DisabledBrightText=#5788c3
+str DisabledButtonText=#ffffff
+str DisabledBase=#002a4e
+str DisabledBackground=#426794
+str DisabledShadow=#000000
+str DisabledHighlight=#000080
+str DisabledHighlightedText=#ffffff
+
+str curTimeChan_bgColor=#8f2813
+str curTimeChan_fgColor=#ffffff
+str date_bgColor=#0f2e8f
+str date_dsColor=#000000
+str date_fgColor=#ffffff
+str chan_bgColor=#0f2f5a
+str chan_dsColor=#000000
+str chan_fgColor=#ffffff
+str time_bgColor=#0f2e8f
+str time_dsColor=#000000
+str time_fgColor=#ffffff
+str prog_bgColor=#2d587b
+str prog_fgColor=#ffffff
+str progLine_Color=#104064
+str progArrow_Color=#ffffff
+int progArrow_Type=0
+str curProg_bgColor=#85a5bc
+str curRecProg_bgColor=#bc4c32
+str curProg_dsColor=#000000
+str curProg_fgColor=#eefb92
+str misChanIcon_bgColor=#000000
+str misChanIcon_fgColor=#ffffff
+
diff --git a/mythtv/themes/MythCenter/qtlook.txt b/mythtv/themes/MythCenter/qtlook.txt
new file mode 100644
index 0000000000..17b2a40a90
--- /dev/null
+++ b/mythtv/themes/MythCenter/qtlook.txt
@@ -0,0 +1,98 @@
+# Color of the background
+str BackgroundColor=SteelBlue
+# Color of lines, text, etc
+str ForegroundColor=white
+# Pixmap to use for the background
+str BackgroundPixmap=ui/background.png
+
+# Colors for the different program categories
+str Cat_Comedy=DarkOrchid
+str Cat_Animals=ForestGreen
+str Cat_Nature=SprintGreen
+str Cat_SciFi=DarkBlue
+str Cat_Horror=firebrick3
+str Cat_Action=maroon
+str Cat_Game=orchid
+str Cat_Children's=MediumSlateBlue
+str Cat_Edu=CornflowerBlue
+str Cat_Adult=thistle3
+str Cat_Musical=turquoise3
+str Cat_News=DarkOrange3
+str Cat_Reality=sienna
+str Cat_Cooking=tan3
+str Cat_Doc=goldenrod
+str Cat_Sports=DarkCyan
+str Cat_Mystery=SlateGrey
+str Cat_Drama=rosybrown3
+str Cat_Classic=grey62
+str Cat_Crime=MediumVioletRed
+str Cat_Talk=MediumTurquoise
+
+str ActiveForeground=#ffffff
+str ActiveButton=#38689c
+str ActiveLight=#5788c3
+str ActiveMidlight=#4871a2
+str ActiveDark=#162231
+str ActiveMid=#37567b
+str ActiveText=#dcdcdc
+str ActiveBrightText=#5788c3
+str ActiveButtonText=#ffffff
+str ActiveBase=#002a4e
+str ActiveBackground=#426794
+str ActiveShadow=#000000
+str ActiveHighlight=#70a0d8
+str ActiveHighlightedText=#000000
+
+str InactiveForeground=#ffffff
+str InactiveButton=#426794
+str InactiveLight=#5788c3
+str InactiveMidlight=#4871a2
+str InactiveDark=#162231
+str InactiveMid=#37567b
+str InactiveText=#dcdcdc
+str InactiveBrightText=#5788c3
+str InactiveButtonText=#ffffff
+str InactiveBase=#002a4e
+str InactiveBackground=#426794
+str InactiveShadow=#000000
+str InactiveHighlight=#5cb3ff
+str InactiveHighlightedText=#000000
+
+str DisabledForeground=#555555
+str DisabledButton=#426794
+str DisabledLight=#5788c3
+str DisabledMidlight=#4871a2
+str DisabledDark=#162231
+str DisabledMid=#37567b
+str DisabledText=#37567b
+str DisabledBrightText=#5788c3
+str DisabledButtonText=#ffffff
+str DisabledBase=#002a4e
+str DisabledBackground=#426794
+str DisabledShadow=#000000
+str DisabledHighlight=#000080
+str DisabledHighlightedText=#ffffff
+
+str curTimeChan_bgColor=#8f2813
+str curTimeChan_fgColor=#ffffff
+str date_bgColor=#0f2e8f
+str date_dsColor=#000000
+str date_fgColor=#ffffff
+str chan_bgColor=#0f2f5a
+str chan_dsColor=#000000
+str chan_fgColor=#ffffff
+str time_bgColor=#0f2e8f
+str time_dsColor=#000000
+str time_fgColor=#ffffff
+str prog_bgColor=#2d587b
+str prog_fgColor=#ffffff
+str progLine_Color=#104064
+str progArrow_Color=#ffffff
+int progArrow_Type=0
+str curProg_bgColor=#85a5bc
+str curRecProg_bgColor=#bc4c32
+str curProg_dsColor=#000000
+str curProg_fgColor=#eefb92
+str misChanIcon_bgColor=#000000
+str misChanIcon_fgColor=#ffffff
+
diff --git a/mythtv/themes/Terra/qtlook.txt b/mythtv/themes/Terra/qtlook.txt
new file mode 100644
index 0000000000..0dc0f7bcb7
--- /dev/null
+++ b/mythtv/themes/Terra/qtlook.txt
@@ -0,0 +1,95 @@
+# Color of the background
+str BackgroundColor=#484537
+# Color of lines, text, etc
+str ForegroundColor=#dddddd
+
+# Colors for the different program categories
+str Cat_Comedy=DarkOrchid
+str Cat_Animals=ForestGreen
+str Cat_Nature=SprintGreen
+str Cat_SciFi=DarkBlue
+str Cat_Horror=firebrick3
+str Cat_Action=maroon
+str Cat_Game=orchid
+str Cat_Children's=MediumSlateBlue
+str Cat_Edu=CornflowerBlue
+str Cat_Adult=thistle3
+str Cat_Musical=turquoise3
+str Cat_News=DarkOrange3
+str Cat_Reality=sienna
+str Cat_Cooking=tan3
+str Cat_Doc=goldenrod
+str Cat_Sports=DarkCyan
+str Cat_Mystery=SlateGrey
+str Cat_Drama=rosybrown3
+str Cat_Classic=grey62
+str Cat_Crime=MediumVioletRed
+str Cat_Talk=MediumTurquoise
+
+str ActiveForeground=#dddddd
+str ActiveButton=#585c47
+str ActiveLight=#a7ac93
+str ActiveMidlight=#4871a2
+str ActiveDark=#8a916f
+str ActiveMid=#464345
+str ActiveText=#333333
+str ActiveBrightText=#5788c3
+str ActiveButtonText=#484537
+str ActiveBase=#9fa589
+str ActiveBackground=#484537
+str ActiveShadow=#333333
+str ActiveHighlight=#8a916f
+str ActiveHighlightedText=#000000
+
+str InactiveForeground=#dddddd
+str InactiveButton=#585c47
+str InactiveLight=#a7ac93
+str InactiveMidlight=#4871a2
+str InactiveDark=#162231
+str InactiveMid=#464345
+str InactiveText=#999999
+str InactiveBrightText=#5788c3
+str InactiveButtonText=#dddddd
+str InactiveBase=#a7ac93
+str InactiveBackground=#484537
+str InactiveShadow=#333333
+str InactiveHighlight=#8a916f
+str InactiveHighlightedText=#000000
+
+str DisabledForeground=#555555
+str DisabledButton=#555555
+str DisabledLight=#585c47
+str DisabledMidlight=#4871a2
+str DisabledDark=#162231
+str DisabledMid=#464345
+str DisabledText=#464345
+str DisabledBrightText=#5788c3
+str DisabledButtonText=#666666
+str DisabledBase=#767662
+str DisabledBackground=#484537
+str DisabledShadow=#333333
+str DisabledHighlight=#a7ac93
+str DisabledHighlightedText=#dddddd
+
+str curTimeChan_bgColor=#8f2813
+str curTimeChan_fgColor=#dddddd
+str date_bgColor=#0f2e8f
+str date_dsColor=#000000
+str date_fgColor=#dddddd
+str chan_bgColor=#0f2f5a
+str chan_dsColor=#000000
+str chan_fgColor=#dddddd
+str time_bgColor=#0f2e8f
+str time_dsColor=#000000
+str time_fgColor=#dddddd
+str prog_bgColor=#2d587b
+str prog_fgColor=#dddddd
+str progLine_Color=#104064
+str progArrow_Color=#dddddd
+int progArrow_Type=0
+str curProg_bgColor=#85a5bc
+str curRecProg_bgColor=#bc4c32
+str curProg_dsColor=#000000
+str curProg_fgColor=#eefb92
+str misChanIcon_bgColor=#000000
+str misChanIcon_fgColor=#dddddd