Commit ea4e11ee authored by Julius Künzel's avatar Julius Künzel
Browse files

Clean up code after 9aaf43a1

parent 61efb037
Pipeline #98353 passed with stage
in 8 minutes and 58 seconds
......@@ -41,18 +41,6 @@ QString AssetTreeModel::getName(const QModelIndex &index) const
return item->dataColumn(AssetTreeModel::nameCol).toString();
}
QString AssetTreeModel::getAssetId(const QModelIndex &index) const
{
if (!index.isValid()) {
return QString();
}
std::shared_ptr<TreeItem> item = getItemById(int(index.internalId()));
if (item->depth() == 1) {
return QString();
}
return item->dataColumn(AssetTreeModel::idCol).toString();
}
bool AssetTreeModel::isFavorite(const QModelIndex &index) const
{
if (!index.isValid()) {
......
......@@ -24,8 +24,6 @@ public:
/** @brief Helper function to retrieve name */
QString getName(const QModelIndex &index) const;
/** @brief Helper function to retrieve asset id */
QString getAssetId(const QModelIndex &index) const;
/** @brief Helper function to retrieve description */
QString getDescription(bool isEffect, const QModelIndex &index) const;
/** @brief Helper function to retrieve if an effect is categorized as favorite */
......
......@@ -50,11 +50,6 @@ QString AssetListWidget::getName(const QModelIndex &index) const
return m_model->getName(m_proxyModel->mapToSource(index));
}
QString AssetListWidget::getAssetId(const QModelIndex &index) const
{
return m_model->getName(m_proxyModel->mapToSource(index));
}
bool AssetListWidget::isFavorite(const QModelIndex &index) const
{
return m_model->isFavorite(m_proxyModel->mapToSource(index));
......
......@@ -31,9 +31,6 @@ public:
/** @brief Returns the name of the asset given its model index */
QString getName(const QModelIndex &index) const;
/** @brief Returns the asset id of the asset given its model index */
QString getAssetId(const QModelIndex &index) const;
/** @brief Returns true if this effect belongs to favorites */
bool isFavorite(const QModelIndex &index) const;
......
......@@ -136,18 +136,19 @@ void EffectListWidget::editCustomAsset(const QModelIndex &index)
}
void EffectListWidget::exportCustomEffect(const QModelIndex &index) {
QString id = getAssetId(index);
if (id.isEmpty()) {
QString name = getName(index);
if (name.isEmpty()) {
return;
}
QString filter = QString("%1 (*.xml);;%2 (*)").arg(i18n("Kdenlive Effect definitions"), i18n("All Files"));
QFileDialog dialog(this, i18n("Export Custom Effect"));
QString startFolder = KRecentDirs::dir(QStringLiteral(":KdenliveExportCustomEffect"));
QUrl source = QUrl::fromLocalFile(EffectsRepository::get()->getCustomPath(id));
QUrl source = QUrl::fromLocalFile(EffectsRepository::get()->getCustomPath(name));
startFolder.append(source.fileName());
QString filename = QFileDialog::getSaveFileName(this, i18n("Export Custom Effect"), startFolder, filter);
QUrl target = QUrl::fromLocalFile(filename);
if (source.isValid() && target.isValid()) {
KRecentDirs::add(QStringLiteral(":KdenliveExportCustomEffect"), target.adjusted(QUrl::RemoveFilename).toLocalFile());
KIO::FileCopyJob *copyjob = KIO::file_copy(source, target);
......
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