Correctly update project profile if user edits a custom profile

parent 44199747
......@@ -115,7 +115,7 @@ bool MltVideoProfile::isCompatible(const MltVideoProfile &point) const
return frame_rate_num * 100 / frame_rate_den == point.frame_rate_num * 100 / point.frame_rate_den;
}
const QVariantList MltVideoProfile::toList()
const QVariantList MltVideoProfile::toList() const
{
QVariantList result;
result << frame_rate_num << frame_rate_den << width << height << progressive << sample_aspect_num << sample_aspect_den <<display_aspect_num << display_aspect_den << colorspace << path << description;
......
......@@ -249,7 +249,7 @@ public:
bool operator!=(const MltVideoProfile &other) const;
/** @brief Returns true if both profiles have same fps, and can be mixed with the xml producer */
bool isCompatible(const MltVideoProfile &point) const;
const QVariantList toList();
const QVariantList toList() const;
const QString descriptiveString();
};
......
......@@ -1256,7 +1256,7 @@ void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix)
void KdenliveSettingsDialog::slotEditVideo4LinuxProfile()
{
QString vl4ProfilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
QPointer<ProfilesDialog> w = new ProfilesDialog(vl4ProfilePath);
QPointer<ProfilesDialog> w = new ProfilesDialog(vl4ProfilePath, true);
if (w->exec() == QDialog::Accepted) {
// save and update profile
loadCurrentV4lProfileInfo();
......
......@@ -32,7 +32,7 @@
#include <QStandardPaths>
#include <QDebug>
ProfilesDialog::ProfilesDialog(QWidget * parent) :
ProfilesDialog::ProfilesDialog(QString profileDescription, QWidget * parent) :
QDialog(parent),
m_profileIsModified(false),
m_isCustomProfile(false)
......@@ -62,7 +62,7 @@ ProfilesDialog::ProfilesDialog(QWidget * parent) :
m_view.button_create->setIcon(KoIconUtils::themedIcon(QStringLiteral("document-new")));
m_view.button_create->setToolTip(i18n("Create new profile"));
fillList();
fillList(profileDescription);
slotUpdateDisplay();
connect(m_view.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
connect(m_view.button_create, SIGNAL(clicked()), this, SLOT(slotCreateProfile()));
......@@ -85,7 +85,7 @@ ProfilesDialog::ProfilesDialog(QWidget * parent) :
}
ProfilesDialog::ProfilesDialog(QString profilePath, QWidget * parent) :
ProfilesDialog::ProfilesDialog(QString profilePath, bool, QWidget * parent) :
QDialog(parent),
m_profileIsModified(false),
m_isCustomProfile(true),
......
......@@ -33,9 +33,9 @@ class ProfilesDialog : public QDialog
Q_OBJECT
public:
explicit ProfilesDialog(QWidget * parent = 0);
explicit ProfilesDialog(const QString profileDescription = QString(), QWidget * parent = 0);
/** @brief Using this constructor, the dialog only allows editing one profile. */
explicit ProfilesDialog(QString profilePath, QWidget * parent = 0);
explicit ProfilesDialog(QString profilePath, bool, QWidget * parent = 0);
void fillList(const QString &selectedProfile = QString());
static QMap< QString, QString > getSettingsFromFile(const QString& path);
......
......@@ -763,6 +763,11 @@ MltVideoProfile KdenliveDoc::mltProfile() const
return m_profile;
}
bool KdenliveDoc::profileChanged(const QString &profile) const
{
return m_profile.toList() != ProfilesDialog::getVideoProfile(profile).toList();
}
ProfileInfo KdenliveDoc::getProfileInfo() const
{
ProfileInfo info;
......
......@@ -156,6 +156,8 @@ public:
/** @brief Force processing of clip id in producer queue. */
void forceProcessing(const QString &id);
void getFileProperties(const QDomElement &xml, const QString &clipId, int imageHeight, bool replaceProducer = true);
/** @brief Returns true if the profile file has changed. */
bool profileChanged(const QString &profile) const;
private:
QUrl m_url;
......
......@@ -1428,7 +1428,7 @@ void MainWindow::slotEditProjectSettings()
if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) {
slotSwitchAudioThumbs();
}
if (project->profilePath() != profile) {
if (project->profilePath() != profile || project->profileChanged(profile)) {
KdenliveSettings::setCurrent_profile(profile);
pCore->projectManager()->slotResetProfiles();
slotUpdateDocumentState(true);
......
......@@ -691,7 +691,7 @@ void ProjectSettings::loadProfiles()
void ProjectSettings::slotEditProfiles()
{
ProfilesDialog *w = new ProfilesDialog;
ProfilesDialog *w = new ProfilesDialog(profiles_list->currentText());
w->exec();
QString currentProf = profiles_list->currentData().toString();
loadProfiles();
......
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