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
master
cg2121 2017-04-09 08:11:35 -05:00 committed by jp9000
parent 0ea0b99aa0
commit e26f07a1c3
6 changed files with 59 additions and 62 deletions

View File

@ -13,35 +13,7 @@
<property name="windowTitle">
<string>RemuxRecordings</string>
</property>
<widget class="QProgressBar" name="progressBar">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>351</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
<widget class="QWidget" name="formLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>471</width>
<height>71</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<layout class="QGridLayout" name="formLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -60,12 +32,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="sourceFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
@ -81,12 +47,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="targetFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
@ -98,21 +58,25 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Ok|QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QPushButton" name="remux">
<property name="geometry">
<rect>
<x>370</x>
<y>90</y>
<width>111</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Remux.Remux</string>
</property>
</widget>
</widget>
<resources/>
<connections/>

View File

@ -201,6 +201,13 @@
</property>
</widget>
</item>
<item row="6" column="8">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources />

View File

@ -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);

View File

@ -1,6 +1,8 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QScrollArea>
#include <QPushButton>
#include <QLabel>
#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 */

View File

@ -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()

View File

@ -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();