Implemente titlewidget button actions for folders

This commit is contained in:
Craig Drummond
2015-10-09 22:01:52 +01:00
committed by Craig Drummond
parent d07fc7532b
commit 9d08c2984b
2 changed files with 13 additions and 0 deletions

View File

@@ -73,6 +73,7 @@ FolderPage::FolderPage(QWidget *p)
view->addAction(StdActions::self()->deleteSongsAction);
#endif
view->setModel(&model);
connect(view, SIGNAL(updateToPlayQueue(QModelIndex,bool)), this, SLOT(updateToPlayQueue(QModelIndex,bool)));
}
FolderPage::~FolderPage()
@@ -149,6 +150,15 @@ void FolderPage::openFileManager()
}
}
void FolderPage::updateToPlayQueue(const QModelIndex &idx, bool replace)
{
BrowseModel::Item *item = static_cast<BrowseModel::Item *>(idx.internalPointer());
if (item->isFolder()) {
emit add(QStringList() << MPDConnection::constDirPrefix+static_cast<BrowseModel::FolderItem *>(item)->getPath(),
replace ? MPDConnection::ReplaceAndplay : MPDConnection::Append, 0);
}
}
QList<Song> FolderPage::selectedSongs(bool allowPlaylists) const
{
return model.songs(view->selectedIndexes(), allowPlaylists);

View File

@@ -57,6 +57,9 @@ public Q_SLOTS:
void itemDoubleClicked(const QModelIndex &);
void openFileManager();
private Q_SLOTS:
void updateToPlayQueue(const QModelIndex &idx, bool replace);
private:
void doSearch() { }
void controlActions();