MythTV master
videometadatasettings.cpp
Go to the documentation of this file.
1// C++
2#include <iostream>
3
4// Qt
5#include <QString>
6
7// MythTV
13
14// MythFrontend
16
17// ---------------------------------------------------
18
20{
21 // Load the theme for this screen
22 bool foundtheme = LoadWindowFromXML("video-ui.xml", "metadatasettings", this);
23 if (!foundtheme)
24 return false;
25
27 dynamic_cast<MythUISpinBox *> (GetChild("trailernum"));
28
30 dynamic_cast<MythUICheckBox *> (GetChild("unknownfilecheck"));
32 dynamic_cast<MythUICheckBox *> (GetChild("autometaupdatecheck"));
34 dynamic_cast<MythUICheckBox *> (GetChild("treeloadsmetacheck"));
36 dynamic_cast<MythUICheckBox *> (GetChild("randomtrailercheck"));
37
38 m_okButton = dynamic_cast<MythUIButton *> (GetChild("ok"));
39 m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel"));
40
44 {
45 LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements.");
46 return false;
47 }
48
49 int unknownSetting =
50 gCoreContext->GetNumSetting("VideoListUnknownFiletypes", 0);
51 if (unknownSetting == 1)
53
54 int autoMetaSetting =
55 gCoreContext->GetNumSetting("mythvideo.AutoMetaDataScan", 1);
56 if (autoMetaSetting == 1)
58
59 int loadMetaSetting =
60 gCoreContext->GetNumSetting("VideoTreeLoadMetaData", 1);
61 if (loadMetaSetting == 1)
63
64 int trailerSetting =
65 gCoreContext->GetNumSetting("mythvideo.TrailersRandomEnabled", 0);
66 if (trailerSetting == 1)
68
69 m_trailerSpin->SetRange(0,100,1);
71 "mythvideo.TrailersRandomCount"));
72
75 else
77
80
83
85 tr("If set, this will enable a button "
86 "called \"Watch With Trailers\" which will "
87 "play a user-specified number of trailers "
88 "before the movie."));
89 m_trailerSpin->SetHelpText(tr("Number of trailers to play before a film."));
91 tr("If set, all files below the MythVideo "
92 "directory will be displayed unless their "
93 "extension is explicitly set to be ignored."));
95 tr("If set, every time a scan for new videos "
96 "is performed, a mass metadata update of the "
97 "collection will also occur."));
99 tr("If set along with Browse Files, this "
100 "will cause the Video List to load any known video meta"
101 "data from the database. Turning this off can greatly "
102 "speed up how long it takes to load the Video List tree."));
103 m_cancelButton->SetHelpText(tr("Exit without saving settings"));
104 m_okButton->SetHelpText(tr("Save settings and Exit"));
105
107
108 return true;
109}
110
112{
113 gCoreContext->SaveSetting("mythvideo.TrailersRandomCount",
115
116 int listUnknownState = 0;
118 listUnknownState = 1;
119 gCoreContext->SaveSetting("VideoListUnknownFiletypes", listUnknownState);
120
121 int autoMetaState = 0;
123 autoMetaState = 1;
124 gCoreContext->SaveSetting("mythvideo.AutoMetaDataScan", autoMetaState);
125
126 int loadMetaState = 0;
128 loadMetaState = 1;
129 gCoreContext->SaveSetting("VideoTreeLoadMetaData", loadMetaState);
130
131 int trailerState = 0;
133 trailerState = 1;
134 gCoreContext->SaveSetting("mythvideo.TrailersRandomEnabled", trailerState);
135
136 Close();
137}
138
140{
141 if (GetFocusWidget()->keyPressEvent(event))
142 return true;
143
144 return MythScreenType::keyPressEvent(event);
145}
146
148{
149 int checkstate = 0;
151 checkstate = 1;
152
153 m_trailerSpin->SetVisible(checkstate != 0);
154}
MythUISpinBox * m_trailerSpin
MythUIButton * m_cancelButton
MythUICheckBox * m_randomTrailerCheck
MythUICheckBox * m_autoMetaUpdateCheck
MythUIButton * m_okButton
MythUICheckBox * m_treeLoadsMetaCheck
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool Create(void) override
MythUICheckBox * m_unknownFileCheck
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void Close()
A single button widget.
Definition: mythuibutton.h:22
void Clicked()
A checkbox widget supporting three check states - on,off,half and two conditions - selected and unsel...
void SetCheckState(MythUIStateType::StateType state)
MythUIStateType::StateType GetCheckState() const
void valueChanged()
A widget for offering a range of numerical values where only the the bounding values and interval are...
Definition: mythuispinbox.h:23
void SetRange(int low, int high, int step, uint pageMultiple=5)
Set the lower and upper bounds of the spinbox, the interval and page amount.
void SetValue(int val) override
Definition: mythuispinbox.h:32
QString GetValue(void) const override
Definition: mythuispinbox.h:37
virtual void SetVisible(bool visible)
void SetHelpText(const QString &text)
Definition: mythuitype.h:177
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39