diff options
author | Arno <arno@disconnect.de> | 2018-10-13 04:32:51 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-10-13 04:32:51 +0200 |
commit | 2a866788cd2608b5f893f173a611785da44d3047 (patch) | |
tree | 370e45f3f6e64a934598a8fd236b95811ba1b704 /collectiondatesview.cpp | |
parent | 003290d919171fe5bb73cbb35f3b3896c4e12db7 (diff) | |
download | BeetPlayer-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.cpp | 19 |
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(); } |