Clean-up of signals and move fileOpen to SkinDisplay class
This commit is contained in:
parent
f2914f4594
commit
d57ebf91a0
8 changed files with 28 additions and 30 deletions
22
Display.cpp
22
Display.cpp
|
@ -1,6 +1,8 @@
|
|||
#include "MainWindow.h"
|
||||
#include "Display.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
SkinDisplay::SkinDisplay (QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
Skin *skin = Skin::getInstance ();
|
||||
|
@ -52,3 +54,23 @@ SkinDisplay::paintEvent (QPaintEvent *event)
|
|||
paint.eraseRect(rect());
|
||||
paint.end();
|
||||
}
|
||||
|
||||
void
|
||||
SkinDisplay::fileOpen (void)
|
||||
{
|
||||
XMMSHandler *xmmsh = XMMSHandler::getInstance();
|
||||
QStringList files;
|
||||
|
||||
files = QFileDialog::getOpenFileNames (NULL, "Select files to play",
|
||||
QDir::homePath(),
|
||||
"Music (*.mp3 *.ogg *.flac *.wav *.mpc *.mp4)");
|
||||
|
||||
if (files.count() > 0) {
|
||||
xmmsh->playlistClear ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
xmmsh->playlistAddURL ("file://" + files.value(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class SkinDisplay : public QWidget
|
|||
|
||||
public slots:
|
||||
virtual void setPixmaps(Skin *skin);
|
||||
void fileOpen (void);
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent *);
|
||||
|
|
|
@ -173,25 +173,6 @@ MainDisplay::SetupPushButtons (void)
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
MainDisplay::fileOpen (void)
|
||||
{
|
||||
XMMSHandler *xmmsh = XMMSHandler::getInstance();
|
||||
QStringList files;
|
||||
|
||||
files = QFileDialog::getOpenFileNames (NULL, "Select files to play",
|
||||
QDir::homePath(),
|
||||
"Music (*.mp3 *.ogg *.flac *.wav *.mpc *.mp4)");
|
||||
|
||||
if (files.count() > 0) {
|
||||
xmmsh->playlistClear ();
|
||||
}
|
||||
|
||||
for (int i = 0; i < files.count(); i++) {
|
||||
xmmsh->playlistAddURL ("file://" + files.value(i));
|
||||
}
|
||||
}
|
||||
|
||||
MainDisplay::~MainDisplay (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ class MainDisplay : public SkinDisplay
|
|||
void setStatus (uint status);
|
||||
void setPlaytime (uint time);
|
||||
void setMediainfo (QHash<QString,QString>);
|
||||
void fileOpen (void);
|
||||
|
||||
protected:
|
||||
void SetupPushButtons (void);
|
||||
|
|
|
@ -61,7 +61,7 @@ MedialibWindow::MedialibWindow (QWidget *parent) : QMainWindow (parent)
|
|||
connect (m_http, SIGNAL (requestFinished (int, bool)), this,
|
||||
SLOT (httpDone (int, bool)));
|
||||
connect (m_http, SIGNAL (requestStarted (int)), this,
|
||||
SLOT (httpDone (int)));
|
||||
SLOT (httpStarted (int)));
|
||||
|
||||
/*** artist ***/
|
||||
m_artist = new MediaArtistList (this, "artist");
|
||||
|
|
|
@ -49,7 +49,7 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
|||
m_eject = new Button (this);
|
||||
m_eject->move(216, 4);
|
||||
m_eject->resize (9, 7);
|
||||
connect (m_eject, SIGNAL(clicked()), xmmsh, SLOT(fileOpen()));
|
||||
connect (m_eject, SIGNAL(clicked()), this, SLOT(fileOpen()));
|
||||
|
||||
connect (xmmsh, SIGNAL(playbackStatusChanged(uint)),
|
||||
this, SLOT(setStatus(uint)));
|
||||
|
|
|
@ -75,8 +75,6 @@ BarButton::mouseMoveEvent (QMouseEvent *event)
|
|||
|
||||
Slider::Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vertical) : PixWidget (parent)
|
||||
{
|
||||
XMMSHandler *xmmsh = XMMSHandler::getInstance ();
|
||||
|
||||
m_bg = bg;
|
||||
m_vertical = vertical;
|
||||
|
||||
|
@ -88,9 +86,6 @@ Slider::Slider (QWidget *parent, uint bg, uint bnormal, uint bpressed, bool vert
|
|||
m_button = new BarButton (this, bnormal, bpressed);
|
||||
m_button->move (0, 0);
|
||||
|
||||
connect (m_button, SIGNAL(clicked ()),
|
||||
xmmsh, SLOT (setPlaytime ()));
|
||||
|
||||
if (m_vertical) {
|
||||
m_pix = size().width()-m_button->size().width();
|
||||
} else {
|
||||
|
|
|
@ -63,10 +63,10 @@ QMAKE_LFLAGS += -L$$[QT_INSTALL_PLUGINS]/imageformats
|
|||
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
QMAKE_CXXFLAGS += -g
|
||||
;CONFIG += debug warn_on
|
||||
;QMAKE_CXXFLAGS += -g
|
||||
CONFIG += debug warn_on
|
||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter
|
||||
PKGCONFIG += xmms2-client xmms2-client-cpp sigc++-2.0
|
||||
|
||||
CONFIG += avahi
|
||||
;CONFIG += avahi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue