OTHER: implement playtime and playback controls in playlistwindow
This commit is contained in:
parent
eb96c8b75b
commit
ef687a9375
14 changed files with 202 additions and 11 deletions
7
README
7
README
|
@ -1,7 +1,7 @@
|
||||||
Required dependencys:
|
Required dependencys:
|
||||||
* QT4.2.x http://www.trolltech.no/
|
* QT4.2.x http://www.trolltech.no/
|
||||||
* XMMS2 http://xmms2.xmms.org/
|
* XMMS2 http://xmms2.xmms.org/
|
||||||
* XMMS2 C++ bindings (make sure to have boost_signals when compiling xmms2)
|
* XMMS2 C++ bindings (make sure you have boost_signals when compiling xmms2)
|
||||||
- promoe works with 0.4DrK and 0.5DrL
|
- promoe works with 0.4DrK and 0.5DrL
|
||||||
|
|
||||||
Optional dependencys:
|
Optional dependencys:
|
||||||
|
@ -37,7 +37,8 @@ Patches:
|
||||||
'http://bugs.xmms2.xmms.se/' at project 'Client - Promoe'.
|
'http://bugs.xmms2.xmms.se/' at project 'Client - Promoe'.
|
||||||
|
|
||||||
Either append the patch to the bug it fixes or supply a link to your own
|
Either append the patch to the bug it fixes or supply a link to your own
|
||||||
git repository
|
git repository (github.com is a good place for your own public git
|
||||||
|
repository)
|
||||||
|
|
||||||
To discuss a patch of wanted feature , you can also try to reach the
|
To discuss a patch or feature request, you can also try to reach the
|
||||||
developer at xmms2's irc channel #xmms2 on freenode (irc.freenode.net)
|
developer at xmms2's irc channel #xmms2 on freenode (irc.freenode.net)
|
||||||
|
|
|
@ -62,6 +62,7 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
m_time = new TimeDisplay(this);
|
m_time = new TimeDisplay(this);
|
||||||
m_time->move (36, 26);
|
m_time->move (36, 26);
|
||||||
connect (m_time, SIGNAL(clicked()), m_mw, SLOT(toggleTime()));
|
connect (m_time, SIGNAL(clicked()), m_mw, SLOT(toggleTime()));
|
||||||
|
connect (this, SIGNAL (displayTime (int)), m_time, SLOT (setTime (int)));
|
||||||
|
|
||||||
m_kbps = new PixmapNumberDisplay (this);
|
m_kbps = new PixmapNumberDisplay (this);
|
||||||
m_kbps->resize (15, 6);
|
m_kbps->resize (15, 6);
|
||||||
|
@ -205,7 +206,8 @@ MainDisplay::setPlaytime (uint32_t time)
|
||||||
} else {
|
} else {
|
||||||
showtime = time/1000;
|
showtime = time/1000;
|
||||||
}
|
}
|
||||||
m_time->setTime (showtime);
|
emit displayTime (showtime);
|
||||||
|
// m_time->setTime (showtime);
|
||||||
|
|
||||||
// update slider
|
// update slider
|
||||||
m_posbar->setValue (time);
|
m_posbar->setValue (time);
|
||||||
|
|
|
@ -67,6 +67,10 @@ class MainDisplay : public SkinDisplay
|
||||||
PlayStatus *m_playstatus;
|
PlayStatus *m_playstatus;
|
||||||
MainWindow *getMW(void) { return m_mw; }
|
MainWindow *getMW(void) { return m_mw; }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//used to set time in timedisplays
|
||||||
|
void displayTime (int time);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPixmaps(Skin *skin);
|
void setPixmaps(Skin *skin);
|
||||||
void setStatus (Xmms::Playback::Status status);
|
void setStatus (Xmms::Playback::Status status);
|
||||||
|
|
|
@ -79,6 +79,12 @@ MainWindow::MainWindow (QWidget *parent) : BaseWindow (parent)
|
||||||
setCentralWidget (m_display);
|
setCentralWidget (m_display);
|
||||||
m_display->show ();
|
m_display->show ();
|
||||||
|
|
||||||
|
//connects for timedisplay in playlistwindow
|
||||||
|
connect (m_display, SIGNAL (displayTime (int)),
|
||||||
|
m_playlistwin, SIGNAL (setDisplayTime (int)));
|
||||||
|
connect (m_playlistwin, SIGNAL (toggleTime()),
|
||||||
|
this, SLOT (toggleTime ()));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MainDisplay's shaded mode
|
* MainDisplay's shaded mode
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,6 @@ HEADERS += clutterbar.h \
|
||||||
skindisplay.h \
|
skindisplay.h \
|
||||||
stereomono.h \
|
stereomono.h \
|
||||||
textbar.h \
|
textbar.h \
|
||||||
timedisplay.h \
|
|
||||||
titlebar.h
|
titlebar.h
|
||||||
|
|
||||||
SOURCES += clutterbar.cpp \
|
SOURCES += clutterbar.cpp \
|
||||||
|
@ -19,7 +18,6 @@ SOURCES += clutterbar.cpp \
|
||||||
skindisplay.cpp \
|
skindisplay.cpp \
|
||||||
stereomono.cpp \
|
stereomono.cpp \
|
||||||
textbar.cpp \
|
textbar.cpp \
|
||||||
timedisplay.cpp \
|
|
||||||
titlebar.cpp
|
titlebar.cpp
|
||||||
|
|
||||||
INCLUDEPATH += $$PWD
|
INCLUDEPATH += $$PWD
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
HEADERS += playlistwindow.h \
|
HEADERS += playlistwindow.h \
|
||||||
playlistwidget.h \
|
playlistwidget.h \
|
||||||
|
playlistcontrols.h \
|
||||||
playlistmenu.h \
|
playlistmenu.h \
|
||||||
playlistshade.h \
|
playlistshade.h \
|
||||||
playlistview.h
|
playlistview.h
|
||||||
|
|
||||||
SOURCES += playlistwindow.cpp \
|
SOURCES += playlistwindow.cpp \
|
||||||
playlistwidget.cpp \
|
playlistwidget.cpp \
|
||||||
|
playlistcontrols.cpp \
|
||||||
playlistmenu.cpp \
|
playlistmenu.cpp \
|
||||||
playlistshade.cpp \
|
playlistshade.cpp \
|
||||||
playlistview.cpp
|
playlistview.cpp
|
||||||
|
|
86
src/playlist/playlistcontrols.cpp
Normal file
86
src/playlist/playlistcontrols.cpp
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005-2008 XMMS2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "playlistcontrols.h"
|
||||||
|
#include "pixmapbutton.h"
|
||||||
|
#include "timedisplay.h"
|
||||||
|
|
||||||
|
PlaylistControls::PlaylistControls (QWidget *parent) : QWidget (parent)
|
||||||
|
{
|
||||||
|
setFixedSize (100, 38);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Buttons
|
||||||
|
*/
|
||||||
|
PixmapButton *button;
|
||||||
|
//prev button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (6, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (prev ()));
|
||||||
|
//play button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (15, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (play ()));
|
||||||
|
//pause button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (24, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (pause ()));
|
||||||
|
//stop button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (33, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (stop ()));
|
||||||
|
//next button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (42, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (next ()));
|
||||||
|
//eject button
|
||||||
|
button = new PixmapButton (this);
|
||||||
|
button->resize (9, 8);
|
||||||
|
button->move (52, 23);
|
||||||
|
connect (button, SIGNAL (clicked ()), this, SIGNAL (eject ()));
|
||||||
|
|
||||||
|
m_timedisplay = new SmallTimeDisplay (this);
|
||||||
|
m_timedisplay->move (69, 23);
|
||||||
|
// m_timedisplay->hide ();
|
||||||
|
connect (m_timedisplay, SIGNAL (clicked ()),
|
||||||
|
this, SIGNAL (toggleTime ()));
|
||||||
|
connect (this, SIGNAL (setDisplayTime (int)),
|
||||||
|
m_timedisplay, SLOT (setTime (int)));
|
||||||
|
|
||||||
|
//TODO: playtimes
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistControls::setNumbers (const PixmapMap &p)
|
||||||
|
{
|
||||||
|
m_timedisplay->setPixmaps (p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistControls::setSelectedLength (int lenght)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistControls::setPlaylistLength (int lenght)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
}
|
59
src/playlist/playlistcontrols.h
Normal file
59
src/playlist/playlistcontrols.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/**
|
||||||
|
* This file is a part of Promoe, an XMMS2 Client.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005-2008 XMMS2 Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; version 2 of the License.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PLAYLISTCONTROLS_H__
|
||||||
|
#define __PLAYLISTCONTROLS_H__
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
class SmallTimeDisplay;
|
||||||
|
class QPixmap;
|
||||||
|
|
||||||
|
typedef QMap<int, QPixmap> PixmapMap;
|
||||||
|
|
||||||
|
class PlaylistControls : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
PlaylistControls (QWidget *parent);
|
||||||
|
|
||||||
|
void setNumbers (const PixmapMap &p);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setSelectedLength (int);
|
||||||
|
void setPlaylistLength (int);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
// emitted when buttons are clicked
|
||||||
|
void prev ();
|
||||||
|
void play ();
|
||||||
|
void pause ();
|
||||||
|
void stop ();
|
||||||
|
void next ();
|
||||||
|
void eject ();
|
||||||
|
|
||||||
|
void toggleTime ();
|
||||||
|
//connected to internal timedisplay
|
||||||
|
void setDisplayTime (int);
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_playlist_length;
|
||||||
|
int m_selected_length;
|
||||||
|
|
||||||
|
SmallTimeDisplay *m_timedisplay;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,9 +20,11 @@
|
||||||
#include "playlistwindow.h"
|
#include "playlistwindow.h"
|
||||||
#include "playlistwidget.h"
|
#include "playlistwidget.h"
|
||||||
#include "playlistview.h"
|
#include "playlistview.h"
|
||||||
|
#include "playlistcontrols.h"
|
||||||
|
|
||||||
#include "playlistmodel.h"
|
#include "playlistmodel.h"
|
||||||
#include "xcollection.h"
|
#include "xcollection.h"
|
||||||
|
#include "xplayback.h"
|
||||||
|
|
||||||
#include "pixmapbutton.h"
|
#include "pixmapbutton.h"
|
||||||
#include "playlistshade.h"
|
#include "playlistshade.h"
|
||||||
|
@ -201,13 +203,10 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
||||||
* It is necessery because of limitations and at least one Bug in the
|
* It is necessery because of limitations and at least one Bug in the
|
||||||
* QT library (as of Version 4.3)
|
* QT library (as of Version 4.3)
|
||||||
* TODO: This might break in a future Qt version. Try to find a better solution
|
* TODO: This might break in a future Qt version. Try to find a better solution
|
||||||
* FIXME: scrollbar is only visible if playlist was closed on startup or
|
|
||||||
* after resizing the playlist
|
|
||||||
*/
|
*/
|
||||||
m_scrollBar = new PlaylistScrollBar (this);
|
m_scrollBar = new PlaylistScrollBar (this);
|
||||||
m_view->setVerticalScrollBar (m_scrollBar);
|
m_view->setVerticalScrollBar (m_scrollBar);
|
||||||
m_scrollBar->setParent(this);
|
m_scrollBar->setParent(this);
|
||||||
m_scrollBar->setVisible (true);
|
|
||||||
m_scrollBar->show();
|
m_scrollBar->show();
|
||||||
/* Workarounds for another QT bug (at least in my opinion) */
|
/* Workarounds for another QT bug (at least in my opinion) */
|
||||||
connect (m_scrollBar, SIGNAL(actionTriggered (int)),
|
connect (m_scrollBar, SIGNAL(actionTriggered (int)),
|
||||||
|
@ -220,6 +219,26 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
||||||
|
|
||||||
addButtons ();
|
addButtons ();
|
||||||
|
|
||||||
|
XMMSHandler &client = XMMSHandler::getInstance ();
|
||||||
|
|
||||||
|
m_controls = new PlaylistControls (this);
|
||||||
|
// connect buttons
|
||||||
|
connect (m_controls, SIGNAL (prev ()),
|
||||||
|
client.xplayback (), SLOT (prev ()));
|
||||||
|
connect (m_controls, SIGNAL (play ()),
|
||||||
|
client.xplayback (), SLOT (play ()));
|
||||||
|
connect (m_controls, SIGNAL (pause ()),
|
||||||
|
client.xplayback (), SLOT (pause ()));
|
||||||
|
connect (m_controls, SIGNAL (stop ()),
|
||||||
|
client.xplayback (), SLOT (stop ()));
|
||||||
|
connect (m_controls, SIGNAL (next ()),
|
||||||
|
client.xplayback (), SLOT (next ()));
|
||||||
|
// TODO: eject
|
||||||
|
connect (m_controls, SIGNAL (toggleTime ()),
|
||||||
|
parent, SIGNAL (toggleTime()));
|
||||||
|
connect (parent, SIGNAL (setDisplayTime (int)),
|
||||||
|
m_controls, SIGNAL (setDisplayTime (int)));
|
||||||
|
|
||||||
setMinimumSize (275, 116);
|
setMinimumSize (275, 116);
|
||||||
// resize (275, 300);
|
// resize (275, 300);
|
||||||
}
|
}
|
||||||
|
@ -418,6 +437,9 @@ PlaylistWidget::resizeEvent (QResizeEvent *event)
|
||||||
m_sel->move (69, height() - m_sel->height() - 12);
|
m_sel->move (69, height() - m_sel->height() - 12);
|
||||||
m_msc->move (98, height() - m_msc->height() - 12);
|
m_msc->move (98, height() - m_msc->height() - 12);
|
||||||
m_lst->move (width()-22-25, height() - m_lst->height() - 12);
|
m_lst->move (width()-22-25, height() - m_lst->height() - 12);
|
||||||
|
|
||||||
|
|
||||||
|
m_controls->move (width ()-150, height()-38);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -426,6 +448,8 @@ PlaylistWidget::setPixmaps (Skin *skin)
|
||||||
m_closebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_CLOSE));
|
m_closebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_CLOSE));
|
||||||
m_shadebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_SHADE));
|
m_shadebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_SHADE));
|
||||||
|
|
||||||
|
m_controls->setNumbers (skin->getSmallNumbers ());
|
||||||
|
|
||||||
setActive (m_active);
|
setActive (m_active);
|
||||||
|
|
||||||
update ();
|
update ();
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
class PlaylistWidget;
|
class PlaylistWidget;
|
||||||
class PlaylistWindow;
|
class PlaylistWindow;
|
||||||
class PlaylistScroller;
|
class PlaylistScroller;
|
||||||
|
class PlaylistControls;
|
||||||
|
|
||||||
class Skin;
|
class Skin;
|
||||||
class PlaylistView;
|
class PlaylistView;
|
||||||
|
@ -118,6 +119,7 @@ class PlaylistWidget : public QWidget {
|
||||||
PlaylistView *m_view;
|
PlaylistView *m_view;
|
||||||
QScrollBar *m_scrollBar;
|
QScrollBar *m_scrollBar;
|
||||||
PlaylistSizeGrip *m_sizegrip;
|
PlaylistSizeGrip *m_sizegrip;
|
||||||
|
PlaylistControls *m_controls;
|
||||||
|
|
||||||
PlaylistMenu *m_add;
|
PlaylistMenu *m_add;
|
||||||
PlaylistMenu *m_del;
|
PlaylistMenu *m_del;
|
||||||
|
|
|
@ -43,6 +43,11 @@ class PlaylistWindow : public BaseWindow {
|
||||||
signals:
|
signals:
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible);
|
||||||
|
|
||||||
|
// connected to
|
||||||
|
void toggleTime (); // toggle the playtime
|
||||||
|
// setTime is used to set playtime in playlistcontrols
|
||||||
|
void setDisplayTime (int seconds);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void switchDisplay (void);
|
void switchDisplay (void);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ include($$PWD/equalizer/equalizer.pri)
|
||||||
include($$PWD/dialogs/dialogs.pri)
|
include($$PWD/dialogs/dialogs.pri)
|
||||||
|
|
||||||
HEADERS += Skin.h \
|
HEADERS += Skin.h \
|
||||||
XMMSHandler.h \
|
timedisplay.h \
|
||||||
|
XMMSHandler.h \
|
||||||
SkinChooser.h \
|
SkinChooser.h \
|
||||||
settingsdialog.h \
|
settingsdialog.h \
|
||||||
basewindow.h \
|
basewindow.h \
|
||||||
|
@ -14,6 +15,7 @@ HEADERS += Skin.h \
|
||||||
BrowseDialog.h
|
BrowseDialog.h
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
|
timedisplay.cpp \
|
||||||
Skin.cpp \
|
Skin.cpp \
|
||||||
XMMSHandler.cpp \
|
XMMSHandler.cpp \
|
||||||
SkinChooser.cpp \
|
SkinChooser.cpp \
|
||||||
|
|
|
@ -32,10 +32,10 @@ class AbstractTimeDisplay : public QWidget
|
||||||
public:
|
public:
|
||||||
AbstractTimeDisplay (QWidget *parent);
|
AbstractTimeDisplay (QWidget *parent);
|
||||||
~AbstractTimeDisplay () {};
|
~AbstractTimeDisplay () {};
|
||||||
void setTime (int);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPixmaps (const PixmapMap &p);
|
void setPixmaps (const PixmapMap &p);
|
||||||
|
void setTime (int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clicked(void);
|
void clicked(void);
|
Loading…
Add table
Add a link
Reference in a new issue