From e043f2bbac954caae1a2c36984f002da1153f1b3 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Wed, 20 Feb 2019 19:08:23 +0000 Subject: mythtv mythplugins: update to latest 30/fixes. refs #1034 add patch for old qt settings for mythinstall --- abs/core/mythtv/stable-30/git_src/git_hash | 2 +- abs/core/mythtv/stable-30/mythplugins/PKGBUILD | 2 +- abs/core/mythtv/stable-30/mythtv/PKGBUILD | 4 +- .../mythtv/revertQTsettingsForMythinstall.patch | 1118 ++++++++++++++++++++ 4 files changed, 1123 insertions(+), 3 deletions(-) create mode 100644 abs/core/mythtv/stable-30/mythtv/revertQTsettingsForMythinstall.patch diff --git a/abs/core/mythtv/stable-30/git_src/git_hash b/abs/core/mythtv/stable-30/git_src/git_hash index 883dfc8..8d2d223 100644 --- a/abs/core/mythtv/stable-30/git_src/git_hash +++ b/abs/core/mythtv/stable-30/git_src/git_hash @@ -1 +1 @@ -f11c5aba6ed1e88c22f1b3b6828fc085e1699b97 +26034244e8b664f2ae0e74027653293625615a86 diff --git a/abs/core/mythtv/stable-30/mythplugins/PKGBUILD b/abs/core/mythtv/stable-30/mythplugins/PKGBUILD index 60c62a7..a224fdb 100644 --- a/abs/core/mythtv/stable-30/mythplugins/PKGBUILD +++ b/abs/core/mythtv/stable-30/mythplugins/PKGBUILD @@ -9,7 +9,7 @@ pkgname=('mytharchive' 'mythweather' 'mythzoneminder') pkgver=30.0 -pkgrel=1 +pkgrel=2 arch=('x86_64') url="http://www.mythtv.org" license=('GPL') diff --git a/abs/core/mythtv/stable-30/mythtv/PKGBUILD b/abs/core/mythtv/stable-30/mythtv/PKGBUILD index 5dd3c72..8b20750 100644 --- a/abs/core/mythtv/stable-30/mythtv/PKGBUILD +++ b/abs/core/mythtv/stable-30/mythtv/PKGBUILD @@ -1,6 +1,6 @@ pkgname=mythtv pkgver=30.0 -pkgrel=1 +pkgrel=2 commit_hash=`cat ../git_src/git_hash` pkgdesc="A Homebrew PVR project $commit_hash" arch=('x86_64') @@ -36,6 +36,7 @@ patches=( 'fixTranslations.patch' 'pull103-Add-heuristic-in-TMDB-script-to-detect-movie-release-years.patch' '0294-0283-FE-Add-network-status-to-machine-status-dialog.patch' + 'revertQTsettingsForMythinstall.patch' ) optdepends=() @@ -136,4 +137,5 @@ md5sums=('fb5a87c52a31168a0c8fdde72f27cc45' 'a1c7fb6a3bd11b7b21f2ea8327a843e1' 'd05eaf66c434a131c8efb4d87e99b402' 'abaef221b00690b329f4dca18676bcd6' + '73ad2f3bec8745f7a3bbf2169ee34db3' '633cd853a89aeee5388daaad21ccec28') diff --git a/abs/core/mythtv/stable-30/mythtv/revertQTsettingsForMythinstall.patch b/abs/core/mythtv/stable-30/mythtv/revertQTsettingsForMythinstall.patch new file mode 100644 index 0000000..a760da8 --- /dev/null +++ b/abs/core/mythtv/stable-30/mythtv/revertQTsettingsForMythinstall.patch @@ -0,0 +1,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 ++#include ++#include ++#include ++ ++#include ++#include ++#include ++using namespace std; ++ ++#include ++ ++#include "oldsettings.h" ++#include "mythlogging.h" ++ ++Settings::Settings(QString strSettingsFile) ++{ ++ if (strSettingsFile.length() == 0) ++ strSettingsFile = "settings.txt"; ++ m_pSettings = new map; ++ ++ ReadSettings(strSettingsFile); ++} ++ ++Settings::~Settings() ++{ ++ delete m_pSettings; ++} ++ ++// Setting retrieval functions ++/** Generic Setting Retrieval functions */ ++QString Settings::GetSetting(QString strSetting, QString defaultvalue) ++{ ++ map::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::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::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 ++#include ++ ++#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 *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 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 -- cgit v0.12