575 changes: 0 additions & 575 deletions mythplugins/mythmusic/mythmusic/globalsettings.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions mythplugins/mythmusic/mythmusic/globalsettings.h

This file was deleted.

175 changes: 175 additions & 0 deletions mythplugins/mythmusic/mythmusic/importsettings.cpp
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);
}

40 changes: 40 additions & 0 deletions mythplugins/mythmusic/mythmusic/importsettings.h
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
81 changes: 50 additions & 31 deletions mythplugins/mythmusic/mythmusic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@
#include "playlisteditorview.h"
#include "playlistview.h"
#include "playlistcontainer.h"
#include "globalsettings.h"
#include "dbcheck.h"
#include "filescanner.h"
#include "musicplayer.h"
#include "config.h"
#include "mainvisual.h"
#include "generalsettings.h"
#include "playersettings.h"
#include "visualizationsettings.h"
#include "importsettings.h"
#include "ratingsettings.h"

#ifndef USING_MINGW
#include "cdrip.h"
#include "importmusic.h"
Expand Down Expand Up @@ -341,34 +346,60 @@ static void MusicCallback(void *data, QString &selection)
delete fscan;
}
}
else if (sel == "music_set_general")
else if (sel == "settings_general")
{
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
GeneralSettings *gs = new GeneralSettings(mainStack, "general settings");

if (gs->Create())
mainStack->AddScreen(gs);
else
delete gs;
}
else if (sel == "settings_player")
{
gCoreContext->ActivateSettingsCache(false);
MusicGeneralSettings settings;
settings.exec();
gCoreContext->ActivateSettingsCache(true);
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
PlayerSettings *ps = new PlayerSettings(mainStack, "player settings");

gCoreContext->dispatch(MythEvent(QString("MUSIC_SETTINGS_CHANGED")));
if (ps->Create())
mainStack->AddScreen(ps);
else
delete ps;
}
else if (sel == "music_set_player")
else if (sel == "settings_rating")
{
gCoreContext->ActivateSettingsCache(false);
MusicPlayerSettings settings;
settings.exec();
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
RatingSettings *rs = new RatingSettings(mainStack, "rating settings");

gCoreContext->ActivateSettingsCache(true);
if (rs->Create())
mainStack->AddScreen(rs);
else
delete rs;
}
else if (sel == "settings_visualization")
{

gCoreContext->dispatch(MythEvent(QString("MUSIC_SETTINGS_CHANGED")));
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
VisualizationSettings *vs = new VisualizationSettings(mainStack, "visualization settings");

if (vs->Create())
mainStack->AddScreen(vs);
else
delete vs;
}
else if (sel == "music_set_ripper")
else if (sel == "settings_import")
{
gCoreContext->ActivateSettingsCache(false);
MusicRipperSettings settings;
settings.exec();
gCoreContext->ActivateSettingsCache(true);
MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
ImportSettings *is = new ImportSettings(mainStack, "import settings");

gCoreContext->dispatch(MythEvent(QString("MUSIC_SETTINGS_CHANGED")));
if (is->Create())
mainStack->AddScreen(is);
else
delete is;
}

if (sel.startsWith("settings_"))
gCoreContext->dispatch(MythEvent(QString("MUSIC_SETTINGS_CHANGED")));
}

static int runMenu(QString which_menu)
Expand Down Expand Up @@ -612,18 +643,6 @@ int mythplugin_init(const char *libversion)
return -1;
}

MusicGeneralSettings general;
general.Load();
general.Save();

MusicPlayerSettings settings;
settings.Load();
settings.Save();

MusicRipperSettings ripper;
ripper.Load();
ripper.Save();

setupKeys();

Decoder::SetLocationFormatUseTags();
Expand Down
8 changes: 6 additions & 2 deletions mythplugins/mythmusic/mythmusic/mythmusic.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ HEADERS += decoder.h flacencoder.h mainvisual.h
HEADERS += metadata.h playlist.h polygon.h
HEADERS += streaminput.h synaesthesia.h encoder.h visualize.h avfdecoder.h
HEADERS += vorbisencoder.h polygon.h
HEADERS += bumpscope.h globalsettings.h lameencoder.h dbcheck.h
HEADERS += bumpscope.h lameencoder.h dbcheck.h
HEADERS += metaio.h metaiotaglib.h
HEADERS += metaioflacvorbis.h metaioavfcomment.h metaiomp4.h
HEADERS += metaiowavpack.h metaioid3.h metaiooggvorbis.h
Expand All @@ -44,13 +44,15 @@ HEADERS += playlistcontainer.h
HEADERS += musiccommon.h decoderhandler.h pls.h shoutcast.h
HEADERS += playlistview.h playlisteditorview.h
HEADERS += visualizerview.h searchview.h musicutils.h
HEADERS += generalsettings.h visualizationsettings.h
HEADERS += importsettings.h playersettings.h ratingsettings.h

SOURCES += cddecoder.cpp cdrip.cpp decoder.cpp
SOURCES += flacencoder.cpp main.cpp
SOURCES += mainvisual.cpp metadata.cpp playlist.cpp
SOURCES += streaminput.cpp encoder.cpp dbcheck.cpp
SOURCES += synaesthesia.cpp lameencoder.cpp
SOURCES += vorbisencoder.cpp visualize.cpp bumpscope.cpp globalsettings.cpp
SOURCES += vorbisencoder.cpp visualize.cpp bumpscope.cpp
SOURCES += genres.cpp
SOURCES += metaio.cpp metaiotaglib.cpp
SOURCES += metaioflacvorbis.cpp metaioavfcomment.cpp metaiomp4.cpp
Expand All @@ -65,6 +67,8 @@ SOURCES += playlistcontainer.cpp
SOURCES += musiccommon.cpp decoderhandler.cpp pls.cpp shoutcast.cpp
SOURCES += playlistview.cpp playlisteditorview.cpp
SOURCES += visualizerview.cpp searchview.cpp musicutils.cpp
SOURCES += generalsettings.cpp visualizationsettings.cpp
SOURCES += importsettings.cpp playersettings.cpp ratingsettings.cpp

macx {
SOURCES -= cddecoder.cpp
Expand Down
118 changes: 118 additions & 0 deletions mythplugins/mythmusic/mythmusic/playersettings.cpp
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);
}




34 changes: 34 additions & 0 deletions mythplugins/mythmusic/mythmusic/playersettings.h
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
111 changes: 111 additions & 0 deletions mythplugins/mythmusic/mythmusic/ratingsettings.cpp
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);
}

32 changes: 32 additions & 0 deletions mythplugins/mythmusic/mythmusic/ratingsettings.h
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
109 changes: 109 additions & 0 deletions mythplugins/mythmusic/mythmusic/visualizationsettings.cpp
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);
}

32 changes: 32 additions & 0 deletions mythplugins/mythmusic/mythmusic/visualizationsettings.h
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
459 changes: 459 additions & 0 deletions mythplugins/mythmusic/theme/default-wide/musicsettings-ui.xml

Large diffs are not rendered by default.

20 changes: 17 additions & 3 deletions mythplugins/mythmusic/theme/menus/music_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,36 @@
<button>
<type>MUSIC_SETTINGS_GENERAL</type>
<text>General Settings</text>
<action>MUSIC_SET_GENERAL</action>
<action>SETTINGS_GENERAL</action>
<description>Music folders and general options</description>
</button>

<button>
<type>MUSIC_SETTINGS_PLAYER</type>
<text>Player Settings</text>
<action>MUSIC_SET_PLAYER</action>
<action>SETTINGS_PLAYER</action>
<description>Music playback options</description>
</button>

<button>
<type>MUSIC_SETTINGS_RIP</type>
<text>Ripper Settings</text>
<action>MUSIC_SET_RIPPER</action>
<action>SETTINGS_IMPORT</action>
<description>CD copying options</description>
</button>

<button>
<type>MUSIC_SETTINGS_RATING</type>
<text>Rating Settings</text>
<action>SETTINGS_RATING</action>
<description>Music rating options</description>
</button>

<button>
<type>MUSIC_SETTINGS_VISUALIZATION</type>
<text>Visualization Settings</text>
<action>SETTINGS_VISUALIZATION</action>
<description>Music visualization options</description>
</button>

</mythmenu>
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/theme/menus/musicmenu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<text>Play Music</text>
<action>MUSIC_PLAY</action>
</button>

<!--
<button>
<type>STREAM_PLAY</type>
<text>Play Streams</text>
<action>STREAM_PLAY</action>
</button>

-->
<button>
<type>MUSIC_PLAYLIST</type>
<text>Select Music</text>
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/theme/theme.pro
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
Expand Down