summaryrefslogtreecommitdiffstats
path: root/collectiondatesview.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2018-10-13 04:32:51 +0200
committerArno <arno@disconnect.de>2018-10-13 04:32:51 +0200
commit2a866788cd2608b5f893f173a611785da44d3047 (patch)
tree370e45f3f6e64a934598a8fd236b95811ba1b704 /collectiondatesview.cpp
parent003290d919171fe5bb73cbb35f3b3896c4e12db7 (diff)
downloadBeetPlayer-2a866788cd2608b5f893f173a611785da44d3047.tar.gz
BeetPlayer-2a866788cd2608b5f893f173a611785da44d3047.tar.bz2
BeetPlayer-2a866788cd2608b5f893f173a611785da44d3047.zip
Set source and Destination folder in CopyDialog
Still does nothing, but fill the source QLineEdit with something reasonable and try to guess the destination directory.
Diffstat (limited to 'collectiondatesview.cpp')
-rw-r--r--collectiondatesview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/collectiondatesview.cpp b/collectiondatesview.cpp
index 83a7c3f..5544f72 100644
--- a/collectiondatesview.cpp
+++ b/collectiondatesview.cpp
@@ -5,6 +5,7 @@
#include "collectiondatesview.h"
#include "copydialog.h"
+#include "collectionwidgetproxy.h"
CollectionDatesView::CollectionDatesView(QWidget *parent) : CollectionWidget(parent){
}
@@ -80,6 +81,24 @@ void CollectionDatesView::populate(){
}
void CollectionDatesView::copyTo(){
+ QModelIndexList sel = view()->selectionModel()->selectedRows();
+ if(sel.isEmpty()){
+ return;
+ }
+ QModelIndex first = sel.first();
+ int type = first.data(TypeRole).toInt();
+ if(type != Album){
+ return;
+ }
+ CollectionWidgetProxy *proxy = static_cast<CollectionWidgetProxy*>(view()->model());
+ QModelIndex srcIdx = proxy->mapToSource(first);
+ QStandardItem *item = model()->itemFromIndex(srcIdx);
+ QString src = QString("%1 (%2 files)").arg(srcIdx.data().toString()).arg(QString::number(item->rowCount()));
CopyDialog *cdlg = new CopyDialog(this);
+ cdlg->setSource(src);
+ QString destDir = srcIdx.data().toString().toLower();
+ destDir = destDir.replace(" - ", "-");
+ destDir = destDir.replace(' ', '.');
+ cdlg->setDestFolder(destDir);
cdlg->show();
}