Changeset - r22838:79957438e365
[Not reviewed]
master
0 1 0
Niels Martin Hansen - 6 years ago 2018-03-19 19:13:25
nielsm@indvikleren.dk
Change: Disable music control buttons when there is no music
1 file changed with 17 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/music_gui.cpp
Show inline comments
 
@@ -528,6 +528,20 @@ struct MusicWindow : public Window {
 
		this->InitNested(number);
 
		this->LowerWidget(_settings_client.music.playlist + WID_M_ALL);
 
		this->SetWidgetLoweredState(WID_M_SHUFFLE, _settings_client.music.shuffle);
 

	
 
		UpdateDisabledButtons();
 
	}
 

	
 
	void UpdateDisabledButtons()
 
	{
 
		/* Disable music control widgets if there is no music
 
		 * -- except Programme button! So you can still select a music set. */
 
		this->SetWidgetsDisabledState(
 
			BaseMusic::GetUsedSet()->num_available == 0,
 
			WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE,
 
			WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2,
 
			WIDGET_LIST_END
 
			);
 
	}
 

	
 
	virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
 
@@ -624,6 +638,9 @@ struct MusicWindow : public Window {
 
		for (int i = 0; i < 6; i++) {
 
			this->SetWidgetLoweredState(WID_M_ALL + i, i == _settings_client.music.playlist);
 
		}
 

	
 
		UpdateDisabledButtons();
 

	
 
		this->SetDirty();
 
	}
 

	
0 comments (0 inline, 0 general)