1 /*
2  * Cantata
3  *
4  * Copyright (c) 2011-2020 Craig Drummond <craig.p.drummond@gmail.com>
5  *
6  * ----
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; see the file COPYING.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #include "dockmenu.h"
25 #include "gui/stdactions.h"
26 #include "mpd-interface/mpdstatus.h"
27 
DockMenu(QWidget * p)28 DockMenu::DockMenu(QWidget *p)
29     : QMenu(p)
30 {
31     setAsDockMenu();
32     addAction(StdActions::self()->prevTrackAction);
33     playPauseAction=addAction(tr("Play"));
34     addAction(StdActions::self()->stopPlaybackAction);
35     addAction(StdActions::self()->stopAfterCurrentTrackAction);
36     addAction(StdActions::self()->nextTrackAction);
37     connect(playPauseAction, SIGNAL(triggered()), StdActions::self()->playPauseTrackAction, SIGNAL(triggered()));
38 }
39 
update(MPDStatus * const status)40 void DockMenu::update(MPDStatus * const status)
41 {
42     playPauseAction->setEnabled(status->playlistLength()>0);
43     playPauseAction->setText(MPDState_Playing==status->state() ? tr("Pause") : tr("Play"));
44 }
45 
46 #include "moc_dockmenu.cpp"
47