Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Reintroduce url param widget

parent 50b06be5
......@@ -15,6 +15,7 @@ set(kdenlive_SRCS
#assets/view/widgets/animationwidget.cpp
assets/view/widgets/boolparamwidget.cpp
assets/view/widgets/switchparamwidget.cpp
assets/view/widgets/urlparamwidget.cpp
assets/view/widgets/doubleparamwidget.cpp
assets/view/widgets/colorwheel.cpp
assets/view/widgets/slidewidget.cpp
......
......@@ -276,6 +276,8 @@ QVariant AssetParameterModel::data(const QModelIndex &index, int role) const
return parseAttribute(QStringLiteral("decimals"), element);
case DefaultRole:
return parseAttribute(QStringLiteral("default"), element);
case FilterRole:
return parseAttribute(QStringLiteral("filter"), element);
case SuffixRole:
return element.attribute(QStringLiteral("suffix"));
case OpacityRole:
......
......@@ -86,6 +86,7 @@ public:
ListValuesRole,
ListNamesRole,
FactorRole,
FilterRole,
ScaleRole,
OpacityRole,
InRole,
......
......@@ -31,6 +31,7 @@
#include "positioneditwidget.hpp"
#include "coloreditwidget.hpp"
#include "slidewidget.hpp"
#include "urlparamwidget.hpp"
#include <QLabel>
#include <QVBoxLayout>
......@@ -105,6 +106,9 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case ParamType::Switch:
widget = new SwitchParamWidget(model, index, parent);
break;
case ParamType::Url:
widget = new UrlParamWidget(model, index, parent);
break;
case ParamType::Animated:
case ParamType::RestrictedAnim:
// widget = new AnimationWidget(model, index, range, parent);
......@@ -116,7 +120,6 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case ParamType::Curve:
case ParamType::Bezier_spline:
case ParamType::Roto_spline:
case ParamType::Url:
case ParamType::Keywords:
case ParamType::Fontfamily:
case ParamType::Filterjob:
......
/***************************************************************************
* Copyright (C) 2018 by Jean-Baptiste Mardelle *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#include "urlparamwidget.hpp"
#include "assets/model/assetparametermodel.hpp"
#include <KUrlRequester>
UrlParamWidget::UrlParamWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent)
: AbstractParamWidget(std::move(model), index, parent)
{
setupUi(this);
// setup the comment
QString name = m_model->data(m_index, AssetParameterModel::NameRole).toString();
QString comment = m_model->data(m_index, AssetParameterModel::CommentRole).toString();
labelComment->setText(comment);
setToolTip(comment);
labelComment->setHidden(true);
QString filter = m_model->data(m_index, AssetParameterModel::FilterRole).toString();
if (!filter.isEmpty()) {
urlwidget->setFilter(filter);
}
slotRefresh();
// setup the name
label->setText(m_model->data(m_index, Qt::DisplayRole).toString());
// set check state
slotRefresh();
// emit the signal of the base class when appropriate
connect(this->urlwidget, &KUrlRequester::urlSelected, [this](QUrl url) {
emit valueChanged(m_index, url.toLocalFile(), true); });
}
void UrlParamWidget::slotShowComment(bool show)
{
if (!labelComment->text().isEmpty()) {
labelComment->setVisible(show);
}
}
void UrlParamWidget::slotRefresh()
{
urlwidget->setUrl(QUrl::fromLocalFile(m_model->data(m_index, AssetParameterModel::ValueRole).toString()));
}
void UrlParamWidget::slotSetRange(QPair<int, int>)
{
}
/***************************************************************************
* Copyright (C) 2018 by Jean-Baptiste Mardelle *
* This file is part of Kdenlive. See www.kdenlive.org. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) version 3 or any later version accepted by the *
* membership of KDE e.V. (or its successor approved by the membership *
* of KDE e.V.), which shall act as a proxy defined in Section 14 of *
* version 3 of the license. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef URLPARAMWIDGET_H
#define URLPARAMWIDGET_H
#include "abstractparamwidget.hpp"
#include "ui_urlval_ui.h"
#include <QWidget>
/** @brief This class represents a parameter that requires
the user to choose tick a checkbox
*/
class UrlParamWidget : public AbstractParamWidget, public Ui::Urlval_UI
{
Q_OBJECT
public:
/** @brief Constructor for the widgetComment
@param name String containing the name of the parameter
@param comment Optional string containing the comment associated to the parameter
@param checked Boolean indicating wether the checkbox should initially be checked
@param parent Parent widget
*/
UrlParamWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent);
public slots:
/** @brief Toggle the comments on or off
*/
void slotShowComment(bool show) override;
/** @brief refresh the properties to reflect changes in the model
*/
void slotRefresh() override;
/** @brief update the clip's in/out point
*/
void slotSetRange(QPair<int, int>) override;
};
#endif
......@@ -7,87 +7,82 @@
<x>0</x>
<y>0</y>
<width>159</width>
<height>23</height>
<height>60</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="KUrlRequester" name="urlwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="widgetComment" native="true">
<layout class="QGridLayout" name="_2">
<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>15</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="labelComment">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<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">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</item>
<item>
<widget class="KUrlRequester" name="urlwidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelComment">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>-1</number>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
......
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