Commit 6eb51ae5 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

Some improvements for guide export

- Don't show YouTube message for JSON export
- Fix Layout
- Add placeholder for category name
- Fix detection of minimum chapter length for YouTube
parent 002d1fbd
Pipeline #262955 failed with stage
in 9 minutes and 2 seconds
......@@ -100,6 +100,7 @@ ExportGuidesDialog::ExportGuidesDialog(const MarkerListModel *model, const GenTi
// fill info button menu
QMap<QString, QString> infoMenu;
infoMenu.insert(QStringLiteral("{{category}}"), i18n("Category name"));
infoMenu.insert(QStringLiteral("{{index}}"), i18n("Guide number"));
infoMenu.insert(QStringLiteral("{{realtimecode}}"), i18n("Guide position in HH:MM:SS:FF"));
infoMenu.insert(QStringLiteral("{{timecode}}"), i18n("Guide position in (HH:)MM.SS"));
......@@ -158,6 +159,7 @@ void ExportGuidesDialog::updateContentByModel() const
{
const int markerIndex = categoryChooser->currentCategory();
if (format_json->isChecked()) {
messageWidget->setVisible(false);
generatedContent->setPlainText(m_markerListModel->toJson({markerIndex}));
return;
}
......@@ -183,7 +185,7 @@ void ExportGuidesDialog::updateContentByModel() const
needShowInfoMsg = true;
}
if (needCheck && (nextTime.seconds() - currentTime.seconds()) < 10) {
if (needCheck && std::abs(nextTime.seconds() - currentTime.seconds()) < 10) {
needShowInfoMsg = true;
}
......@@ -193,6 +195,7 @@ void ExportGuidesDialog::updateContentByModel() const
line.replace("{{nexttimecode}}", chapterTimeStringFromMs(nextTime.ms()));
line.replace("{{frame}}", QString::number(currentTime.frames(currentFps)));
line.replace("{{comment}}", currentMarker.comment());
line.replace("{{category}}", pCore->markerTypes[currentMarker.markerType()].displayName);
chapterTexts.append(line);
}
......
......@@ -76,8 +76,8 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
<property name="flat">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
......@@ -90,46 +90,14 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="offsetTimeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Add</string>
</property>
</item>
<item>
<property name="text">
<string>Subtract</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="TimecodeDisplay" name="offsetTimeSpinbox"/>
</item>
</layout>
</item>
<item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Format:</string>
</property>
</widget>
</item>
<item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="formatEdit"/>
......@@ -167,6 +135,38 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QComboBox" name="offsetTimeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Disabled</string>
</property>
</item>
<item>
<property name="text">
<string>Add</string>
</property>
</item>
<item>
<property name="text">
<string>Subtract</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="TimecodeDisplay" name="offsetTimeSpinbox"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......@@ -212,7 +212,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="onlyUsed">
<property name="onlyUsed" stdset="0">
<bool>true</bool>
</property>
</widget>
......@@ -225,17 +225,17 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
<extends>QWidget</extends>
<header>widgets/timecodedisplay.h</header>
</customwidget>
<customwidget>
<class>MarkerCategoryChooser</class>
<extends>QComboBox</extends>
<header>widgets/markercategorychooser.h</header>
</customwidget>
<customwidget>
<class>KMessageWidget</class>
<extends>QFrame</extends>
<header>kmessagewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>MarkerCategoryChooser</class>
<extends>QComboBox</extends>
<header>widgets/markercategorychooser.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment