From e26f07a1c357e1b5f43fcea82a03b532eea0f04c Mon Sep 17 00:00:00 2001 From: cg2121 Date: Sun, 9 Apr 2017 08:11:35 -0500 Subject: [PATCH] UI: Make sure all dialogs have close buttons This adds close buttons to remux dialog, output timer dialog, and advanced audio properties dialog. I also did a small refactor of the remux dialog so the buttons were consistent with other dialogs. Closes jp9000/obs-studio#876 --- UI/forms/OBSRemux.ui | 74 +++++-------------- .../frontend-tools/forms/output-timer.ui | 7 ++ .../frontend-tools/output-timer.cpp | 2 + UI/window-basic-adv-audio.cpp | 11 +++ UI/window-remux.cpp | 25 +++++-- UI/window-remux.hpp | 2 +- 6 files changed, 59 insertions(+), 62 deletions(-) diff --git a/UI/forms/OBSRemux.ui b/UI/forms/OBSRemux.ui index 70dfa63f..4c74e56b 100644 --- a/UI/forms/OBSRemux.ui +++ b/UI/forms/OBSRemux.ui @@ -13,35 +13,7 @@ RemuxRecordings - - - - 10 - 90 - 351 - 23 - - - - 24 - - - - - - 10 - 10 - 471 - 71 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - 6 - + @@ -60,12 +32,6 @@ - - - 0 - 0 - - @@ -81,12 +47,6 @@ - - - 0 - 0 - - @@ -98,21 +58,25 @@ + + + + 24 + + + + + + + + + QDialogButtonBox::Ok|QDialogButtonBox::Close + + + + + - - - - - 370 - 90 - 111 - 23 - - - - Remux.Remux - - diff --git a/UI/frontend-plugins/frontend-tools/forms/output-timer.ui b/UI/frontend-plugins/frontend-tools/forms/output-timer.ui index b9ea3d98..e56ae421 100644 --- a/UI/frontend-plugins/frontend-tools/forms/output-timer.ui +++ b/UI/frontend-plugins/frontend-tools/forms/output-timer.ui @@ -201,6 +201,13 @@ + + + + QDialogButtonBox::Close + + + diff --git a/UI/frontend-plugins/frontend-tools/output-timer.cpp b/UI/frontend-plugins/frontend-tools/output-timer.cpp index 441e929d..155c8d2a 100644 --- a/UI/frontend-plugins/frontend-tools/output-timer.cpp +++ b/UI/frontend-plugins/frontend-tools/output-timer.cpp @@ -22,6 +22,8 @@ OutputTimer::OutputTimer(QWidget *parent) SLOT(StreamingTimerButton())); QObject::connect(ui->outputTimerRecord, SIGNAL(clicked()), this, SLOT(RecordingTimerButton())); + QObject::connect(ui->buttonBox->button(QDialogButtonBox::Close), + SIGNAL(clicked()), this, SLOT(hide())); streamingTimer = new QTimer(this); streamingTimerDisplay = new QTimer(this); diff --git a/UI/window-basic-adv-audio.cpp b/UI/window-basic-adv-audio.cpp index ad3977d6..33fe0cb5 100644 --- a/UI/window-basic-adv-audio.cpp +++ b/UI/window-basic-adv-audio.cpp @@ -1,6 +1,8 @@ #include +#include #include #include +#include #include #include "window-basic-adv-audio.hpp" #include "window-basic-main.hpp" @@ -65,11 +67,20 @@ OBSBasicAdvAudio::OBSBasicAdvAudio(QWidget *parent) scrollArea->setWidget(widget); scrollArea->setWidgetResizable(true); + QPushButton *closeButton = new QPushButton(QTStr("Close")); + + QHBoxLayout *buttonLayout = new QHBoxLayout; + buttonLayout->addStretch(); + buttonLayout->addWidget(closeButton); + vlayout = new QVBoxLayout; vlayout->setContentsMargins(11, 11, 11, 11); vlayout->addWidget(scrollArea); + vlayout->addLayout(buttonLayout); setLayout(vlayout); + connect(closeButton, &QPushButton::clicked, [this] () {close();}); + installEventFilter(CreateShortcutFilter()); /* enum user scene/sources */ diff --git a/UI/window-remux.cpp b/UI/window-remux.cpp index ea9ecce7..f6bdf953 100644 --- a/UI/window-remux.cpp +++ b/UI/window-remux.cpp @@ -40,7 +40,8 @@ OBSRemux::OBSRemux(const char *path, QWidget *parent) ui->setupUi(this); ui->progressBar->setVisible(false); - ui->remux->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setEnabled(false); ui->targetFile->setEnabled(false); ui->browseTarget->setEnabled(false); @@ -54,11 +55,19 @@ OBSRemux::OBSRemux(const char *path, QWidget *parent) [&]() { BrowseInput(); }); connect(ui->browseTarget, &QPushButton::clicked, [&]() { BrowseOutput(); }); - connect(ui->remux, &QPushButton::clicked, [&]() { Remux(); }); connect(ui->sourceFile, &QLineEdit::textChanged, this, &OBSRemux::inputChanged); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setText(QTStr("Remux.Remux")); + + connect(ui->buttonBox->button(QDialogButtonBox::Ok), + SIGNAL(clicked()), this, SLOT(Remux())); + + connect(ui->buttonBox->button(QDialogButtonBox::Close), + SIGNAL(clicked()), this, SLOT(close())); + worker->moveToThread(&remuxer); remuxer.start(); @@ -116,12 +125,14 @@ void OBSRemux::BrowseInput() void OBSRemux::inputChanged(const QString &path) { if (!QFileInfo::exists(path)) { - ui->remux->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setEnabled(false); return; } ui->sourceFile->setText(path); - ui->remux->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setEnabled(true); QFileInfo fi(path); QString mp4 = fi.path() + "/" + fi.baseName() + ".mp4"; @@ -161,7 +172,8 @@ void OBSRemux::Remux() worker->lastProgress = 0.f; ui->progressBar->setVisible(true); - ui->remux->setEnabled(false); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setEnabled(false); emit remux(); } @@ -195,7 +207,8 @@ void OBSRemux::remuxFinished(bool success) worker->job.reset(); ui->progressBar->setVisible(false); - ui->remux->setEnabled(true); + ui->buttonBox->button(QDialogButtonBox::Ok)-> + setEnabled(true); } RemuxWorker::RemuxWorker() diff --git a/UI/window-remux.hpp b/UI/window-remux.hpp index 8bda363d..d6898287 100644 --- a/UI/window-remux.hpp +++ b/UI/window-remux.hpp @@ -39,7 +39,6 @@ class OBSRemux : public QDialog { void BrowseInput(); void BrowseOutput(); - void Remux(); bool Stop(); @@ -58,6 +57,7 @@ private slots: public slots: void updateProgress(float percent); void remuxFinished(bool success); + void Remux(); signals: void remux(); -- GitLab