mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-03 13:30:26 +01:00
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 <QAction>
|
||||
#include <QDateTime>
|
||||
#include <QDirIterator>
|
||||
#include <QFileDialog>
|
||||
@ -24,6 +25,7 @@
|
||||
#include <QSettings>
|
||||
#include <algorithm>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "transcoder.h"
|
||||
#include "transcoderoptionsdialog.h"
|
||||
#include "ui/iconloader.h"
|
||||
@ -59,11 +61,18 @@ TranscodeDialog::TranscodeDialog(QWidget* parent)
|
||||
ui_->files->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
||||
details_ui_->setupUi(details_dialog_);
|
||||
details_ui_->pipelines->setModel(transcoder_->model());
|
||||
details_ui_->pipelines->setPipelineModel(transcoder_->model());
|
||||
QPushButton* clear_button = details_ui_->buttonBox->addButton(
|
||||
tr("Clear"), QDialogButtonBox::ResetRole);
|
||||
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
|
||||
QList<TranscoderPreset> presets = Transcoder::GetAllPresets();
|
||||
std::sort(presets.begin(), presets.end(), ComparePresetsByName);
|
||||
@ -180,6 +189,12 @@ void TranscodeDialog::Cancel() {
|
||||
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,
|
||||
bool success) {
|
||||
if (success)
|
||||
|
@ -56,6 +56,7 @@ class TranscodeDialog : public QDialog {
|
||||
void AllJobsComplete();
|
||||
void Options();
|
||||
void AddDestination();
|
||||
void PipelineDumpAction(bool checked);
|
||||
|
||||
private:
|
||||
void SetWorking(bool working);
|
||||
|
@ -31,13 +31,16 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QListView" name="pipelines">
|
||||
<widget class="PipelineView" name="pipelines">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -80,6 +83,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PipelineView</class>
|
||||
<extends>QListView</extends>
|
||||
<header>engines/pipelineview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../data/data.qrc"/>
|
||||
</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> ret;
|
||||
|
||||
|
@ -67,6 +67,7 @@ class Transcoder : public QObject {
|
||||
|
||||
void Start();
|
||||
void Cancel();
|
||||
void DumpGraph(int id);
|
||||
|
||||
signals:
|
||||
void JobComplete(const QString& input, const QString& output, bool success);
|
||||
|
Loading…
Reference in New Issue
Block a user