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

Commit 844edbd5 authored by Nicolas Carion's avatar Nicolas Carion

Remove deprecated ProfilesDialog::getSettingsFromFile

parent 67f4a1f0
......@@ -19,6 +19,7 @@
#include "profilesdialog.h"
#include "kdenlivesettings.h"
#include "profiles/profilemodel.hpp"
#include "profiles/profilerepository.hpp"
#include "utils/KoIconUtils.h"
......@@ -468,23 +469,7 @@ QList<MltVideoProfile> ProfilesDialog::profilesList()
return list;
}
// static
QMap<QString, QString> ProfilesDialog::getSettingsFromFile(const QString &path)
{
QStringList profilesNames;
QStringList profilesFiles;
QStringList profilesFilter;
profilesFilter << QStringLiteral("*");
QDir mltDir(KdenliveSettings::mltpath());
if (!path.contains(QLatin1Char('/'))) {
// This is an MLT profile
KConfig confFile(mltDir.absoluteFilePath(path), KConfig::SimpleConfig);
return confFile.entryMap();
}
// This is a custom profile
KConfig confFile(path, KConfig::SimpleConfig);
return confFile.entryMap();
}
// static
bool ProfilesDialog::matchProfile(int width, int height, double fps, double par, bool isImage, const MltVideoProfile &profile)
......@@ -617,26 +602,26 @@ void ProfilesDialog::slotUpdateDisplay(QString currentProfile)
m_view.button_delete->setEnabled(m_isCustomProfile);
m_view.properties->setEnabled(m_isCustomProfile);
m_view.button_save->setEnabled(m_isCustomProfile);
QMap<QString, QString> values = ProfilesDialog::getSettingsFromFile(currentProfile);
m_view.description->setText(values.value(QStringLiteral("description")));
m_view.size_w->setValue(values.value(QStringLiteral("width")).toInt());
m_view.size_h->setValue(values.value(QStringLiteral("height")).toInt());
m_view.aspect_num->setValue(values.value(QStringLiteral("sample_aspect_num")).toInt());
m_view.aspect_den->setValue(values.value(QStringLiteral("sample_aspect_den")).toInt());
m_view.display_num->setValue(values.value(QStringLiteral("display_aspect_num")).toInt());
m_view.display_den->setValue(values.value(QStringLiteral("display_aspect_den")).toInt());
m_view.frame_num->setValue(values.value(QStringLiteral("frame_rate_num")).toInt());
m_view.frame_den->setValue(values.value(QStringLiteral("frame_rate_den")).toInt());
m_view.progressive->setChecked(values.value(QStringLiteral("progressive")).toInt() != 0);
if (values.value(QStringLiteral("progressive")).toInt() != 0) {
std::unique_ptr<ProfileModel> &curProfile = ProfileRepository::get()->getProfile(currentProfile);
m_view.description->setText(curProfile->description());
m_view.size_w->setValue(curProfile->width());
m_view.size_h->setValue(curProfile->height());
m_view.aspect_num->setValue(curProfile->sample_aspect_num());
m_view.aspect_den->setValue(curProfile->sample_aspect_den());
m_view.display_num->setValue(curProfile->display_aspect_num());
m_view.display_den->setValue(curProfile->display_aspect_den());
m_view.frame_num->setValue(curProfile->frame_rate_num());
m_view.frame_den->setValue(curProfile->frame_rate_den());
m_view.progressive->setChecked(curProfile->progressive() != 0);
if (curProfile->progressive() != 0) {
m_view.fields->setText(
locale.toString((double)values.value(QStringLiteral("frame_rate_num")).toInt() / values.value(QStringLiteral("frame_rate_den")).toInt(), 'f', 2));
locale.toString((double)curProfile->frame_rate_num() / curProfile->frame_rate_den(), 'f', 2));
} else {
m_view.fields->setText(locale.toString(
(double)2 * values.value(QStringLiteral("frame_rate_num")).toInt() / values.value(QStringLiteral("frame_rate_den")).toInt(), 'f', 2));
(double)2 * curProfile->frame_rate_num() / curProfile->frame_rate_den(), 'f', 2));
}
int colorix = m_view.colorspace->findData(values.value(QStringLiteral("colorspace")).toInt());
int colorix = m_view.colorspace->findData(curProfile->colorspace());
if (colorix > -1) {
m_view.colorspace->setCurrentIndex(colorix);
}
......
......@@ -36,7 +36,6 @@ public:
explicit ProfilesDialog(const QString &profilePath, bool, QWidget *parent = nullptr);
void fillList(const QString &selectedProfile = QString());
static QMap<QString, QString> getSettingsFromFile(const QString &path);
static MltVideoProfile getVideoProfile(const QString &name);
static MltVideoProfile getVideoProfile(Mlt::Profile &profile);
static void saveProfile(MltVideoProfile &profile, QString profilePath = QString());
......
......@@ -20,6 +20,8 @@
#include "wizard.h"
#include "kdenlivesettings.h"
#include "profilesdialog.h"
#include "profiles/profilerepository.hpp"
#include "profiles/profilemodel.hpp"
#include "utils/KoIconUtils.h"
#include "utils/thememanager.h"
#ifdef USE_V4L
......@@ -770,14 +772,14 @@ void Wizard::slotCheckStandard()
for (int i = 0; i < m_standard.profiles_list->count(); ++i) {
QListWidgetItem *item = m_standard.profiles_list->item(i);
QMap<QString, QString> values = ProfilesDialog::getSettingsFromFile(item->data(Qt::UserRole).toString());
std::unique_ptr<ProfileModel> &curProfile = ProfileRepository::get()->getProfile(item->data(Qt::UserRole).toString());
const QString infoString = ("<strong>" + i18n("Frame size:") + QStringLiteral(" </strong>%1x%2<br /><strong>") + i18n("Frame rate:") +
QStringLiteral(" </strong>%3/%4<br /><strong>") + i18n("Pixel aspect ratio:") +
QStringLiteral("</strong>%5/%6<br /><strong>") + i18n("Display aspect ratio:") + QStringLiteral(" </strong>%7/%8"))
.arg(values.value(QStringLiteral("width")), values.value(QStringLiteral("height")),
values.value(QStringLiteral("frame_rate_num")), values.value(QStringLiteral("frame_rate_den")),
values.value(QStringLiteral("sample_aspect_num")), values.value(QStringLiteral("sample_aspect_den")),
values.value(QStringLiteral("display_aspect_num")), values.value(QStringLiteral("display_aspect_den")));
.arg(QString::number(curProfile->width()), QString::number(curProfile->height()),
QString::number(curProfile->frame_rate_num()), QString::number(curProfile->frame_rate_den()),
QString::number(curProfile->sample_aspect_num()), QString::number(curProfile->sample_aspect_den()),
QString::number(curProfile->display_aspect_num()), QString::number(curProfile->display_aspect_den()));
item->setToolTip(infoString);
}
......
......@@ -12,7 +12,6 @@
#include "waveformgenerator.h"
// For reading out the project resolution
#include "core.h"
#include "dialogs/profilesdialog.h"
#include "profiles/profilemodel.hpp"
#include "klocalizedstring.h"
......@@ -122,7 +121,6 @@ QImage Waveform::renderHUD(uint)
QPainter davinci(&hud);
davinci.setPen(penLight);
QMap<QString, QString> values = ProfilesDialog::getSettingsFromFile(pCore->getCurrentProfile()->path());
// qCDebug(KDENLIVE_LOG) << values.value("width");
const int rightX = scopeRect().width() - m_textWidth.width() + 3;
......@@ -152,7 +150,7 @@ QImage Waveform::renderHUD(uint)
if (scopeRect().width() > 0) {
// Draw a vertical line and the x position of the source clip
bool ok;
const int profileWidth = values.value(QStringLiteral("width")).toInt(&ok);
const int profileWidth = pCore->getCurrentProfile()->width();
if (ok) {
const int clipX = (float)x / (scopeRect().width() - m_textWidth.width() - 1) * (profileWidth - 1);
......
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