Commit 383b454c authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Some progress on ui scene cut task

parent 427c7132
Pipeline #62850 passed with stage
in 7 minutes and 45 seconds
......@@ -28,6 +28,7 @@
#include "bin/model/markerlistmodel.hpp"
#include "bin/model/markerlistmodel.hpp"
#include "core.h"
#include "ui_scenecutdialog_ui.h"
#include "doc/kdenlivedoc.h"
#include "kdenlive_debug.h"
#include "kdenlivesettings.h"
......@@ -38,6 +39,7 @@
#include <QThread>
#include <klocalizedstring.h>
#include <project/projectmanager.h>
SceneSplitTask::SceneSplitTask(const ObjectId &owner, double threshold, QObject* object)
: AbstractTask(owner, AbstractTask::ANALYSECLIPJOB, object)
......@@ -49,11 +51,23 @@ SceneSplitTask::SceneSplitTask(const ObjectId &owner, double threshold, QObject*
void SceneSplitTask::start(QObject* object, bool force)
{
bool ok;
int threshold = QInputDialog::getInt(qApp->activeWindow(), i18n("Scene Split"), i18n("Enter detection threshold"), KdenliveSettings::scenesplitthreshold(), 0, 100, 1, &ok);
if (!ok) {
QPointer<QDialog> d = new QDialog;
Ui::SceneCutDialog_UI view;
view.setupUi(d);
view.threshold->setValue(KdenliveSettings::scenesplitthreshold());
// Set up categories
static std::array<QColor, 9> markerTypes = pCore->projectManager()->getGuideModel()->markerTypes;
QPixmap pixmap(32,32);
for (uint i = 0; i < markerTypes.size(); ++i) {
pixmap.fill(markerTypes[size_t(i)]);
QIcon colorIcon(pixmap);
view.marker_type->addItem(colorIcon, i18n("Category %1", i));
}
d->setWindowTitle(i18n("Scene detection"));
if (d->exec() != QDialog::Accepted) {
return;
}
int threshold = view.threshold->value();
KdenliveSettings::setScenesplitthreshold(threshold);
std::vector<QString> binIds = pCore->bin()->selectedClipsIds(true);
for (auto & id : binIds) {
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>482</width>
<height>192</height>
<width>402</width>
<height>154</height>
</rect>
</property>
<property name="windowTitle">
......@@ -96,18 +96,11 @@
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="KComboBox" name="marker_type"/>
<item row="4" column="2" colspan="2">
<widget class="QComboBox" name="marker_type"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>336</width>
<height>236</height>
<width>368</width>
<height>250</height>
</rect>
</property>
<property name="windowTitle">
......@@ -15,23 +15,53 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="add_markers">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Add clip markers</string>
<string>Change threshold</string>
</property>
<property name="checked">
<bool>true</bool>
</widget>
</item>
<item row="8" column="0" colspan="5">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<item row="2" column="0" colspan="5">
<widget class="QCheckBox" name="cut_scenes">
<property name="text">
<string>Cut scenes</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="1" column="2" colspan="3">
<widget class="QComboBox" name="marker_type">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QSlider" name="horizontalSlider">
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>30</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -44,41 +74,38 @@
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="zone_only">
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="add_markers">
<property name="text">
<string>Analyze only selected zone</string>
<string>Add clip markers</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="KComboBox" name="marker_type"/>
</item>
<item row="6" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Minimum scene length</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="store_data">
<item row="4" column="0" colspan="5">
<widget class="QCheckBox" name="zone_only">
<property name="text">
<string>Save result in clip metadata</string>
<string>Analyze only selected zone</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<item row="3" column="0" colspan="5">
<widget class="QCheckBox" name="store_data">
<property name="text">
<string>Minimum scene length</string>
<string>Save result in clip metadata</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<item row="6" column="2">
<widget class="QSpinBox" name="minDuration">
<property name="suffix">
<string> frames</string>
......@@ -88,15 +115,11 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="threshold"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
......@@ -131,5 +154,37 @@
</hint>
</hints>
</connection>
<connection>
<sender>horizontalSlider</sender>
<signal>valueChanged(int)</signal>
<receiver>threshold</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>208</x>
<y>21</y>
</hint>
<hint type="destinationlabel">
<x>327</x>
<y>21</y>
</hint>
</hints>
</connection>
<connection>
<sender>threshold</sender>
<signal>valueChanged(int)</signal>
<receiver>horizontalSlider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>327</x>
<y>21</y>
</hint>
<hint type="destinationlabel">
<x>208</x>
<y>21</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Markdown is supported
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