소스 검색

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
cg2121 8 년 전
부모
커밋
e26f07a1c3

+ 19 - 55
UI/forms/OBSRemux.ui

@@ -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/>

+ 7 - 0
UI/frontend-plugins/frontend-tools/forms/output-timer.ui

@@ -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 />

+ 2 - 0
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);

+ 11 - 0
UI/window-basic-adv-audio.cpp

@@ -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 */

+ 19 - 6
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()

+ 1 - 1
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();