Ticket #10305: 10305-v2.patch
File 10305-v2.patch, 45.3 KB (added by , 12 years ago) |
---|
-
mythtv/docs/doxygen-architecture-document.cpp
diff --git a/mythtv/docs/doxygen-architecture-document.cpp b/mythtv/docs/doxygen-architecture-document.cpp index 464a5f4..8b8e90fa 100644
a b Most MythTV programs follow a common sequence: 576 576 <li>Initialise the MythContext, which:</li> 577 577 <ul> 578 578 <li>Tries to find a database on localhost, 579 or on the host specified in mysql.txt,</li>579 or on the host specified in config.xml,</li> 580 580 <li>Tries to locate exactly one backend host via UPnP, 581 581 to find its database,</li> 582 582 <li>If possible, displays a list of all backends located via UPnP -
mythtv/libs/libmyth/backendselect.h
diff --git a/mythtv/libs/libmyth/backendselect.h b/mythtv/libs/libmyth/backendselect.h index 560622c..c96fdb9 100644
a b struct DatabaseParams; 19 19 // location at this moment in time 20 20 // Some common UPnP search and XML value strings 21 21 const QString gBackendURI = "urn:schemas-mythtv-org:device:MasterMediaServer:1"; 22 const QString kDefaultBE = "UPnP/MythFrontend/DefaultBackend/"; 23 const QString kDefaultPIN = kDefaultBE + "SecurityPin"; 24 const QString kDefaultUSN = kDefaultBE + "USN"; 22 const QString kDefaultDB = "Database/"; 23 const QString kDefaultWOL = "WakeOnLAN/"; 24 const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/"; 25 const QString kDefaultPIN = kDefaultMFE + "SecurityPin"; 26 const QString kDefaultUSN = kDefaultMFE + "USN"; 25 27 26 28 typedef QMap <QString, DeviceLocation*> ItemMap; 27 29 -
mythtv/libs/libmyth/langsettings.cpp
diff --git a/mythtv/libs/libmyth/langsettings.cpp b/mythtv/libs/libmyth/langsettings.cpp index 5cbe870..70ccd7f 100644
a b void LanguageSelection::Save(void) 187 187 MythUIButtonListItem *item = m_languageList->GetItemCurrent(); 188 188 189 189 QString langCode = item->GetData().toString(); 190 gCoreContext->SetSetting("Language", langCode);191 190 gCoreContext->SaveSetting("Language", langCode); 192 191 193 192 item = m_countryList->GetItemCurrent(); 194 193 195 194 QString countryCode = item->GetData().toString(); 196 gCoreContext->SetSetting("Country", countryCode);197 195 gCoreContext->SaveSetting("Country", countryCode); 198 196 199 197 if (m_language != langCode) -
mythtv/libs/libmyth/mythcontext.cpp
diff --git a/mythtv/libs/libmyth/mythcontext.cpp b/mythtv/libs/libmyth/mythcontext.cpp index ea8c07d..3b624c9 100644
a b using namespace std; 14 14 #include "config.h" 15 15 #include "mythcontext.h" 16 16 #include "exitcodes.h" 17 #include "oldsettings.h"18 17 #include "util.h" 19 18 #include "remotefile.h" 20 19 #include "mythplugin.h" … … class MythContextPrivate : public QObject 66 65 void EndTempWindow(void); 67 66 68 67 bool LoadDatabaseSettings(void); 68 bool SaveDatabaseParams(const DatabaseParams ¶ms, bool force); 69 69 70 70 bool PromptForDatabaseParams(const QString &error); 71 71 QString TestDBconnection(void); … … class MythContextPrivate : public QObject 75 75 76 76 int ChooseBackend(const QString &error); 77 77 int UPnPautoconf(const int milliSeconds = 2000); 78 void StoreConnectionInfo(void);79 78 bool DefaultUPnP(QString &error); 80 79 bool UPnPconnect(const DeviceLocation *device, const QString &PIN); 81 80 … … class MythContextPrivate : public QObject 99 98 DatabaseParams m_DBparams; ///< Current database host & WOL details 100 99 QString m_DBhostCp; ///< dbHostName backup 101 100 102 Configuration *m_pConfig;101 XmlConfiguration *m_XMLConfig; 103 102 104 103 bool disableeventpopup; 105 104 bool disablelibrarypopup; … … static void eject_cb(void) 203 202 MythContextPrivate::MythContextPrivate(MythContext *lparent) 204 203 : parent(lparent), 205 204 m_gui(false), 206 m_ pConfig(NULL),205 m_XMLConfig(NULL), 207 206 disableeventpopup(false), 208 207 disablelibrarypopup(false), 209 208 pluginmanager(NULL), … … MythContextPrivate::MythContextPrivate(MythContext *lparent) 217 216 218 217 MythContextPrivate::~MythContextPrivate() 219 218 { 219 if (m_XMLConfig) 220 delete m_XMLConfig; 220 221 if (m_ui) 221 222 DestroyMythUI(); 222 223 if (m_sh) … … void MythContextPrivate::TempMainWindow(bool languagePrompt) 240 241 241 242 SilenceDBerrors(); 242 243 243 gCoreContext-> SetSetting("Theme", DEFAULT_UI_THEME);244 gCoreContext->OverrideSettingForSession("Theme", DEFAULT_UI_THEME); 244 245 #ifdef Q_WS_MACX 245 246 // Qt 4.4 has window-focus problems 246 gCoreContext-> SetSetting("RunFrontendInWindow", "1");247 gCoreContext->OverrideSettingForSession("RunFrontendInWindow", "1"); 247 248 #endif 248 249 GetMythUI()->LoadQtConfig(); 249 250 … … void MythContextPrivate::TempMainWindow(bool languagePrompt) 261 262 void MythContextPrivate::EndTempWindow(void) 262 263 { 263 264 DestroyMythMainWindow(); 265 gCoreContext->ClearOverrideSettingForSession("Theme"); 264 266 EnableDBerrors(); 265 267 } 266 268 … … bool MythContextPrivate::Init(const bool gui, 273 275 m_gui = gui; 274 276 275 277 // We don't have a database yet, so lets use the config.xml file. 276 277 m_pConfig = UPnp::GetConfiguration(); 278 m_XMLConfig = new XmlConfiguration("config.xml"); 278 279 279 280 // Creates screen saver control if we will have a GUI 280 281 if (gui) … … bool MythContextPrivate::FindDatabase(const bool prompt, const bool noPrompt) 333 334 334 335 QString failure; 335 336 336 // 1. Load either mysql.txt, or use sensible "localhost" defaults:337 // 1. Load either config.xml, or use sensible "localhost" defaults: 337 338 bool loaded = LoadDatabaseSettings(); 339 DatabaseParams dbParamsFromFile = m_DBparams; 338 340 339 341 // In addition to the UI chooser, we can also try to autoSelect later, 340 // but only if we're not doing manualSelect and there was no mysql.txt 342 // but only if we're not doing manualSelect and there was no 343 // valid config.xml 341 344 bool autoSelect = !manualSelect && !loaded; 342 345 343 346 // 2. If the user isn't forcing up the chooser UI, look for a default … … bool MythContextPrivate::FindDatabase(const bool prompt, const bool noPrompt) 424 427 } 425 428 426 429 DBfound: 427 #if 0428 430 LOG(VB_GENERAL, LOG_DEBUG, "FindDatabase() - Success!"); 429 #endif 430 StoreConnectionInfo(); 431 SaveDatabaseParams(m_DBparams, 432 !loaded || m_DBparams.forceSave || 433 dbParamsFromFile != m_DBparams); 431 434 EnableDBerrors(); 432 435 ResetDatabase(); 433 436 return true; 434 437 435 438 NoDBfound: 436 #if 0437 439 LOG(VB_GENERAL, LOG_DEBUG, "FindDatabase() - failed"); 438 #endif439 440 return false; 440 441 } 441 442 442 /** Load database and host settings from mysql.txt or config.xml, 443 * or set some defaults. 444 * \return true if mysql.txt or config.xml was parsed 443 /** Load database and host settings from config.xml, or set some defaults. 444 * \return true if config.xml was parsed 445 445 */ 446 446 bool MythContextPrivate::LoadDatabaseSettings(void) 447 447 { 448 bool ok = MythDB::LoadDatabaseParamsFromDisk(m_DBparams); 449 if (!ok) 448 // try new format first 449 m_DBparams.LoadDefaults(); 450 451 m_DBparams.localHostName = m_XMLConfig->GetValue("LocalHostName", ""); 452 453 m_DBparams.dbHostName = m_XMLConfig->GetValue(kDefaultDB + "Host", ""); 454 m_DBparams.dbUserName = m_XMLConfig->GetValue(kDefaultDB + "UserName", ""); 455 m_DBparams.dbPassword = m_XMLConfig->GetValue(kDefaultDB + "Password", ""); 456 m_DBparams.dbName = m_XMLConfig->GetValue(kDefaultDB + "DatabaseName", ""); 457 m_DBparams.dbPort = m_XMLConfig->GetValue(kDefaultDB + "Port", 0); 458 459 m_DBparams.wolEnabled = 460 m_XMLConfig->GetValue(kDefaultWOL + "Enabled", false); 461 m_DBparams.wolReconnect = 462 m_XMLConfig->GetValue(kDefaultWOL + "SQLReconnectWaitTime", 0); 463 m_DBparams.wolRetry = 464 m_XMLConfig->GetValue(kDefaultWOL + "SQLConnectRetry", 0); 465 m_DBparams.wolCommand = 466 m_XMLConfig->GetValue(kDefaultWOL + "Command", ""); 467 468 bool ok = m_DBparams.IsValid("config.xml"); 469 if (!ok) // if new format fails, try legacy format 450 470 { 451 XmlConfiguration cfg("config.xml"); 452 MythDB::LoadDefaultDatabaseParams(m_DBparams); 453 m_DBparams.dbHostName = cfg.GetValue(kDefaultBE + "DBHostName", ""); 454 m_DBparams.dbUserName = cfg.GetValue(kDefaultBE + "DBUserName", ""); 455 m_DBparams.dbPassword = cfg.GetValue(kDefaultBE + "DBPassword", ""); 456 m_DBparams.dbName = cfg.GetValue(kDefaultBE + "DBName", ""); 457 m_DBparams.dbPort = cfg.GetValue(kDefaultBE + "DBPort", 0); 458 ok = MythDB::ValidateDatabaseParams(m_DBparams, "config.xml"); 471 m_DBparams.LoadDefaults(); 472 m_DBparams.dbHostName = m_XMLConfig->GetValue( 473 kDefaultMFE + "DBHostName", ""); 474 m_DBparams.dbUserName = m_XMLConfig->GetValue( 475 kDefaultMFE + "DBUserName", ""); 476 m_DBparams.dbPassword = m_XMLConfig->GetValue( 477 kDefaultMFE + "DBPassword", ""); 478 m_DBparams.dbName = m_XMLConfig->GetValue( 479 kDefaultMFE + "DBName", ""); 480 m_DBparams.dbPort = m_XMLConfig->GetValue( 481 kDefaultMFE + "DBPort", 0); 482 m_DBparams.forceSave = true; 483 ok = m_DBparams.IsValid("config.xml"); 459 484 } 460 485 if (!ok) 461 MythDB::LoadDefaultDatabaseParams(m_DBparams);486 m_DBparams.LoadDefaults(); 462 487 463 488 gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); 464 489 … … bool MythContextPrivate::LoadDatabaseSettings(void) 476 501 hostname = localhostname; 477 502 LOG(VB_GENERAL, LOG_NOTICE, "Empty LocalHostName."); 478 503 } 504 else 505 { 506 m_DBparams.localEnabled = true; 507 } 479 508 480 509 LOG(VB_GENERAL, LOG_INFO, QString("Using localhost value of %1") 481 510 .arg(hostname)); … … bool MythContextPrivate::LoadDatabaseSettings(void) 484 513 return ok; 485 514 } 486 515 516 bool MythContextPrivate::SaveDatabaseParams( 517 const DatabaseParams ¶ms, bool force) 518 { 519 bool ret = true; 520 521 // only rewrite file if it has changed 522 if (params != m_DBparams || force) 523 { 524 m_XMLConfig->SetValue( 525 "LocalHostName", params.localHostName); 526 527 m_XMLConfig->SetValue( 528 kDefaultDB + "PingHost", params.dbHostPing); 529 m_XMLConfig->SetValue( 530 kDefaultDB + "Host", params.dbHostName); 531 m_XMLConfig->SetValue( 532 kDefaultDB + "UserName", params.dbUserName); 533 m_XMLConfig->SetValue( 534 kDefaultDB + "Password", params.dbPassword); 535 m_XMLConfig->SetValue( 536 kDefaultDB + "DatabaseName", params.dbName); 537 m_XMLConfig->SetValue( 538 kDefaultDB + "Port", params.dbPort); 539 540 m_XMLConfig->SetValue( 541 kDefaultWOL + "Enabled", params.wolEnabled); 542 m_XMLConfig->SetValue( 543 kDefaultWOL + "SQLReconnectWaitTime", params.wolReconnect); 544 m_XMLConfig->SetValue( 545 kDefaultWOL + "SQLConnectRetry", params.wolRetry); 546 m_XMLConfig->SetValue( 547 kDefaultWOL + "Command", params.wolCommand); 548 549 // clear out any legacy nodes.. 550 m_XMLConfig->ClearValue(kDefaultMFE + "DBHostName"); 551 m_XMLConfig->ClearValue(kDefaultMFE + "DBUserName"); 552 m_XMLConfig->ClearValue(kDefaultMFE + "DBPassword"); 553 m_XMLConfig->ClearValue(kDefaultMFE + "DBName"); 554 m_XMLConfig->ClearValue(kDefaultMFE + "DBPort"); 555 556 // actually save the file 557 m_XMLConfig->Save(); 558 559 // Save the new settings: 560 m_DBparams = params; 561 gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); 562 563 // If database has changed, force its use: 564 ResetDatabase(); 565 } 566 return ret; 567 } 568 487 569 bool MythContextPrivate::PromptForDatabaseParams(const QString &error) 488 570 { 489 571 bool accepted = false; … … int MythContextPrivate::ChooseBackend(const QString &error) 698 780 699 781 LOG(VB_GENERAL, LOG_INFO, "Putting up the UPnP backend chooser"); 700 782 701 BackendSelection::prompt(&m_DBparams, m_ pConfig);783 BackendSelection::prompt(&m_DBparams, m_XMLConfig); 702 784 703 785 EndTempWindow(); 704 786 … … int MythContextPrivate::ChooseBackend(const QString &error) 706 788 } 707 789 708 790 /** 709 * Try to store the current location of this backend in config.xml710 *711 * This is intended as a last resort for future connections712 * (e.g. Perl scripts, backend not running).713 *714 * Note that the Save() may fail (e.g. non writable ~/.mythtv)715 */716 void MythContextPrivate::StoreConnectionInfo(void)717 {718 if (!m_pConfig)719 return;720 721 m_pConfig->SetValue(kDefaultBE + "DBHostName", m_DBparams.dbHostName);722 m_pConfig->SetValue(kDefaultBE + "DBUserName", m_DBparams.dbUserName);723 m_pConfig->SetValue(kDefaultBE + "DBPassword", m_DBparams.dbPassword);724 m_pConfig->SetValue(kDefaultBE + "DBName", m_DBparams.dbName);725 m_pConfig->SetValue(kDefaultBE + "DBPort", m_DBparams.dbPort);726 m_pConfig->Save();727 }728 729 /**730 791 * If there is only a single UPnP backend, use it. 731 792 * 732 793 * This does <i>not</i> prompt for PIN entry. If the backend requires one, … … int MythContextPrivate::UPnPautoconf(const int milliSeconds) 802 863 */ 803 864 bool MythContextPrivate::DefaultUPnP(QString &error) 804 865 { 805 Configuration *pConfig = new XmlConfiguration("config.xml");806 866 QString loc = "DefaultUPnP() - "; 807 QString localHostName = pConfig->GetValue(kDefaultBE + "LocalHostName", ""); 808 QString PIN = pConfig->GetValue(kDefaultPIN, ""); 809 QString USN = pConfig->GetValue(kDefaultUSN, ""); 810 811 delete pConfig; 867 QString PIN = m_XMLConfig->GetValue(kDefaultPIN, ""); 868 QString USN = m_XMLConfig->GetValue(kDefaultUSN, ""); 812 869 813 870 if (USN.isEmpty()) 814 871 { … … bool MythContextPrivate::DefaultUPnP(QString &error) 856 913 857 914 if (UPnPconnect(pDevLoc, PIN)) 858 915 { 859 if (localHostName.length())860 {861 m_DBparams.localHostName = localHostName;862 m_DBparams.localEnabled = true;863 gCoreContext->GetDB()->SetDatabaseParams(m_DBparams);864 }865 866 916 pDevLoc->Release(); 867 917 868 918 return true; … … DatabaseParams MythContext::GetDatabaseParams(void) 1176 1226 1177 1227 bool MythContext::SaveDatabaseParams(const DatabaseParams ¶ms) 1178 1228 { 1179 bool ret = true; 1180 DatabaseParams cur_params = GetDatabaseParams(); 1181 1182 // only rewrite file if it has changed 1183 if (params.dbHostName != cur_params.dbHostName || 1184 params.dbHostPing != cur_params.dbHostPing || 1185 params.dbPort != cur_params.dbPort || 1186 params.dbUserName != cur_params.dbUserName || 1187 params.dbPassword != cur_params.dbPassword || 1188 params.dbName != cur_params.dbName || 1189 params.dbType != cur_params.dbType || 1190 params.localEnabled != cur_params.localEnabled || 1191 params.wolEnabled != cur_params.wolEnabled || 1192 (params.localEnabled && 1193 (params.localHostName != cur_params.localHostName)) || 1194 (params.wolEnabled && 1195 (params.wolReconnect != cur_params.wolReconnect || 1196 params.wolRetry != cur_params.wolRetry || 1197 params.wolCommand != cur_params.wolCommand))) 1198 { 1199 ret = MythDB::SaveDatabaseParamsToDisk(params, GetConfDir(), true); 1200 if (ret) 1201 { 1202 // Save the new settings: 1203 d->m_DBparams = params; 1204 gCoreContext->GetDB()->SetDatabaseParams(d->m_DBparams); 1205 1206 // If database has changed, force its use: 1207 d->ResetDatabase(); 1208 } 1209 } 1210 return ret; 1229 return d->SaveDatabaseParams(params, false); 1211 1230 } 1212 1231 1213 1232 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
mythtv/libs/libmythbase/libmythbase.pro
diff --git a/mythtv/libs/libmythbase/libmythbase.pro b/mythtv/libs/libmythbase/libmythbase.pro index 7049ebe..b87a51a 100644
a b HEADERS += mythscheduler.h filesysteminfo.h hardwareprofile.h 27 27 28 28 SOURCES += mthread.cpp mthreadpool.cpp 29 29 SOURCES += mythsocket.cpp mythsocketthread.cpp msocketdevice.cpp 30 SOURCES += mythdbcon.cpp mythdb.cpp oldsettings.cpp30 SOURCES += mythdbcon.cpp mythdb.cpp mythdbparams.cpp oldsettings.cpp 31 31 SOURCES += mythobservable.cpp mythevent.cpp httpcomms.cpp mcodecs.cpp 32 32 SOURCES += mythdirs.cpp mythsignalingtimer.cpp 33 33 SOURCES += lcddevice.cpp mythstorage.cpp remotefile.cpp -
mythtv/libs/libmythbase/mythcorecontext.cpp
diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index 5f1b84c..17033d7 100644
a b class MythCoreContextPrivate : public QObject 55 55 QString m_appBinaryVersion; 56 56 57 57 QMutex m_hostnameLock; ///< Locking for thread-safe copying of: 58 QString m_localHostname; ///< hostname from mysql.txtor gethostname()58 QString m_localHostname; ///< hostname from config.xml or gethostname() 59 59 QString m_masterHostname; ///< master backend hostname 60 60 61 61 QMutex m_sockLock; ///< protects both m_serverSock and m_eventSock … … double MythCoreContext::GetFloatSettingOnHost(const QString &key, 839 839 return d->m_database->GetFloatSettingOnHost(key, host, defaultval); 840 840 } 841 841 842 void MythCoreContext::SetSetting(const QString &key, const QString &newValue)843 {844 d->m_database->SetSetting(key, newValue);845 }846 847 842 void MythCoreContext::OverrideSettingForSession(const QString &key, 848 843 const QString &value) 849 844 { 850 845 d->m_database->OverrideSettingForSession(key, value); 851 846 } 852 847 848 void MythCoreContext::ClearOverrideSettingForSession(const QString &key) 849 { 850 d->m_database->ClearOverrideSettingForSession(key); 851 } 852 853 853 bool MythCoreContext::IsUIThread(void) 854 854 { 855 855 return is_current_thread(d->m_UIThread); -
mythtv/libs/libmythbase/mythcorecontext.h
diff --git a/mythtv/libs/libmythbase/mythcorecontext.h b/mythtv/libs/libmythbase/mythcorecontext.h index ca2e0c2..824457c 100644
a b class MBASE_PUBLIC MythCoreContext : public MythObservable, public MythSocketCBs 145 145 double GetFloatSettingOnHost(const QString &key, const QString &host, 146 146 double defaultval = 0.0); 147 147 148 void SetSetting(const QString &key, const QString &newValue);149 150 148 void ClearSettingsCache(const QString &myKey = QString("")); 151 149 void ActivateSettingsCache(bool activate = true); 152 150 void OverrideSettingForSession(const QString &key, const QString &value); 151 void ClearOverrideSettingForSession(const QString &key); 153 152 154 153 void dispatch(const MythEvent &event); 155 154 void dispatchNow(const MythEvent &event) MDEPRECATED; -
mythtv/libs/libmythbase/mythdb.cpp
diff --git a/mythtv/libs/libmythbase/mythdb.cpp b/mythtv/libs/libmythbase/mythdb.cpp index adfe3c5..b871b88 100644
a b using namespace std; 12 12 #include "mythdb.h" 13 13 #include "mythdbcon.h" 14 14 #include "mythlogging.h" 15 #include "oldsettings.h"16 15 #include "mythdirs.h" 17 16 #include "mythcorecontext.h" 18 17 … … class MythDBPrivate 72 71 QString m_localhostname; 73 72 MDBManager m_dbmanager; 74 73 75 Settings *m_settings;76 77 74 bool ignoreDatabase; 78 75 bool suppressDBMessages; 79 76 … … class MythDBPrivate 93 90 94 91 static const int settings_reserve = 61; 95 92 96 MythDBPrivate::MythDBPrivate() 97 : m_settings(new Settings()), 98 ignoreDatabase(false), suppressDBMessages(true), useSettingsCache(false), 99 haveDBConnection(false), haveSchema(false) 93 MythDBPrivate::MythDBPrivate() : 94 ignoreDatabase(false), suppressDBMessages(true), useSettingsCache(false), 95 haveDBConnection(false), haveSchema(false) 100 96 { 101 97 m_localhostname.clear(); 102 98 settingsCache.reserve(settings_reserve); … … MythDBPrivate::MythDBPrivate() 105 101 MythDBPrivate::~MythDBPrivate() 106 102 { 107 103 LOG(VB_DATABASE, LOG_INFO, "Destroying MythDBPrivate"); 108 delete m_settings;109 104 } 110 105 111 106 MythDB::MythDB() … … MDBManager *MythDB::GetDBManager(void) 123 118 return &(d->m_dbmanager); 124 119 } 125 120 126 Settings *MythDB::GetOldSettings(void)127 {128 return d->m_settings;129 }130 131 121 QString MythDB::toCommaList(const QMap<QString, QVariant> &bindings, 132 122 uint indent, uint maxColumn) 133 123 { … … QString MythDB::GetSetting(const QString &_key, const QString &defaultval) 375 365 return value; 376 366 377 367 MSqlQuery query(MSqlQuery::InitCon()); 378 if (!query.isConnected())379 {380 if (!d->suppressDBMessages)381 LOG(VB_GENERAL, LOG_ERR,382 QString("Database not open while trying to load setting: %1")383 .arg(key));384 return d->m_settings->GetSetting(key, defaultval);385 }386 387 368 query.prepare( 388 369 "SELECT data " 389 370 "FROM settings " … … QString MythDB::GetSetting(const QString &_key, const QString &defaultval) 407 388 { 408 389 value = query.value(0).toString(); 409 390 } 410 else411 {412 value = d->m_settings->GetSetting(key, defaultval);413 }414 391 } 415 392 416 393 if (d->useSettingsCache && value != kSentinelValue) … … double MythDB::GetFloatSettingOnHost(const QString &key, const QString &host) 697 674 return (retval == sentinel) ? 0.0 : retval.toDouble(); 698 675 } 699 676 700 void MythDB::SetSetting(const QString &key, const QString &newValueRaw)701 {702 QString newValue = (newValueRaw.isNull()) ? "" : newValueRaw;703 d->m_settings->SetSetting(key, newValue);704 ClearSettingsCache(key);705 }706 707 677 void MythDB::GetResolutionSetting(const QString &type, 708 678 int &width, int &height, 709 679 double &forced_aspect, … … void MythDB::OverrideSettingForSession( 798 768 d->settingsCacheLock.unlock(); 799 769 } 800 770 771 /// \brief Clears session Overrides for the given setting. 772 void MythDB::ClearOverrideSettingForSession(const QString &key) 773 { 774 QString mk = key.toLower(); 775 QString mk2 = d->m_localhostname + ' ' + mk; 776 777 d->settingsCacheLock.lockForWrite(); 778 779 SettingsMap::iterator oit = d->overriddenSettings.find(mk); 780 if (oit != d->overriddenSettings.end()) 781 d->overriddenSettings.erase(oit); 782 783 SettingsMap::iterator sit = d->settingsCache.find(mk); 784 if (sit != d->settingsCache.end()) 785 d->settingsCache.erase(sit); 786 787 sit = d->settingsCache.find(mk2); 788 if (sit != d->settingsCache.end()) 789 d->settingsCache.erase(sit); 790 791 d->settingsCacheLock.unlock(); 792 } 793 801 794 static void clear( 802 795 SettingsMap &cache, SettingsMap &overrides, const QString &myKey) 803 796 { … … void MythDB::ActivateSettingsCache(bool activate) 866 859 ClearSettingsCache(); 867 860 } 868 861 869 bool MythDB::LoadDatabaseParamsFromDisk(DatabaseParams ¶ms)870 {871 Settings settings;872 if (!settings.LoadSettingsFiles(873 "mysql.txt", GetInstallPrefix(), GetConfDir()))874 {875 LOG(VB_GENERAL, LOG_ERR, "Unable to read configuration file mysql.txt");876 return false;877 }878 879 params.dbHostName = settings.GetSetting("DBHostName");880 params.dbHostPing = settings.GetSetting("DBHostPing") != "no";881 params.dbPort = settings.GetNumSetting("DBPort", 3306);882 params.dbUserName = settings.GetSetting("DBUserName");883 params.dbPassword = settings.GetSetting("DBPassword");884 params.dbName = settings.GetSetting("DBName");885 params.dbType = settings.GetSetting("DBType");886 887 params.localHostName = settings.GetSetting("LocalHostName");888 params.localEnabled = !params.localHostName.isEmpty();889 890 params.wolReconnect =891 settings.GetNumSetting("WOLsqlReconnectWaitTime");892 params.wolEnabled = params.wolReconnect > 0;893 894 params.wolRetry = settings.GetNumSetting("WOLsqlConnectRetry");895 params.wolCommand = settings.GetSetting("WOLsqlCommand");896 897 return ValidateDatabaseParams(params, "mysql.txt");898 }899 900 bool MythDB::ValidateDatabaseParams(901 const DatabaseParams ¶ms, const QString &source)902 {903 // Print some warnings if things look fishy..904 QString msg = QString(" is not set in %1").arg(source);905 906 if (params.dbHostName.isEmpty())907 {908 LOG(VB_GENERAL, LOG_ERR, "DBHostName" + msg);909 return false;910 }911 if (params.dbUserName.isEmpty())912 {913 LOG(VB_GENERAL, LOG_ERR, "DBUserName" + msg);914 return false;915 }916 if (params.dbPassword.isEmpty())917 {918 LOG(VB_GENERAL, LOG_ERR, "DBPassword" + msg);919 return false;920 }921 if (params.dbName.isEmpty())922 {923 LOG(VB_GENERAL, LOG_ERR, "DBName" + msg);924 return false;925 }926 927 return true;928 }929 930 // Sensible connection defaults.931 void MythDB::LoadDefaultDatabaseParams(DatabaseParams ¶ms)932 {933 params.dbHostName = "localhost";934 params.dbHostPing = true;935 params.dbPort = 3306;936 params.dbUserName = "mythtv";937 params.dbPassword = "mythtv";938 params.dbName = "mythconverg";939 params.dbType = "QMYSQL";940 params.localEnabled = false;941 params.localHostName = "my-unique-identifier-goes-here";942 params.wolEnabled = false;943 params.wolReconnect = 0;944 params.wolRetry = 5;945 params.wolCommand = "echo 'WOLsqlServerCommand not set'";946 }947 948 bool MythDB::SaveDatabaseParamsToDisk(949 const DatabaseParams ¶ms, const QString &confdir, bool overwrite)950 {951 QString path = confdir + "/mysql.txt";952 QFile * f = new QFile(path);953 954 if (!overwrite && f->exists())955 {956 return false;957 }958 959 QString dirpath = confdir;960 QDir createDir(dirpath);961 962 if (!createDir.exists())963 {964 if (!createDir.mkdir(dirpath))965 {966 LOG(VB_GENERAL, LOG_ERR,967 QString("Could not create %1").arg(dirpath));968 return false;969 }970 }971 972 if (!f->open(QIODevice::WriteOnly))973 {974 LOG(VB_GENERAL, LOG_ERR, QString("Could not open settings file %1 "975 "for writing").arg(path));976 return false;977 }978 979 LOG(VB_GENERAL, LOG_NOTICE, QString("Writing settings file %1").arg(path));980 QTextStream s(f);981 s << "DBHostName=" << params.dbHostName << endl;982 983 s << "\n"984 << "# By default, Myth tries to ping the DB host to see if it exists.\n"985 << "# If your DB host or network doesn't accept pings, set this to no:\n"986 << "#\n";987 988 if (params.dbHostPing)989 s << "#DBHostPing=no" << endl << endl;990 else991 s << "DBHostPing=no" << endl << endl;992 993 if (params.dbPort)994 s << "DBPort=" << params.dbPort << endl;995 996 s << "DBUserName=" << params.dbUserName << endl997 << "DBPassword=" << params.dbPassword << endl998 << "DBName=" << params.dbName << endl999 << "DBType=" << params.dbType << endl1000 << endl1001 << "# Set the following if you want to use something other than this\n"1002 << "# machine's real hostname for identifying settings in the database.\n"1003 << "# This is useful if your hostname changes often, as otherwise you\n"1004 << "# will need to reconfigure mythtv every time.\n"1005 << "# NO TWO HOSTS MAY USE THE SAME VALUE\n"1006 << "#\n";1007 1008 if (params.localEnabled)1009 s << "LocalHostName=" << params.localHostName << endl;1010 else1011 s << "#LocalHostName=my-unique-identifier-goes-here\n";1012 1013 s << endl1014 << "# If you want your frontend to be able to wake your MySQL server\n"1015 << "# using WakeOnLan, have a look at the following settings:\n"1016 << "#\n"1017 << "#\n"1018 << "# The time the frontend waits (in seconds) between reconnect tries.\n"1019 << "# This should be the rough time your MySQL server needs for startup\n"1020 << "#\n";1021 1022 if (params.wolEnabled)1023 s << "WOLsqlReconnectWaitTime=" << params.wolReconnect << endl;1024 else1025 s << "#WOLsqlReconnectWaitTime=0\n";1026 1027 s << "#\n"1028 << "#\n"1029 << "# This is the number of retries to wake the MySQL server\n"1030 << "# until the frontend gives up\n"1031 << "#\n";1032 1033 if (params.wolEnabled)1034 s << "WOLsqlConnectRetry=" << params.wolRetry << endl;1035 else1036 s << "#WOLsqlConnectRetry=5\n";1037 1038 s << "#\n"1039 << "#\n"1040 << "# This is the command executed to wake your MySQL server.\n"1041 << "#\n";1042 1043 if (params.wolEnabled)1044 s << "WOLsqlCommand=" << params.wolCommand << endl;1045 else1046 s << "#WOLsqlCommand=echo 'WOLsqlServerCommand not set'\n";1047 1048 f->close();1049 return true;1050 }1051 1052 862 void MythDB::WriteDelayedSettings(void) 1053 863 { 1054 864 if (!HaveValidDatabase()) -
mythtv/libs/libmythbase/mythdb.h
diff --git a/mythtv/libs/libmythbase/mythdb.h b/mythtv/libs/libmythbase/mythdb.h index 79abe56..255511f 100644
a b 9 9 #include "mythdbparams.h" 10 10 11 11 class MythDBPrivate; 12 class Settings;13 12 class MDBManager; 14 13 15 14 class MBASE_PUBLIC MythDB … … class MBASE_PUBLIC MythDB 17 16 friend class MSqlQuery; 18 17 public: 19 18 MDBManager *GetDBManager(void); 20 Settings *GetOldSettings(void);21 19 22 20 static QString GetError(const QString &where, const MSqlQuery &query); 23 21 static void DBError(const QString &where, const MSqlQuery &query); … … class MBASE_PUBLIC MythDB 38 36 void ClearSettingsCache(const QString &key = QString()); 39 37 void ActivateSettingsCache(bool activate = true); 40 38 void OverrideSettingForSession(const QString &key, const QString &newValue); 39 void ClearOverrideSettingForSession(const QString &key); 41 40 42 41 void SaveSetting(const QString &key, int newValue); 43 42 void SaveSetting(const QString &key, const QString &newValue); … … class MBASE_PUBLIC MythDB 71 70 void GetResolutionSetting(const QString &type, int &width, int &height, 72 71 int index=-1); 73 72 74 void SetSetting(const QString &key, const QString &newValue);75 76 73 void WriteDelayedSettings(void); 77 74 78 75 void SetHaveDBConnection(bool connected); … … class MBASE_PUBLIC MythDB 85 82 static QString toCommaList(const QMap<QString, QVariant> &bindings, 86 83 uint indent = 0, uint softMaxColumn = 80); 87 84 88 static bool LoadDatabaseParamsFromDisk(DatabaseParams ¶ms);89 static bool ValidateDatabaseParams(90 const DatabaseParams ¶ms, const QString &source);91 static void LoadDefaultDatabaseParams(DatabaseParams ¶ms);92 static bool SaveDatabaseParamsToDisk(93 const DatabaseParams ¶ms, const QString &confdir, bool overwrite);94 95 85 protected: 96 86 MythDB(); 97 87 ~MythDB(); -
new file mythtv/libs/libmythbase/mythdbparams.cpp
diff --git a/mythtv/libs/libmythbase/mythdbparams.cpp b/mythtv/libs/libmythbase/mythdbparams.cpp new file mode 100644 index 0000000..273804c
- + 1 #include "mythdbparams.h" 2 #include "mythlogging.h" 3 4 /// Load sensible connection defaults. 5 void DatabaseParams::LoadDefaults(void) 6 { 7 dbHostName = "localhost"; 8 dbHostPing = true; 9 dbPort = 3306; 10 dbUserName = "mythtv"; 11 dbPassword = "mythtv"; 12 dbName = "mythconverg"; 13 dbType = "QMYSQL"; 14 15 localEnabled = false; 16 localHostName = "my-unique-identifier-goes-here"; 17 18 wolEnabled = false; 19 wolReconnect = 0; 20 wolRetry = 5; 21 wolCommand = "echo 'WOLsqlServerCommand not set'"; 22 23 forceSave = false; 24 25 verVersion.clear(); 26 verBranch.clear(); 27 verProtocol.clear(); 28 verBinary.clear(); 29 verSchema.clear(); 30 } 31 32 bool DatabaseParams::IsValid(const QString &source) const 33 { 34 // Print some warnings if things look fishy.. 35 QString msg = QString(" is not set in %1").arg(source); 36 37 if (dbHostName.isEmpty()) 38 { 39 LOG(VB_GENERAL, LOG_ERR, "DBHostName" + msg); 40 return false; 41 } 42 if (dbUserName.isEmpty()) 43 { 44 LOG(VB_GENERAL, LOG_ERR, "DBUserName" + msg); 45 return false; 46 } 47 if (dbPassword.isEmpty()) 48 { 49 LOG(VB_GENERAL, LOG_ERR, "DBPassword" + msg); 50 return false; 51 } 52 if (dbName.isEmpty()) 53 { 54 LOG(VB_GENERAL, LOG_ERR, "DBName" + msg); 55 return false; 56 } 57 58 return true; 59 } 60 61 bool DatabaseParams::operator==(const DatabaseParams &other) const 62 { 63 return 64 dbHostName == other.dbHostName && 65 dbHostPing == other.dbHostPing && 66 dbPort == other.dbPort && 67 dbUserName == other.dbUserName && 68 dbPassword == other.dbPassword && 69 dbName == other.dbName && 70 dbType == other.dbType && 71 localEnabled == other.localEnabled && 72 wolEnabled == other.wolEnabled && 73 (!localEnabled || (localHostName == other.localHostName)) && 74 (!wolEnabled || 75 (wolReconnect == other.wolReconnect && 76 wolRetry == other.wolRetry && 77 wolCommand == other.wolCommand)); 78 } -
mythtv/libs/libmythbase/mythdbparams.h
diff --git a/mythtv/libs/libmythbase/mythdbparams.h b/mythtv/libs/libmythbase/mythdbparams.h index a60f576..a6d349d 100644
a b 1 1 #ifndef MYTHDBPARAMS_H_ 2 2 #define MYTHDBPARAMS_H_ 3 3 4 #include <QString> 5 4 6 #include "mythbaseexp.h" 5 7 6 8 /// Structure containing the basic Database parameters 7 structMBASE_PUBLIC DatabaseParams9 class MBASE_PUBLIC DatabaseParams 8 10 { 11 public: 12 DatabaseParams() { LoadDefaults(); } 13 14 void LoadDefaults(void); 15 bool IsValid(const QString &source = QString("Unknown")) const; 16 17 bool operator==(const DatabaseParams &other) const; 18 bool operator!=(const DatabaseParams &other) const 19 { return !((*this)==other); } 20 9 21 QString dbHostName; ///< database server 10 22 bool dbHostPing; ///< Can we test connectivity using ping? 11 23 int dbPort; ///< database port … … struct MBASE_PUBLIC DatabaseParams 22 34 int wolRetry; ///< times to retry to reconnect 23 35 QString wolCommand; ///< command to use for wake-on-lan 24 36 37 bool forceSave; ///< set to true to force a save of the settings file 38 25 39 QString verVersion; ///< git version string 26 40 QString verBranch; ///< git branch 27 41 QString verProtocol; ///< backend protocol -
mythtv/libs/libmythbase/mythlocale.cpp
diff --git a/mythtv/libs/libmythbase/mythlocale.cpp b/mythtv/libs/libmythbase/mythlocale.cpp index e22d55c..9142bb8 100644
a b void MythLocale::SaveLocaleDefaults(bool overwrite) 168 168 { 169 169 MythDB *mythDB = MythDB::getMythDB(); 170 170 if (overwrite || mythDB->GetSetting(it.key()).isEmpty()) 171 {172 mythDB->SetSetting(it.key(), it.value());173 171 mythDB->SaveSettingOnHost(it.key(), it.value(), ""); 174 }175 172 } 176 173 177 174 for (it = m_hostSettings.begin(); it != m_hostSettings.end(); ++it) 178 175 { 179 176 MythDB *mythDB = MythDB::getMythDB(); 180 177 if (overwrite || mythDB->GetSetting(it.key()).isEmpty()) 181 {182 mythDB->SetSetting(it.key(), it.value());183 178 mythDB->SaveSetting(it.key(), it.value()); 184 }185 179 } 186 180 } 187 181 -
mythtv/libs/libmythbase/mythtranslation.cpp
diff --git a/mythtv/libs/libmythbase/mythtranslation.cpp b/mythtv/libs/libmythbase/mythtranslation.cpp index 46adf08..6690cf9 100644
a b void MythTranslation::load(const QString &module_name) 52 52 53 53 if (lang == "en") 54 54 { 55 gCoreContext->SetSetting("Language", "en_US");56 55 gCoreContext->SaveSetting("Language", "en_US"); 57 56 lang = "en_us"; 58 57 } -
mythtv/libs/libmythmetadata/parentalcontrols.cpp
diff --git a/mythtv/libs/libmythmetadata/parentalcontrols.cpp b/mythtv/libs/libmythmetadata/parentalcontrols.cpp index 74b2054..124c832 100644
a b class ParentalLevelChangeCheckerPrivate : public QObject 277 277 { 278 278 // Two minute window 279 279 last_time_stamp = curr_time.toString(Qt::ISODate); 280 gCoreContext->SetSetting("VideoPasswordTime", last_time_stamp);281 280 gCoreContext->SaveSetting("VideoPasswordTime", last_time_stamp); 282 281 return true; 283 282 } -
mythtv/libs/libmythui/myththemedmenu.cpp
diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp index bfd5429..8b1f6fa 100644
a b void MythThemedMenu::customEvent(QEvent *event) 424 424 QString timestamp_setting = QString("%1Time").arg(button.password); 425 425 QDateTime curr_time = QDateTime::currentDateTime(); 426 426 QString last_time_stamp = curr_time.toString(Qt::TextDate); 427 GetMythDB()->SetSetting(timestamp_setting, last_time_stamp);428 427 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp); 429 428 buttonAction(item, true); 430 429 } … … bool MythThemedMenu::checkPinCode(const QString &password_setting) 923 922 if (last_time.secsTo(curr_time) < 120) 924 923 { 925 924 last_time_stamp = curr_time.toString(Qt::TextDate); 926 GetMythDB()->SetSetting(timestamp_setting, last_time_stamp);927 925 GetMythDB()->SaveSetting(timestamp_setting, last_time_stamp); 928 926 return true; 929 927 } -
mythtv/libs/libmythupnp/configuration.cpp
diff --git a/mythtv/libs/libmythupnp/configuration.cpp b/mythtv/libs/libmythupnp/configuration.cpp index 1447355..658008c 100644
a b 21 21 // 22 22 ////////////////////////////////////////////////////////////////////////////// 23 23 24 #include <unistd.h> // for fsync 25 24 26 #include <iostream> 25 27 26 28 #include <QDir> … … bool XmlConfiguration::Save( void ) 98 100 if (m_sFileName.isEmpty()) // Special case. No file is created 99 101 return true; 100 102 101 QString sName = m_sPath + '/' + m_sFileName; 103 QString config_temppath = m_sPath + '/' + m_sFileName + ".new"; 104 QString config_filepath = m_sPath + '/' + m_sFileName; 105 QString config_origpath = m_sPath + '/' + m_sFileName + ".orig"; 102 106 103 QFile file( sName);107 QFile file(config_temppath); 104 108 105 109 if (!file.exists()) 106 110 { 107 QDir createDir( m_sPath ); 108 111 QDir createDir(m_sPath); 109 112 if (!createDir.exists()) 110 113 { 111 114 if (!createDir.mkdir(m_sPath)) … … bool XmlConfiguration::Save( void ) 117 120 } 118 121 } 119 122 120 if (!file.open( QIODevice::WriteOnly | QIODevice::Truncate))123 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) 121 124 { 122 125 LOG(VB_GENERAL, LOG_ERR, 123 QString("Could not open settings file %1 for writing").arg(sName)); 126 QString("Could not open settings file %1 for writing") 127 .arg(config_temppath)); 124 128 125 129 return false; 126 130 } 127 131 128 QTextStream ts( &file ); 132 { 133 QTextStream ts(&file); 134 m_config.save(ts, 2); 135 } 136 137 file.flush(); 129 138 130 m_config.save( ts, 2);139 fsync(file.handle()); 131 140 132 141 file.close(); 133 142 134 return true; 143 bool ok = true; 144 if (QFile::exists(config_filepath)) 145 ok = QFile::rename(config_filepath, config_origpath); 146 147 if (ok) 148 { 149 ok = file.rename(config_filepath); 150 if (ok) 151 QFile::remove(config_origpath); 152 else if (QFile::exists(config_origpath)) 153 QFile::rename(config_origpath, config_filepath); 154 } 155 156 if (!ok) 157 { 158 LOG(VB_GENERAL, LOG_ERR, 159 QString("Could not save settings file %1").arg(config_filepath)); 160 } 161 162 return ok; 135 163 } 136 164 137 165 ////////////////////////////////////////////////////////////////////////////// … … void XmlConfiguration::SetValue( const QString &sSetting, QString sValue ) 268 296 } 269 297 } 270 298 299 void XmlConfiguration::ClearValue(const QString &sSetting) 300 { 301 QDomNode node = FindNode(sSetting); 302 if (!node.isNull()) 303 { 304 QDomNode parent = node.parentNode(); 305 parent.removeChild(node); 306 while (parent.childNodes().count() == 0) 307 { 308 QDomNode next_parent = parent.parentNode(); 309 next_parent.removeChild(parent); 310 parent = next_parent; 311 } 312 } 313 } 271 314 272 315 ////////////////////////////////////////////////////////////////////////////// 273 316 ////////////////////////////////////////////////////////////////////////////// -
mythtv/libs/libmythupnp/configuration.h
diff --git a/mythtv/libs/libmythupnp/configuration.h b/mythtv/libs/libmythupnp/configuration.h index ee3f51e..74f1a69 100644
a b class UPNP_PUBLIC XmlConfiguration : public Configuration 84 84 85 85 virtual void SetValue( const QString &sSetting, int value ); 86 86 virtual void SetValue( const QString &sSetting, QString value ); 87 87 virtual void ClearValue( const QString &sSetting ); 88 88 }; 89 89 90 90 ////////////////////////////////////////////////////////////////////////////// -
mythtv/programs/mythbackend/mythsettings.cpp
diff --git a/mythtv/programs/mythbackend/mythsettings.cpp b/mythtv/programs/mythbackend/mythsettings.cpp index 4b033cc..cfdebfa 100644
a b QMap<QString,QString> GetSettingsMap(MythSettingList &settings, 355 355 QMap<QString,QString> result; 356 356 MSqlQuery query(MSqlQuery::InitCon()); 357 357 358 QString list = extract_query_list(settings, MythSetting::kFile); 359 if (!list.isEmpty()) 360 { 361 result = GetConfigFileSettingValues(); 362 if (result.isEmpty()) 363 return result; 364 } 365 366 list = extract_query_list(settings, MythSetting::kHost); 358 QString list = extract_query_list(settings, MythSetting::kHost); 367 359 QString qstr = 368 360 "SELECT value, data " 369 361 "FROM settings " … … QString StringListToJSON(const QString &key, 474 466 return result; 475 467 } 476 468 477 QMap<QString,QString> GetConfigFileSettingValues(void)478 {479 QMap<QString,QString> map;480 DatabaseParams params;481 if (!MythDB::LoadDatabaseParamsFromDisk(params))482 MythDB::LoadDefaultDatabaseParams(params);483 484 map["dbHostName"] = params.dbHostName;485 map["dbPort"] = QString::number(params.dbPort);486 map["dbPing"] = QString::number(params.dbHostPing);487 map["dbName"] = params.dbName;488 map["dbUserName"] = params.dbUserName;489 map["dbPassword"] = params.dbPassword;490 map["dbHostID"] = params.localHostName;491 map["dbWOLEnabled"] =492 QString::number(params.wolEnabled);493 map["dbWOLReconnectCount"] =494 QString::number(params.wolReconnect);495 map["dbWOLRetryCount"] =496 QString::number(params.wolRetry);497 map["dbWOLCommand"] = params.wolCommand;498 499 return map;500 }501 502 469 bool parse_dom(MythSettingList &settings, const QDomElement &element, 503 470 const QString &filename, const QString &group, 504 471 bool includeAllChildren, bool &foundGroup) … … bool load_settings(MythSettingList &settings, const QString &hostname) 706 673 { 707 674 MSqlQuery query(MSqlQuery::InitCon()); 708 675 709 QString list = extract_query_list(settings, MythSetting::kFile); 710 if (!list.isEmpty()) 711 { 712 QMap<QString,QString> map = GetConfigFileSettingValues(); 713 if (map.isEmpty()) 714 return false; 715 716 MythSettingList::const_iterator it = settings.begin(); 717 for (; it != settings.end(); ++it) 718 fill_setting(*it, map, MythSetting::kFile); 719 } 720 721 list = extract_query_list(settings, MythSetting::kHost); 676 QString list = extract_query_list(settings, MythSetting::kHost); 722 677 QString qstr = 723 678 "SELECT value, data " 724 679 "FROM settings " -
mythtv/programs/mythbackend/mythsettings.h
diff --git a/mythtv/programs/mythbackend/mythsettings.h b/mythtv/programs/mythbackend/mythsettings.h index 43fa892..2c6f812 100644
a b bool check_settings(MythSettingList &database_settings, 125 125 QStringList GetSettingValueList(const QString &type); 126 126 QString StringMapToJSON(const QMap<QString,QString> &map); 127 127 QString StringListToJSON(const QString &key, const QStringList &sList); 128 QMap<QString,QString> GetConfigFileSettingValues();129 128 QMap<QString,QString> GetSettingsMap(MythSettingList &settings, const QString &hostname); 130 129 131 130 #endif -
mythtv/programs/mythtv-setup/main.cpp
diff --git a/mythtv/programs/mythtv-setup/main.cpp b/mythtv/programs/mythtv-setup/main.cpp index 266256a..2e82fdd 100644
a b int main(int argc, char *argv[]) 342 342 343 343 if (use_display) 344 344 { 345 gCoreContext-> SetSetting("Theme", DEFAULT_UI_THEME);345 gCoreContext->OverrideSettingForSession("Theme", DEFAULT_UI_THEME); 346 346 GetMythUI()->LoadQtConfig(); 347 347 348 348 QString fileprefix = GetConfDir(); -
mythtv/programs/mythtv-setup/startprompt.cpp
diff --git a/mythtv/programs/mythtv-setup/startprompt.cpp b/mythtv/programs/mythtv-setup/startprompt.cpp index b49385a..e61cf12 100644
a b void StartPrompter::handleStart() 44 44 void StartPrompter::leaveBackendRunning() 45 45 { 46 46 LOG(VB_GENERAL, LOG_INFO, "Continuing with backend running"); 47 gCoreContext-> SetSetting("AutoRestartBackend", "0");47 gCoreContext->OverrideSettingForSession("AutoRestartBackend", "0"); 48 48 } 49 49 50 50 void StartPrompter::stopBackend() … … void StartPrompter::stopBackend() 56 56 { 57 57 myth_system(commandString); 58 58 } 59 gCoreContext-> SetSetting("AutoRestartBackend", "1");59 gCoreContext->OverrideSettingForSession("AutoRestartBackend", "1"); 60 60 } 61 61 62 62 void StartPrompter::backendRunningPrompt(void)