From: tmarki Date: Wed, 11 Aug 2010 17:36:28 +0000 (+0200) Subject: better 'up' button X-Git-Url: http://vcs.maemo.org/git/?p=tomamp;a=commitdiff_plain;h=4152a7cdebace6191fe6a6804c03b0a02bbd4fb6 better 'up' button --- diff --git a/bugs.txt b/bugs.txt index b772738..cd91f3f 100644 --- a/bugs.txt +++ b/bugs.txt @@ -1,3 +1,6 @@ +- remember folder position when adding songs (takes time as adding a song and going one folder up for next song jumps to top of folder) +- when saving a playlist, the default path seems invalid, so playlist doesn's save, and no error given +- for some reasom, one folder shows 0 files, but filled with mp3 files (?) Fixed: + context menu event outside of musicTable causes crash diff --git a/mainwindow.cpp b/mainwindow.cpp index 78d23b0..6024d17 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -786,8 +786,17 @@ void MainWindow::setRowFromItem (int row, const PlaylistItem& item) void MainWindow::buttonUp() { - qDebug () << "Presses up on " << sender()->parent()->property("row"); - plman.moveItemUp(sender()->parent()->property("row").toInt()); + int i = sender()->parent()->property("row").toInt(); + qDebug () << "Presses up on " << i; + if (i) + { + plman.moveItemUp(i); + setRowFromItem (i, plman.getItem(i)); + setRowFromItem (i - 1, plman.getItem(i - 1)); + musicTable->cellWidget(i, 3)->setProperty("row", i); + musicTable->cellWidget(i - 1, 3)->setProperty("row", i - 1); + musicTable->selectRow(i - 1); + } } void MainWindow::itemUpdated(int index) diff --git a/playlistmanager.cpp b/playlistmanager.cpp index 0b43077..c70ae1d 100644 --- a/playlistmanager.cpp +++ b/playlistmanager.cpp @@ -321,13 +321,15 @@ bool PlaylistManager::fileSupported (const QString& fname) const return false; } -void PlaylistManager::moveItemUp (int i) +bool PlaylistManager::moveItemUp (int i) { if (i) { PlaylistItem tmp = items[i - 1]; items[i - 1] = items[i]; items[i] = tmp; - emit playlistChanged(i - 1); + return true; +// emit playlistChanged(i - 1); } + return false; } diff --git a/playlistmanager.h b/playlistmanager.h index 407e38b..df87b4b 100644 --- a/playlistmanager.h +++ b/playlistmanager.h @@ -34,12 +34,12 @@ public: int indexOf (const Phonon::MediaSource& s) const; const Phonon::MediaSource& at (int i) { return items[i].source; } const PlaylistItem& getItem (int i) const { return items[i]; } + bool moveItemUp (int i); public slots: void savePlaylist(const QString& filename); void loadPlaylist(const QString& filename); void clearPlaylist(); void addPlaylist (const QString& filename); - void moveItemUp (int i); signals: void playlistChanged (int from); void itemUpdated (int index);