transcoder: Add ability to dump pipeline graphs
Add a "Dump Graph" menu option to the pipeline view if CLEMENTINE_DEBUG is enabled.
This commit is contained in:
parent
7d061afdc3
commit
18eef830a5
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "transcodedialog.h"
|
#include "transcodedialog.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -24,6 +25,7 @@
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include "core/application.h"
|
||||||
#include "transcoder.h"
|
#include "transcoder.h"
|
||||||
#include "transcoderoptionsdialog.h"
|
#include "transcoderoptionsdialog.h"
|
||||||
#include "ui/iconloader.h"
|
#include "ui/iconloader.h"
|
||||||
|
@ -59,11 +61,18 @@ TranscodeDialog::TranscodeDialog(QWidget* parent)
|
||||||
ui_->files->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
ui_->files->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
|
||||||
details_ui_->setupUi(details_dialog_);
|
details_ui_->setupUi(details_dialog_);
|
||||||
details_ui_->pipelines->setModel(transcoder_->model());
|
details_ui_->pipelines->setPipelineModel(transcoder_->model());
|
||||||
QPushButton* clear_button = details_ui_->buttonBox->addButton(
|
QPushButton* clear_button = details_ui_->buttonBox->addButton(
|
||||||
tr("Clear"), QDialogButtonBox::ResetRole);
|
tr("Clear"), QDialogButtonBox::ResetRole);
|
||||||
connect(clear_button, SIGNAL(clicked()), details_ui_->log, SLOT(clear()));
|
connect(clear_button, SIGNAL(clicked()), details_ui_->log, SLOT(clear()));
|
||||||
|
|
||||||
|
if (Application::DebugFeaturesEnabled()) {
|
||||||
|
QAction* dump_action = new QAction(tr("Dump Graph"));
|
||||||
|
details_ui_->pipelines->addAction(dump_action);
|
||||||
|
connect(dump_action, SIGNAL(triggered(bool)),
|
||||||
|
SLOT(PipelineDumpAction(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
// Get presets
|
// Get presets
|
||||||
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||||
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
||||||
|
@ -180,6 +189,12 @@ void TranscodeDialog::Cancel() {
|
||||||
SetWorking(false);
|
SetWorking(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TranscodeDialog::PipelineDumpAction(bool checked) {
|
||||||
|
for (int i : details_ui_->pipelines->GetSelectedIds()) {
|
||||||
|
transcoder_->DumpGraph(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TranscodeDialog::JobComplete(const QString& input, const QString& output,
|
void TranscodeDialog::JobComplete(const QString& input, const QString& output,
|
||||||
bool success) {
|
bool success) {
|
||||||
if (success)
|
if (success)
|
||||||
|
|
|
@ -56,6 +56,7 @@ class TranscodeDialog : public QDialog {
|
||||||
void AllJobsComplete();
|
void AllJobsComplete();
|
||||||
void Options();
|
void Options();
|
||||||
void AddDestination();
|
void AddDestination();
|
||||||
|
void PipelineDumpAction(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetWorking(bool working);
|
void SetWorking(bool working);
|
||||||
|
|
|
@ -31,13 +31,16 @@
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="pipelines">
|
<widget class="PipelineView" name="pipelines">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::ActionsContextMenu</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -80,6 +83,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>PipelineView</class>
|
||||||
|
<extends>QListView</extends>
|
||||||
|
<header>engines/pipelineview.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../data/data.qrc"/>
|
<include location="../../data/data.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -541,6 +541,15 @@ void Transcoder::Cancel() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Transcoder::DumpGraph(int id) {
|
||||||
|
for (JobStateList::iterator it = current_jobs_.begin();
|
||||||
|
it != current_jobs_.end(); it++) {
|
||||||
|
if ((*it)->id() == id) {
|
||||||
|
(*it)->DumpGraph();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QMap<QString, float> Transcoder::GetProgress() const {
|
QMap<QString, float> Transcoder::GetProgress() const {
|
||||||
QMap<QString, float> ret;
|
QMap<QString, float> ret;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ class Transcoder : public QObject {
|
||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
void Cancel();
|
void Cancel();
|
||||||
|
void DumpGraph(int id);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void JobComplete(const QString& input, const QString& output, bool success);
|
void JobComplete(const QString& input, const QString& output, bool success);
|
||||||
|
|
Loading…
Reference in New Issue