Connect actions

This commit is contained in:
Craig Drummond
2018-02-05 20:02:00 +00:00
committed by Craig Drummond
parent 650003cd64
commit 6f19b25433
3 changed files with 15 additions and 7 deletions

View File

@@ -24,6 +24,7 @@
#include "localfolderpage.h"
#include "gui/stdactions.h"
#include "gui/customactions.h"
#include "models/playqueuemodel.h"
#include "widgets/menubutton.h"
LocalFolderBrowsePage::LocalFolderBrowsePage(bool isHome, QWidget *p)
@@ -58,8 +59,6 @@ void LocalFolderBrowsePage::headerClicked(int level)
}
}
#include <QDebug>
void LocalFolderBrowsePage::itemDoubleClicked(const QModelIndex &)
{
const QModelIndexList selected = view->selectedIndexes(false); // Dont need sorted selection here...
@@ -71,7 +70,16 @@ void LocalFolderBrowsePage::itemDoubleClicked(const QModelIndex &)
void LocalFolderBrowsePage::addSelectionToPlaylist(const QString &name, int action, quint8 priority, bool decreasePriority)
{
qWarning() << name << action;
Q_UNUSED(priority)
Q_UNUSED(decreasePriority)
const QModelIndexList selected = view->selectedIndexes(true);
QStringList paths;
for (const auto &idx: selected) {
paths.append(model->filePath(proxy->mapToSource(idx)));
}
PlayQueueModel::self()->load(paths, action);
}
void LocalFolderBrowsePage::controlActions()

View File

@@ -25,7 +25,6 @@
*/
#include "playqueuemodel.h"
#include "mpd-interface/mpdconnection.h"
#include "mpd-interface/mpdparseutils.h"
#include "mpd-interface/mpdstats.h"
#include "mpd-interface/cuefile.h"
@@ -724,11 +723,11 @@ bool PlayQueueModel::dropMimeData(const QMimeData *data,
return false;
}
void PlayQueueModel::load(const QStringList &urls)
void PlayQueueModel::load(const QStringList &urls, int action)
{
QStringList useable=parseUrls(urls, false);
if (useable.count()) {
addItems(useable, songs.count(), songs.isEmpty(), 0, false);
addItems(useable, songs.count(), action, 0, false);
}
}

View File

@@ -27,6 +27,7 @@
#ifndef PLAYQUEUEMODEL_H
#define PLAYQUEUEMODEL_H
#include "mpd-interface/mpdconnection.h"
#include "mpd-interface/song.h"
#include "mpd-interface/mpdstatus.h"
#include "config.h"
@@ -138,7 +139,7 @@ private:
void addSortAction(const QString &name, const QString &key);
public Q_SLOTS:
void load(const QStringList &urls);
void load(const QStringList &urls, int action=MPDConnection::Append);
void addItems(const QStringList &items, int row, int action, quint8 priority, bool decreasePriority);
void addItems(const QStringList &items, int action, quint8 priority, bool decreasePriority) { addItems(items, -1, action, priority, decreasePriority); }
void addFiles(const QStringList &filenames, int row, int action, quint8 priority, bool decreasePriority=false);