summaryrefslogtreecommitdiffstats
path: root/randomtab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'randomtab.cpp')
-rw-r--r--randomtab.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/randomtab.cpp b/randomtab.cpp
index 5f0245f..835a750 100644
--- a/randomtab.cpp
+++ b/randomtab.cpp
@@ -26,6 +26,7 @@
#include <QStringList>
#include <QSettings>
#include <QDirIterator>
+#include <QProcess>
#include <algorithm>
#include <random>
@@ -392,11 +393,36 @@ void RandomTab::select(){
}
void RandomTab::playAll(){
-
+ logMessage(tr("Playing All"));
+ QStringList files;
+ QStandardItem *root = mFileModel->invisibleRootItem();
+ for(int i = 0; i < root->rowCount(); ++i){
+ QStandardItem *c = root->child(i, FullPath);
+ logMessage(QString(tr("Adding %1")).arg(c->text()));
+ files << c->text();
+ }
+ play(files);
}
void RandomTab::playSelected(){
+ logMessage(tr("Playing Selected"));
+ QStringList files;
+ QModelIndexList idxs = mFileView->selectionModel()->selectedRows(FullPath);
+ foreach(QModelIndex i, idxs){
+ QString fp = i.data().toString();
+ logMessage(QString(tr("Adding %1")).arg(fp));
+ files << fp;
+ }
+ play(files);
+}
+void RandomTab::play(const QStringList &files){
+ QPair<QString, QStringList> pgdata = Helper::programData("movieviewer");
+ QString program = pgdata.first;
+ QStringList args = pgdata.second;
+ args.append(files);
+ logMessage(QString(tr("Cmd: %1 %2")).arg(program).arg(args.join(" ")));
+ QProcess::startDetached(program, args);
}
void RandomTab::logMessage(const QString &msg){