| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,175 @@ | ||
| // Qt | ||
| #include <QString> | ||
|
|
||
| // MythTV | ||
| #include <mythcorecontext.h> | ||
|
|
||
| #include "importsettings.h" | ||
|
|
||
| ImportSettings::ImportSettings(MythScreenStack *parent, const char *name) | ||
| : MythScreenType(parent, name), | ||
| m_paranoiaLevel(NULL), | ||
| m_filenameTemplate(NULL), | ||
| m_noWhitespace(NULL), | ||
| m_postCDRipScript(NULL), | ||
| m_ejectCD(NULL), | ||
| m_encoderType(NULL), | ||
| m_defaultRipQuality(NULL), | ||
| m_mp3UseVBR(NULL), | ||
| m_saveButton(NULL), | ||
| m_cancelButton(NULL) | ||
| { | ||
| } | ||
|
|
||
| ImportSettings::~ImportSettings() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| bool ImportSettings::Create() | ||
| { | ||
| bool err = false; | ||
|
|
||
| // Load the theme for this screen | ||
| if (!LoadWindowFromXML("musicsettings-ui.xml", "importsettings", this)) | ||
| return false; | ||
|
|
||
| UIUtilE::Assign(this, m_paranoiaLevel, "paranoialevel", &err); | ||
| UIUtilE::Assign(this, m_filenameTemplate, "filenametemplate", &err); | ||
| UIUtilE::Assign(this, m_noWhitespace, "nowhitespace", &err); | ||
| UIUtilE::Assign(this, m_postCDRipScript, "postcdripscript", &err); | ||
| UIUtilE::Assign(this, m_ejectCD, "ejectcd", &err); | ||
| UIUtilE::Assign(this, m_encoderType, "encodertype", &err); | ||
| UIUtilE::Assign(this, m_defaultRipQuality, "defaultripquality", &err); | ||
| UIUtilE::Assign(this, m_mp3UseVBR, "mp3usevbr", &err); | ||
| UIUtilE::Assign(this, m_helpText, "helptext", &err); | ||
| UIUtilE::Assign(this, m_saveButton, "save", &err); | ||
| UIUtilE::Assign(this, m_cancelButton, "cancel", &err); | ||
|
|
||
| if (err) | ||
| { | ||
| LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'importsettings'"); | ||
| return false; | ||
| } | ||
|
|
||
| new MythUIButtonListItem(m_paranoiaLevel, tr("Full"), qVariantFromValue(QString("Full"))); | ||
| new MythUIButtonListItem(m_paranoiaLevel, tr("Faster"), qVariantFromValue(QString("Faster"))); | ||
| m_paranoiaLevel->SetValueByData(gCoreContext->GetSetting("ParanoiaLevel")); | ||
|
|
||
| m_filenameTemplate->SetText(gCoreContext->GetSetting("FilenameTemplate")); | ||
|
|
||
| int loadNoWhitespace = gCoreContext->GetNumSetting("NoWhitespace", 0); | ||
| if (loadNoWhitespace == 1) | ||
| m_noWhitespace->SetCheckState(MythUIStateType::Full); | ||
|
|
||
| m_postCDRipScript->SetText(gCoreContext->GetSetting("PostCDRipScript")); | ||
|
|
||
| int loadEjectCD = gCoreContext->GetNumSetting("EjectCDAfterRipping", 0); | ||
| if (loadEjectCD == 1) | ||
| m_ejectCD->SetCheckState(MythUIStateType::Full); | ||
|
|
||
| new MythUIButtonListItem(m_encoderType, tr("Ogg Vorbis"), qVariantFromValue(QString("ogg"))); | ||
| new MythUIButtonListItem(m_encoderType, tr("Lame (MP3)"), qVariantFromValue(QString("mp3"))); | ||
| m_encoderType->SetValueByData(gCoreContext->GetSetting("EncoderType")); | ||
|
|
||
| new MythUIButtonListItem(m_defaultRipQuality, tr("Low"), qVariantFromValue(0)); | ||
| new MythUIButtonListItem(m_defaultRipQuality, tr("Medium"), qVariantFromValue(1)); | ||
| new MythUIButtonListItem(m_defaultRipQuality, tr("High"), qVariantFromValue(2)); | ||
| new MythUIButtonListItem(m_defaultRipQuality, tr("Perfect"), qVariantFromValue(3)); | ||
| m_defaultRipQuality->SetValueByData(gCoreContext->GetSetting("DefaultRipQuality")); | ||
|
|
||
| int loadMp3UseVBR = gCoreContext->GetNumSetting("Mp3UseVBR", 0); | ||
| if (loadMp3UseVBR == 1) | ||
| m_mp3UseVBR->SetCheckState(MythUIStateType::Full); | ||
|
|
||
| connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); | ||
| connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); | ||
| connect(m_paranoiaLevel, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_filenameTemplate, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_noWhitespace, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_postCDRipScript, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_ejectCD, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_encoderType, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_defaultRipQuality, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_mp3UseVBR, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
|
|
||
| BuildFocusList(); | ||
|
|
||
| SetFocusWidget(m_paranoiaLevel); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| bool ImportSettings::keyPressEvent(QKeyEvent *event) | ||
| { | ||
| if (GetFocusWidget()->keyPressEvent(event)) | ||
| return true; | ||
|
|
||
| bool handled = false; | ||
|
|
||
| if (!handled && MythScreenType::keyPressEvent(event)) | ||
| handled = true; | ||
|
|
||
| return handled; | ||
| } | ||
|
|
||
| void ImportSettings::slotSave(void) | ||
| { | ||
| gCoreContext->SaveSetting("ParanoiaLevel", m_paranoiaLevel->GetDataValue().toString()); | ||
| gCoreContext->SaveSetting("FilenameTemplate", m_filenameTemplate->GetText()); | ||
| gCoreContext->SaveSetting("PostCDRipScript", m_postCDRipScript->GetText()); | ||
| gCoreContext->SaveSetting("EncoderType", m_encoderType->GetDataValue().toString()); | ||
| gCoreContext->SaveSetting("DefaultRipQuality", m_defaultRipQuality->GetDataValue().toString()); | ||
|
|
||
| int saveNoWhitespace = (m_noWhitespace->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("Ignore_ID3", saveNoWhitespace); | ||
|
|
||
| int saveEjectCD = (m_ejectCD->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("EjectCDAfterRipping", saveEjectCD); | ||
|
|
||
| int saveMp3UseVBR = (m_mp3UseVBR->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("Mp3UseVBR", saveMp3UseVBR); | ||
|
|
||
| Close(); | ||
| } | ||
|
|
||
| void ImportSettings::slotFocusChanged(void) | ||
| { | ||
| if (!m_helpText) | ||
| return; | ||
|
|
||
| QString msg = ""; | ||
| if (GetFocusWidget() == m_paranoiaLevel) | ||
| msg = tr("Paranoia level of the CD ripper. Set to " | ||
| "faster if you're not concerned about " | ||
| "possible errors in the audio."); | ||
| else if (GetFocusWidget() == m_filenameTemplate) | ||
| msg = tr("Defines the location/name for new songs. Valid tokens are:\n" | ||
| "GENRE, ARTIST, ALBUM, TRACK, TITLE, YEAR"); | ||
| else if (GetFocusWidget() == m_noWhitespace) | ||
| msg = tr("If set, whitespace characters in filenames " | ||
| "will be replaced with underscore characters."); | ||
| else if (GetFocusWidget() == m_postCDRipScript) | ||
| msg = tr("If present this script will be executed " | ||
| "after a CD Rip is completed."); | ||
| else if (GetFocusWidget() == m_ejectCD) | ||
| msg = tr("If set, the CD tray will automatically open " | ||
| "after the CD has been ripped."); | ||
| else if (GetFocusWidget() == m_encoderType) | ||
| msg = tr("Audio encoder to use for CD ripping. " | ||
| "Note that the quality level 'Perfect' " | ||
| "will use the FLAC encoder."); | ||
| else if (GetFocusWidget() == m_defaultRipQuality) | ||
| msg = tr("Default quality for new CD rips."); | ||
| else if (GetFocusWidget() == m_mp3UseVBR) | ||
| msg = tr("If set, the MP3 encoder will use variable " | ||
| "bitrates (VBR) except for the low quality setting. " | ||
| "The Ogg encoder will always use variable bitrates."); | ||
| else if (GetFocusWidget() == m_cancelButton) | ||
| msg = tr("Exit without saving settings"); | ||
| else if (GetFocusWidget() == m_saveButton) | ||
| msg = tr("Save settings and Exit"); | ||
|
|
||
| m_helpText->SetText(msg); | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #ifndef IMPORTSETTINGS_H | ||
| #define IMPORTSETTINGS_H | ||
|
|
||
| #include <mythscreentype.h> | ||
| #include <mythuibutton.h> | ||
| #include <mythuibuttonlist.h> | ||
| #include <mythuicheckbox.h> | ||
| #include <mythuitext.h> | ||
| #include <mythuitextedit.h> | ||
|
|
||
| class ImportSettings : public MythScreenType | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| ImportSettings(MythScreenStack *parent, const char *name = 0); | ||
| ~ImportSettings(); | ||
|
|
||
| bool Create(void); | ||
| bool keyPressEvent(QKeyEvent *); | ||
|
|
||
| private: | ||
| MythUIButtonList *m_paranoiaLevel; | ||
| MythUITextEdit *m_filenameTemplate; | ||
| MythUICheckBox *m_noWhitespace; | ||
| MythUITextEdit *m_postCDRipScript; | ||
| MythUICheckBox *m_ejectCD; | ||
| MythUIButtonList *m_encoderType; | ||
| MythUIButtonList *m_defaultRipQuality; | ||
| MythUICheckBox *m_mp3UseVBR; | ||
| MythUIText *m_helpText; | ||
| MythUIButton *m_saveButton; | ||
| MythUIButton *m_cancelButton; | ||
|
|
||
| private slots: | ||
| void slotSave(void); | ||
| void slotFocusChanged(void); | ||
|
|
||
| }; | ||
|
|
||
| #endif // IMPORTSETTINGS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| // Qt | ||
| #include <QString> | ||
|
|
||
| // MythTV | ||
| #include <mythcorecontext.h> | ||
|
|
||
| #include "playersettings.h" | ||
|
|
||
| PlayerSettings::PlayerSettings(MythScreenStack *parent, const char *name) | ||
| : MythScreenType(parent, name), | ||
| m_resumeMode(NULL), | ||
| m_exitAction(NULL), | ||
| m_autoLookupCD(NULL), | ||
| m_autoPlayCD(NULL), | ||
| m_saveButton(NULL), | ||
| m_cancelButton(NULL) | ||
| { | ||
| } | ||
|
|
||
| PlayerSettings::~PlayerSettings() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| bool PlayerSettings::Create() | ||
| { | ||
| bool err = false; | ||
|
|
||
| // Load the theme for this screen | ||
| if (!LoadWindowFromXML("musicsettings-ui.xml", "playersettings", this)) | ||
| return false; | ||
|
|
||
| UIUtilE::Assign(this, m_resumeMode, "resumemode", &err); | ||
| UIUtilE::Assign(this, m_exitAction, "exitaction", &err); | ||
| UIUtilE::Assign(this, m_autoLookupCD, "autolookupcd", &err); | ||
| UIUtilE::Assign(this, m_autoPlayCD, "autoplaycd", &err); | ||
| UIUtilE::Assign(this, m_helpText, "helptext", &err); | ||
| UIUtilE::Assign(this, m_saveButton, "save", &err); | ||
| UIUtilE::Assign(this, m_cancelButton, "cancel", &err); | ||
|
|
||
| if (err) | ||
| { | ||
| LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'playersettings'"); | ||
| return false; | ||
| } | ||
|
|
||
| new MythUIButtonListItem(m_resumeMode, tr("Off"), qVariantFromValue(QString("off"))); | ||
| new MythUIButtonListItem(m_resumeMode, tr("Track"), qVariantFromValue(QString("track"))); | ||
| new MythUIButtonListItem(m_resumeMode, tr("Exact"), qVariantFromValue(QString("exact"))); | ||
| m_resumeMode->SetValueByData(gCoreContext->GetSetting("ResumeMode")); | ||
|
|
||
| new MythUIButtonListItem(m_exitAction, tr("Prompt"), qVariantFromValue(QString("prompt"))); | ||
| new MythUIButtonListItem(m_exitAction, tr("Stop playing"), qVariantFromValue(QString("stop"))); | ||
| new MythUIButtonListItem(m_exitAction, tr("Continue Playing"), qVariantFromValue(QString("play"))); | ||
| m_exitAction->SetValueByData(gCoreContext->GetSetting("MusicExitAction")); | ||
|
|
||
| int loadAutoLookupCD = gCoreContext->GetNumSetting("AutoLookupCD", 0); | ||
| if (loadAutoLookupCD == 1) | ||
| m_autoLookupCD->SetCheckState(MythUIStateType::Full); | ||
| int loadAutoPlayCD = gCoreContext->GetNumSetting("AutoPlayCD", 0); | ||
| if (loadAutoPlayCD == 1) | ||
| m_autoLookupCD->SetCheckState(MythUIStateType::Full); | ||
|
|
||
| connect(m_resumeMode, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_exitAction, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_autoLookupCD, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_autoPlayCD, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); | ||
| connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); | ||
|
|
||
| BuildFocusList(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| void PlayerSettings::slotSave(void) | ||
| { | ||
| gCoreContext->SaveSetting("ResumeMode", m_resumeMode->GetDataValue().toString()); | ||
| gCoreContext->SaveSetting("MusicExitAction", m_exitAction->GetDataValue().toString()); | ||
|
|
||
| int saveAutoLookupCD = (m_autoLookupCD->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("AutoLookupCD", saveAutoLookupCD); | ||
| int saveAutoPlayCD = (m_autoPlayCD->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("AutoPlayCD", saveAutoPlayCD); | ||
|
|
||
| Close(); | ||
| } | ||
|
|
||
| void PlayerSettings::slotFocusChanged(void) | ||
| { | ||
| if (!m_helpText) | ||
| return; | ||
|
|
||
| QString msg = ""; | ||
| if (GetFocusWidget() == m_resumeMode) | ||
| msg = tr("Resume playback at either the beginning of the " | ||
| "active play queue, the beginning of the last track, " | ||
| "an exact point within the last track."); | ||
| else if (GetFocusWidget() == m_exitAction) | ||
| msg = tr("Specify what action to take when exiting mythmusic plugin."); | ||
| else if (GetFocusWidget() == m_autoLookupCD) | ||
| msg = tr("Automatically lookup an audio CD if it is " | ||
| "present and show its information in the " | ||
| "Music Selection Tree."); | ||
| else if (GetFocusWidget() == m_autoPlayCD) | ||
| msg = tr("Automatically put a new CD on the " | ||
| "playlist and start playing the CD."); | ||
| else if (GetFocusWidget() == m_cancelButton) | ||
| msg = tr("Exit without saving settings"); | ||
| else if (GetFocusWidget() == m_saveButton) | ||
| msg = tr("Save settings and Exit"); | ||
|
|
||
| m_helpText->SetText(msg); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #ifndef PLAYERSETTINGS_H | ||
| #define PLAYERSETTINGS_H | ||
|
|
||
| #include <libmythui/mythscreentype.h> | ||
| #include <libmythui/mythuibutton.h> | ||
| #include <libmythui/mythuibuttonlist.h> | ||
| #include <libmythui/mythuicheckbox.h> | ||
|
|
||
|
|
||
| class PlayerSettings : public MythScreenType | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| PlayerSettings(MythScreenStack *parent, const char *name = 0); | ||
| ~PlayerSettings(); | ||
|
|
||
| bool Create(void); | ||
|
|
||
| private: | ||
| MythUIButtonList *m_resumeMode; | ||
| MythUIButtonList *m_exitAction; | ||
| MythUICheckBox *m_autoLookupCD; | ||
| MythUICheckBox *m_autoPlayCD; | ||
| MythUIText *m_helpText; | ||
| MythUIButton *m_saveButton; | ||
| MythUIButton *m_cancelButton; | ||
|
|
||
| private slots: | ||
| void slotSave(void); | ||
| void slotFocusChanged(void); | ||
|
|
||
| }; | ||
|
|
||
| #endif // PLAYERSETTINGS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| // Qt | ||
| #include <QString> | ||
|
|
||
| // MythTV | ||
| #include <mythcorecontext.h> | ||
|
|
||
| #include "ratingsettings.h" | ||
|
|
||
| RatingSettings::RatingSettings(MythScreenStack *parent, const char *name) | ||
| : MythScreenType(parent, name), | ||
| m_ratingWeight(NULL), | ||
| m_playCountWeight(NULL), | ||
| m_lastPlayWeight(NULL), | ||
| m_randomWeight(NULL), | ||
| m_saveButton(NULL), | ||
| m_cancelButton(NULL) | ||
| { | ||
| } | ||
|
|
||
| RatingSettings::~RatingSettings() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| bool RatingSettings::Create() | ||
| { | ||
| bool err = false; | ||
|
|
||
| // Load the theme for this screen | ||
| if (!LoadWindowFromXML("musicsettings-ui.xml", "ratingsettings", this)) | ||
| return false; | ||
|
|
||
| m_ratingWeight = dynamic_cast<MythUISpinBox *> (GetChild("ratingweight")); | ||
| m_playCountWeight = dynamic_cast<MythUISpinBox *> (GetChild("playcountweight")); | ||
| m_lastPlayWeight = dynamic_cast<MythUISpinBox *> (GetChild("lastplayweight")); | ||
| m_randomWeight = dynamic_cast<MythUISpinBox *> (GetChild("randomweight")); | ||
| m_helpText = dynamic_cast<MythUIText *> (GetChild("helptext")); | ||
| m_saveButton = dynamic_cast<MythUIButton *> (GetChild("save")); | ||
| m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel")); | ||
|
|
||
| if (err) | ||
| { | ||
| LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'ratingsettings'"); | ||
| return false; | ||
| } | ||
|
|
||
| m_ratingWeight->SetRange(0,100,1); | ||
| m_ratingWeight->SetValue(gCoreContext->GetNumSetting("IntelliRatingWeight")); | ||
| m_playCountWeight->SetRange(0,100,1); | ||
| m_playCountWeight->SetValue(gCoreContext->GetNumSetting("IntelliPlayCountWeight")); | ||
| m_lastPlayWeight->SetRange(0,100,1); | ||
| m_lastPlayWeight->SetValue(gCoreContext->GetNumSetting("IntelliLastPlayWeight")); | ||
| m_randomWeight->SetRange(0,100,1); | ||
| m_randomWeight->SetValue(gCoreContext->GetNumSetting("IntelliRandomWeight")); | ||
|
|
||
| connect(m_ratingWeight, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_playCountWeight, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_lastPlayWeight, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_randomWeight, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); | ||
| connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); | ||
|
|
||
| BuildFocusList(); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| void RatingSettings::slotSave(void) | ||
| { | ||
| gCoreContext->SaveSetting("IntelliRatingWeight", m_ratingWeight->GetValue()); | ||
| gCoreContext->SaveSetting("IntelliPlayCountWeight", m_playCountWeight->GetValue()); | ||
| gCoreContext->SaveSetting("IntelliLastPlayWeight", m_lastPlayWeight->GetValue()); | ||
| gCoreContext->SaveSetting("IntelliRandomWeight", m_randomWeight->GetValue()); | ||
|
|
||
| Close(); | ||
| } | ||
|
|
||
| void RatingSettings::slotFocusChanged(void) | ||
| { | ||
| if (!m_helpText) | ||
| return; | ||
|
|
||
| QString msg = ""; | ||
| if (GetFocusWidget() == m_ratingWeight) | ||
| msg = tr("Used in \"Smart\" Shuffle mode. " | ||
| "This weighting affects how much strength is " | ||
| "given to your rating of a given track when " | ||
| "ordering a group of songs."); | ||
| else if (GetFocusWidget() == m_playCountWeight) | ||
| msg = tr("Used in \"Smart\" Shuffle mode. " | ||
| "This weighting affects how much strength is " | ||
| "given to how many times a given track has been " | ||
| "played when ordering a group of songs."); | ||
| else if (GetFocusWidget() == m_lastPlayWeight) | ||
| msg = tr("Used in \"Smart\" Shuffle mode. " | ||
| "This weighting affects how much strength is " | ||
| "given to how long it has been since a given " | ||
| "track was played when ordering a group of songs."); | ||
| else if (GetFocusWidget() == m_randomWeight) | ||
| msg = tr("Used in \"Smart\" Shuffle mode. " | ||
| "This weighting affects how much strength is " | ||
| "given to good old (peudo-)randomness " | ||
| "when ordering a group of songs."); | ||
| else if (GetFocusWidget() == m_cancelButton) | ||
| msg = tr("Exit without saving settings"); | ||
| else if (GetFocusWidget() == m_saveButton) | ||
| msg = tr("Save settings and Exit"); | ||
|
|
||
| m_helpText->SetText(msg); | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #ifndef RATINGSETTINGS_H | ||
| #define RATINGSETTINGS_H | ||
|
|
||
| #include <mythscreentype.h> | ||
| #include <mythuispinbox.h> | ||
| #include <mythuibutton.h> | ||
|
|
||
|
|
||
| class RatingSettings : public MythScreenType | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| RatingSettings(MythScreenStack *parent, const char *name = 0); | ||
| ~RatingSettings(); | ||
|
|
||
| bool Create(void); | ||
|
|
||
| private: | ||
| MythUISpinBox *m_ratingWeight; | ||
| MythUISpinBox *m_playCountWeight; | ||
| MythUISpinBox *m_lastPlayWeight; | ||
| MythUISpinBox *m_randomWeight; | ||
| MythUIText *m_helpText; | ||
| MythUIButton *m_saveButton; | ||
| MythUIButton *m_cancelButton; | ||
|
|
||
| private slots: | ||
| void slotSave(void); | ||
| void slotFocusChanged(void); | ||
| }; | ||
|
|
||
| #endif // RATINGSETTINGS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| // Qt | ||
| #include <QString> | ||
|
|
||
| // MythTV | ||
| #include <mythcorecontext.h> | ||
|
|
||
| #include "visualizationsettings.h" | ||
|
|
||
| VisualizationSettings::VisualizationSettings(MythScreenStack *parent, const char *name) | ||
| : MythScreenType(parent, name), | ||
| m_changeOnSongChange(NULL), | ||
| m_randomizeOrder(NULL), | ||
| m_scaleWidth(NULL), | ||
| m_scaleHeight(NULL), | ||
| m_saveButton(NULL), | ||
| m_cancelButton(NULL) | ||
| { | ||
| } | ||
|
|
||
| VisualizationSettings::~VisualizationSettings() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| bool VisualizationSettings::Create() | ||
| { | ||
| bool err = false; | ||
|
|
||
| // Load the theme for this screen | ||
| if (!LoadWindowFromXML("musicsettings-ui.xml", "visualizationsettings", this)) | ||
| return false; | ||
|
|
||
| UIUtilE::Assign(this, m_changeOnSongChange, "cycleonsongchange", &err); | ||
| UIUtilE::Assign(this, m_randomizeOrder, "randomizeorder", &err); | ||
| UIUtilE::Assign(this, m_scaleWidth, "scalewidth", &err); | ||
| UIUtilE::Assign(this, m_scaleHeight, "scaleheight", &err); | ||
| UIUtilE::Assign(this, m_helpText, "helptext", &err); | ||
| UIUtilE::Assign(this, m_saveButton, "save", &err); | ||
| UIUtilE::Assign(this, m_cancelButton, "cancel", &err); | ||
|
|
||
| int changeOnSongChange = gCoreContext->GetNumSetting("VisualCycleOnSongChange", 0); | ||
| if (changeOnSongChange == 1) | ||
| m_changeOnSongChange->SetCheckState(MythUIStateType::Full); | ||
| int randomizeorder = gCoreContext->GetNumSetting("VisualRandomize", 0); | ||
| if (randomizeorder == 1) | ||
| m_randomizeOrder->SetCheckState(MythUIStateType::Full); | ||
|
|
||
| m_scaleWidth->SetRange(1,2,1); | ||
| m_scaleWidth->SetValue(gCoreContext->GetNumSetting("VisualScaleWidth")); | ||
| m_scaleHeight->SetRange(1,2,1); | ||
| m_scaleHeight->SetValue(gCoreContext->GetNumSetting("VisualScaleHeight")); | ||
|
|
||
| connect(m_changeOnSongChange, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_randomizeOrder, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_scaleWidth, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
| connect(m_scaleHeight, SIGNAL(TakingFocus()), SLOT(slotFocusChanged())); | ||
|
|
||
|
|
||
| connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave())); | ||
| connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); | ||
|
|
||
| BuildFocusList(); | ||
|
|
||
| SetFocusWidget(m_cancelButton); | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| void VisualizationSettings::slotSave(void) | ||
| { | ||
| int changeOnSongChange = (m_changeOnSongChange->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("VisualCycleOnSongChange", changeOnSongChange); | ||
| int randomizeorder = (m_randomizeOrder->GetCheckState() == MythUIStateType::Full) ? 1 : 0; | ||
| gCoreContext->SaveSetting("VisualRandomize", randomizeorder); | ||
|
|
||
| gCoreContext->SaveSetting("VisualScaleWidth", m_scaleWidth->GetIntValue()); | ||
| gCoreContext->SaveSetting("VisualScaleHeight", m_scaleHeight->GetIntValue()); | ||
|
|
||
| Close(); | ||
| } | ||
|
|
||
| void VisualizationSettings::slotFocusChanged(void) | ||
| { | ||
| if (!m_helpText) | ||
| return; | ||
|
|
||
| QString msg = ""; | ||
| if (GetFocusWidget() == m_changeOnSongChange) | ||
| msg = tr("Change the visualizer when the song changes."); | ||
| else if (GetFocusWidget() == m_randomizeOrder) | ||
| msg = tr("On changing the visualizer pick a new one at random."); | ||
| else if (GetFocusWidget() == m_scaleWidth) | ||
| msg = tr("If set to \"2\", visualizations will be " | ||
| "scaled in half. Currently only used by " | ||
| "the goom visualization. Reduces CPU load " | ||
| "on slower machines."); | ||
| else if (GetFocusWidget() == m_scaleHeight) | ||
| msg = tr("If set to \"2\", visualizations will be " | ||
| "scaled in half. Currently only used by " | ||
| "the goom visualization. Reduces CPU load " | ||
| "on slower machines."); | ||
| else if (GetFocusWidget() == m_cancelButton) | ||
| msg = tr("Exit without saving settings"); | ||
| else if (GetFocusWidget() == m_saveButton) | ||
| msg = tr("Save settings and Exit"); | ||
|
|
||
| m_helpText->SetText(msg); | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #ifndef VISUALIZATIONSETTINGS_H | ||
| #define VISUALIZATIONSETTINGS_H | ||
|
|
||
| #include <mythscreentype.h> | ||
| #include <mythuispinbox.h> | ||
| #include <mythuibutton.h> | ||
| #include <mythuicheckbox.h> | ||
|
|
||
| class VisualizationSettings : public MythScreenType | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| VisualizationSettings(MythScreenStack *parent, const char *name = 0); | ||
| ~VisualizationSettings(); | ||
|
|
||
| bool Create(void); | ||
|
|
||
| private: | ||
| MythUICheckBox *m_changeOnSongChange; | ||
| MythUICheckBox *m_randomizeOrder; | ||
| MythUISpinBox *m_scaleWidth; | ||
| MythUISpinBox *m_scaleHeight; | ||
| MythUIText *m_helpText; | ||
| MythUIButton *m_saveButton; | ||
| MythUIButton *m_cancelButton; | ||
|
|
||
| private slots: | ||
| void slotSave(void); | ||
| void slotFocusChanged(void); | ||
| }; | ||
|
|
||
| #endif // VISUALIZATIONSETTINGS_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| include ( ../../mythconfig.mak ) | ||
| include ( ../../settings.pro ) | ||
|
|
||
| QMAKE_STRIP = echo | ||
|
|
||
| TARGET = themenop | ||
|
|
||