MythTV
0.27pre
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Groups
Pages
programs
mythfrontend
videometadatasettings.cpp
Go to the documentation of this file.
1
#include <iostream>
2
3
// qt
4
#include <QString>
5
6
// myth
7
#include "
mythcontext.h
"
8
#include "
mythdbcon.h
"
9
#include "
mythdirs.h
"
10
#include "
mythprogressdialog.h
"
11
12
#include "
videometadatasettings.h
"
13
14
using namespace
std;
15
16
// ---------------------------------------------------
17
18
MetadataSettings::MetadataSettings
(
MythScreenStack
*parent,
const
char
*
name
)
19
:
MythScreenType
(parent, name),
20
m_trailerSpin(NULL),
21
m_unknownFileCheck(NULL), m_autoMetaUpdateCheck(NULL),
22
m_treeLoadsMetaCheck(NULL), m_randomTrailerCheck(NULL),
23
m_okButton(NULL), m_cancelButton(NULL)
24
{
25
}
26
27
bool
MetadataSettings::Create
()
28
{
29
bool
foundtheme =
false
;
30
31
// Load the theme for this screen
32
foundtheme =
LoadWindowFromXML
(
"video-ui.xml"
,
"metadatasettings"
,
this
);
33
34
if
(!foundtheme)
35
return
false
;
36
37
m_trailerSpin
=
38
dynamic_cast<
MythUISpinBox
*
>
(
GetChild
(
"trailernum"
));
39
40
m_unknownFileCheck
=
41
dynamic_cast<
MythUICheckBox
*
>
(
GetChild
(
"unknownfilecheck"
));
42
m_autoMetaUpdateCheck
=
43
dynamic_cast<
MythUICheckBox
*
>
(
GetChild
(
"autometaupdatecheck"
));
44
m_treeLoadsMetaCheck
=
45
dynamic_cast<
MythUICheckBox
*
>
(
GetChild
(
"treeloadsmetacheck"
));
46
m_randomTrailerCheck
=
47
dynamic_cast<
MythUICheckBox
*
>
(
GetChild
(
"randomtrailercheck"
));
48
49
m_okButton
=
dynamic_cast<
MythUIButton
*
>
(
GetChild
(
"ok"
));
50
m_cancelButton
=
dynamic_cast<
MythUIButton
*
>
(
GetChild
(
"cancel"
));
51
52
if
(!
m_trailerSpin
|| !
m_autoMetaUpdateCheck
||
53
!
m_unknownFileCheck
|| !
m_treeLoadsMetaCheck
||
54
!
m_randomTrailerCheck
||!
m_okButton
|| !
m_cancelButton
)
55
{
56
LOG(VB_GENERAL, LOG_ERR,
"Theme is missing critical theme elements."
);
57
return
false
;
58
}
59
60
int
unknownSetting =
61
gCoreContext
->
GetNumSetting
(
"VideoListUnknownFiletypes"
, 0);
62
if
(unknownSetting == 1)
63
m_unknownFileCheck
->
SetCheckState
(
MythUIStateType::Full
);
64
65
int
autoMetaSetting =
66
gCoreContext
->
GetNumSetting
(
"mythvideo.AutoMetaDataScan"
, 1);
67
if
(autoMetaSetting == 1)
68
m_autoMetaUpdateCheck
->
SetCheckState
(
MythUIStateType::Full
);
69
70
int
loadMetaSetting =
71
gCoreContext
->
GetNumSetting
(
"VideoTreeLoadMetaData"
, 1);
72
if
(loadMetaSetting == 1)
73
m_treeLoadsMetaCheck
->
SetCheckState
(
MythUIStateType::Full
);
74
75
int
trailerSetting =
76
gCoreContext
->
GetNumSetting
(
"mythvideo.TrailersRandomEnabled"
, 0);
77
if
(trailerSetting == 1)
78
m_randomTrailerCheck
->
SetCheckState
(
MythUIStateType::Full
);
79
80
m_trailerSpin
->
SetRange
(0,100,1);
81
m_trailerSpin
->
SetValue
(
gCoreContext
->
GetNumSetting
(
82
"mythvideo.TrailersRandomCount"
));
83
84
if
(
m_randomTrailerCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
85
m_trailerSpin
->
SetVisible
(
true
);
86
else
87
m_trailerSpin
->
SetVisible
(
false
);
88
89
connect(
m_okButton
, SIGNAL(Clicked()),
this
, SLOT(
slotSave
()));
90
connect(
m_cancelButton
, SIGNAL(Clicked()),
this
, SLOT(
Close
()));
91
92
connect(
m_randomTrailerCheck
, SIGNAL(valueChanged()),
93
SLOT(
toggleTrailers
()));
94
95
m_randomTrailerCheck
->
SetHelpText
(
96
tr(
"If set, this will enable a button "
97
"called \"Watch With Trailers\" which will "
98
"play a user-specified number of trailers "
99
"before the movie."
));
100
m_trailerSpin
->
SetHelpText
(tr(
"Number of trailers to play before a film."
));
101
m_unknownFileCheck
->
SetHelpText
(
102
tr(
"If set, all files below the MythVideo "
103
"directory will be displayed unless their "
104
"extension is explicitly set to be ignored."
));
105
m_autoMetaUpdateCheck
->
SetHelpText
(
106
tr(
"If set, every time a scan for new videos "
107
"is performed, a mass metadata update of the "
108
"collection will also occur."
));
109
m_treeLoadsMetaCheck
->
SetHelpText
(
110
tr(
"If set along with Browse Files, this "
111
"will cause the Video List to load any known video meta"
112
"data from the database. Turning this off can greatly "
113
"speed up how long it takes to load the Video List tree."
));
114
m_cancelButton
->
SetHelpText
(tr(
"Exit without saving settings"
));
115
m_okButton
->
SetHelpText
(tr(
"Save settings and Exit"
));
116
117
BuildFocusList
();
118
119
return
true
;
120
}
121
122
MetadataSettings::~MetadataSettings
()
123
{
124
}
125
126
void
MetadataSettings::slotSave
(
void
)
127
{
128
gCoreContext
->
SaveSetting
(
"mythvideo.TrailersRandomCount"
,
129
m_trailerSpin
->
GetValue
());
130
131
int
listUnknownState = 0;
132
if
(
m_unknownFileCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
133
listUnknownState = 1;
134
gCoreContext
->
SaveSetting
(
"VideoListUnknownFiletypes"
, listUnknownState);
135
136
int
autoMetaState = 0;
137
if
(
m_autoMetaUpdateCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
138
autoMetaState = 1;
139
gCoreContext
->
SaveSetting
(
"mythvideo.AutoMetaDataScan"
, autoMetaState);
140
141
int
loadMetaState = 0;
142
if
(
m_treeLoadsMetaCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
143
loadMetaState = 1;
144
gCoreContext
->
SaveSetting
(
"VideoTreeLoadMetaData"
, loadMetaState);
145
146
int
trailerState = 0;
147
if
(
m_randomTrailerCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
148
trailerState = 1;
149
gCoreContext
->
SaveSetting
(
"mythvideo.TrailersRandomEnabled"
, trailerState);
150
151
Close
();
152
}
153
154
bool
MetadataSettings::keyPressEvent
(QKeyEvent *event)
155
{
156
if
(
GetFocusWidget
()->
keyPressEvent
(event))
157
return
true
;
158
159
bool
handled =
false
;
160
161
if
(!handled &&
MythScreenType::keyPressEvent
(event))
162
handled =
true
;
163
164
return
handled;
165
}
166
167
void
MetadataSettings::toggleTrailers
()
168
{
169
int
checkstate = 0;
170
if
(
m_randomTrailerCheck
->
GetCheckState
() ==
MythUIStateType::Full
)
171
checkstate = 1;
172
173
m_trailerSpin
->
SetVisible
(checkstate);
174
}
Generated on Thu May 23 2013 19:00:12 for MythTV by
1.8.1.2