mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-29 06:15:24 +00:00
GUI: chapters: remove support for editing legacy country elements
Instead the legacy elements will be derived from the region part of the IETF BCP 47 language tags. Part of the implementation of #3193.
This commit is contained in:
parent
88b97761bf
commit
7a8297c985
7
NEWS.md
7
NEWS.md
@ -1,5 +1,12 @@
|
||||
# Version ?
|
||||
|
||||
## New features and enhancements
|
||||
|
||||
* MKVToolNix GUI: chapter editor: removed the support for explicitly setting
|
||||
the legacy country elements. Instead the legacy country elements are derived
|
||||
from the region parts of the IETF BCP 47 languages. Part of the
|
||||
implementation of #3193.
|
||||
|
||||
## Bug fixes
|
||||
|
||||
* mkvmerge: Matroska reader, TrueHD: mkvmerge will now probe much more TrueHD
|
||||
|
@ -182,9 +182,9 @@ ChapterModel::chapterNameForLanguage(KaxChapterAtom &chapter,
|
||||
if (!kDisplay)
|
||||
continue;
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesAndCountriesForDisplay(*kDisplay);
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesForDisplay(*kDisplay);
|
||||
auto actualLanguage = mtx::chapters::get_language_from_display(*kDisplay, "eng"s);
|
||||
|
||||
if ( language.empty()
|
||||
|| (std::find_if(lists.languageCodes.begin(), lists.languageCodes.end(), [&language](auto const &actualLanguage) {
|
||||
return (language == actualLanguage.get_language())
|
||||
|
@ -23,12 +23,11 @@ using namespace mtx::gui;
|
||||
GenerateSubChaptersParametersDialog::GenerateSubChaptersParametersDialog(QWidget *parent,
|
||||
int firstChapterNumber,
|
||||
uint64_t startTimestamp,
|
||||
QStringList const &additionalLanguages,
|
||||
QStringList const &additionalCountryCodes)
|
||||
QStringList const &additionalLanguages)
|
||||
: QDialog{parent}
|
||||
, m_ui{new Ui::GenerateSubChaptersParametersDialog}
|
||||
{
|
||||
setupUi(firstChapterNumber, startTimestamp, additionalLanguages, additionalCountryCodes);
|
||||
setupUi(firstChapterNumber, startTimestamp, additionalLanguages);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
@ -38,8 +37,7 @@ GenerateSubChaptersParametersDialog::~GenerateSubChaptersParametersDialog() {
|
||||
void
|
||||
GenerateSubChaptersParametersDialog::setupUi(int firstChapterNumber,
|
||||
uint64_t startTimestamp,
|
||||
QStringList const &additionalLanguages,
|
||||
QStringList const &additionalCountryCodes) {
|
||||
QStringList const &additionalLanguages) {
|
||||
auto &cfg = Util::Settings::get();
|
||||
|
||||
m_ui->setupUi(this);
|
||||
@ -52,7 +50,6 @@ GenerateSubChaptersParametersDialog::setupUi(int firstChapterNumber,
|
||||
m_ui->ldwLanguage->setLanguage(cfg.m_defaultChapterLanguage);
|
||||
m_ui->ldwLanguage->enableClearingLanguage(true);
|
||||
m_ui->ldwLanguage->setClearTitle(QY("– Set to none –"));
|
||||
m_ui->cbCountry->setAdditionalItems(additionalCountryCodes).setup(true, QY("– Set to none –")).setCurrentByData(cfg.m_defaultChapterCountry);
|
||||
|
||||
m_ui->sbNumberOfEntries->setFocus();
|
||||
|
||||
@ -110,13 +107,6 @@ GenerateSubChaptersParametersDialog::language()
|
||||
return m_ui->ldwLanguage->language();
|
||||
}
|
||||
|
||||
OptQString
|
||||
GenerateSubChaptersParametersDialog::country()
|
||||
const {
|
||||
auto countryStr = m_ui->cbCountry->currentData().toString();
|
||||
return countryStr.isEmpty() ? OptQString{} : OptQString{ countryStr };
|
||||
}
|
||||
|
||||
void
|
||||
GenerateSubChaptersParametersDialog::verifyStartTimestamp() {
|
||||
int64_t dummy = 0;
|
||||
|
@ -22,7 +22,7 @@ private:
|
||||
std::unique_ptr<Ui::GenerateSubChaptersParametersDialog> m_ui;
|
||||
|
||||
public:
|
||||
explicit GenerateSubChaptersParametersDialog(QWidget *parent, int firstChapterNumber, uint64_t startTimestamp, QStringList const &additionalLanguages, QStringList const &additionalCountryCodes);
|
||||
explicit GenerateSubChaptersParametersDialog(QWidget *parent, int firstChapterNumber, uint64_t startTimestamp, QStringList const &additionalLanguages);
|
||||
~GenerateSubChaptersParametersDialog();
|
||||
|
||||
int numberOfEntries() const;
|
||||
@ -31,13 +31,12 @@ public:
|
||||
uint64_t startTimestamp() const;
|
||||
QString nameTemplate() const;
|
||||
mtx::bcp47::language_c language() const;
|
||||
OptQString country() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void verifyStartTimestamp();
|
||||
|
||||
protected:
|
||||
void setupUi(int firstChapterNumber, uint64_t startTimestamp, QStringList const &additionalLanguages, QStringList const &additionalCountryCodes);
|
||||
void setupUi(int firstChapterNumber, uint64_t startTimestamp, QStringList const &additionalLanguages);
|
||||
void retranslateUi();
|
||||
};
|
||||
|
||||
|
@ -20,13 +20,12 @@ using namespace mtx::gui;
|
||||
|
||||
MassModificationDialog::MassModificationDialog(QWidget *parent,
|
||||
bool editionOrChapterSelected,
|
||||
QStringList const &additionalLanguages,
|
||||
QStringList const &additionalCountryCodes)
|
||||
QStringList const &additionalLanguages)
|
||||
: QDialog{parent}
|
||||
, m_ui{new Ui::MassModificationDialog}
|
||||
, m_editionOrChapterSelected{editionOrChapterSelected}
|
||||
{
|
||||
setupUi(additionalLanguages, additionalCountryCodes);
|
||||
setupUi(additionalLanguages);
|
||||
retranslateUi();
|
||||
}
|
||||
|
||||
@ -34,19 +33,16 @@ MassModificationDialog::~MassModificationDialog() {
|
||||
}
|
||||
|
||||
void
|
||||
MassModificationDialog::setupUi(QStringList const &additionalLanguages,
|
||||
QStringList const &additionalCountryCodes) {
|
||||
MassModificationDialog::setupUi(QStringList const &additionalLanguages) {
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_ui->ldwLanguage->setAdditionalLanguages(additionalLanguages);
|
||||
m_ui->cbCountry->setAdditionalItems(additionalCountryCodes).setup(true, QY("– Set to none –"));
|
||||
|
||||
connect(m_ui->cbShift, &QCheckBox::toggled, this, &MassModificationDialog::verifyOptions);
|
||||
connect(m_ui->leShiftBy, &QLineEdit::textChanged, this, &MassModificationDialog::verifyOptions);
|
||||
connect(m_ui->cbMultiply, &QCheckBox::toggled, this, &MassModificationDialog::verifyOptions);
|
||||
connect(m_ui->dsbMultiplyBy, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &MassModificationDialog::verifyOptions);
|
||||
connect(m_ui->cbSetLanguage, &QCheckBox::toggled, m_ui->ldwLanguage, &QComboBox::setEnabled);
|
||||
connect(m_ui->cbSetCountry, &QCheckBox::toggled, m_ui->cbCountry, &QComboBox::setEnabled);
|
||||
connect(m_ui->cbConstrictExpand, &QCheckBox::toggled, m_ui->rbConstrict, &QRadioButton::setEnabled);
|
||||
connect(m_ui->cbConstrictExpand, &QCheckBox::toggled, m_ui->rbExpand, &QRadioButton::setEnabled);
|
||||
connect(m_ui->cbSetEndTimestamps, &QCheckBox::toggled, m_ui->cbRemoveEndTimestamps, &QRadioButton::setDisabled);
|
||||
@ -57,7 +53,6 @@ MassModificationDialog::setupUi(QStringList const &additionalLanguages,
|
||||
m_ui->leShiftBy->setEnabled(false);
|
||||
m_ui->dsbMultiplyBy->setEnabled(false);
|
||||
m_ui->ldwLanguage->setEnabled(false);
|
||||
m_ui->cbCountry->setEnabled(false);
|
||||
m_ui->rbConstrict->setEnabled(false);
|
||||
m_ui->rbExpand->setEnabled(false);
|
||||
m_ui->rbConstrict->setChecked(true);
|
||||
@ -97,7 +92,6 @@ MassModificationDialog::actions()
|
||||
if (m_ui->cbConstrictExpand->isChecked() && m_ui->rbConstrict->isChecked()) result |= Action::Constrict;
|
||||
if (m_ui->cbConstrictExpand->isChecked() && m_ui->rbExpand->isChecked()) result |= Action::Expand;
|
||||
if (m_ui->cbSetLanguage->isChecked()) result |= Action::SetLanguage;
|
||||
if (m_ui->cbSetCountry->isChecked()) result |= Action::SetCountry;
|
||||
if (m_ui->cbMultiply->isChecked()) result |= Action::Multiply;
|
||||
if (m_ui->cbSetEndTimestamps->isEnabled() && m_ui->cbSetEndTimestamps->isChecked()) result |= Action::SetEndTimestamps;
|
||||
if (m_ui->cbRemoveEndTimestamps->isEnabled() && m_ui->cbRemoveEndTimestamps->isChecked()) result |= Action::RemoveEndTimestamps;
|
||||
@ -126,12 +120,6 @@ MassModificationDialog::language()
|
||||
return m_ui->ldwLanguage->language();
|
||||
}
|
||||
|
||||
QString
|
||||
MassModificationDialog::country()
|
||||
const {
|
||||
return m_ui->cbCountry->currentData().toString();
|
||||
}
|
||||
|
||||
bool
|
||||
MassModificationDialog::isMultiplyByValid()
|
||||
const {
|
||||
|
@ -24,11 +24,10 @@ public:
|
||||
Constrict = 0x0004,
|
||||
Expand = 0x0008,
|
||||
SetLanguage = 0x0010,
|
||||
SetCountry = 0x0020,
|
||||
Multiply = 0x0040,
|
||||
SetEndTimestamps = 0x0080,
|
||||
RemoveEndTimestamps = 0x0100,
|
||||
RemoveNames = 0x0200,
|
||||
Multiply = 0x0020,
|
||||
SetEndTimestamps = 0x0040,
|
||||
RemoveEndTimestamps = 0x0080,
|
||||
RemoveNames = 0x0100,
|
||||
};
|
||||
Q_DECLARE_FLAGS(Actions, Action)
|
||||
|
||||
@ -37,16 +36,15 @@ private:
|
||||
bool m_editionOrChapterSelected;
|
||||
|
||||
public:
|
||||
explicit MassModificationDialog(QWidget *parent, bool editionOrChapterSelected, QStringList const &additionalLanguages, QStringList const &additionalCountryCodes);
|
||||
explicit MassModificationDialog(QWidget *parent, bool editionOrChapterSelected, QStringList const &additionalLanguages);
|
||||
~MassModificationDialog();
|
||||
|
||||
Actions actions() const;
|
||||
int64_t shiftBy() const;
|
||||
double multiplyBy() const;
|
||||
mtx::bcp47::language_c language() const;
|
||||
QString country() const;
|
||||
|
||||
void setupUi(QStringList const &additionalLanguages, QStringList const &additionalCountryCodes);
|
||||
void setupUi(QStringList const &additionalLanguages);
|
||||
void retranslateUi();
|
||||
|
||||
public Q_SLOTS:
|
||||
|
@ -26,7 +26,6 @@ NameModel::retranslateUi() {
|
||||
Util::setDisplayableAndSymbolicColumnNames(*this, {
|
||||
{ QY("Name"), Q("name") },
|
||||
{ QY("Languages"), Q("language") },
|
||||
{ QY("Countries"), Q("country") },
|
||||
});
|
||||
}
|
||||
|
||||
@ -45,9 +44,9 @@ NameModel::displayFromIndex(QModelIndex const &idx) {
|
||||
return displayFromItem(itemFromIndex(idx));
|
||||
}
|
||||
|
||||
LanguagesAndCountries
|
||||
NameModel::effectiveLanguagesAndCountriesForDisplay(libmatroska::KaxChapterDisplay &display) {
|
||||
LanguagesAndCountries lists;
|
||||
Languages
|
||||
NameModel::effectiveLanguagesForDisplay(libmatroska::KaxChapterDisplay &display) {
|
||||
Languages lists;
|
||||
QList<mtx::bcp47::language_c> legacyLanguageCodes;
|
||||
QStringList legacyLanguageNames;
|
||||
|
||||
@ -62,10 +61,6 @@ NameModel::effectiveLanguagesAndCountriesForDisplay(libmatroska::KaxChapterDispl
|
||||
legacyLanguageCodes << language;
|
||||
legacyLanguageNames << Q(language.format_long());
|
||||
|
||||
} else if (auto kCountry = dynamic_cast<libmatroska::KaxChapterCountry const *>(child); kCountry) {
|
||||
auto countryCode = Q(kCountry->GetValue());
|
||||
lists.countryCodes << countryCode;
|
||||
lists.countryNames << App::descriptionForRegion(countryCode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,20 +81,18 @@ NameModel::effectiveLanguagesAndCountriesForDisplay(libmatroska::KaxChapterDispl
|
||||
void
|
||||
NameModel::setRowText(QList<QStandardItem *> const &rowItems) {
|
||||
auto &display = *displayFromItem(rowItems[0]);
|
||||
auto lists = effectiveLanguagesAndCountriesForDisplay(display);
|
||||
auto lists = effectiveLanguagesForDisplay(display);
|
||||
|
||||
lists.languageNames.sort();
|
||||
lists.countryNames.sort();
|
||||
|
||||
rowItems[0]->setText(Q(GetChildValue<KaxChapterString>(display)));
|
||||
rowItems[1]->setText(lists.languageNames.join(Q("; ")));
|
||||
rowItems[2]->setText(lists.countryNames.join(Q("; ")));
|
||||
}
|
||||
|
||||
QList<QStandardItem *>
|
||||
NameModel::itemsForRow(int row) {
|
||||
auto rowItems = QList<QStandardItem *>{};
|
||||
for (auto column = 0; 3 > column; ++column)
|
||||
for (auto column = 0; 2 > column; ++column)
|
||||
rowItems << item(row, column);
|
||||
|
||||
return rowItems;
|
||||
@ -126,8 +119,6 @@ NameModel::addNew() {
|
||||
|
||||
GetChild<KaxChapterString>(display).SetValueUTF8(Y("<Unnamed>"));
|
||||
mtx::chapters::set_languages_in_display(*display, cfg.m_defaultChapterLanguage);
|
||||
if (!cfg.m_defaultChapterCountry.isEmpty())
|
||||
GetChild<KaxChapterCountry>(display).SetValue(to_utf8(cfg.m_defaultChapterCountry));
|
||||
|
||||
m_chapter->PushElement(*display);
|
||||
append(*display);
|
||||
|
@ -13,9 +13,9 @@ Q_DECLARE_METATYPE(libmatroska::KaxChapterDisplay *)
|
||||
|
||||
namespace mtx::gui::ChapterEditor {
|
||||
|
||||
struct LanguagesAndCountries {
|
||||
struct Languages {
|
||||
QList<mtx::bcp47::language_c> languageCodes;
|
||||
QStringList languageNames, countryCodes, countryNames;
|
||||
QStringList languageNames;
|
||||
};
|
||||
|
||||
class NameModel: public QStandardItemModel {
|
||||
@ -49,7 +49,7 @@ public:
|
||||
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
|
||||
|
||||
public:
|
||||
static LanguagesAndCountries effectiveLanguagesAndCountriesForDisplay(libmatroska::KaxChapterDisplay &display);
|
||||
static Languages effectiveLanguagesForDisplay(libmatroska::KaxChapterDisplay &display);
|
||||
|
||||
protected:
|
||||
void setRowText(QList<QStandardItem *> const &rowItems);
|
||||
|
@ -61,8 +61,8 @@ namespace mtx::gui::ChapterEditor {
|
||||
namespace {
|
||||
|
||||
bool
|
||||
removeLanguageOrCountryControlRow(QVector<std::tuple<QBoxLayout *, QWidget *, QPushButton *>> &controls,
|
||||
QObject *sender) {
|
||||
removeLanguageControlRow(QVector<std::tuple<QBoxLayout *, QWidget *, QPushButton *>> &controls,
|
||||
QObject *sender) {
|
||||
for (int idx = 0, numControls = controls.size(); idx < numControls; ++idx) {
|
||||
auto &[layout, widget, button] = controls[idx];
|
||||
|
||||
@ -147,17 +147,9 @@ Tab::setupUi() {
|
||||
|
||||
p->ui->elements->acceptDroppedFiles(true);
|
||||
|
||||
p->ui->cbChNameCountry1->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
p->ui->cbChNameCountry1->setWithAlphaCodesOnly(true);
|
||||
p->ui->cbChNameCountry1->setup(true);
|
||||
Util::fixComboBoxViewWidth(*p->ui->cbChNameCountry1);
|
||||
|
||||
p->languageControls.push_back({ nullptr, p->ui->ldwChNameLanguage1, p->ui->pbChNameLanguageAdd });
|
||||
p->countryControls .push_back({ nullptr, p->ui->cbChNameCountry1, p->ui->pbChNameCountryAdd });
|
||||
|
||||
p->nameWidgets << p->ui->pbChRemoveName
|
||||
<< p->ui->lChName << p->ui->leChName
|
||||
<< p->ui->lChNameLanguage << p->ui->lChNameCountry;
|
||||
p->nameWidgets << p->ui->pbChRemoveName << p->ui->lChName << p->ui->leChName;
|
||||
|
||||
Util::fixScrollAreaBackground(p->ui->scrollArea);
|
||||
Util::HeaderViewManager::create(*p->ui->elements, "ChapterEditor::Elements") .setDefaultSizes({ { Q("editionChapter"), 200 }, { Q("start"), 130 }, { Q("end"), 130 } });
|
||||
@ -174,7 +166,6 @@ Tab::setupUi() {
|
||||
p->massModificationAction->setIcon(QIcon{Q(":/icons/16x16/tools-wizard.png")});
|
||||
p->copyToOtherTabMenu->setIcon(QIcon{Q(":/icons/16x16/edit-copy.png")});
|
||||
|
||||
auto mw = MainWindow::get();
|
||||
auto tool = MainWindow::chapterEditorTool();
|
||||
connect(p->ui->elements, &Util::BasicTreeView::customContextMenuRequested, this, &Tab::showChapterContextMenu);
|
||||
connect(p->ui->elements, &Util::BasicTreeView::deletePressed, this, &Tab::removeElement);
|
||||
@ -184,12 +175,10 @@ Tab::setupUi() {
|
||||
connect(p->ui->tvChNames->selectionModel(), &QItemSelectionModel::selectionChanged, this, &Tab::nameSelectionChanged);
|
||||
connect(p->ui->leChName, &QLineEdit::textEdited, this, &Tab::chapterNameEdited);
|
||||
connect(p->ui->ldwChNameLanguage1, &Util::LanguageDisplayWidget::languageChanged, this, &Tab::chapterNameLanguageChanged);
|
||||
connect(p->ui->cbChNameCountry1, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &Tab::chapterNameCountryChanged);
|
||||
connect(p->ui->pbChAddName, &QPushButton::clicked, this, &Tab::addChapterName);
|
||||
connect(p->ui->pbChRemoveName, &QPushButton::clicked, this, &Tab::removeChapterName);
|
||||
connect(p->ui->pbBrowseSegmentUID, &QPushButton::clicked, this, &Tab::addSegmentUIDFromFile);
|
||||
connect(p->ui->pbChNameLanguageAdd, &QPushButton::clicked, this, &Tab::addChapterNameLanguage);
|
||||
connect(p->ui->pbChNameCountryAdd, &QPushButton::clicked, this, &Tab::addChapterNameCountry);
|
||||
|
||||
connect(p->expandAllAction, &QAction::triggered, this, &Tab::expandAll);
|
||||
connect(p->collapseAllAction, &QAction::triggered, this, &Tab::collapseAll);
|
||||
@ -204,8 +193,6 @@ Tab::setupUi() {
|
||||
connect(p->generateSubChaptersAction, &QAction::triggered, this, &Tab::generateSubChapters);
|
||||
connect(p->renumberSubChaptersAction, &QAction::triggered, this, &Tab::renumberSubChapters);
|
||||
|
||||
connect(mw, &MainWindow::preferencesChanged, p->ui->cbChNameCountry1, &Util::ComboBoxBase::reInitialize);
|
||||
|
||||
for (auto &lineEdit : findChildren<Util::BasicLineEdit *>()) {
|
||||
lineEdit->acceptDroppedFiles(false).setTextToDroppedFileName(false);
|
||||
connect(lineEdit, &Util::BasicLineEdit::returnPressed, this, &Tab::focusOtherControlInNextChapterElement);
|
||||
@ -685,8 +672,6 @@ void
|
||||
Tab::appendTheseChapters(ChaptersPtr const &chapters) {
|
||||
auto p = p_func();
|
||||
|
||||
mtx::chapters::fix_country_codes(*chapters);
|
||||
|
||||
disconnect(p->chapterModel, &QStandardItemModel::rowsInserted, this, &Tab::expandInsertedElements);
|
||||
|
||||
p->chapterModel->populate(*chapters, true);
|
||||
@ -703,8 +688,6 @@ Tab::chaptersLoaded(ChaptersPtr const &chapters,
|
||||
bool canBeWritten) {
|
||||
auto p = p_func();
|
||||
|
||||
mtx::chapters::fix_country_codes(*chapters);
|
||||
|
||||
if (!p->fileName.isEmpty())
|
||||
p->fileModificationTime = QFileInfo{p->fileName}.lastModified();
|
||||
|
||||
@ -1170,14 +1153,10 @@ Tab::setNameControlsFromStorage(QModelIndex const &idx) {
|
||||
|
||||
p.ui->leChName->setText(Q(GetChildValue<KaxChapterString>(display)));
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesAndCountriesForDisplay(*display);
|
||||
auto lists = NameModel::effectiveLanguagesForDisplay(*display);
|
||||
auto usedLanguageCodes = usedNameLanguages();
|
||||
auto usedCountryCodes = usedNameCountryCodes();
|
||||
|
||||
// qDebug() << lists.languageNames << usedCountryCodes;
|
||||
|
||||
std::sort(lists.languageCodes.begin(), lists.languageCodes.end(), [](auto const &a, auto const &b) { return a.format_long() < b.format_long(); });
|
||||
lists.countryCodes.sort();
|
||||
|
||||
for (int languageIdx = 1, numLanguages = p.languageControls.size(); languageIdx < numLanguages; ++languageIdx) {
|
||||
auto &[layout, language, button] = p.languageControls[languageIdx];
|
||||
@ -1186,29 +1165,14 @@ Tab::setNameControlsFromStorage(QModelIndex const &idx) {
|
||||
delete button;
|
||||
}
|
||||
|
||||
for (int countryIdx = 1, numCountries = p.countryControls.size(); countryIdx < numCountries; ++countryIdx) {
|
||||
auto &[layout, country, button] = p.countryControls[countryIdx];
|
||||
delete layout;
|
||||
delete country;
|
||||
delete button;
|
||||
}
|
||||
|
||||
p.languageControls.remove(1, p.languageControls.size() - 1);
|
||||
p.countryControls .remove(1, p.countryControls .size() - 1);
|
||||
|
||||
p.ui->ldwChNameLanguage1->setAdditionalLanguages(usedLanguageCodes);
|
||||
p.ui->ldwChNameLanguage1->setLanguage(lists.languageCodes.isEmpty() ? mtx::bcp47::language_c{} : lists.languageCodes[0]);
|
||||
|
||||
p.ui->cbChNameCountry1->setAdditionalItems(usedCountryCodes)
|
||||
.reInitializeIfNecessary()
|
||||
.setCurrentByData(lists.countryCodes.isEmpty() ? QString{} : lists.countryCodes[0]);
|
||||
|
||||
for (int languageIdx = 1, numLanguages = lists.languageCodes.size(); languageIdx < numLanguages; ++languageIdx)
|
||||
addOneChapterNameLanguage(lists.languageCodes[languageIdx], usedLanguageCodes);
|
||||
|
||||
for (int countryIdx = 1, numCountries = lists.countryCodes.size(); countryIdx < numCountries; ++countryIdx)
|
||||
addOneChapterNameCountry(lists.countryCodes[countryIdx], usedCountryCodes);
|
||||
|
||||
p.ignoreChapterNameChanges = false;
|
||||
|
||||
// qDebug() << "setNameControlsFromStorage end";
|
||||
@ -1290,40 +1254,6 @@ Tab::chapterNameLanguageChanged() {
|
||||
// qDebug() << "chapterNameLanguageChanged end";
|
||||
}
|
||||
|
||||
void
|
||||
Tab::chapterNameCountryChanged() {
|
||||
auto &p = *p_func();
|
||||
|
||||
// qDebug() << "chapterNameCountryChanged start";
|
||||
|
||||
if (p.ignoreChapterNameChanges) {
|
||||
// qDebug() << "chapterNameCountryChanged ignoring";
|
||||
return;
|
||||
}
|
||||
|
||||
QSet<QString> uniqueCountryCodes;
|
||||
|
||||
for (auto const &control : p.countryControls) {
|
||||
auto countryCode = static_cast<QComboBox *>(std::get<1>(control))->currentData().toString();
|
||||
if (!countryCode.isEmpty())
|
||||
uniqueCountryCodes << countryCode;
|
||||
}
|
||||
|
||||
auto countryCodes = uniqueCountryCodes.values();
|
||||
countryCodes.sort();
|
||||
|
||||
withSelectedName([&p, &countryCodes](QModelIndex const &idx, KaxChapterDisplay &display) {
|
||||
DeleteChildren<KaxChapterCountry>(display);
|
||||
|
||||
for (auto const &countryCode : countryCodes)
|
||||
AddEmptyChild<KaxChapterCountry>(display).SetValue(to_utf8(countryCode));
|
||||
|
||||
p.nameModel->updateRow(idx.row());
|
||||
});
|
||||
|
||||
// qDebug() << "chapterNameCountryChanged end";
|
||||
}
|
||||
|
||||
void
|
||||
Tab::addChapterName() {
|
||||
auto p = p_func();
|
||||
@ -1373,61 +1303,14 @@ Tab::addOneChapterNameLanguage(mtx::bcp47::language_c const &languageCode,
|
||||
p.languageControls.push_back({ layout, language, removeButton });
|
||||
|
||||
connect(language, &Util::LanguageDisplayWidget::languageChanged, this, &Tab::chapterNameLanguageChanged);
|
||||
connect(removeButton, &QPushButton::clicked, this, &Tab::removeChapterNameLanguageOrCountry);
|
||||
}
|
||||
|
||||
void
|
||||
Tab::addChapterNameCountry() {
|
||||
addOneChapterNameCountry({}, usedNameCountryCodes());
|
||||
}
|
||||
|
||||
void
|
||||
Tab::addOneChapterNameCountry(QString const &countryCode,
|
||||
QStringList const &usedCountryCodes) {
|
||||
auto &p = *p_func();
|
||||
|
||||
auto country = new mtx::gui::Util::CountryComboBox{p.ui->wChNameCountries};
|
||||
auto removeButton = new QPushButton{p.ui->wChNameCountries};
|
||||
auto layout = new QHBoxLayout;
|
||||
|
||||
country->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
country->setWithAlphaCodesOnly(true);
|
||||
country->setup(true);
|
||||
Util::fixComboBoxViewWidth(*country);
|
||||
|
||||
country->setAdditionalItems(usedCountryCodes)
|
||||
.reInitializeIfNecessary()
|
||||
.setCurrentByData(countryCode);
|
||||
|
||||
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
country->setSizePolicy(sizePolicy);
|
||||
|
||||
QIcon removeIcon;
|
||||
removeIcon.addFile(QString::fromUtf8(":/icons/16x16/list-remove.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
|
||||
removeButton->setIcon(removeIcon);
|
||||
|
||||
layout->addWidget(country);
|
||||
layout->addWidget(removeButton);
|
||||
|
||||
static_cast<QBoxLayout *>(p.ui->wChNameCountries->layout())->addLayout(layout);
|
||||
|
||||
p.countryControls.push_back({ layout, country, removeButton });
|
||||
|
||||
connect(country, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &Tab::chapterNameCountryChanged);
|
||||
connect(removeButton, &QPushButton::clicked, this, &Tab::removeChapterNameLanguageOrCountry);
|
||||
connect(MainWindow::get(), &MainWindow::preferencesChanged, country, &Util::ComboBoxBase::reInitialize);
|
||||
}
|
||||
|
||||
void
|
||||
Tab::removeChapterNameLanguageOrCountry() {
|
||||
Tab::removeChapterNameLanguage() {
|
||||
auto &p = *p_func();
|
||||
|
||||
if (removeLanguageOrCountryControlRow(p.languageControls, sender()))
|
||||
if (removeLanguageControlRow(p.languageControls, sender()))
|
||||
chapterNameLanguageChanged();
|
||||
|
||||
else if (removeLanguageOrCountryControlRow(p.countryControls, sender()))
|
||||
chapterNameCountryChanged();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1439,9 +1322,6 @@ Tab::enableNameWidgets(bool enable) {
|
||||
|
||||
for (auto const &widget : p->ui->wChNameLanguages->findChildren<QWidget *>())
|
||||
widget->setEnabled(enable);
|
||||
|
||||
for (auto const &widget : p->ui->wChNameCountries->findChildren<QWidget *>())
|
||||
widget->setEnabled(enable);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1505,8 +1385,7 @@ ChapterPtr
|
||||
Tab::createEmptyChapter(int64_t startTime,
|
||||
int chapterNumber,
|
||||
std::optional<QString> const &nameTemplate,
|
||||
mtx::bcp47::language_c const &language,
|
||||
std::optional<QString> const &country) {
|
||||
mtx::bcp47::language_c const &language) {
|
||||
auto &cfg = Util::Settings::get();
|
||||
auto chapter = std::make_shared<KaxChapterAtom>();
|
||||
auto name = formatChapterName(nameTemplate ? *nameTemplate : cfg.m_chapterNameTemplate, chapterNumber, timestamp_c::ns(startTime));
|
||||
@ -1514,11 +1393,11 @@ Tab::createEmptyChapter(int64_t startTime,
|
||||
GetChild<KaxChapterUID>(*chapter).SetValue(0);
|
||||
GetChild<KaxChapterTimeStart>(*chapter).SetValue(startTime);
|
||||
if (!name.isEmpty()) {
|
||||
auto &display = GetChild<KaxChapterDisplay>(*chapter);
|
||||
auto &display = GetChild<KaxChapterDisplay>(*chapter);
|
||||
auto actual_language = language.is_valid() ? language : cfg.m_defaultChapterLanguage;
|
||||
|
||||
GetChild<KaxChapterString>(display).SetValue(to_wide(name));
|
||||
mtx::chapters::set_languages_in_display(display, language.is_valid() ? language : cfg.m_defaultChapterLanguage);
|
||||
if ((country && !country->isEmpty()) || !cfg.m_defaultChapterCountry.isEmpty())
|
||||
GetChild<KaxChapterCountry>(display).SetValue(to_utf8((country && !country->isEmpty()) ? *country : cfg.m_defaultChapterCountry));
|
||||
mtx::chapters::set_languages_in_display(display, actual_language);
|
||||
}
|
||||
|
||||
return chapter;
|
||||
@ -1720,31 +1599,6 @@ Tab::setLanguages(QStandardItem *item,
|
||||
setLanguages(item->child(row), language);
|
||||
}
|
||||
|
||||
void
|
||||
Tab::setCountries(QStandardItem *item,
|
||||
QString const &country) {
|
||||
auto p = p_func();
|
||||
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
auto chapter = p->chapterModel->chapterFromItem(item);
|
||||
if (chapter)
|
||||
for (auto const &element : *chapter) {
|
||||
auto kDisplay = dynamic_cast<KaxChapterDisplay *>(element);
|
||||
if (!kDisplay)
|
||||
continue;
|
||||
|
||||
if (country.isEmpty())
|
||||
DeleteChildren<KaxChapterCountry>(*kDisplay);
|
||||
else
|
||||
GetChild<KaxChapterCountry>(*kDisplay).SetValue(to_utf8(country));
|
||||
}
|
||||
|
||||
for (auto row = 0, numRows = item->rowCount(); row < numRows; ++row)
|
||||
setCountries(item->child(row), country);
|
||||
}
|
||||
|
||||
void
|
||||
Tab::setEndTimestamps(QStandardItem *startItem) {
|
||||
auto p = p_func();
|
||||
@ -1831,7 +1685,7 @@ Tab::massModify() {
|
||||
auto selectedIdx = Util::selectedRowIdx(p->ui->elements);
|
||||
auto item = selectedIdx.isValid() ? p->chapterModel->itemFromIndex(selectedIdx) : p->chapterModel->invisibleRootItem();
|
||||
|
||||
MassModificationDialog dlg{this, selectedIdx.isValid(), usedNameLanguages(), usedNameCountryCodes()};
|
||||
MassModificationDialog dlg{this, selectedIdx.isValid(), usedNameLanguages()};
|
||||
if (!dlg.exec())
|
||||
return;
|
||||
|
||||
@ -1852,9 +1706,6 @@ Tab::massModify() {
|
||||
if (actions & MassModificationDialog::SetLanguage)
|
||||
setLanguages(item, dlg.language());
|
||||
|
||||
if (actions & MassModificationDialog::SetCountry)
|
||||
setCountries(item, dlg.country());
|
||||
|
||||
if (actions & MassModificationDialog::Sort)
|
||||
item->sortChildren(1);
|
||||
|
||||
@ -1931,7 +1782,7 @@ Tab::generateSubChapters() {
|
||||
maxEndTimestamp = std::max(maxEndTimestamp, std::max(FindChildValue<KaxChapterTimeStart>(*chapter, 0ull), FindChildValue<KaxChapterTimeEnd>(*chapter, 0ull)));
|
||||
}
|
||||
|
||||
GenerateSubChaptersParametersDialog dlg{this, numRows + 1, maxEndTimestamp, usedNameLanguages(), usedNameCountryCodes()};
|
||||
GenerateSubChaptersParametersDialog dlg{this, numRows + 1, maxEndTimestamp, usedNameLanguages()};
|
||||
if (!dlg.exec())
|
||||
return;
|
||||
|
||||
@ -1941,10 +1792,9 @@ Tab::generateSubChapters() {
|
||||
auto duration = dlg.durationInNs();
|
||||
auto nameTemplate = dlg.nameTemplate();
|
||||
auto language = dlg.language();
|
||||
auto country = dlg.country();
|
||||
|
||||
while (toCreate > 0) {
|
||||
auto chapter = createEmptyChapter(timestamp, chapterNumber, nameTemplate, language, country);
|
||||
auto chapter = createEmptyChapter(timestamp, chapterNumber, nameTemplate, language);
|
||||
timestamp += duration;
|
||||
|
||||
++chapterNumber;
|
||||
@ -1995,7 +1845,7 @@ Tab::changeChapterName(QModelIndex const &parentIdx,
|
||||
if (!kDisplay)
|
||||
continue;
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesAndCountriesForDisplay(*kDisplay);
|
||||
auto lists = NameModel::effectiveLanguagesForDisplay(*kDisplay);
|
||||
|
||||
if ( (RenumberSubChaptersParametersDialog::NameMatch::All == nameMatchingMode)
|
||||
|| (std::find_if(lists.languageCodes.begin(), lists.languageCodes.end(), [&languageOfNamesToReplace](auto const &actualLanguage) {
|
||||
@ -2335,7 +2185,7 @@ Tab::usedNameLanguages(QStandardItem *rootItem) {
|
||||
if (!kDisplay)
|
||||
continue;
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesAndCountriesForDisplay(*static_cast<libmatroska::KaxChapterDisplay *>(kDisplay));
|
||||
auto lists = NameModel::effectiveLanguagesForDisplay(*static_cast<libmatroska::KaxChapterDisplay *>(kDisplay));
|
||||
for (auto const &languageCodeHere : lists.languageCodes)
|
||||
languages << Q(languageCodeHere.format());
|
||||
}
|
||||
@ -2349,40 +2199,6 @@ Tab::usedNameLanguages(QStandardItem *rootItem) {
|
||||
return languages.values();
|
||||
}
|
||||
|
||||
QStringList
|
||||
Tab::usedNameCountryCodes(QStandardItem *rootItem) {
|
||||
auto p = p_func();
|
||||
|
||||
if (!rootItem)
|
||||
rootItem = p->chapterModel->invisibleRootItem();
|
||||
|
||||
auto countryCodes = QSet<QString>{};
|
||||
|
||||
std::function<void(QStandardItem *)> collector = [p, &collector, &countryCodes](auto *currentItem) {
|
||||
if (!currentItem)
|
||||
return;
|
||||
|
||||
auto chapter = p->chapterModel->chapterFromItem(currentItem);
|
||||
if (chapter)
|
||||
for (auto const &element : *chapter) {
|
||||
auto kDisplay = dynamic_cast<KaxChapterDisplay *>(element);
|
||||
if (!kDisplay)
|
||||
continue;
|
||||
|
||||
auto lists = NameModel::effectiveLanguagesAndCountriesForDisplay(*static_cast<libmatroska::KaxChapterDisplay *>(kDisplay));
|
||||
for (auto const &countryCodeHere : lists.countryCodes)
|
||||
countryCodes << countryCodeHere;
|
||||
}
|
||||
|
||||
for (int row = 0, numRows = currentItem->rowCount(); row < numRows; ++row)
|
||||
collector(currentItem->child(row));
|
||||
};
|
||||
|
||||
collector(rootItem);
|
||||
|
||||
return countryCodes.values();
|
||||
}
|
||||
|
||||
QHash<KaxChapterAtom *, ChapterAtomDataPtr>
|
||||
Tab::collectChapterAtomDataForEdition(QStandardItem *item) {
|
||||
auto p = p_func();
|
||||
|
@ -28,10 +28,6 @@ namespace mtx::bluray::mpls {
|
||||
struct chapter_t;
|
||||
}
|
||||
|
||||
namespace mtx::gui::Util {
|
||||
class CountryComboBox;
|
||||
}
|
||||
|
||||
namespace mtx::gui::ChapterEditor {
|
||||
|
||||
namespace Ui {
|
||||
@ -124,12 +120,10 @@ public Q_SLOTS:
|
||||
virtual void nameSelectionChanged(QItemSelection const &selected, QItemSelection const &deselected);
|
||||
virtual void chapterNameEdited(QString const &text);
|
||||
virtual void chapterNameLanguageChanged();
|
||||
virtual void chapterNameCountryChanged();
|
||||
virtual void addChapterName();
|
||||
virtual void addChapterNameLanguage();
|
||||
virtual void addChapterNameCountry();
|
||||
virtual void removeChapterName();
|
||||
virtual void removeChapterNameLanguageOrCountry();
|
||||
virtual void removeChapterNameLanguage();
|
||||
|
||||
virtual void showChapterContextMenu(QPoint const &pos);
|
||||
|
||||
@ -178,7 +172,7 @@ protected:
|
||||
QModelIndex addEdition(bool before);
|
||||
QModelIndex addChapter(bool before);
|
||||
|
||||
ChapterPtr createEmptyChapter(int64_t startTime, int chapterNumber, OptQString const &nameTemplate = OptQString{}, mtx::bcp47::language_c const &language = {}, OptQString const &country = OptQString{});
|
||||
ChapterPtr createEmptyChapter(int64_t startTime, int chapterNumber, std::optional<QString> const &nameTemplate = {}, mtx::bcp47::language_c const &language = {});
|
||||
|
||||
void saveAsImpl(bool requireNewFileName, std::function<bool(bool, QString &)> const &worker);
|
||||
void saveAsXmlImpl(bool requireNewFileName);
|
||||
@ -191,7 +185,6 @@ protected:
|
||||
void constrictTimestamps(QStandardItem *item, std::optional<uint64_t> const &constrictStart, std::optional<uint64_t> const &constrictEnd);
|
||||
std::pair<std::optional<uint64_t>, std::optional<uint64_t>> expandTimestamps(QStandardItem *item);
|
||||
void setLanguages(QStandardItem *item, mtx::bcp47::language_c const &language);
|
||||
void setCountries(QStandardItem *item, QString const &country);
|
||||
void setEndTimestamps(QStandardItem *startItem);
|
||||
void removeEndTimestamps(QStandardItem *startItem);
|
||||
void removeNames(QStandardItem *startItem);
|
||||
@ -205,7 +198,6 @@ protected:
|
||||
|
||||
QString currentState() const;
|
||||
QStringList usedNameLanguages(QStandardItem *parentItem = nullptr);
|
||||
QStringList usedNameCountryCodes(QStandardItem *parentItem = nullptr);
|
||||
ChaptersPtr mplsChaptersToMatroskaChapters(std::vector<mtx::bluray::mpls::chapter_t> const &mplsChapters) const;
|
||||
QHash<libmatroska::KaxChapterAtom *, ChapterAtomDataPtr> collectChapterAtomDataForEdition(QStandardItem *item);
|
||||
QString formatChapterName(QString const &nameTemplate, int chapterNumber, timestamp_c const &startTimestamp) const;
|
||||
@ -217,7 +209,6 @@ protected:
|
||||
void focusNextChapterElement(bool keepSameControl);
|
||||
|
||||
void addOneChapterNameLanguage(mtx::bcp47::language_c const &languageCode, QStringList const &usedLanguageCodes);
|
||||
void addOneChapterNameCountry(QString const &countryCode, QStringList const &usedCountryCodes);
|
||||
|
||||
static QString formatEbmlBinary(EbmlBinary *binary);
|
||||
};
|
||||
|
@ -28,7 +28,7 @@ class TabPrivate {
|
||||
|
||||
timestamp_c fileEndTimestamp;
|
||||
|
||||
QVector<std::tuple<QBoxLayout *, QWidget *, QPushButton *>> languageControls, countryControls;
|
||||
QVector<std::tuple<QBoxLayout *, QWidget *, QPushButton *>> languageControls;
|
||||
|
||||
explicit TabPrivate(Tab &tab, QString const &pFileName);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>344</height>
|
||||
<height>274</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -30,36 +30,13 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lLanguage">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&Language:</string>
|
||||
<string>Nu&mber of entries to create:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>ldwLanguage</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="sbNumberOfEntries">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbFirstChapterNumber">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
<cstring>sbNumberOfEntries</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -73,13 +50,63 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="leNameTemplate">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="sbFirstChapterNumber">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="lLanguage">
|
||||
<property name="text">
|
||||
<string>Nu&mber of entries to create:</string>
|
||||
<string>&Language:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>sbNumberOfEntries</cstring>
|
||||
<cstring>ldwLanguage</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>&Start timestamp of first created entry:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leStartTimestamp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="mtx::gui::Util::LanguageDisplayWidget" name="ldwLanguage"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="leStartTimestamp">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="sbNumberOfEntries">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -109,13 +136,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="leStartTimestamp">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
@ -126,39 +146,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="leNameTemplate">
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>&Start timestamp of first created entry:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leStartTimestamp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>C&ountry:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cbCountry</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="mtx::gui::Util::LanguageDisplayWidget" name="ldwLanguage"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="mtx::gui::Util::CountryComboBox" name="cbCountry"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -189,13 +176,9 @@
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::LanguageDisplayWidget</class>
|
||||
<extends>QForm</extends>
|
||||
<extends>QFrame</extends>
|
||||
<header>mkvtoolnix-gui/util/language_display_widget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::CountryComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>mkvtoolnix-gui/util/country_combo_box.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
@ -205,7 +188,6 @@
|
||||
<tabstop>leStartTimestamp</tabstop>
|
||||
<tabstop>leNameTemplate</tabstop>
|
||||
<tabstop>ldwLanguage</tabstop>
|
||||
<tabstop>cbCountry</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>833</width>
|
||||
<height>386</height>
|
||||
<height>394</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -39,13 +39,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="cbSetCountry">
|
||||
<property name="text">
|
||||
<string>Set the chapter names' co&untries:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="cbShift">
|
||||
<property name="text">
|
||||
@ -53,8 +46,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="mtx::gui::Util::CountryComboBox" name="cbCountry"/>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsbMultiplyBy">
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.999998999999661</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="mtx::gui::Util::LanguageDisplayWidget" name="ldwLanguage"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="cbSetLanguage">
|
||||
@ -73,9 +82,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="mtx::gui::Util::LanguageDisplayWidget" name="ldwLanguage"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="cbMultiply">
|
||||
<property name="text">
|
||||
@ -83,22 +89,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="dsbMultiplyBy">
|
||||
<property name="decimals">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.999998999999661</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -202,13 +192,9 @@
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::LanguageDisplayWidget</class>
|
||||
<extends>QForm</extends>
|
||||
<extends>QFrame</extends>
|
||||
<header>mkvtoolnix-gui/util/language_display_widget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::CountryComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>mkvtoolnix-gui/util/country_combo_box.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
@ -218,8 +204,6 @@
|
||||
<tabstop>dsbMultiplyBy</tabstop>
|
||||
<tabstop>cbSetLanguage</tabstop>
|
||||
<tabstop>ldwLanguage</tabstop>
|
||||
<tabstop>cbSetCountry</tabstop>
|
||||
<tabstop>cbCountry</tabstop>
|
||||
<tabstop>cbSort</tabstop>
|
||||
<tabstop>cbConstrictExpand</tabstop>
|
||||
<tabstop>rbConstrict</tabstop>
|
||||
|
@ -450,6 +450,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="mtx::gui::Util::BasicLineEdit" name="leChName"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lChName">
|
||||
<property name="text">
|
||||
@ -460,19 +463,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="mtx::gui::Util::BasicLineEdit" name="leChName"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lChNameLanguage">
|
||||
<property name="text">
|
||||
<string>Languages:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>ldwChNameLanguage1</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="wChNameLanguages" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
@ -516,59 +506,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lChNameCountry">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lChNameLanguage">
|
||||
<property name="text">
|
||||
<string>&Countries:</string>
|
||||
<string>Languages:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cbChNameCountry1</cstring>
|
||||
<cstring>ldwChNameLanguage1</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="wChNameCountries" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="mtx::gui::Util::CountryComboBox" name="cbChNameCountry1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbChNameCountryAdd">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../qt_resources.qrc">
|
||||
<normaloff>:/icons/16x16/list-add.png</normaloff>:/icons/16x16/list-add.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -601,11 +548,6 @@
|
||||
<extends>QLabel</extends>
|
||||
<header>mkvtoolnix-gui/util/elide_label.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::CountryComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>mkvtoolnix-gui/util/country_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::LanguageDisplayWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
@ -632,7 +574,6 @@
|
||||
<tabstop>pbChRemoveName</tabstop>
|
||||
<tabstop>leChName</tabstop>
|
||||
<tabstop>ldwChNameLanguage1</tabstop>
|
||||
<tabstop>cbChNameCountry1</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../qt_resources.qrc"/>
|
||||
|
@ -1972,16 +1972,6 @@
|
||||
<string>Defaults for new chapter entries</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Na&me template:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leCENameTemplate</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="leCENameTemplate">
|
||||
<property name="clearButtonEnabled">
|
||||
@ -1989,10 +1979,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
<string>Na&me template:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leCENameTemplate</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2006,23 +1999,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>C&ountry:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cbCEDefaultCountry</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="mtx::gui::Util::CountryComboBox" name="cbCEDefaultCountry">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2392,11 +2372,6 @@
|
||||
<extends>QComboBox</extends>
|
||||
<header>mkvtoolnix-gui/util/character_set_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::CountryComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>mkvtoolnix-gui/util/country_combo_box.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>mtx::gui::Util::BasicTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
@ -2514,7 +2489,6 @@
|
||||
<tabstop>cbCEDropLastFromBlurayPlaylist</tabstop>
|
||||
<tabstop>cbCETextFileCharacterSet</tabstop>
|
||||
<tabstop>leCENameTemplate</tabstop>
|
||||
<tabstop>cbCEDefaultCountry</tabstop>
|
||||
<tabstop>cbGuiSwitchToJobOutputAfterStarting</tabstop>
|
||||
<tabstop>cbGuiUseDefaultJobDescription</tabstop>
|
||||
<tabstop>cbGuiShowOutputOfAllJobs</tabstop>
|
||||
|
@ -130,7 +130,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,
|
||||
ui->cbCETextFileCharacterSet->setAdditionalItems(m_cfg.m_ceTextFileCharacterSet).setup(true, QY("Always ask the user")).setCurrentByData(m_cfg.m_ceTextFileCharacterSet);
|
||||
ui->leCENameTemplate->setText(m_cfg.m_chapterNameTemplate);
|
||||
ui->ldwCEDefaultLanguage->setLanguage(m_cfg.m_defaultChapterLanguage);
|
||||
ui->cbCEDefaultCountry->setWithAlphaCodesOnly(true).setAdditionalItems(m_cfg.m_defaultChapterCountry).setup(true, QY("– No selection by default –")).setCurrentByData(m_cfg.m_defaultChapterCountry);
|
||||
|
||||
// Header editor page
|
||||
setupHeaderEditorDroppedFilesPolicy();
|
||||
@ -310,7 +309,6 @@ PreferencesDialog::setupToolTips() {
|
||||
|
||||
Util::setToolTip(ui->leCENameTemplate, ChapterEditor::Tool::chapterNameTemplateToolTip());
|
||||
Util::setToolTip(ui->ldwCEDefaultLanguage, QY("This is the language that newly added chapter names get assigned automatically."));
|
||||
Util::setToolTip(ui->cbCEDefaultCountry, QY("This is the country that newly added chapter names get assigned automatically."));
|
||||
Util::setToolTip(ui->cbCEDropLastFromBlurayPlaylist,
|
||||
Q("%1 %2")
|
||||
.arg(QY("Blu-ray discs often contain a chapter entry very close to the end of the movie."))
|
||||
@ -1047,7 +1045,6 @@ PreferencesDialog::save() {
|
||||
m_cfg.m_chapterNameTemplate = ui->leCENameTemplate->text();
|
||||
m_cfg.m_ceTextFileCharacterSet = ui->cbCETextFileCharacterSet->currentData().toString();
|
||||
m_cfg.m_defaultChapterLanguage = ui->ldwCEDefaultLanguage->language();
|
||||
m_cfg.m_defaultChapterCountry = ui->cbCEDefaultCountry->currentData().toString();
|
||||
m_cfg.m_dropLastChapterFromBlurayPlaylist = ui->cbCEDropLastFromBlurayPlaylist->isChecked();
|
||||
|
||||
// Merge page:
|
||||
|
@ -7,4 +7,3 @@
|
||||
#include <matroska/KaxSemantic.h>
|
||||
|
||||
using ChaptersPtr = std::shared_ptr<libmatroska::KaxChapters>;
|
||||
using OptQString = std::optional<QString>;
|
||||
|
@ -530,7 +530,6 @@ Settings::loadDefaults(QSettings ®) {
|
||||
m_defaultSubtitleTrackLanguage = mtx::bcp47::language_c::parse(to_utf8(reg.value(s_valDefaultSubtitleTrackLanguage, Q("und")).toString()));
|
||||
m_whenToSetDefaultLanguage = static_cast<SetDefaultLanguagePolicy>(reg.value(s_valWhenToSetDefaultLanguage, static_cast<int>(SetDefaultLanguagePolicy::IfAbsentOrUndetermined)).toInt());
|
||||
m_defaultChapterLanguage = mtx::bcp47::language_c::parse(to_utf8(reg.value(s_valDefaultChapterLanguage, Q("und")).toString()));
|
||||
m_defaultChapterCountry = reg.value(s_valDefaultChapterCountry).toString();
|
||||
m_defaultSubtitleCharset = reg.value(s_valDefaultSubtitleCharset).toString();
|
||||
m_defaultAdditionalMergeOptions = reg.value(s_valDefaultAdditionalMergeOptions).toString();
|
||||
reg.endGroup(); // defaults
|
||||
@ -851,7 +850,6 @@ Settings::saveDefaults(QSettings ®)
|
||||
reg.setValue(s_valDefaultSubtitleTrackLanguage, Q(m_defaultSubtitleTrackLanguage.format()));
|
||||
reg.setValue(s_valWhenToSetDefaultLanguage, static_cast<int>(m_whenToSetDefaultLanguage));
|
||||
reg.setValue(s_valDefaultChapterLanguage, Q(m_defaultChapterLanguage.format()));
|
||||
reg.setValue(s_valDefaultChapterCountry, m_defaultChapterCountry);
|
||||
reg.setValue(s_valDefaultSubtitleCharset, m_defaultSubtitleCharset);
|
||||
reg.setValue(s_valDefaultAdditionalMergeOptions, m_defaultAdditionalMergeOptions);
|
||||
reg.endGroup(); // defaults
|
||||
|
@ -169,7 +169,7 @@ public:
|
||||
QString m_boundaryCharsForDerivingTrackLanguagesFromFileNames;
|
||||
QStringList m_recognizedTrackLanguagesInFileNames, m_mergePredefinedSplitSizes, m_mergePredefinedSplitDurations;
|
||||
QStringList m_mergePredefinedVideoTrackNames, m_mergePredefinedAudioTrackNames, m_mergePredefinedSubtitleTrackNames;
|
||||
QString m_chapterNameTemplate, m_defaultChapterCountry, m_ceTextFileCharacterSet, m_defaultSubtitleCharset, m_defaultAdditionalMergeOptions;
|
||||
QString m_chapterNameTemplate, m_ceTextFileCharacterSet, m_defaultSubtitleCharset, m_defaultAdditionalMergeOptions;
|
||||
QStringList m_oftenUsedLanguages, m_oftenUsedRegions, m_oftenUsedCharacterSets;
|
||||
bool m_oftenUsedLanguagesOnly, m_oftenUsedRegionsOnly, m_oftenUsedCharacterSetsOnly;
|
||||
bool m_useISO639_3Languages;
|
||||
|
@ -33,7 +33,6 @@ char const * const s_valColumnSizes = "columnSizes
|
||||
char const * const s_valCommandLine = "commandLine";
|
||||
char const * const s_valDefaultAdditionalMergeOptions = "defaultAdditionalMergeOptions";
|
||||
char const * const s_valDefaultAudioTrackLanguage = "defaultAudioTrackLanguage";
|
||||
char const * const s_valDefaultChapterCountry = "defaultChapterCountry";
|
||||
char const * const s_valDefaultChapterLanguage = "defaultChapterLanguage";
|
||||
char const * const s_valDefaultSubtitleCharset = "defaultSubtitleCharset";
|
||||
char const * const s_valDefaultSubtitleTrackLanguage = "defaultSubtitleTrackLanguage";
|
||||
|
Loading…
Reference in New Issue
Block a user