Ticket #1288: switch_for_overriding_RunFrontendInWindow.patch
File switch_for_overriding_RunFrontendInWindow.patch, 4.3 KB (added by , 18 years ago) |
---|
-
libs/libmyth/mythcontext.h
348 348 double defaultval = 0.0); 349 349 350 350 void SetSetting(const QString &key, const QString &newValue); 351 351 void OverrideSettingForSession(const QString &key, const QString &newValue); 352 352 QFont GetBigFont(); 353 353 QFont GetMediumFont(); 354 354 QFont GetSmallFont(); … … 427 427 bool useSettingsCache; 428 428 QMutex cacheLock; 429 429 QMap <QString, QString> settingsCache; 430 /// The settings that are overridden for this session. 431 QMap <QString, QString> overriddenSettings; 432 QMutex overriddenSettingsLock; 430 433 431 434 QMutex locationLock; 432 435 QValueList <QString> currentLocation; -
libs/libmyth/mythcontext.cpp
1766 1766 bool found = false; 1767 1767 QString value; 1768 1768 1769 overriddenSettingsLock.lock(); 1770 if (overriddenSettings.contains(key)) { 1771 value = overriddenSettings[key]; 1772 overriddenSettingsLock.unlock(); 1773 return value; 1774 } 1775 overriddenSettingsLock.unlock(); 1776 1769 1777 if (useSettingsCache) 1770 1778 { 1771 1779 cacheLock.lock(); … … 2291 2299 ClearSettingsCache(key, newValue); 2292 2300 } 2293 2301 2302 /** \fn MythContext::OverrideSettingForSession() 2303 * \brief Overrides the given setting for the execution time of the process. 2304 * 2305 * This allows defining settings for the session only, without touching the 2306 * settings in the data base. 2307 */ 2308 void MythContext::OverrideSettingForSession(const QString &key, 2309 const QString &value) 2310 { 2311 overriddenSettingsLock.lock(); 2312 overriddenSettings[key] = value; 2313 overriddenSettingsLock.unlock(); 2314 } 2315 2316 2294 2317 bool MythContext::SendReceiveStringList(QStringList &strlist, bool quickTimeout, bool block) 2295 2318 { 2296 2319 d->serverSockLock.lock(); -
programs/mythfrontend/main.cpp
761 761 QString binname = finfo.baseName(); 762 762 763 763 bool ResetSettings = false; 764 764 bool OverrideRunFrontendInWindow = false; 765 int RunFrontendInWindow = 0; 765 766 if (binname != "mythfrontend") 766 767 pluginname = binname; 767 768 … … 820 821 { 821 822 ResetSettings = true; 822 823 } 824 else if (!strcmp(a.argv()[argpos],"-w") || 825 !strcmp(a.argv()[argpos],"--windowed")) 826 { 827 OverrideRunFrontendInWindow = true; 828 RunFrontendInWindow = 1; 829 } 830 else if (!strcmp(a.argv()[argpos],"-nw") || 831 !strcmp(a.argv()[argpos],"--no-windowed")) 832 { 833 OverrideRunFrontendInWindow = true; 834 RunFrontendInWindow = 0; 835 } 823 836 else if (!strcmp(a.argv()[argpos],"-geometry") || 824 837 !strcmp(a.argv()[argpos],"--geometry")) 825 838 { … … 859 872 "--geometry WxH+X+Y Override window size and position\n" << 860 873 "-l or --logfile filename Writes STDERR and STDOUT messages to filename" << endl << 861 874 "-r or --reset Resets frontend appearance settings and language" << endl << 862 "-v or --verbose debug-level Use '-v help' for level info" << endl << 875 "-v or --verbose debug-level Use '-v help' for level info" << endl << 876 "Override 'RunFrontendInWindow' setting:" << endl << 877 "-w/--windowed Run in windowed mode" << endl << 878 "-nw or --no-windowed Run in non-windowed mode " << endl << 863 879 864 880 "--version Version information" << endl << 865 881 "<plugin> Initialize and run this plugin" << endl << … … 933 949 .arg(geometry)); 934 950 } 935 951 952 if (OverrideRunFrontendInWindow) { 953 QString setting; 954 setting.setNum(RunFrontendInWindow); 955 gContext->OverrideSettingForSession("RunFrontendInWindow", setting); 956 } 957 936 958 // Create priveleged thread, then drop privs 937 959 pthread_t priv_thread; 938 960