提交 797b3dc1 编写于 作者: N nleseul 提交者: jp9000

UI: Batch remux and drag/drop support on remux dialog

This changes the remux dialog to support a collection of input/output
pairs, presented as a QTableView.  Standard Qt icons are used to
indicate the state of each entry during a remux operation.  Drag/drop
support is added to populate the list quickly.  Both Dark and Rachni
themes are updated to make QTableView look reasonable.

Relevant text is added in the localization files.

Closes obsproject/obs-studio#1153
上级 4659efc7
......@@ -271,16 +271,19 @@ LogReturnDialog.ErrorUploadingLog="Error uploading log file"
Remux.SourceFile="OBS Recording"
Remux.TargetFile="Target File"
Remux.Remux="Remux"
Remux.ClearFinished="Clear Finished Items"
Remux.ClearAll="Clear All Items"
Remux.OBSRecording="OBS Recording"
Remux.FinishedTitle="Remuxing finished"
Remux.Finished="Recording remuxed"
Remux.FinishedError="Recording remuxed, but the file may be incomplete"
Remux.SelectRecording="Select OBS Recording …"
Remux.SelectTarget="Select target file …"
Remux.FileExistsTitle="Target file exists"
Remux.FileExists="Target file exists, do you want to replace it?"
Remux.FileExistsTitle="Target files exist"
Remux.FileExists="The following target files already exist. Do you want to replace them?"
Remux.ExitUnfinishedTitle="Remuxing in progress"
Remux.ExitUnfinished="Remuxing is not finished, stopping now may render the target file unusable.\nAre you sure you want to stop remuxing?"
Remux.HelpText="Drop files in this window to remux, or select an empty \"OBS Recording\" cell to browse for a file."
# update dialog
UpdateAvailable="New Update Available"
......
......@@ -579,6 +579,18 @@ QStatusBar::item {
border: none;
}
/* Table View */
QTableView {
gridline-color: rgb(88,87,88); /* kindaDark */
}
QHeaderView::section {
background-color: rgb(58,57,58); /* dark */
color: rgb(225,224,225); /* veryLight */
border: 1px solid rgb(31,30,31); /* veryDark */;
border-radius: 5px;
}
/* Mute CheckBox */
......
......@@ -1165,6 +1165,21 @@ QSlider::handle:hover {
QSlider::handle:disabled {
background-color: rgb(122, 121, 122);
}
/**********************/
/* --- Table View --- */
/**********************/
QTableView {
gridline-color: rgb(118, 121, 124); /* Light Gray */
}
QHeaderView::section {
background-color: rgb(35, 38, 41); /* Dark Gray */
color: rgb(239, 240, 241); /* "White" */
border: 1px solid rgb(118, 121, 124); /* Light Gray */
border-radius: 2px;
padding: 4px;
}
/****************/
/* --- Misc --- */
......@@ -1191,7 +1206,6 @@ QFrame[frameShape="0"] {
border: 1px transparent;
}
/* Misc style tweaks for dark themes */
* [themeID="error"] {
color: rgb(255, 89, 76); /* Red Error */
......
......@@ -6,77 +6,62 @@
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>124</height>
<width>850</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>RemuxRecordings</string>
</property>
<layout class="QGridLayout" name="formLayout">
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Remux.SourceFile</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Remux.TargetFile</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="sourceFile">
</widget>
</item>
<item>
<widget class="QPushButton" name="browseSource">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="targetFile">
</widget>
</item>
<item>
<widget class="QPushButton" name="browseTarget">
<property name="text">
<string>Browse</string>
</property>
</widget>
</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>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Remux.HelpText</string>
</property>
</widget>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTableView" name="tableView">
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>23</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>23</number>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>23</number>
</attribute>
</widget>
</item>
<item row="2" column="0">
<widget class="QProgressBar" name="progressBar">
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
......
此差异已折叠。
......@@ -17,6 +17,8 @@
#pragma once
#include <QFileInfo>
#include <QMutex>
#include <QPointer>
#include <QThread>
#include <memory>
......@@ -25,11 +27,25 @@
#include <media-io/media-remux.h>
#include <util/threading.h>
class RemuxQueueModel;
class RemuxWorker;
enum RemuxEntryState
{
Empty,
Ready,
Pending,
InProgress,
Complete,
InvalidPath,
Error
};
Q_DECLARE_METATYPE(RemuxEntryState);
class OBSRemux : public QDialog {
Q_OBJECT
QPointer<RemuxQueueModel> queueModel;
QThread remuxer;
QPointer<RemuxWorker> worker;
......@@ -37,11 +53,6 @@ class OBSRemux : public QDialog {
const char *recPath;
void BrowseInput();
void BrowseOutput();
bool Stop();
virtual void closeEvent(QCloseEvent *event) override;
virtual void reject() override;
......@@ -51,32 +62,89 @@ public:
using job_t = std::shared_ptr<struct media_remux_job>;
protected:
void dropEvent(QDropEvent *ev);
void dragEnterEvent(QDragEnterEvent *ev);
void remuxNextEntry();
private slots:
void inputChanged(const QString &str);
void rowCountChanged(const QModelIndex &parent, int first, int last);
public slots:
void updateProgress(float percent);
void remuxFinished(bool success);
void Remux();
void beginRemux();
bool stopRemux();
void clearFinished();
void clearAll();
signals:
void remux();
void remux(const QString &source, const QString &target);
};
class RemuxQueueModel : public QAbstractTableModel {
Q_OBJECT
friend class OBSRemux;
public:
RemuxQueueModel(QObject *parent = 0)
: QAbstractTableModel(parent)
, isProcessing(false) {}
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index, const QVariant &value,
int role);
QFileInfoList checkForOverwrites() const;
bool checkForErrors() const;
void beginProcessing();
void endProcessing();
bool beginNextEntry(QString &inputPath, QString &outputPath);
void finishEntry(bool success);
bool canClearFinished() const;
void clearFinished();
void clearAll();
private:
struct RemuxQueueEntry
{
RemuxEntryState state;
QString sourcePath;
QString targetPath;
};
QList<RemuxQueueEntry> queue;
bool isProcessing;
static QVariant getIcon(RemuxEntryState state);
void checkInputPath(int row);
};
class RemuxWorker : public QObject {
Q_OBJECT
OBSRemux::job_t job;
os_event_t *stop;
QMutex updateMutex;
bool isWorking;
float lastProgress;
void UpdateProgress(float percent);
explicit RemuxWorker();
virtual ~RemuxWorker();
explicit RemuxWorker()
: isWorking(false) { }
virtual ~RemuxWorker() {};
private slots:
void remux();
void remux(const QString &source, const QString &target);
signals:
void updateProgress(float percent);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册