Update mute button in tray icon
This commit is contained in:
parent
4864d24e42
commit
47ad50dc41
@ -899,6 +899,7 @@ void MainWindow::MediaPlaying() {
|
|||||||
|
|
||||||
void MainWindow::VolumeChanged(int volume) {
|
void MainWindow::VolumeChanged(int volume) {
|
||||||
ui_->action_mute->setChecked(!volume);
|
ui_->action_mute->setChecked(!volume);
|
||||||
|
tray_icon_->MuteButtonStateChanged(!volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SongChanged(const Song& song) {
|
void MainWindow::SongChanged(const Song& song) {
|
||||||
|
@ -35,6 +35,7 @@ QtSystemTrayIcon::QtSystemTrayIcon(QObject* parent)
|
|||||||
action_play_pause_(NULL),
|
action_play_pause_(NULL),
|
||||||
action_stop_(NULL),
|
action_stop_(NULL),
|
||||||
action_stop_after_this_track_(NULL),
|
action_stop_after_this_track_(NULL),
|
||||||
|
action_mute_(NULL),
|
||||||
action_love_(NULL),
|
action_love_(NULL),
|
||||||
action_ban_(NULL)
|
action_ban_(NULL)
|
||||||
{
|
{
|
||||||
@ -111,7 +112,9 @@ void QtSystemTrayIcon::SetupMenu(
|
|||||||
menu_->addAction(next->icon(), next->text(), next, SLOT(trigger()));
|
menu_->addAction(next->icon(), next->text(), next, SLOT(trigger()));
|
||||||
|
|
||||||
menu_->addSeparator();
|
menu_->addSeparator();
|
||||||
menu_->addAction(mute->icon(), mute->text(), mute, SLOT(trigger()));
|
action_mute_ = menu_->addAction(mute->icon(), mute->text(), mute, SLOT(trigger()));
|
||||||
|
action_mute_->setCheckable(true);
|
||||||
|
action_mute_->setChecked(mute->isChecked());
|
||||||
|
|
||||||
menu_->addSeparator();
|
menu_->addSeparator();
|
||||||
#ifdef HAVE_LIBLASTFM
|
#ifdef HAVE_LIBLASTFM
|
||||||
@ -215,6 +218,10 @@ void QtSystemTrayIcon::LastFMButtonBanStateChanged(bool value) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtSystemTrayIcon::MuteButtonStateChanged(bool value) {
|
||||||
|
if (action_mute_)
|
||||||
|
action_mute_->setChecked(value);
|
||||||
|
}
|
||||||
|
|
||||||
bool QtSystemTrayIcon::IsVisible() const {
|
bool QtSystemTrayIcon::IsVisible() const {
|
||||||
return tray_->isVisible();
|
return tray_->isVisible();
|
||||||
|
@ -50,6 +50,7 @@ protected:
|
|||||||
void LastFMButtonVisibilityChanged(bool value);
|
void LastFMButtonVisibilityChanged(bool value);
|
||||||
void LastFMButtonLoveStateChanged(bool value);
|
void LastFMButtonLoveStateChanged(bool value);
|
||||||
void LastFMButtonBanStateChanged(bool value);
|
void LastFMButtonBanStateChanged(bool value);
|
||||||
|
void MuteButtonStateChanged(bool value);
|
||||||
|
|
||||||
// QObject
|
// QObject
|
||||||
bool eventFilter(QObject *, QEvent *);
|
bool eventFilter(QObject *, QEvent *);
|
||||||
@ -63,6 +64,7 @@ private:
|
|||||||
QAction* action_play_pause_;
|
QAction* action_play_pause_;
|
||||||
QAction* action_stop_;
|
QAction* action_stop_;
|
||||||
QAction* action_stop_after_this_track_;
|
QAction* action_stop_after_this_track_;
|
||||||
|
QAction* action_mute_;
|
||||||
QAction* action_love_;
|
QAction* action_love_;
|
||||||
QAction* action_ban_;
|
QAction* action_ban_;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class SystemTrayIcon : public QObject {
|
|||||||
virtual void LastFMButtonVisibilityChanged(bool value) {}
|
virtual void LastFMButtonVisibilityChanged(bool value) {}
|
||||||
virtual void LastFMButtonLoveStateChanged(bool value) {}
|
virtual void LastFMButtonLoveStateChanged(bool value) {}
|
||||||
virtual void LastFMButtonBanStateChanged(bool value) {}
|
virtual void LastFMButtonBanStateChanged(bool value) {}
|
||||||
|
virtual void MuteButtonStateChanged(bool value) {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ChangeVolume(int delta);
|
void ChangeVolume(int delta);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user