Commit 025e6c79 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Profile widget: make UI more compact, remember filter status if default...

Profile widget: make UI more compact, remember filter status if default profile matches, ensure selected profile is visible
CCBUG: 377853
parent 6b3810f2
......@@ -78,6 +78,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString> &map
m_pw = new ProfileWidget(this);
vbox->addWidget(m_pw);
m_configProject.profile_box->setLayout(vbox);
m_configProject.profile_box->setTitle(i18n("Select the default profile (preset)"));
// Select profile
m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? KdenliveSettings::current_profile() : KdenliveSettings::default_profile());
connect(m_pw, &ProfileWidget::profileChanged, this, &KdenliveSettingsDialog::slotDialogModified);
......
......@@ -102,6 +102,17 @@
<label>Disable parameters when the effect is disabled.</label>
<default>true</default>
</entry>
<entry name="profile_fps_filter" type="String">
<label>Default fps filter for project profile.</label>
<default></default>
</entry>
<entry name="profile_scanning_filter" type="String">
<label>Default scanning filter for project profile.</label>
<default></default>
</entry>
</group>
<group name="project">
......
......@@ -69,7 +69,6 @@ bool ProfileFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar
}
QModelIndex row = sourceModel()->index(sourceRow, 0, sourceParent);
QString profile_path = ProfileTreeModel::getProfile(row);
if (profile_path.isEmpty()) {
return true;
}
......
......@@ -125,7 +125,6 @@ QVariant ProfileTreeModel::data(const QModelIndex &index, int role) const
return item->data(index.column());
}
//static
QString ProfileTreeModel::getProfile(const QModelIndex& index)
{
......
......@@ -31,24 +31,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QLabel>
#include <QComboBox>
#include <KLocalizedString>
#include <KMessageWidget>
#include <QTextEdit>
#include <QSplitter>
#include <KCollapsibleGroupBox>
ProfileWidget::ProfileWidget(QWidget *parent) :
QWidget(parent)
{
m_originalProfile = QStringLiteral("invalid");
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
QVBoxLayout *lay = new QVBoxLayout;
QHBoxLayout *labelLay = new QHBoxLayout;
QLabel *title = new QLabel(i18n("Select the profile (preset) of the project"),this);
labelLay->addWidget(title);
QLabel* fpsLabel = new QLabel(i18n("Fps"),this);
fpsFilt = new QComboBox(this);
fpsLabel->setBuddy(fpsFilt);
labelLay->addWidget(fpsLabel);
labelLay->addWidget(fpsFilt);
QLabel* scanningLabel = new QLabel(i18n("Scanning"),this);
scanningFilt = new QComboBox(this);
scanningLabel->setBuddy(scanningFilt);
labelLay->addWidget(scanningLabel);
labelLay->addWidget(scanningFilt);
labelLay->addStretch(1);
QToolButton *manage_profiles = new QToolButton(this);
......@@ -62,7 +66,6 @@ ProfileWidget::ProfileWidget(QWidget *parent) :
QSplitter *profileSplitter = new QSplitter;
m_treeView = new QTreeView(this);
m_treeView->setMinimumSize(QSize(400, 400));
m_treeModel = new ProfileTreeModel(this);
m_filter = new ProfileFilter(this);
m_filter->setSourceModel(m_treeModel);
......@@ -85,63 +88,55 @@ ProfileWidget::ProfileWidget(QWidget *parent) :
slotChangeSelection(current, old);
});
profileSplitter->addWidget(m_treeView);
m_treeView->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
m_descriptionPanel = new QTextEdit(this);
m_descriptionPanel->setReadOnly(true);
m_descriptionPanel->viewport()->setCursor(Qt::ArrowCursor);
m_descriptionPanel->viewport()->setBackgroundRole(QPalette::Mid);
m_descriptionPanel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
m_descriptionPanel->setFrameStyle(QFrame::NoFrame);
profileSplitter->addWidget(m_descriptionPanel);
lay->addWidget(profileSplitter);
QHBoxLayout* filtersLayout = new QHBoxLayout;
QLabel* fpsLabel = new QLabel(i18n("Fps"),this);
fpsFilt = new QComboBox(this);
fpsLabel->setBuddy(fpsFilt);
filtersLayout->addWidget(fpsLabel);
filtersLayout->addWidget(fpsFilt);
filtersLayout->addStretch();
profileSplitter->setStretchFactor(0, 2);
profileSplitter->setStretchFactor(1, 1);
auto all_fps = ProfileRepository::get()->getAllFps();
QLocale locale;
locale.setNumberOptions(QLocale::OmitGroupSeparator);
fpsFilt->addItem("Any", -1);
for (double fps : all_fps) {
fpsFilt->addItem(locale.toString(fps), fps);
}
auto updateFps = [&]() {
double current = fpsFilt->currentData().toDouble();
KdenliveSettings::setProfile_fps_filter(fpsFilt->currentText());
m_filter->setFilterFps(current > 0,
current);
slotFilterChanged();
};
connect(fpsFilt, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), updateFps);
QLabel* scanningLabel = new QLabel(i18n("Scanning"),this);
scanningFilt = new QComboBox(this);
scanningLabel->setBuddy(scanningFilt);
filtersLayout->addWidget(scanningLabel);
filtersLayout->addWidget(scanningFilt);
filtersLayout->addStretch();
int ix = fpsFilt->findText(KdenliveSettings::profile_fps_filter());
if (ix > -1) {
fpsFilt->setCurrentIndex(ix);
}
scanningFilt->addItem("Any", -1);
scanningFilt->addItem("Interlaced", 0);
scanningFilt->addItem("Progressive", 1);
auto updateScanning = [&]() {
int current = scanningFilt->currentData().toInt();
KdenliveSettings::setProfile_scanning_filter(scanningFilt->currentText());
m_filter->setFilterInterlaced(current != -1,
current == 0);
slotFilterChanged();
};
connect(scanningFilt, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), updateScanning);
lay->addLayout(filtersLayout);
ix = scanningFilt->findText(KdenliveSettings::profile_scanning_filter());
if (ix > -1) {
scanningFilt->setCurrentIndex(ix);
}
setLayout(lay);
}
......@@ -154,7 +149,11 @@ void ProfileWidget::loadProfile(const QString& profile)
auto index = m_treeModel->findProfile(profile);
if (index.isValid()) {
m_originalProfile = m_currentProfile = m_lastValidProfile = profile;
trySelectProfile(profile);
if (!trySelectProfile(profile)) {
// When loading a profile, ensure it is visible so reset filters if necessary
fpsFilt->setCurrentIndex(0);
scanningFilt->setCurrentIndex(0);
}
}
}
......@@ -181,15 +180,15 @@ void ProfileWidget::fillDescriptionPanel(const QString& profile_path)
std::unique_ptr<ProfileModel> & profile = ProfileRepository::get()->getProfile(profile_path);
description += i18n("<h5>Video Settings</h5>");
description += i18n("<p style='font-size:small'>Frame size: %1 x %2 (%3)</p>",profile->width(), profile->height(), profile->dar());
description += i18n("<p style='font-size:small'>Frame rate: %1 fps</p>",profile->fps());
description += i18n("<p style='font-size:small'>Pixel Aspect Ratio: %1</p>",profile->sar());
description += i18n("<p style='font-size:small'>Color Space: %1</p>",profile->colorspaceDescription());
description += i18n("<p style='font-size:small'>Frame size: %1 x %2 (%3:%4)<br/>",profile->width(), profile->height(), profile->display_aspect_num(), profile->display_aspect_den());
description += i18n("Frame rate: %1 fps<br/>",profile->fps());
description += i18n("Pixel Aspect Ratio: %1<br/>",profile->sar());
description += i18n("Color Space: %1<br/>",profile->colorspaceDescription());
QString interlaced = i18n("yes");
if (profile->progressive()) {
interlaced = i18n("no");
}
description += i18n("<p style='font-size:small'>Interlaced : %1</p>", interlaced);
description += i18n("Interlaced : %1</p>", interlaced);
}
m_descriptionPanel->setHtml(description);
}
......@@ -225,10 +224,12 @@ bool ProfileWidget::trySelectProfile(const QString& profile)
//expand corresponding category
auto parent = m_treeModel->parent(index);
m_treeView->expand(m_filter->mapFromSource(parent));
m_treeView->scrollTo(m_filter->mapFromSource(index), QAbstractItemView::PositionAtCenter);
return true;
} else {
return false;
}
} else {
}
return false;
}
......
......@@ -69,6 +69,7 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metada
m_pw = new ProfileWidget(this);
vbox->addWidget(m_pw);
profile_box->setLayout(vbox);
profile_box->setTitle(i18n("Select the profile (preset) of the project"));
list_search->setTreeWidget(files_list);
project_folder->setMode(KFile::Directory);
......
......@@ -6,89 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>632</height>
<width>610</width>
<height>695</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<property name="text">
<string>Open last project on startup</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_crashrecovery">
<property name="text">
<string>Crash recovery (automatic backup)</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_usekuiserver">
<property name="text">
<string>Use KDE job tracking for render jobs</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_projectloading_avformatnovalidate">
<property name="text">
<string>Do not validate the video files when loading a project (faster)</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disable_effect_parameters">
<property name="text">
<string>Disable parameters when the effect is disabled</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_automultistreams">
<property name="text">
<string>Automatically import all streams in multi stream clips</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_bypasscodeccheck">
<property name="text">
<string>Bypass codec verification</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<property name="text">
<string>Get clip metadata with exiftool</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_magicLantern">
<property name="text">
<string>Get clip metadata created by Magic Lantern</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="9" column="1">
<widget class="QComboBox" name="kcfg_tabposition">
<item>
<property name="text">
......@@ -112,20 +42,7 @@
</item>
</widget>
</item>
<item row="10" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0" colspan="3">
<item row="10" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Default Durations</string>
......@@ -184,21 +101,34 @@
</layout>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagesequence">
<item row="8" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_magicLantern">
<property name="text">
<string>Automatically import image sequences</string>
<string>Get clip metadata created by Magic Lantern</string>
</property>
</widget>
</item>
<item row="13" column="0" colspan="3">
<item row="9" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagetransparency">
<property name="text">
<string>Transparent background for imported images</string>
</property>
</widget>
</item>
<item row="14" column="1">
<item row="13" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -211,6 +141,69 @@
</property>
</spacer>
</item>
<item row="11" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_autoimagesequence">
<property name="text">
<string>Automatically import image sequences</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_automultistreams">
<property name="text">
<string>Automatically import all streams in multi stream clips</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Tab position</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_bypasscodeccheck">
<property name="text">
<string>Bypass codec verification</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_projectloading_avformatnovalidate">
<property name="text">
<string>Do not validate the video files when loading a project (faster)</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_use_exiftool">
<property name="text">
<string>Get clip metadata with exiftool</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_openlastproject">
<property name="text">
<string>Open last project on startup</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_disable_effect_parameters">
<property name="text">
<string>Disable parameters when the effect is disabled</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="kcfg_checkfirstprojectclip">
<property name="text">
<string>Check if first added clip matches project profile</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>499</width>
<height>532</height>
<width>521</width>
<height>560</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
......@@ -17,13 +17,6 @@
<property name="topMargin">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Video tracks</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
......@@ -81,16 +74,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Audio tracks</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="kcfg_videotracks"/>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="kcfg_audiotracks"/>
</item>
......@@ -108,24 +91,24 @@
</spacer>
</item>
<item row="0" column="0" colspan="5">
<widget class="QGroupBox" name="profile_box">
<property name="title">
<string>Default Profile</string>
<widget class="QGroupBox" name="profile_box"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Video tracks</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
<item row="1" column="1">
<widget class="QSpinBox" name="kcfg_videotracks"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Audio tracks</string>
</property>
</spacer>
</widget>
</item>
<item row="3" column="0" colspan="5">
<widget class="QGroupBox" name="kcfg_enableproxy">
......@@ -259,17 +242,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KUrlRequester</class>
<extends>QWidget</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>591</width>
<height>710</height>
<height>742</height>
</rect>
</property>
<property name="windowTitle">
......@@ -27,10 +27,13 @@
<string>Settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="1">
<widget class="QCheckBox" name="video_thumbs">
<property name="text">
<string>Video</string>
<item row="2" column="0" colspan="4">
<widget class="QGroupBox" name="profile_box">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
......@@ -41,6 +44,13 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="video_thumbs">
<property name="text">
<string>Video</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
......@@ -59,10 +69,10 @@
</item>
</layout>
</item>
<item row="2" column="0" colspan="4">
<widget class="QGroupBox" name="profile_box">
<property name="title">
<string>Video Profile</string>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Thumbnails:</string>
</property>
</widget>
</item>
......@@ -110,17 +120,10 @@
</property>
</widget>
</item>
<item row="4" column="0">