mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-25 04:11:44 +00:00
GUI: merge: preview buttons for subtitle & chapter character sets
This commit is contained in:
parent
ee625d960b
commit
57e326ee41
@ -1,5 +1,11 @@
|
||||
2015-10-04 Moritz Bunkus <moritz@bunkus.org>
|
||||
|
||||
* MKVToolNix GUI: merge tool enhancement: added buttons for
|
||||
previewing the character sets for text subtitles read from SRT and
|
||||
SSA/ASS files as well as for chapter files. They're located next
|
||||
to the drop down boxes for the character sets on the input and
|
||||
output tabs.
|
||||
|
||||
* MKVToolNix GUI: merge tool enhancement: added buttons next to
|
||||
the 'segment UID', 'previous segment UID' and 'next segment UID'
|
||||
controls that enable the user to select a Matroska file. The GUI
|
||||
|
BIN
share/icons/16x16/character-set.png
Normal file
BIN
share/icons/16x16/character-set.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 494 B |
BIN
share/icons/32x32/character-set.png
Normal file
BIN
share/icons/32x32/character-set.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 992 B |
BIN
share/icons/48x48/character-set.png
Normal file
BIN
share/icons/48x48/character-set.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -852,6 +852,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="subtitleCharacterSetPreview">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qt_resources.qrc">
|
||||
<normaloff>:/icons/16x16/character-set.png</normaloff>:/icons/16x16/character-set.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1160,7 +1171,7 @@
|
||||
<property name="title">
|
||||
<string>File/Segment linking</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="gridLayout1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="segmentUIDsLabel">
|
||||
<property name="text">
|
||||
@ -1169,7 +1180,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_61">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="segmentUIDs"/>
|
||||
</item>
|
||||
@ -1250,7 +1261,7 @@
|
||||
<property name="title">
|
||||
<string>Chapters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="chaptersLabel">
|
||||
<property name="text">
|
||||
@ -1294,7 +1305,29 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="mtx::gui::Util::CharacterSetComboBox" name="chapterCharacterSet"/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="mtx::gui::Util::CharacterSetComboBox" name="chapterCharacterSet">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chapterCharacterSetPreview">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qt_resources.qrc">
|
||||
<normaloff>:/icons/16x16/character-set.png</normaloff>:/icons/16x16/character-set.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="chapterCueNameFormatLabel">
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "common/common_pch.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include "common/locale.h"
|
||||
#include "common/qt.h"
|
||||
#include "mkvtoolnix-gui/forms/main_window/select_character_set_dialog.h"
|
||||
@ -14,6 +16,7 @@ class SelectCharacterSetDialogPrivate {
|
||||
|
||||
std::unique_ptr<Ui::SelectCharacterSetDialog> m_ui{new Ui::SelectCharacterSetDialog};
|
||||
QByteArray m_content;
|
||||
QVariant m_userData;
|
||||
};
|
||||
|
||||
SelectCharacterSetDialog::SelectCharacterSetDialog(QWidget *parent,
|
||||
@ -87,4 +90,19 @@ SelectCharacterSetDialog::selectedCharacterSet()
|
||||
return d->m_ui->characterSet->currentData().toString();
|
||||
}
|
||||
|
||||
void
|
||||
SelectCharacterSetDialog::setUserData(QVariant const &data) {
|
||||
Q_D(SelectCharacterSetDialog);
|
||||
|
||||
d->m_userData = data;
|
||||
}
|
||||
|
||||
QVariant const &
|
||||
SelectCharacterSetDialog::userData()
|
||||
const {
|
||||
Q_D(const SelectCharacterSetDialog);
|
||||
|
||||
return d->m_userData;
|
||||
}
|
||||
|
||||
}}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "mkvtoolnix-gui/util/settings.h"
|
||||
|
||||
class QListWidget;
|
||||
class QVariant;
|
||||
|
||||
namespace mtx { namespace gui {
|
||||
|
||||
@ -22,6 +23,9 @@ public:
|
||||
explicit SelectCharacterSetDialog(QWidget *parent, QString const &fileName, QString const &initialCharacterSet = QString{});
|
||||
virtual ~SelectCharacterSetDialog();
|
||||
|
||||
void setUserData(QVariant const &data);
|
||||
QVariant const &userData() const;
|
||||
|
||||
signals:
|
||||
void characterSetSelected(QString const &characterSet);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "mkvtoolnix-gui/app.h"
|
||||
#include "mkvtoolnix-gui/forms/merge/tab.h"
|
||||
#include "mkvtoolnix-gui/main_window/main_window.h"
|
||||
#include "mkvtoolnix-gui/main_window/select_character_set_dialog.h"
|
||||
#include "mkvtoolnix-gui/merge/adding_appending_files_dialog.h"
|
||||
#include "mkvtoolnix-gui/merge/executable_location_dialog.h"
|
||||
#include "mkvtoolnix-gui/merge/tab.h"
|
||||
@ -252,6 +253,7 @@ Tab::setupInputControls() {
|
||||
connect(ui->moveFilesDown, &QPushButton::clicked, this, &Tab::onMoveFilesDown);
|
||||
connect(ui->moveTracksUp, &QPushButton::clicked, this, &Tab::onMoveTracksUp);
|
||||
connect(ui->moveTracksDown, &QPushButton::clicked, this, &Tab::onMoveTracksDown);
|
||||
connect(ui->subtitleCharacterSetPreview, &QPushButton::clicked, this, &Tab::onPreviewSubtitleCharacterSet);
|
||||
|
||||
connect(m_addFilesAction, &QAction::triggered, this, &Tab::onAddFiles);
|
||||
connect(m_appendFilesAction, &QAction::triggered, this, &Tab::onAppendFiles);
|
||||
@ -411,6 +413,7 @@ Tab::onTrackSelectionChanged() {
|
||||
Util::enableWidgets(m_allInputControls, false);
|
||||
ui->moveTracksUp->setEnabled(false);
|
||||
ui->moveTracksDown->setEnabled(false);
|
||||
ui->subtitleCharacterSetPreview->setEnabled(false);
|
||||
|
||||
auto selection = ui->tracks->selectionModel()->selection();
|
||||
auto numRows = Util::numSelectedRows(selection);
|
||||
@ -449,6 +452,9 @@ Tab::onTrackSelectionChanged() {
|
||||
if (track->m_file->m_type == FILE_TYPE_MATROSKA)
|
||||
Util::enableWidgets(QList<QWidget *>{} << ui->characterSetLabel << ui->subtitleCharacterSet, false);
|
||||
|
||||
else if (track->m_file->isTextSubtitleContainer())
|
||||
ui->subtitleCharacterSetPreview->setEnabled(true);
|
||||
|
||||
} else if (track->isChapters())
|
||||
Util::enableWidgets(m_chapterControls, true);
|
||||
|
||||
@ -1599,4 +1605,38 @@ Tab::openFilesInMediaInfo(QStringList const &fileNames) {
|
||||
QProcess::startDetached(exe, fileNames);
|
||||
}
|
||||
|
||||
void
|
||||
Tab::onPreviewSubtitleCharacterSet() {
|
||||
auto selection = selectedTracks();
|
||||
auto track = selection.count() ? selection[0] : nullptr;
|
||||
|
||||
if ((selection.count() != 1) || !track->m_file->isTextSubtitleContainer())
|
||||
return;
|
||||
|
||||
auto dlg = new SelectCharacterSetDialog{this, track->m_file->m_fileName, track->m_characterSet};
|
||||
dlg->setUserData(reinterpret_cast<qulonglong>(track));
|
||||
|
||||
connect(dlg, &SelectCharacterSetDialog::characterSetSelected, this, &Tab::setSubtitleCharacterSet);
|
||||
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void
|
||||
Tab::setSubtitleCharacterSet(QString const &characterSet) {
|
||||
auto dlg = qobject_cast<SelectCharacterSetDialog *>(QObject::sender());
|
||||
if (!dlg)
|
||||
return;
|
||||
|
||||
auto track = reinterpret_cast<Track *>(dlg->userData().toULongLong());
|
||||
|
||||
if (!m_config.m_tracks.contains(track))
|
||||
return;
|
||||
|
||||
track->m_characterSet = characterSet;
|
||||
auto selection = selectedTracks();
|
||||
|
||||
if ((selection.count() == 1) && (selection[0] == track))
|
||||
Util::setComboBoxTextByData(ui->subtitleCharacterSet, characterSet);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "common/qt.h"
|
||||
#include "mkvtoolnix-gui/forms/merge/tab.h"
|
||||
#include "mkvtoolnix-gui/main_window/main_window.h"
|
||||
#include "mkvtoolnix-gui/main_window/select_character_set_dialog.h"
|
||||
#include "mkvtoolnix-gui/merge/additional_command_line_options_dialog.h"
|
||||
#include "mkvtoolnix-gui/merge/tab.h"
|
||||
#include "mkvtoolnix-gui/util/message_box.h"
|
||||
@ -23,6 +24,8 @@ Tab::setupOutputControls() {
|
||||
|
||||
setupOutputFileControls();
|
||||
|
||||
ui->chapterCharacterSetPreview->setEnabled(false);
|
||||
|
||||
m_splitControls << ui->splitOptions << ui->splitOptionsLabel << ui->splitMaxFilesLabel << ui->splitMaxFiles << ui->linkFiles;
|
||||
|
||||
auto comboBoxControls = QList<QComboBox *>{} << ui->splitMode << ui->chapterLanguage << ui->chapterCharacterSet;
|
||||
@ -33,10 +36,11 @@ Tab::setupOutputControls() {
|
||||
|
||||
onSplitModeChanged(MuxConfig::DoNotSplit);
|
||||
|
||||
connect(MainWindow::get(), &MainWindow::preferencesChanged, this, &Tab::setupOutputFileControls);
|
||||
connect(ui->browseSegmentUID, &QPushButton::clicked, this, &Tab::onBrowseSegmentUID);
|
||||
connect(ui->browsePreviousSegmentUID, &QPushButton::clicked, this, &Tab::onBrowsePreviousSegmentUID);
|
||||
connect(ui->browseNextSegmentUID, &QPushButton::clicked, this, &Tab::onBrowseNextSegmentUID);
|
||||
connect(MainWindow::get(), &MainWindow::preferencesChanged, this, &Tab::setupOutputFileControls);
|
||||
connect(ui->browseSegmentUID, &QPushButton::clicked, this, &Tab::onBrowseSegmentUID);
|
||||
connect(ui->browsePreviousSegmentUID, &QPushButton::clicked, this, &Tab::onBrowsePreviousSegmentUID);
|
||||
connect(ui->browseNextSegmentUID, &QPushButton::clicked, this, &Tab::onBrowseNextSegmentUID);
|
||||
connect(ui->chapterCharacterSetPreview, &QPushButton::clicked, this, &Tab::onPreviewChapterCharacterSet);
|
||||
}
|
||||
|
||||
void
|
||||
@ -393,6 +397,7 @@ Tab::onNextSegmentUIDChanged(QString newValue) {
|
||||
void
|
||||
Tab::onChaptersChanged(QString newValue) {
|
||||
m_config.m_chapters = newValue;
|
||||
ui->chapterCharacterSetPreview->setEnabled(!newValue.isEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
@ -405,7 +410,7 @@ Tab::onBrowseChapters() {
|
||||
InitialDirMode::ContentFirstInputFileLastOpenDir);
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
m_config.m_chapters = fileName;
|
||||
onChaptersChanged(fileName);
|
||||
}
|
||||
|
||||
void
|
||||
@ -518,4 +523,21 @@ Tab::addSegmentUIDFromFile(QLineEdit &lineEdit,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Tab::onPreviewChapterCharacterSet() {
|
||||
if (m_config.m_chapters.isEmpty())
|
||||
return;
|
||||
|
||||
auto dlg = new SelectCharacterSetDialog{this, m_config.m_chapters, ui->chapterCharacterSet->currentData().toString()};
|
||||
connect(dlg, &SelectCharacterSetDialog::characterSetSelected, this, &Tab::setChapterCharacterSet);
|
||||
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
void
|
||||
Tab::setChapterCharacterSet(QString const &characterSet) {
|
||||
Util::setComboBoxTextByData(ui->chapterCharacterSet, characterSet);
|
||||
onChapterCharacterSetChanged(characterSet);
|
||||
}
|
||||
|
||||
}}}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "common/common_pch.h"
|
||||
|
||||
#include "common/list_utils.h"
|
||||
#include "common/qt.h"
|
||||
#include "mkvtoolnix-gui/merge/mkvmerge_option_builder.h"
|
||||
#include "mkvtoolnix-gui/merge/mux_config.h"
|
||||
@ -132,6 +133,12 @@ SourceFile::container()
|
||||
return Q(file_type_t::get_name(m_type).get_translated());
|
||||
}
|
||||
|
||||
bool
|
||||
SourceFile::isTextSubtitleContainer()
|
||||
const {
|
||||
return mtx::included_in(m_type, FILE_TYPE_SRT, FILE_TYPE_SSA);
|
||||
}
|
||||
|
||||
void
|
||||
SourceFile::saveSettings(Util::ConfigFile &settings)
|
||||
const {
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
SourceFile &operator =(SourceFile const &other);
|
||||
|
||||
virtual QString container() const;
|
||||
virtual bool isTextSubtitleContainer() const;
|
||||
virtual bool isValid() const;
|
||||
virtual bool isRegular() const;
|
||||
virtual bool isAppended() const;
|
||||
|
@ -141,6 +141,8 @@ public slots:
|
||||
virtual void onSubtitleCharacterSetChanged(int newValue);
|
||||
virtual void onCuesChanged(int newValue);
|
||||
virtual void onAdditionalTrackOptionsChanged(QString newValue);
|
||||
virtual void onPreviewChapterCharacterSet();
|
||||
virtual void setChapterCharacterSet(QString const &characterSet);
|
||||
|
||||
virtual void resizeFilesColumnsToContents() const;
|
||||
virtual void resizeTracksColumnsToContents() const;
|
||||
@ -188,6 +190,8 @@ public slots:
|
||||
virtual void onWebmClicked(bool newValue);
|
||||
virtual void onAdditionalOptionsChanged(QString newValue);
|
||||
virtual void onEditAdditionalOptions();
|
||||
virtual void onPreviewSubtitleCharacterSet();
|
||||
virtual void setSubtitleCharacterSet(QString const &characterSet);
|
||||
|
||||
// Attachments tab:
|
||||
virtual void onAttachmentSelectionChanged();
|
||||
|
@ -158,5 +158,8 @@
|
||||
<file alias='icons/32x32/arrow-down.png'>../../share/icons/32x32/arrow-down.png</file>
|
||||
<file alias='icons/48x48/arrow-up.png'>../../share/icons/48x48/arrow-up.png</file>
|
||||
<file alias='icons/48x48/arrow-down.png'>../../share/icons/48x48/arrow-down.png</file>
|
||||
<file alias='icons/16x16/character-set.png'>../../share/icons/16x16/character-set.png</file>
|
||||
<file alias='icons/32x32/character-set.png'>../../share/icons/32x32/character-set.png</file>
|
||||
<file alias='icons/48x48/character-set.png'>../../share/icons/48x48/character-set.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue
Block a user