Skip to content

Commit

Permalink
Use existing help text stuff in mythmusic settings pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Jan 30, 2012
1 parent cb03390 commit a949feb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 83 deletions.
47 changes: 12 additions & 35 deletions mythplugins/mythmusic/mythmusic/playersettings.cpp
Expand Up @@ -34,7 +34,6 @@ bool PlayerSettings::Create()
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);

Expand All @@ -61,10 +60,18 @@ bool PlayerSettings::Create()
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()));
m_resumeMode->SetHelpText(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."));
m_exitAction->SetHelpText(tr("Specify what action to take when exiting mythmusic plugin."));
m_autoLookupCD->SetHelpText(tr("Automatically lookup an audio CD if it is "
"present and show its information in the "
"Music Selection Tree."));
m_autoPlayCD->SetHelpText(tr("Automatically put a new CD on the "
"playlist and start playing the CD."));
m_cancelButton->SetHelpText(tr("Exit without saving settings"));
m_saveButton->SetHelpText(tr("Save settings and Exit"));

connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave()));
connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));

Expand All @@ -86,33 +93,3 @@ void PlayerSettings::slotSave(void)
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);
}




2 changes: 0 additions & 2 deletions mythplugins/mythmusic/mythmusic/playersettings.h
Expand Up @@ -21,13 +21,11 @@ class PlayerSettings : public MythScreenType
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);

};

Expand Down
66 changes: 22 additions & 44 deletions mythplugins/mythmusic/mythmusic/ratingsettings.cpp
Expand Up @@ -8,12 +8,9 @@

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)
m_ratingWeight(NULL), m_playCountWeight(NULL),
m_lastPlayWeight(NULL), m_randomWeight(NULL),
m_saveButton(NULL), m_cancelButton(NULL)
{
}

Expand All @@ -34,7 +31,6 @@ bool RatingSettings::Create()
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"));

Expand All @@ -53,10 +49,25 @@ bool RatingSettings::Create()
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()));
m_ratingWeight->SetHelpText(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."));
m_playCountWeight->SetHelpText(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."));
m_lastPlayWeight->SetHelpText(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."));
m_randomWeight->SetHelpText(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."));
m_cancelButton->SetHelpText(tr("Exit without saving settings"));
m_saveButton->SetHelpText(tr("Save settings and Exit"));

connect(m_saveButton, SIGNAL(Clicked()), this, SLOT(slotSave()));
connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close()));

Expand All @@ -75,37 +86,4 @@ void RatingSettings::slotSave(void)
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);
}

2 changes: 0 additions & 2 deletions mythplugins/mythmusic/mythmusic/ratingsettings.h
Expand Up @@ -20,13 +20,11 @@ class RatingSettings : public MythScreenType
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

0 comments on commit a949feb

Please sign in to comment.