forked from qt-creator/qt-creator
ScreenRecorder: Block dialog UI and show spinner while exporting
...instead of just disabling the "Export..." button. Change-Id: I3d2b414233492b400e02a39c89677dedce475100 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
add_qtc_plugin(ScreenRecorder
|
||||
PLUGIN_DEPENDS Core
|
||||
DEPENDS Spinner
|
||||
SOURCES
|
||||
cropandtrim.cpp cropandtrim.h
|
||||
export.cpp export.h
|
||||
|
@@ -164,16 +164,17 @@ ExportWidget::ExportWidget(QWidget *parent)
|
||||
startExport();
|
||||
}
|
||||
});
|
||||
connect(m_process, &Process::started, this, [exportButton] {
|
||||
exportButton->setEnabled(false);
|
||||
connect(m_process, &Process::started, this, [this] {
|
||||
emit started();
|
||||
});
|
||||
connect(m_process, &Process::done, this, [this, exportButton] {
|
||||
exportButton->setEnabled(true);
|
||||
connect(m_process, &Process::done, this, [this] {
|
||||
m_futureInterface->reportFinished();
|
||||
if (m_process->exitCode() == 0)
|
||||
emit clipReady(m_outputClipInfo);
|
||||
else
|
||||
if (m_process->exitCode() == 0) {
|
||||
emit finished(m_outputClipInfo.file);
|
||||
} else {
|
||||
FFmpegUtils::reportError(m_process->commandLine(), m_lastOutputChunk);
|
||||
emit finished({});
|
||||
}
|
||||
});
|
||||
connect(m_process, &Process::readyReadStandardError, this, [this] {
|
||||
m_lastOutputChunk = m_process->readAllRawStandardError();
|
||||
|
@@ -48,7 +48,8 @@ public:
|
||||
void setTrimRange(FrameRange range);
|
||||
|
||||
signals:
|
||||
void clipReady(const ClipInfo &clip);
|
||||
void started();
|
||||
void finished(const Utils::FilePath &clip);
|
||||
|
||||
private:
|
||||
void startExport();
|
||||
|
@@ -3,10 +3,8 @@ import qbs 1.0
|
||||
QtcPlugin {
|
||||
name: "ScreenRecorder"
|
||||
|
||||
Depends { name: "Qt.widgets" }
|
||||
Depends { name: "Utils" }
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "Spinner" }
|
||||
|
||||
files: [
|
||||
"cropandtrim.cpp",
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/temporaryfile.h>
|
||||
|
||||
#include <solutions/spinner/spinner.h>
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
@@ -76,6 +78,17 @@ public:
|
||||
m_exportWidget, &ExportWidget::setCropRect);
|
||||
connect(m_cropAndTrimStatusWidget, &CropAndTrimWidget::trimRangeChanged,
|
||||
m_exportWidget, &ExportWidget::setTrimRange);
|
||||
connect(m_exportWidget, &ExportWidget::started, this, [this] {
|
||||
setEnabled(false);
|
||||
m_spinner->show();
|
||||
});
|
||||
connect(m_exportWidget, &ExportWidget::finished, this, [this] {
|
||||
setEnabled(true);
|
||||
m_spinner->hide();
|
||||
});
|
||||
|
||||
m_spinner = new SpinnerSolution::Spinner(SpinnerSolution::SpinnerSize::Medium, this);
|
||||
m_spinner->hide();
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -83,6 +96,7 @@ private:
|
||||
TemporaryFile m_recordFile;
|
||||
CropAndTrimWidget *m_cropAndTrimStatusWidget;
|
||||
ExportWidget *m_exportWidget;
|
||||
SpinnerSolution::Spinner *m_spinner;
|
||||
};
|
||||
|
||||
class ScreenRecorderPlugin final : public ExtensionSystem::IPlugin
|
||||
|
Reference in New Issue
Block a user