Skip to content

Commit

Permalink
adjust GUIDialogSmartPlaylistRule: clear rule spinner before filling …
Browse files Browse the repository at this point in the history
…it, clear rule and operand spinner on deinit and try to change value button to edit control just once on window load
  • Loading branch information
pieh committed Sep 8, 2012
1 parent 00bd5fb commit 5649658
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 19 additions & 1 deletion xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
Expand Up @@ -45,6 +45,7 @@ CGUIDialogSmartPlaylistRule::CGUIDialogSmartPlaylistRule(void)
: CGUIDialog(WINDOW_DIALOG_SMART_PLAYLIST_RULE, "SmartPlaylistRule.xml")
{
m_cancelled = false;
m_loadType = KEEP_IN_MEMORY;
}

CGUIDialogSmartPlaylistRule::~CGUIDialogSmartPlaylistRule()
Expand Down Expand Up @@ -412,10 +413,17 @@ void CGUIDialogSmartPlaylistRule::AddOperatorLabel(CSmartPlaylistRule::SEARCH_OP
OnMessage(select);
}

void CGUIDialogSmartPlaylistRule::OnInitWindow()
void CGUIDialogSmartPlaylistRule::OnWindowLoaded()
{
CGUIWindow::OnWindowLoaded();
ChangeButtonToEdit(CONTROL_VALUE, true); // true for single label
}

void CGUIDialogSmartPlaylistRule::OnInitWindow()
{
CGUIDialog::OnInitWindow();

SendMessage(GUI_MSG_LABEL_RESET, CONTROL_FIELD);
// add the fields to the field spincontrol
vector<Field> fields = CSmartPlaylistRule::GetFields(m_type);
for (unsigned int i = 0; i < fields.size(); i++)
Expand All @@ -427,6 +435,16 @@ void CGUIDialogSmartPlaylistRule::OnInitWindow()
UpdateButtons();
}

void CGUIDialogSmartPlaylistRule::OnDeinitWindow(int nextWindowID)
{
CGUIDialog::OnDeinitWindow(nextWindowID);

// reset field spincontrolex
SendMessage(GUI_MSG_LABEL_RESET, CONTROL_FIELD);
// reset operator spincontrolex
SendMessage(GUI_MSG_LABEL_RESET, CONTROL_OPERATOR);
}

bool CGUIDialogSmartPlaylistRule::EditRule(CSmartPlaylistRule &rule, const CStdString& type)
{
CGUIDialogSmartPlaylistRule *editor = (CGUIDialogSmartPlaylistRule *)g_windowManager.GetWindow(WINDOW_DIALOG_SMART_PLAYLIST_RULE);
Expand Down
2 changes: 2 additions & 0 deletions xbmc/dialogs/GUIDialogSmartPlaylistRule.h
Expand Up @@ -33,6 +33,8 @@ class CGUIDialogSmartPlaylistRule :
virtual bool OnMessage(CGUIMessage& message);
virtual bool OnBack(int actionID);
virtual void OnInitWindow();
virtual void OnWindowLoaded();
virtual void OnDeinitWindow(int nextWindowID);

static bool EditRule(CSmartPlaylistRule &rule, const CStdString& type="songs");

Expand Down

0 comments on commit 5649658

Please sign in to comment.