MythTV master
videoplayersettings.cpp
Go to the documentation of this file.
1// C++
2#include <iostream>
3
4// Qt
5#include <QString>
6
7// MythTV
12
13// MythFrontend
14#include "videoplayersettings.h"
15
16// ---------------------------------------------------
17
19{
20 // Load the theme for this screen
21 bool foundtheme = LoadWindowFromXML("video-ui.xml", "playersettings", this);
22 if (!foundtheme)
23 return false;
24
26 dynamic_cast<MythUITextEdit *> (GetChild("defaultplayer"));
27 m_dvdPlayerEdit = dynamic_cast<MythUITextEdit *> (GetChild("dvdplayer"));
28 m_dvdDriveEdit = dynamic_cast<MythUITextEdit *> (GetChild("dvddrive"));
30 dynamic_cast<MythUITextEdit *> (GetChild("bluraymount"));
31 m_altPlayerEdit = dynamic_cast<MythUITextEdit *> (GetChild("altplayer"));
32
34 dynamic_cast<MythUIButtonList *> (GetChild("blurayregionlist"));
35
36 m_altCheck = dynamic_cast<MythUICheckBox *> (GetChild("altcheck"));
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 setting =
50 gCoreContext->GetNumSetting("mythvideo.EnableAlternatePlayer", 0);
51 if (setting == 1)
53
55 "Internal"));
57 GetSetting("mythdvd.DVDPlayerCommand", "Internal"));
58 m_dvdDriveEdit->SetText(gCoreContext->GetSetting("DVDDeviceLocation",
59 "default"));
61 "/media/cdrom"));
63 "mythvideo.VideoAlternatePlayer", "Internal"));
64
67 else
69
72
74
76 tr("This is the command used for any file "
77 "whose extension is not specifically defined. "
78 "You may also enter the name of one of the playback "
79 "plugins such as 'Internal'."));
81 tr("This can be any command to launch a DVD "
82 " player. Internal is the default. For other players, %d "
83 "will be substituted for the DVD device (e.g. /dev/dvd)."));
85 tr("This device must exist, and the user "
86 "playing the DVD needs to have read permission "
87 "on the device. 'default' will let the "
88 "MediaMonitor choose a device."));
90 tr("This path is the location your "
91 "operating system mounts Blu-ray discs."));
93 tr("If for some reason the default player "
94 "doesn't play a video, you can play it in an alternate "
95 "player by selecting 'Play in Alternate Player.'"));
97 tr("Some Blu-ray discs require that a player region be "
98 "explicitly set. Only change the value from "
99 "'No Region' if you encounter a disc which "
100 "fails to play citing a region mismatch."));
101 m_cancelButton->SetHelpText(tr("Exit without saving settings"));
102 m_okButton->SetHelpText(tr("Save settings and Exit"));
103
105
107
108 return true;
109}
110
112{
113 gCoreContext->SaveSetting("VideoDefaultPlayer", m_defaultPlayerEdit->GetText());
114 gCoreContext->SaveSetting("mythdvd.DVDPlayerCommand", m_dvdPlayerEdit->GetText());
115 gCoreContext->SaveSetting("DVDDeviceLocation", m_dvdDriveEdit->GetText());
116 gCoreContext->SaveSetting("BluRayMountpoint", m_blurayMountEdit->GetText());
117 gCoreContext->SaveSetting("mythvideo.VideoAlternatePlayer", m_altPlayerEdit->GetText());
118
119 gCoreContext->SaveSetting("BlurayRegionCode",
121
122 int checkstate = 0;
124 checkstate = 1;
125 gCoreContext->SaveSetting("mythvideo.EnableAlternatePlayer", checkstate);
126
127 Close();
128}
129
130bool PlayerSettings::keyPressEvent(QKeyEvent *event)
131{
132 if (GetFocusWidget()->keyPressEvent(event))
133 return true;
134
135 return MythScreenType::keyPressEvent(event);
136}
137
139{
140 int checkstate = 0;
142 checkstate = 1;
143
144 m_altPlayerEdit->SetVisible(checkstate != 0);
145}
146
148{
149 auto *noRegion =
150 new MythUIButtonListItem(m_blurayRegionList, tr("No Region"));
151 noRegion->SetData(0);
152
153 auto *regionA =
154 new MythUIButtonListItem(m_blurayRegionList, tr("Region A: "
155 "The Americas, Southeast Asia, Japan"));
156 regionA->SetData(1);
157
158 auto *regionB =
159 new MythUIButtonListItem(m_blurayRegionList, tr("Region B: "
160 "Europe, Middle East, Africa, Oceania"));
161 regionB->SetData(2);
162
163 auto *regionC =
164 new MythUIButtonListItem(m_blurayRegionList, tr("Region C: "
165 "Eastern Europe, Central and South Asia"));
166 regionC->SetData(4);
167
168 int region = gCoreContext->GetNumSetting("BlurayRegionCode", 0);
169
171
172 if (item)
174}
void SaveSetting(const QString &key, int newValue)
QString GetSetting(const QString &key, const QString &defaultval="")
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()
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
MythUIButtonListItem * GetItemCurrent() const
void SetItemCurrent(MythUIButtonListItem *item)
MythUIButtonListItem * GetItemByData(const QVariant &data)
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 text entry and edit widget.
QString GetText(void) const
void SetText(const QString &text, bool moveCursor=true)
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
MythUIButton * m_cancelButton
MythUIButtonList * m_blurayRegionList
MythUITextEdit * m_defaultPlayerEdit
MythUITextEdit * m_dvdPlayerEdit
MythUITextEdit * m_altPlayerEdit
bool Create(void) override
MythUICheckBox * m_altCheck
MythUIButton * m_okButton
MythUITextEdit * m_blurayMountEdit
MythUITextEdit * m_dvdDriveEdit
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
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