|
MythTV
0.26-pre
|
00001 #include <map> 00002 #include <vector> 00003 00004 #include <QDir> 00005 00006 #include "mythdirs.h" 00007 #include "globals.h" 00008 00009 #include "videodlg.h" 00010 #include "videoglobalsettings.h" 00011 00012 namespace 00013 { 00014 // General Settings 00015 HostComboBox *VideoDefaultParentalLevel() 00016 { 00017 HostComboBox *gc = new HostComboBox("VideoDefaultParentalLevel"); 00018 gc->setLabel(QObject::tr("Starting Parental Level")); 00019 gc->addSelection(QObject::tr("4 - Highest"), 00020 QString::number(ParentalLevel::plHigh)); 00021 gc->addSelection(QObject::tr("1 - Lowest"), 00022 QString::number(ParentalLevel::plLowest)); 00023 gc->addSelection(QString::number(ParentalLevel::plLow)); 00024 gc->addSelection(QString::number(ParentalLevel::plMedium)); 00025 gc->setHelpText(QObject::tr("This is the 'level' that Video starts at. " 00026 "Any videos with a level at or below this will be shown in " 00027 "the list or while browsing by default. The Parental PIN " 00028 "should be set to limit changing of the default level.")); 00029 return gc; 00030 } 00031 00032 const char *password_clue = 00033 QT_TRANSLATE_NOOP("QObject", "Setting this value to all numbers will make your life " 00034 "much easier."); 00035 00036 HostLineEdit *VideoAdminPassword() 00037 { 00038 HostLineEdit *gc = new HostLineEdit("VideoAdminPassword"); 00039 gc->setLabel(QObject::tr("Parental Level 4 PIN")); 00040 gc->setHelpText(QString("%1 %2") 00041 .arg(QObject::tr("This PIN is used to enter Parental Control " 00042 "Level 4 as well as the Video Manager.")) 00043 .arg(QObject::tr(password_clue))); 00044 return gc; 00045 } 00046 00047 HostLineEdit *VideoAdminPasswordThree() 00048 { 00049 HostLineEdit *gc = new HostLineEdit("VideoAdminPasswordThree"); 00050 gc->setLabel(QObject::tr("Parental Level 3 PIN")); 00051 gc->setHelpText(QString("%1 %2") 00052 .arg(QObject::tr("This PIN is used to enter Parental Control Level 3.")) 00053 .arg(QObject::tr(password_clue))); 00054 return gc; 00055 } 00056 00057 HostLineEdit *VideoAdminPasswordTwo() 00058 { 00059 HostLineEdit *gc = new HostLineEdit("VideoAdminPasswordTwo"); 00060 gc->setLabel(QObject::tr("Parental Level 2 PIN")); 00061 gc->setHelpText(QString("%1 %2") 00062 .arg(QObject::tr("This PIN is used to enter Parental Control Level 2.")) 00063 .arg(QObject::tr(password_clue))); 00064 return gc; 00065 } 00066 00067 HostCheckBox *VideoAggressivePC() 00068 { 00069 HostCheckBox *gc = new HostCheckBox("VideoAggressivePC"); 00070 gc->setLabel(QObject::tr("Aggressive Parental Control")); 00071 gc->setValue(false); 00072 gc->setHelpText(QObject::tr("If set, you will not be able to return " 00073 "to this screen and reset the Parental " 00074 "PIN without first entering the current PIN. You have " 00075 "been warned.")); 00076 return gc; 00077 } 00078 00079 HostLineEdit *VideoStartupDirectory() 00080 { 00081 HostLineEdit *gc = new HostLineEdit("VideoStartupDir"); 00082 gc->setLabel(QObject::tr("Directories that hold videos")); 00083 gc->setValue(DEFAULT_VIDEOSTARTUP_DIR); 00084 gc->setHelpText(QObject::tr("Multiple directories can be separated by ':'. " 00085 "Each directory must exist and be readable by the user " 00086 "running the frontend.")); 00087 return gc; 00088 } 00089 00090 HostLineEdit *VideoArtworkDirectory() 00091 { 00092 HostLineEdit *gc = new HostLineEdit("VideoArtworkDir"); 00093 gc->setLabel(QObject::tr("Directory that holds movie posters")); 00094 gc->setValue(GetConfDir() + "/Video/Artwork"); 00095 gc->setHelpText(QObject::tr("This directory must exist, and the user " 00096 "running the frontend needs to have read/write permission " 00097 "to the directory.")); 00098 return gc; 00099 } 00100 00101 HostLineEdit *VideoScreenshotDirectory() 00102 { 00103 HostLineEdit *gc = new HostLineEdit("mythvideo.screenshotDir"); 00104 gc->setLabel(QObject::tr("Directory that holds movie screenshots")); 00105 gc->setValue(GetConfDir() + "/Video/Screenshots"); 00106 gc->setHelpText(QObject::tr("This directory must exist, and the user " 00107 "running the frontend needs to have read/write permission " 00108 "to the directory.")); 00109 return gc; 00110 } 00111 00112 HostLineEdit *VideoBannerDirectory() 00113 { 00114 HostLineEdit *gc = new HostLineEdit("mythvideo.bannerDir"); 00115 gc->setLabel(QObject::tr("Directory that holds movie/TV Banners")); 00116 gc->setValue(GetConfDir() + "/Video/Banners"); 00117 gc->setHelpText(QObject::tr("This directory must exist, and the user " 00118 "running the frontend needs to have read/write permission " 00119 "to the directory.")); 00120 return gc; 00121 } 00122 00123 HostLineEdit *VideoFanartDirectory() 00124 { 00125 HostLineEdit *gc = new HostLineEdit("mythvideo.fanartDir"); 00126 gc->setLabel(QObject::tr("Directory that holds movie fanart")); 00127 gc->setValue(GetConfDir() + "/Video/Fanart"); 00128 gc->setHelpText(QObject::tr("This directory must exist, and the user " 00129 "running the frontend needs to have read/write permission " 00130 "to the directory.")); 00131 return gc; 00132 } 00133 00134 HostLineEdit *TrailerDirectory() 00135 { 00136 HostLineEdit *gc = new HostLineEdit("mythvideo.TrailersDir"); 00137 gc->setLabel(QObject::tr("Directory that holds movie trailers")); 00138 gc->setValue(GetConfDir() + "/Video/Trailers"); 00139 gc->setHelpText(QObject::tr("This directory must exist, and the user " 00140 "running the frontend needs to have read/write permission " 00141 "to the directory.")); 00142 return gc; 00143 } 00144 00148 00149 // General Settings 00150 00151 HostComboBox *SetOnInsertDVD() 00152 { 00153 HostComboBox *gc = new HostComboBox("DVDOnInsertDVD"); 00154 gc->setLabel(QObject::tr("On DVD insertion")); 00155 gc->addSelection(QObject::tr("Display mythdvd menu"),"1"); 00156 gc->addSelection(QObject::tr("Do nothing"),"0"); 00157 gc->addSelection(QObject::tr("Play DVD"),"2"); 00158 gc->setHelpText(QObject::tr("Media Monitoring should be turned on to " 00159 "allow this feature (Setup -> General -> CD/DVD Monitor).")); 00160 return gc; 00161 } 00162 00163 HostCheckBox *VideoTreeRemember() 00164 { 00165 HostCheckBox *gc = new HostCheckBox("mythvideo.VideoTreeRemember"); 00166 gc->setLabel(QObject::tr("Video Tree remembers last selected position")); 00167 gc->setValue(false); 00168 gc->setHelpText(QObject::tr("If set, the current position in the Video " 00169 "Tree is persistent.")); 00170 return gc; 00171 } 00172 00173 struct ConfigPage 00174 { 00175 typedef std::vector<ConfigurationGroup *> PageList; 00176 00177 protected: 00178 ConfigPage(PageList &pl) : m_pl(pl) 00179 { 00180 } 00181 00182 void Add(ConfigurationGroup *page) 00183 { 00184 m_pl.push_back(page); 00185 } 00186 00187 private: 00188 ConfigPage(const ConfigPage &); 00189 ConfigPage &operator=(const ConfigPage &); 00190 00191 private: 00192 PageList &m_pl; 00193 }; 00194 00195 struct VConfigPage : public ConfigPage 00196 { 00197 VConfigPage(PageList &pl, bool luselabel = true, bool luseframe = true, 00198 bool lzeroMargin = false, bool lzeroSpace = false) : 00199 ConfigPage(pl) 00200 { 00201 m_vc_page = new VerticalConfigurationGroup(luselabel, luseframe, 00202 lzeroMargin, lzeroSpace); 00203 Add(m_vc_page); 00204 } 00205 00206 VerticalConfigurationGroup *operator->() 00207 { 00208 return m_vc_page; 00209 } 00210 00211 private: 00212 VerticalConfigurationGroup *m_vc_page; 00213 }; 00214 00215 class RatingsToPL : public TriggeredConfigurationGroup 00216 { 00217 public: 00218 RatingsToPL() : TriggeredConfigurationGroup(false) 00219 { 00220 HostCheckBox *r2pl = 00221 new HostCheckBox("mythvideo.ParentalLevelFromRating"); 00222 r2pl->setLabel(QObject::tr("Enable automatic Parental Level from " 00223 "rating")); 00224 r2pl->setValue(false); 00225 r2pl->setHelpText(QObject::tr("If enabled, searches will automatically " 00226 "set the Parental Level to the one " 00227 "matching the rating below.")); 00228 addChild(r2pl); 00229 setTrigger(r2pl); 00230 00231 typedef std::map<ParentalLevel::Level, QString> r2pl_map; 00232 r2pl_map r2pl_defaults; 00233 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLowest, 00234 tr("G", "PL 1 default search string."))); 00235 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plLow, 00236 tr("PG", "PL 2 default search string."))); 00237 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plMedium, 00238 tr("PG-13", "PL3 default search string."))); 00239 r2pl_defaults.insert(r2pl_map::value_type(ParentalLevel::plHigh, 00240 tr("R:NC-17", "PL4 default search string."))); 00241 00242 VerticalConfigurationGroup *vcg = new VerticalConfigurationGroup(true); 00243 00244 for (ParentalLevel pl(ParentalLevel::plLowest); 00245 pl.GetLevel() <= ParentalLevel::plHigh && pl.good(); ++pl) 00246 { 00247 HostLineEdit *hle = new HostLineEdit(QString("mythvideo.AutoR2PL%1") 00248 .arg(pl.GetLevel())); 00249 hle->setLabel(QObject::tr("Level %1").arg(pl.GetLevel())); 00250 hle->setHelpText(QObject::tr("Ratings containing these strings " 00251 "(separated by :) will be assigned " 00252 "to Parental Level %1.") 00253 .arg(pl.GetLevel())); 00254 00255 r2pl_map::const_iterator def_setting = 00256 r2pl_defaults.find(pl.GetLevel()); 00257 if (def_setting != r2pl_defaults.end()) 00258 { 00259 hle->setValue(def_setting->second); 00260 } 00261 00262 vcg->addChild(hle); 00263 } 00264 00265 addTarget("0", new VerticalConfigurationGroup(true)); 00266 addTarget("1", vcg); 00267 } 00268 }; 00269 00270 } // namespace 00271 00272 VideoGeneralSettings::VideoGeneralSettings() 00273 { 00274 ConfigPage::PageList pages; 00275 00276 VConfigPage page1(pages, false); 00277 page1->addChild(VideoStartupDirectory()); 00278 page1->addChild(TrailerDirectory()); 00279 page1->addChild(VideoArtworkDirectory()); 00280 page1->addChild(VideoScreenshotDirectory()); 00281 page1->addChild(VideoBannerDirectory()); 00282 page1->addChild(VideoFanartDirectory()); 00283 00284 VConfigPage page2(pages, false); 00285 page2->addChild(SetOnInsertDVD()); 00286 page2->addChild(VideoTreeRemember()); 00287 00288 // page 3 00289 VerticalConfigurationGroup *pctrl = 00290 new VerticalConfigurationGroup(true, false); 00291 pctrl->setLabel(QObject::tr("Parental Control Settings")); 00292 pctrl->addChild(VideoDefaultParentalLevel()); 00293 pctrl->addChild(VideoAdminPassword()); 00294 pctrl->addChild(VideoAdminPasswordThree()); 00295 pctrl->addChild(VideoAdminPasswordTwo()); 00296 pctrl->addChild(VideoAggressivePC()); 00297 VConfigPage page3(pages, false); 00298 page3->addChild(pctrl); 00299 00300 VConfigPage page4(pages, false); 00301 page4->addChild(new RatingsToPL()); 00302 00303 int page_num = 1; 00304 for (ConfigPage::PageList::const_iterator p = pages.begin(); 00305 p != pages.end(); ++p, ++page_num) 00306 { 00307 (*p)->setLabel(QObject::tr("General Settings (%1/%2)").arg(page_num) 00308 .arg(pages.size())); 00309 addChild(*p); 00310 } 00311 }
1.7.6.1