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
|
@ -1,11 +1,13 @@
|
|||
HEADERS += playlistwindow.h \
|
||||
playlistwidget.h \
|
||||
playlistcontrols.h \
|
||||
playlistmenu.h \
|
||||
playlistshade.h \
|
||||
playlistview.h
|
||||
|
||||
SOURCES += playlistwindow.cpp \
|
||||
playlistwidget.cpp \
|
||||
playlistcontrols.cpp \
|
||||
playlistmenu.cpp \
|
||||
playlistshade.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 "playlistwidget.h"
|
||||
#include "playlistview.h"
|
||||
#include "playlistcontrols.h"
|
||||
|
||||
#include "playlistmodel.h"
|
||||
#include "xcollection.h"
|
||||
#include "xplayback.h"
|
||||
|
||||
#include "pixmapbutton.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
|
||||
* QT library (as of Version 4.3)
|
||||
* 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_view->setVerticalScrollBar (m_scrollBar);
|
||||
m_scrollBar->setParent(this);
|
||||
m_scrollBar->setVisible (true);
|
||||
m_scrollBar->show();
|
||||
/* Workarounds for another QT bug (at least in my opinion) */
|
||||
connect (m_scrollBar, SIGNAL(actionTriggered (int)),
|
||||
|
@ -220,6 +219,26 @@ PlaylistWidget::PlaylistWidget (PlaylistWindow *parent) : QWidget (parent)
|
|||
|
||||
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);
|
||||
// resize (275, 300);
|
||||
}
|
||||
|
@ -418,6 +437,9 @@ PlaylistWidget::resizeEvent (QResizeEvent *event)
|
|||
m_sel->move (69, height() - m_sel->height() - 12);
|
||||
m_msc->move (98, height() - m_msc->height() - 12);
|
||||
m_lst->move (width()-22-25, height() - m_lst->height() - 12);
|
||||
|
||||
|
||||
m_controls->move (width ()-150, height()-38);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -426,6 +448,8 @@ PlaylistWidget::setPixmaps (Skin *skin)
|
|||
m_closebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_CLOSE));
|
||||
m_shadebtn->setIcon (skin->getIcon (Skin::BUTTON_PLS_SHADE));
|
||||
|
||||
m_controls->setNumbers (skin->getSmallNumbers ());
|
||||
|
||||
setActive (m_active);
|
||||
|
||||
update ();
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
class PlaylistWidget;
|
||||
class PlaylistWindow;
|
||||
class PlaylistScroller;
|
||||
class PlaylistControls;
|
||||
|
||||
class Skin;
|
||||
class PlaylistView;
|
||||
|
@ -118,6 +119,7 @@ class PlaylistWidget : public QWidget {
|
|||
PlaylistView *m_view;
|
||||
QScrollBar *m_scrollBar;
|
||||
PlaylistSizeGrip *m_sizegrip;
|
||||
PlaylistControls *m_controls;
|
||||
|
||||
PlaylistMenu *m_add;
|
||||
PlaylistMenu *m_del;
|
||||
|
|
|
@ -43,6 +43,11 @@ class PlaylistWindow : public BaseWindow {
|
|||
signals:
|
||||
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:
|
||||
void switchDisplay (void);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue