From 56dd4cf3eea091b38422f1756298c086f002665d Mon Sep 17 00:00:00 2001 From: Tobias Rundstrom Date: Sun, 26 Feb 2006 14:36:54 -0300 Subject: [PATCH] Unbreak resizing and scrolling. --- MainWindow.cpp | 8 +++++--- Playlist.cpp | 18 +++++++++++++++--- Playlist.h | 9 +++++++++ PlaylistList.cpp | 6 +++++- TODO | 10 ---------- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/MainWindow.cpp b/MainWindow.cpp index 094a084..0bff5c7 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -78,15 +78,14 @@ Skin *MainWindow::getSkin(void) return skin; } -int main (int argc, char **argv) +int +main (int argc, char **argv) { QApplication app(argc, argv); MainWindow *mw = new MainWindow (NULL); - mw->show (); QMainWindow *playlistwin = new PlaylistWindow (NULL, mw->getSkin ()); - playlistwin->show (); /* * Now that everything is initialized @@ -95,6 +94,9 @@ int main (int argc, char **argv) * all widgets to get their pixmaps */ mw->getSkin ()->setSkin ("./CleanAMP/"); + + mw->show (); + playlistwin->show (); return app.exec(); } diff --git a/Playlist.cpp b/Playlist.cpp index 11095bc..dc337b7 100644 --- a/Playlist.cpp +++ b/Playlist.cpp @@ -29,6 +29,14 @@ PlaylistScrollButton::mouseMoveEvent (QMouseEvent *event) m_slider->doScroll (npos); } +void +dragButton::mouseMoveEvent (QMouseEvent *event) +{ + PlaylistWindow *pw = dynamic_cast(window ()); + pw->resize (pw->size().width()+(event->pos().x()-m_diffx), + pw->size().height()+(event->pos().y()-m_diffy)); +} + PlaylistScroller::PlaylistScroller (PlaylistWindow *parent) : QWidget (parent) { m_pixmap = QPixmap(0,0); @@ -47,7 +55,6 @@ void PlaylistScroller::setPixmaps (Skin *skin) { m_pixmap = skin->getPls (Skin::PLS_RFILL2_0); - } void @@ -82,6 +89,8 @@ PlaylistWindow::PlaylistWindow (QWidget *parent, Skin *skin) : QMainWindow (pare m_scroller = new PlaylistScroller (this); connect (m_scroller, SIGNAL(scrolled(int)), this, SLOT(doScroll (int))); + m_drag = new dragButton (this); + setMinimumSize (275, 116); resize (275, 300); } @@ -98,8 +107,7 @@ void PlaylistWindow::resizeEvent (QResizeEvent *event) { m_view->resize (size().width()-30, size().height()-20-38); - m_list->resize (m_view->size().width(), m_view->size().height()); - + m_list->setSize (m_view->size().width(), m_view->size().height()); } void @@ -268,5 +276,9 @@ PlaylistWindow::paintEvent (QPaintEvent *event) m_scroller->resize (m_rfill2.width(), size().height()-m_corner2.height()-m_corner4.height()); + m_drag->move (size().width()-30, + size().height()-30); + m_drag->resize (30, 30); + } diff --git a/Playlist.h b/Playlist.h index 3d924fa..8f338d7 100644 --- a/Playlist.h +++ b/Playlist.h @@ -11,6 +11,14 @@ class PlaylistWindow; class PlaylistScroller; +class dragButton : public Button { + public: + dragButton (QWidget *parent) : Button (parent) {} + ~dragButton () {} + + void mouseMoveEvent (QMouseEvent *event); +}; + class PlaylistScrollButton : public Button { public: PlaylistScrollButton (PlaylistScroller *parent, uint normal, uint pressed); @@ -94,6 +102,7 @@ class PlaylistWindow : public QMainWindow { PlaylistView *m_view; PlaylistList *m_list; PlaylistScroller *m_scroller; + dragButton *m_drag; }; #endif diff --git a/PlaylistList.cpp b/PlaylistList.cpp index 0f8d212..bebf466 100644 --- a/PlaylistList.cpp +++ b/PlaylistList.cpp @@ -101,6 +101,10 @@ PlaylistList::setPixmaps (Skin *skin) delete m_fontmetrics; } m_fontmetrics = new QFontMetrics (*m_font); + + for (int i = 0; i < 100; i++) { + PlaylistItem (this, i); + } } @@ -118,7 +122,7 @@ PlaylistList::setSize (int width, int height) } else { ny = size().height(); } - resize (ny, nx); + resize (nx, ny); } diff --git a/TODO b/TODO index 2e6c0ee..68b9d9d 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,9 @@ Todo: Config -ShadeDisplay Balance VolumeBar -PlayStatus -PlaylistWindow -PlaylistItem -PlaylistList -PlaylistSliderButton -PlaylistSlider PlaylistButton CloseButton ShadeButton ResizeButton - - -