MythTV master
visualizationsettings.cpp
Go to the documentation of this file.
1// Qt
2#include <QString>
3
4// MythTV
7
9
11{
12 bool err = false;
13
14 // Load the theme for this screen
15 if (!LoadWindowFromXML("musicsettings-ui.xml", "visualizationsettings", this))
16 return false;
17
18 UIUtilE::Assign(this, m_changeOnSongChange, "cycleonsongchange", &err);
19 UIUtilE::Assign(this, m_randomizeOrder, "randomizeorder", &err);
20 UIUtilE::Assign(this, m_scaleWidth, "scalewidth", &err);
21 UIUtilE::Assign(this, m_scaleHeight, "scaleheight", &err);
22 UIUtilE::Assign(this, m_saveButton, "save", &err);
23 UIUtilE::Assign(this, m_cancelButton, "cancel", &err);
24
25 if (err)
26 {
27 LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'visualizationsettings'");
28 return false;
29 }
30
31 int changeOnSongChange = gCoreContext->GetNumSetting("VisualCycleOnSongChange", 0);
32 if (changeOnSongChange == 1)
34 int randomizeorder = gCoreContext->GetNumSetting("VisualRandomize", 0);
35 if (randomizeorder == 1)
37
38 m_scaleWidth->SetRange(1,4,1);
39 m_scaleWidth->SetValue(gCoreContext->GetNumSetting("VisualScaleWidth"));
40 m_scaleHeight->SetRange(1,4,1);
41 m_scaleHeight->SetValue(gCoreContext->GetNumSetting("VisualScaleHeight"));
42
43 m_changeOnSongChange->SetHelpText(tr("Change the visualizer when the song changes."));
44 m_randomizeOrder->SetHelpText(tr("On changing the visualizer pick a new one at random."));
45 m_scaleWidth->SetHelpText(tr("If set to \"2\", visualizations will be "
46 "scaled in half. Currently only used by "
47 "the goom visualization. Reduces CPU load "
48 "on slower machines."));
49 m_scaleHeight->SetHelpText(tr("If set to \"2\", visualizations will be "
50 "scaled in half. Currently only used by "
51 "the goom visualization. Reduces CPU load "
52 "on slower machines."));
53 m_cancelButton->SetHelpText(tr("Exit without saving settings"));
54 m_saveButton->SetHelpText(tr("Save settings and Exit"));
55
58
60
62
63 return true;
64}
65
67{
68 int changeOnSongChange = (m_changeOnSongChange->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
69 gCoreContext->SaveSetting("VisualCycleOnSongChange", changeOnSongChange);
70 int randomizeorder = (m_randomizeOrder->GetCheckState() == MythUIStateType::Full) ? 1 : 0;
71 gCoreContext->SaveSetting("VisualRandomize", randomizeorder);
72
73 gCoreContext->SaveSetting("VisualScaleWidth", m_scaleWidth->GetIntValue());
74 gCoreContext->SaveSetting("VisualScaleHeight", m_scaleHeight->GetIntValue());
75
76 gCoreContext->dispatch(MythEvent(QString("MUSIC_SETTINGS_CHANGED VISUALIZATION_SETTINGS")));
77
78 Close();
79}
void SaveSetting(const QString &key, int newValue)
void dispatch(const MythEvent &event)
int GetNumSetting(const QString &key, int defaultval=0)
This class is used as a container for messages.
Definition: mythevent.h:17
void BuildFocusList(void)
bool SetFocusWidget(MythUIType *widget=nullptr)
virtual void Close()
void Clicked()
void SetCheckState(MythUIStateType::StateType state)
MythUIStateType::StateType GetCheckState() const
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
int GetIntValue(void) const override
Definition: mythuispinbox.h:39
void SetHelpText(const QString &text)
Definition: mythuitype.h:177
MythUICheckBox * m_randomizeOrder
bool Create(void) override
MythUICheckBox * m_changeOnSongChange
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
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition: mythuiutils.h:27