rework PlaylistWindow: move handling of visibilitychanges into Playlistwindow
and rely on signals and slots to get rid of MainWindow::togglePL(). cleaned up some unnecessary includes
This commit is contained in:
parent
b10ef97cfc
commit
a228d7a01b
14 changed files with 121 additions and 106 deletions
|
@ -2,7 +2,7 @@
|
|||
* This file is a part of Prome, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2007 XMMS2 Team
|
||||
* Copyright (C) 2007 Thomas Frauendorfer
|
||||
* Copyright (C) 2008 Thomas Frauendorfer
|
||||
*
|
||||
* 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
|
||||
|
@ -43,7 +43,7 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
if (!s.contains ("size")) {
|
||||
s.setValue ("size", QSize (275, 350));
|
||||
}
|
||||
resize (s.value("size").toSize ());
|
||||
resize (s.value ("size").toSize ());
|
||||
|
||||
m_playlist = new PlaylistWidget (this);
|
||||
setCentralWidget (m_playlist);
|
||||
|
@ -54,7 +54,7 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
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 ()));
|
||||
connect (m_closebtn, SIGNAL (clicked()), this, SLOT (hide ()));
|
||||
m_closebtn->move(size().width() - 11, 3);
|
||||
|
||||
if (!s.contains ("shaded"))
|
||||
|
@ -70,12 +70,25 @@ PlaylistWindow::PlaylistWindow (QWidget *parent) : QMainWindow (parent)
|
|||
//setSizeIncrement (25, 29);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistWindow::togglePL (void)
|
||||
void
|
||||
PlaylistWindow::hideEvent (QHideEvent *event)
|
||||
{
|
||||
m_mw->togglePL(true);
|
||||
QSettings s;
|
||||
s.setValue ("playlist/visible", false);
|
||||
|
||||
emit visibilityChanged (false);
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistWindow::showEvent (QShowEvent *event)
|
||||
{
|
||||
QSettings s;
|
||||
s.setValue ("playlist/visible", true);
|
||||
|
||||
emit visibilityChanged (true);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistWindow::switchDisplay (void)
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* This file is a part of Prome, an XMMS2 Client.
|
||||
*
|
||||
* Copyright (C) 2005-2007 XMMS2 Team
|
||||
* Copyright (C) 2008 Thomas Frauendorfer
|
||||
*
|
||||
* 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
|
||||
|
@ -17,12 +18,14 @@
|
|||
#define _PLAYLISTWINDOW_
|
||||
|
||||
// Qt classes
|
||||
#include <QMainWindow>
|
||||
#include <QMainWindow>
|
||||
|
||||
class QEvent;
|
||||
class QMouseEvent;
|
||||
class QMoveEvent;
|
||||
class QResizeEvent;
|
||||
class QHideEvent;
|
||||
class QShowEvent;
|
||||
|
||||
// our own classes
|
||||
class Button;
|
||||
|
@ -39,6 +42,15 @@ class PlaylistWindow : public QMainWindow {
|
|||
|
||||
void setActive (bool);
|
||||
|
||||
signals:
|
||||
void visibilityChanged(bool visible);
|
||||
|
||||
public slots:
|
||||
void switchDisplay (void);
|
||||
|
||||
protected slots:
|
||||
void hideEvent (QHideEvent *event);
|
||||
void showEvent (QShowEvent *event);
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseMoveEvent (QMouseEvent *event);
|
||||
void enterEvent (QEvent *event);
|
||||
|
@ -46,9 +58,6 @@ class PlaylistWindow : public QMainWindow {
|
|||
void moveEvent (QMoveEvent *event);
|
||||
void resizeEvent (QResizeEvent *event);
|
||||
|
||||
public slots:
|
||||
void switchDisplay (void);
|
||||
void togglePL (void);
|
||||
|
||||
private:
|
||||
PlaylistWidget *m_playlist;
|
||||
|
@ -59,7 +68,6 @@ class PlaylistWindow : public QMainWindow {
|
|||
|
||||
Button *m_shadebtn;
|
||||
Button *m_closebtn;
|
||||
uint getOffset (void);
|
||||
MainWindow *m_mw;
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue