diff options
author | Arno <arno@disconnect.de> | 2018-08-26 21:56:03 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-08-26 21:56:03 +0200 |
commit | 6fcc0807135bee7d2d505d40a243d21cca4a6daa (patch) | |
tree | e3275a8a57ba8eb30f8ed39dfbe34d9b2d525fa8 /fswidget.cpp | |
parent | 02163d24e30d914f82c11edc7a98a9cc08d45310 (diff) | |
download | SheMov-6fcc0807135bee7d2d505d40a243d21cca4a6daa.tar.gz SheMov-6fcc0807135bee7d2d505d40a243d21cca4a6daa.tar.bz2 SheMov-6fcc0807135bee7d2d505d40a243d21cca4a6daa.zip |
Add option for using the internal viewer
Also use the new connect syntax for ProgramConfigurator.
Diffstat (limited to 'fswidget.cpp')
-rw-r--r-- | fswidget.cpp | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/fswidget.cpp b/fswidget.cpp index 405d19d..0215e3a 100644 --- a/fswidget.cpp +++ b/fswidget.cpp @@ -114,8 +114,6 @@ void FSWidget::setupWidget(){ toolbar->addAction(headerA); toolbar->addSeparator(); toolbar->addAction(SmGlobals::instance()->globalAction()); - QAction *playQtA = new QAction(QIcon(":/bizarre_amputee.png"), tr("Play with QT"), this); - connect(playQtA, &QAction::triggered, this, &FSWidget::playQt); QAction *playSelectedA = new QAction(QIcon(":/spreadingpants.png"), tr("Play selected"), this); connect(playSelectedA, &QAction::triggered, [=] { playSelected(1, QString()); }); playSelectedA->setShortcut(Qt::Key_Return); @@ -196,7 +194,7 @@ void FSWidget::setupWidget(){ mFileView->sortByColumn(0, Qt::AscendingOrder); connect(mFileView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &FSWidget::calculateSelectionChanged); - mFileView->addActions(QList<QAction*>() << playQtA << playSelectedA << playRepeatMA << mPlayWithA << Helper::createSeparator(this) << backA << forwardA << Helper::createSeparator(this) << refreshA << deleteFilesA << Helper::createSeparator(this) << archiveMovieA << archivePicsA << Helper::createSeparator(this) << unpackA << previewA << selectFilterA << unselectAllA); + mFileView->addActions(QList<QAction*>() << playSelectedA << playRepeatMA << mPlayWithA << Helper::createSeparator(this) << backA << forwardA << Helper::createSeparator(this) << refreshA << deleteFilesA << Helper::createSeparator(this) << archiveMovieA << archivePicsA << Helper::createSeparator(this) << unpackA << previewA << selectFilterA << unselectAllA); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topWL); @@ -575,16 +573,32 @@ void FSWidget::playSelected(int count, QString player){ for(const QModelIndex &idx : selected){ paths << idx.data(FullPathRole).toString(); } - if(player.isEmpty()){ - QSettings s; - player = s.value("programs_movieviewer/default").toString(); - } - QPair<QString, QStringList> playerData = Helper::programData("movieviewer", player); - QStringList args = playerData.second; - for(int i = 0; i < count; ++i){ - args << paths; + QSettings s; + bool useInternal = s.value("vw/internal").toBool(); + if(useInternal && player.isEmpty()){ + VideoViewer *wv = new VideoViewer; + QMediaPlaylist *pl = wv->player()->playlist(); + pl->clear(); + for(int i = 0; i < count; ++i){ + for(const QString &p : paths){ + pl->addMedia(QUrl::fromLocalFile(p)); + } + } + pl->setCurrentIndex(0); + wv->setVisible(true); + wv->player()->play(); + }else{ + if(player.isEmpty()){ + QSettings s; + player = s.value("programs_movieviewer/default").toString(); + } + QPair<QString, QStringList> playerData = Helper::programData("movieviewer", player); + QStringList args = playerData.second; + for(int i = 0; i < count; ++i){ + args << paths; + } + QProcess::startDetached(playerData.first, args); } - QProcess::startDetached(playerData.first, args); } void FSWidget::playQt(){ |