Ticket #10092: mythfrontendsetup-07-02-2012.diff
File mythfrontendsetup-07-02-2012.diff, 16.8 KB (added by , 12 years ago) |
---|
-
mythtv/programs/mythfrontend/main.cpp
diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp index 259e020..c2a1d48 100644
a b 1 #include <unistd.h>2 1 #include <fcntl.h> 3 2 #include <signal.h> 4 3 #include <cerrno> … … using namespace std; 75 74 #include "mythversion.h" 76 75 #include "taskqueue.h" 77 76 77 78 #include "standardsettings.h" 79 78 80 // Video 79 81 #include "cleanup.h" 80 82 #include "globals.h" … … namespace 138 140 139 141 if (passwordValid) 140 142 { 141 VideoGeneralSettings settings; 142 settings.exec(); 143 MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); 144 StandardSettingDialog *ssd = new StandardSettingDialog(mainStack, "videogeneralsettings"); 145 146 if (ssd->Create()) 147 { 148 ssd->loadSettings(new VideoGeneralSettings()); 149 mainStack->AddScreen(ssd); 150 } 151 else 152 delete ssd; 143 153 } 144 154 else 145 155 { -
mythtv/programs/mythfrontend/mythfrontend.pro
diff --git a/mythtv/programs/mythfrontend/mythfrontend.pro b/mythtv/programs/mythfrontend/mythfrontend.pro index 7c71469..dde9b2d 100644
a b HEADERS += videoplayercommand.h videopopups.h 39 39 HEADERS += videofilter.h videolist.h 40 40 HEADERS += videoplayersettings.h videodlg.h 41 41 HEADERS += videoglobalsettings.h upnpscanner.h 42 HEADERS += commandlineparser.h 42 HEADERS += commandlineparser.h standardsettings.h 43 43 44 44 SOURCES += main.cpp playbackbox.cpp viewscheduled.cpp audiogeneralsettings.cpp 45 45 SOURCES += globalsettings.cpp manualschedule.cpp programrecpriority.cpp … … SOURCES += videoplayercommand.cpp videopopups.cpp 60 60 SOURCES += videofilter.cpp videolist.cpp 61 61 SOURCES += videoplayersettings.cpp videodlg.cpp 62 62 SOURCES += videoglobalsettings.cpp upnpscanner.cpp 63 SOURCES += commandlineparser.cpp 63 SOURCES += commandlineparser.cpp standardsettings.cpp 64 64 65 65 HEADERS += serviceHosts/frontendServiceHost.h 66 66 HEADERS += services/frontend.h -
mythtv/programs/mythfrontend/videoglobalsettings.cpp
diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.cpp b/mythtv/programs/mythfrontend/videoglobalsettings.cpp index 0365bfc..55bd18d 100644
a b 9 9 #include "videodlg.h" 10 10 #include "videoglobalsettings.h" 11 11 12 #include "mythlogging.h" 13 12 14 namespace 13 15 { 14 16 // General Settings 15 HostComboBox *VideoDefaultParentalLevel()17 HostComboBoxSetting *VideoDefaultParentalLevel() 16 18 { 17 HostComboBox *gc = new HostComboBox("VideoDefaultParentalLevel");19 HostComboBoxSetting *gc = new HostComboBoxSetting("VideoDefaultParentalLevel"); 18 20 gc->setLabel(QObject::tr("Starting Parental Level")); 19 21 gc->addSelection(QObject::tr("4 - Highest"), 20 22 QString::number(ParentalLevel::plHigh)); … … const char *password_clue = 33 35 QT_TRANSLATE_NOOP("QObject", "Setting this value to all numbers will make your life " 34 36 "much easier."); 35 37 36 Host LineEdit*VideoAdminPassword()38 HostTextEditSetting *VideoAdminPassword() 37 39 { 38 Host LineEdit *gc = new HostLineEdit("VideoAdminPassword");40 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPassword"); 39 41 gc->setLabel(QObject::tr("Parental Level 4 PIN")); 40 42 gc->setHelpText(QString("%1 %2") 41 43 .arg(QObject::tr("This PIN is used to enter Parental Control " … … HostLineEdit *VideoAdminPassword() 44 46 return gc; 45 47 } 46 48 47 Host LineEdit*VideoAdminPasswordThree()49 HostTextEditSetting *VideoAdminPasswordThree() 48 50 { 49 Host LineEdit *gc = new HostLineEdit("VideoAdminPasswordThree");51 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordThree"); 50 52 gc->setLabel(QObject::tr("Parental Level 3 PIN")); 51 53 gc->setHelpText(QString("%1 %2") 52 54 .arg(QObject::tr("This PIN is used to enter Parental Control Level 3.")) … … HostLineEdit *VideoAdminPasswordThree() 54 56 return gc; 55 57 } 56 58 57 Host LineEdit*VideoAdminPasswordTwo()59 HostTextEditSetting *VideoAdminPasswordTwo() 58 60 { 59 Host LineEdit *gc = new HostLineEdit("VideoAdminPasswordTwo");61 HostTextEditSetting *gc = new HostTextEditSetting("VideoAdminPasswordTwo"); 60 62 gc->setLabel(QObject::tr("Parental Level 2 PIN")); 61 63 gc->setHelpText(QString("%1 %2") 62 64 .arg(QObject::tr("This PIN is used to enter Parental Control Level 2.")) … … HostLineEdit *VideoAdminPasswordTwo() 64 66 return gc; 65 67 } 66 68 67 HostCheckBox *VideoAggressivePC()69 HostCheckBoxSetting *VideoAggressivePC() 68 70 { 69 HostCheckBox *gc = new HostCheckBox("VideoAggressivePC");71 HostCheckBoxSetting *gc = new HostCheckBoxSetting("VideoAggressivePC"); 70 72 gc->setLabel(QObject::tr("Aggressive Parental Control")); 71 73 gc->setValue(false); 72 74 gc->setHelpText(QObject::tr("If set, you will not be able to return " … … HostCheckBox *VideoAggressivePC() 76 78 return gc; 77 79 } 78 80 79 Host LineEdit*VideoStartupDirectory()81 HostTextEditSetting *VideoStartupDirectory() 80 82 { 81 Host LineEdit *gc = new HostLineEdit("VideoStartupDir");83 HostTextEditSetting *gc = new HostTextEditSetting("VideoStartupDir"); 82 84 gc->setLabel(QObject::tr("Directories that hold videos")); 83 85 gc->setValue(DEFAULT_VIDEOSTARTUP_DIR); 84 86 gc->setHelpText(QObject::tr("Multiple directories can be separated by ':'. " … … HostLineEdit *VideoStartupDirectory() 87 89 return gc; 88 90 } 89 91 90 Host LineEdit*VideoArtworkDirectory()92 HostTextEditSetting *VideoArtworkDirectory() 91 93 { 92 Host LineEdit *gc = new HostLineEdit("VideoArtworkDir");94 HostTextEditSetting *gc = new HostTextEditSetting("VideoArtworkDir"); 93 95 gc->setLabel(QObject::tr("Directory that holds movie posters")); 94 96 gc->setValue(GetConfDir() + "/Video/Artwork"); 95 97 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoArtworkDirectory() 98 100 return gc; 99 101 } 100 102 101 Host LineEdit*VideoScreenshotDirectory()103 HostTextEditSetting *VideoScreenshotDirectory() 102 104 { 103 Host LineEdit *gc = new HostLineEdit("mythvideo.screenshotDir");105 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.screenshotDir"); 104 106 gc->setLabel(QObject::tr("Directory that holds movie screenshots")); 105 107 gc->setValue(GetConfDir() + "/Video/Screenshots"); 106 108 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoScreenshotDirectory() 109 111 return gc; 110 112 } 111 113 112 Host LineEdit*VideoBannerDirectory()114 HostTextEditSetting *VideoBannerDirectory() 113 115 { 114 Host LineEdit *gc = new HostLineEdit("mythvideo.bannerDir");116 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.bannerDir"); 115 117 gc->setLabel(QObject::tr("Directory that holds movie/TV Banners")); 116 118 gc->setValue(GetConfDir() + "/Video/Banners"); 117 119 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoBannerDirectory() 120 122 return gc; 121 123 } 122 124 123 Host LineEdit*VideoFanartDirectory()125 HostTextEditSetting *VideoFanartDirectory() 124 126 { 125 Host LineEdit *gc = new HostLineEdit("mythvideo.fanartDir");127 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.fanartDir"); 126 128 gc->setLabel(QObject::tr("Directory that holds movie fanart")); 127 129 gc->setValue(GetConfDir() + "/Video/Fanart"); 128 130 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *VideoFanartDirectory() 131 133 return gc; 132 134 } 133 135 134 Host LineEdit*TrailerDirectory()136 HostTextEditSetting *TrailerDirectory() 135 137 { 136 Host LineEdit *gc = new HostLineEdit("mythvideo.TrailersDir");138 HostTextEditSetting *gc = new HostTextEditSetting("mythvideo.TrailersDir"); 137 139 gc->setLabel(QObject::tr("Directory that holds movie trailers")); 138 140 gc->setValue(GetConfDir() + "/Video/Trailers"); 139 141 gc->setHelpText(QObject::tr("This directory must exist, and the user " … … HostLineEdit *TrailerDirectory() 148 150 149 151 // General Settings 150 152 151 HostComboBox *SetOnInsertDVD()153 HostComboBoxSetting *SetOnInsertDVD() 152 154 { 153 HostComboBox *gc = new HostComboBox("DVDOnInsertDVD");155 HostComboBoxSetting *gc = new HostComboBoxSetting("DVDOnInsertDVD"); 154 156 gc->setLabel(QObject::tr("On DVD insertion")); 155 157 gc->addSelection(QObject::tr("Display mythdvd menu"),"1"); 156 158 gc->addSelection(QObject::tr("Do nothing"),"0"); … … HostComboBox *SetOnInsertDVD() 160 162 return gc; 161 163 } 162 164 163 HostCheckBox *VideoTreeRemember()165 HostCheckBoxSetting *VideoTreeRemember() 164 166 { 165 HostCheckBox *gc = new HostCheckBox("mythvideo.VideoTreeRemember");167 HostCheckBoxSetting *gc = new HostCheckBoxSetting("mythvideo.VideoTreeRemember"); 166 168 gc->setLabel(QObject::tr("Video Tree remembers last selected position")); 167 169 gc->setValue(false); 168 170 gc->setHelpText(QObject::tr("If set, the current position in the Video " … … HostCheckBox *VideoTreeRemember() 170 172 return gc; 171 173 } 172 174 173 struct ConfigPage174 {175 typedef std::vector<ConfigurationGroup *> PageList;176 177 protected:178 ConfigPage(PageList &pl) : m_pl(pl)179 {180 }181 182 void Add(ConfigurationGroup *page)183 {184 m_pl.push_back(page);185 }186 187 private:188 ConfigPage(const ConfigPage &);189 ConfigPage &operator=(const ConfigPage &);190 191 private:192 PageList &m_pl;193 };194 195 struct VConfigPage : public ConfigPage196 {197 VConfigPage(PageList &pl, bool luselabel = true, bool luseframe = true,198 bool lzeroMargin = false, bool lzeroSpace = false) :199 ConfigPage(pl)200 {201 m_vc_page = new VerticalConfigurationGroup(luselabel, luseframe,202 lzeroMargin, lzeroSpace);203 Add(m_vc_page);204 }205 175 206 VerticalConfigurationGroup *operator->()207 {208 return m_vc_page;209 }210 176 211 private:212 VerticalConfigurationGroup *m_vc_page;213 };214 177 215 class RatingsToPL : public TriggeredConfigurationGroup 178 HostCheckBoxSetting *RatingsToPL() 216 179 { 217 public: 218 RatingsToPL() : TriggeredConfigurationGroup(false) 180 HostCheckBoxSetting *r2pl = 181 new HostCheckBoxSetting("mythvideo.ParentalLevelFromRating"); 182 r2pl->setLabel(QObject::tr("Enable automatic Parental Level from " 183 "rating")); 184 r2pl->setValue(false); 185 r2pl->setHelpText(QObject::tr("If enabled, searches will automatically " 186 "set the Parental Level to the one " 187 "matching the rating below.")); 188 189 typedef std::map<ParentalLevel::Level, QString> r2pl_map; 190 r2pl_map r2pl_defaults; 191 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest, 192 QObject::tr("G", "PL 1 default search string."))); 193 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow, 194 QObject::tr("PG", "PL 2 default search string."))); 195 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium, 196 QObject::tr("PG-13", "PL3 default search string."))); 197 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh, 198 QObject::tr("R:NC-17", "PL4 default search string."))); 199 200 for (ParentalLevel pl(ParentalLevel::plLowest); 201 pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) 219 202 { 220 HostCheckBox *r2pl = 221 new HostCheckBox("mythvideo.ParentalLevelFromRating"); 222 r2pl->setLabel(QObject::tr("Enable automatic Parental Level from " 223 "rating")); 224 r2pl->setValue(false); 225 r2pl->setHelpText(QObject::tr("If enabled, searches will automatically " 226 "set the Parental Level to the one " 227 "matching the rating below.")); 228 addChild(r2pl); 229 setTrigger(r2pl); 230 231 typedef std::map<ParentalLevel::Level, QString> r2pl_map; 232 r2pl_map r2pl_defaults; 233 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest, 234 tr("G", "PL 1 default search string."))); 235 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow, 236 tr("PG", "PL 2 default search string."))); 237 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium, 238 tr("PG-13", "PL3 default search string."))); 239 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh, 240 tr("R:NC-17", "PL4 default search string."))); 241 242 VerticalConfigurationGroup *vcg = new VerticalConfigurationGroup(true); 243 244 for (ParentalLevel pl(ParentalLevel::plLowest); 245 pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) 203 HostTextEditSetting *hle = new HostTextEditSetting(QString("mythvideo.AutoR2PL%1") 204 .arg(pl.GetLevel())); 205 hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel())); 206 hle->setHelpText(QObject::tr("Ratings containing these strings " 207 "(separated by :) will be assigned " 208 "to Parental Level %1.") 209 .arg(pl.GetLevel())); 210 211 r2pl_map::const_iterator def_setting = 212 r2pl_defaults.find(pl.GetLevel()); 213 if (def_setting != r2pl_defaults.end()) 246 214 { 247 HostLineEdit *hle = new HostLineEdit(QString("mythvideo.AutoR2PL%1") 248 .arg(pl.GetLevel())); 249 hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel())); 250 hle->setHelpText(QObject::tr("Ratings containing these strings " 251 "(separated by :) will be assigned " 252 "to Parental Level %1.") 253 .arg(pl.GetLevel())); 254 255 r2pl_map::const_iterator def_setting = 256 r2pl_defaults.find(pl.GetLevel()); 257 if (def_setting != r2pl_defaults.end()) 258 { 259 hle->setValue(def_setting->second); 260 } 261 262 vcg->addChild(hle); 215 hle->setValue(def_setting->second); 263 216 } 264 217 265 addTarget("0", new VerticalConfigurationGroup(true)); 266 addTarget("1", vcg); 218 r2pl->addTargetedChild("1", hle); 267 219 } 268 };269 220 270 } // namespace 221 return r2pl; 222 } 223 224 } 271 225 272 226 VideoGeneralSettings::VideoGeneralSettings() 227 :GroupSetting() 273 228 { 274 ConfigPage::PageList pages;275 276 VConfigPage page1(pages, false);277 page1->addChild(VideoStartupDirectory());278 page1->addChild(TrailerDirectory()); 279 page1->addChild(VideoArtworkDirectory());280 page1->addChild(VideoScreenshotDirectory());281 page1->addChild(VideoBannerDirectory());282 page1->addChild(VideoFanartDirectory());283 284 VConfigPage page2(pages, false);285 page2->addChild(SetOnInsertDVD()); 286 page2->addChild(VideoTreeRemember());287 288 // page 3 289 VerticalConfigurationGroup*pctrl =290 new VerticalConfigurationGroup(true, false);229 setLabel(QObject::tr("General settings")); 230 231 setHelpText(QObject::tr("TODO add a descrition for this group of settings")); 232 233 234 addChild(VideoStartupDirectory()); 235 addChild(TrailerDirectory()); 236 addChild(VideoArtworkDirectory()); 237 addChild(VideoScreenshotDirectory()); 238 addChild(VideoBannerDirectory()); 239 addChild(VideoFanartDirectory()); 240 241 addChild(SetOnInsertDVD()); 242 addChild(VideoTreeRemember()); 243 244 GroupSetting *pctrl = 245 new GroupSetting(); 291 246 pctrl->setLabel(QObject::tr("Parental Control Settings")); 247 248 pctrl->setHelpText(QObject::tr("TODO add a description for this group of setting")); 292 249 pctrl->addChild(VideoDefaultParentalLevel()); 293 250 pctrl->addChild(VideoAdminPassword()); 294 251 pctrl->addChild(VideoAdminPasswordThree()); 295 252 pctrl->addChild(VideoAdminPasswordTwo()); 296 253 pctrl->addChild(VideoAggressivePC()); 297 VConfigPage page3(pages, false);298 page3->addChild(pctrl);299 254 300 VConfigPage page4(pages, false); 301 page4->addChild(new RatingsToPL()); 255 addChild(pctrl); 256 257 addChild(RatingsToPL()); 302 258 303 int page_num = 1;304 for (ConfigPage::PageList::const_iterator p = pages.begin();305 p != pages.end(); ++p, ++page_num)306 {307 (*p)->setLabel(QObject::tr("General Settings (%1/%2)").arg(page_num)308 .arg(pages.size()));309 addChild(*p);310 }311 259 } 260 -
mythtv/programs/mythfrontend/videoglobalsettings.h
diff --git a/mythtv/programs/mythfrontend/videoglobalsettings.h b/mythtv/programs/mythfrontend/videoglobalsettings.h index 9f621e6..de155db 100644
a b 3 3 4 4 #include "settings.h" 5 5 6 class VideoGeneralSettings : public ConfigurationWizard 6 #include "standardsettings.h" 7 8 class VideoGeneralSettings : public GroupSetting 7 9 { 8 10 public: 9 11 VideoGeneralSettings();