Added support for the shade/close buttons on the playlist, and changed the way
that togglePL works a bit to play nicer.
This commit is contained in:
parent
13b9c47523
commit
0c5593076a
7 changed files with 49 additions and 8 deletions
|
@ -14,6 +14,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_tbar->move(0, 0);
|
||||
m_tbar->resize(275, 14);
|
||||
|
||||
m_mw = dynamic_cast<MainWindow *>(parent);
|
||||
|
||||
SetupPushButtons ();
|
||||
SetupToggleButtons ();
|
||||
|
||||
|
@ -126,7 +128,7 @@ MainDisplay::SetupToggleButtons (void)
|
|||
if (!s.value ("playlist/hidden").toBool ())
|
||||
m_pls->toggleOn ();
|
||||
|
||||
connect (m_pls, SIGNAL(clicked()), window(), SLOT(togglePL()));
|
||||
connect (m_pls, SIGNAL(clicked()), this, SLOT(togglePL()));
|
||||
|
||||
m_eq = new ToggleButton (this, Skin::EQ_ON_0, Skin::EQ_ON_1,
|
||||
Skin::EQ_OFF_0, Skin::EQ_OFF_1);
|
||||
|
@ -141,6 +143,12 @@ MainDisplay::SetupToggleButtons (void)
|
|||
m_repeat->move(210, 89);
|
||||
}
|
||||
|
||||
void
|
||||
MainDisplay::togglePL (void)
|
||||
{
|
||||
m_mw->togglePL(false);
|
||||
}
|
||||
|
||||
void
|
||||
MainDisplay::SetupPushButtons (void)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ class MainDisplay : public SkinDisplay
|
|||
public:
|
||||
MainDisplay (QWidget *parent);
|
||||
~MainDisplay ();
|
||||
ToggleButton *GetPls() {return m_pls;};
|
||||
|
||||
TextScroller *m_text;
|
||||
NumberDisplay *m_number;
|
||||
|
@ -49,6 +50,7 @@ class MainDisplay : public SkinDisplay
|
|||
void setStatus (uint status);
|
||||
void setPlaytime (uint time);
|
||||
void setMediainfo (QHash<QString,QString>);
|
||||
void togglePL(void);
|
||||
|
||||
protected:
|
||||
void SetupPushButtons (void);
|
||||
|
@ -66,6 +68,8 @@ class MainDisplay : public SkinDisplay
|
|||
ToggleButton *m_shuffle;
|
||||
ToggleButton *m_repeat;
|
||||
|
||||
MainWindow *m_mw;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -101,10 +101,15 @@ MainWindow::moveEvent (QMoveEvent *event)
|
|||
}
|
||||
|
||||
void
|
||||
MainWindow::togglePL (void)
|
||||
MainWindow::togglePL (bool UpdateButton)
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
if(UpdateButton)
|
||||
{
|
||||
getMD()->GetPls()->toggleOn();
|
||||
}
|
||||
|
||||
if (s.value ("playlist/hidden").toBool ()) {
|
||||
m_playlistwin->move (s.value("playlist/pos").toPoint ());
|
||||
m_playlistwin->show ();
|
||||
|
@ -136,7 +141,7 @@ main (int argc, char **argv)
|
|||
|
||||
MainWindow *mw = new MainWindow (NULL);
|
||||
|
||||
PlaylistWindow *playlistwin = new PlaylistWindow (NULL);
|
||||
PlaylistWindow *playlistwin = new PlaylistWindow (mw);
|
||||
|
||||
/*
|
||||
* Now that everything is initialized
|
||||
|
|
|
@ -33,10 +33,10 @@ class MainWindow : public QMainWindow
|
|||
void setPL (PlaylistWindow *p) { m_playlistwin = p; }
|
||||
void raisePL (void) { m_playlistwin->raise (); }
|
||||
void moveEvent (QMoveEvent *event);
|
||||
void togglePL (bool UpdateButton);
|
||||
|
||||
public slots:
|
||||
void switchDisplay ();
|
||||
void togglePL (void);
|
||||
|
||||
private:
|
||||
bool isShaded (void) { QSettings s; return s.value("MainWindow/shaded").toBool(); }
|
||||
|
|
20
Playlist.cpp
20
Playlist.cpp
|
@ -1,4 +1,4 @@
|
|||
|
||||
#include "MainWindow.h"
|
||||
#include "Playlist.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
@ -105,7 +105,7 @@ PlaylistScroller::paintEvent (QPaintEvent *event)
|
|||
PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
||||
{
|
||||
QSettings s;
|
||||
|
||||
m_mw = dynamic_cast<MainWindow *>(parent);
|
||||
#ifndef _WIN32
|
||||
setWindowIcon (QIcon (":icon.png"));
|
||||
#endif
|
||||
|
@ -123,6 +123,14 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
setCentralWidget (m_playlist);
|
||||
m_shaded = new PlaylistShade (this);
|
||||
|
||||
m_shadebtn = new Button (this, Skin::PLS_SHADE_BTN_0, Skin::PLS_SHADE_BTN_1, true);
|
||||
connect (m_shadebtn, SIGNAL (clicked()), this, SLOT (switchDisplay ()));
|
||||
m_shadebtn->move(size().width() - 21, 3);
|
||||
|
||||
m_closebtn = new Button (this, Skin::PLS_CLOSE_BTN_0, Skin::PLS_CLOSE_BTN_1, true);
|
||||
connect (m_closebtn, SIGNAL (clicked()), this, SLOT (togglePL ()));
|
||||
m_closebtn->move(size().width() - 11, 3);
|
||||
|
||||
if (!s.contains ("shaded"))
|
||||
s.setValue ("shaded", false);
|
||||
else
|
||||
|
@ -134,6 +142,11 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
|
||||
}
|
||||
|
||||
void PlaylistWindow::togglePL (void)
|
||||
{
|
||||
m_mw->togglePL(true);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistWindow::switchDisplay (void)
|
||||
{
|
||||
|
@ -169,6 +182,9 @@ PlaylistWindow::resizeEvent (QResizeEvent *event)
|
|||
{
|
||||
QSettings s;
|
||||
|
||||
m_shadebtn->move(size().width() - 21, 3);
|
||||
m_closebtn->move(size().width() - 11, 3);
|
||||
|
||||
if (s.value("playlist/shaded").toBool ()) {
|
||||
s.setValue ("playlist/size", size ());
|
||||
}
|
||||
|
|
10
Playlist.h
10
Playlist.h
|
@ -9,6 +9,7 @@
|
|||
#include <QMainWindow>
|
||||
#include <QFont>
|
||||
|
||||
class MainWindow;
|
||||
class PlaylistWidget;
|
||||
class PlaylistScroller;
|
||||
|
||||
|
@ -113,7 +114,6 @@ class PlaylistWindow : public QMainWindow {
|
|||
~PlaylistWindow () {}
|
||||
|
||||
void setActive (bool);
|
||||
void switchDisplay (void);
|
||||
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseMoveEvent (QMouseEvent *event);
|
||||
|
@ -123,6 +123,10 @@ class PlaylistWindow : public QMainWindow {
|
|||
void resizeEvent (QResizeEvent *event);
|
||||
|
||||
|
||||
public slots:
|
||||
void switchDisplay (void);
|
||||
void togglePL (void);
|
||||
|
||||
private:
|
||||
PlaylistWidget *m_playlist;
|
||||
PlaylistShade *m_shaded;
|
||||
|
@ -130,6 +134,10 @@ class PlaylistWindow : public QMainWindow {
|
|||
int m_diffx;
|
||||
int m_diffy;
|
||||
|
||||
Button *m_shadebtn;
|
||||
Button *m_closebtn;
|
||||
MainWindow *m_mw;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
2
Skin.cpp
2
Skin.cpp
|
@ -46,7 +46,7 @@ Skin::BuildPlaylist (void)
|
|||
m_playlist[PLS_CLOSE_BTN_1] = img->copy(52, 42, 9, 9);
|
||||
|
||||
m_playlist[PLS_SHADE_BTN_0] = tmp.copy(14, 3, 9, 9);
|
||||
m_playlist[PLS_SHADE_BTN_1] = img->copy(52, 42, 9, 9);
|
||||
m_playlist[PLS_SHADE_BTN_1] = img->copy(62, 42, 9, 9);
|
||||
|
||||
m_playlist[PLS_MAX_BTN_0] = img->copy(150, 42, 9, 9);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue