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

Get rid of KdenliveSettings::current_profile() and try directly reusing the core method

parent fca8319c
......@@ -51,7 +51,7 @@ MltDeviceCapture::MltDeviceCapture(QString profile, /*VideoSurface *surface, */
{
analyseAudio = KdenliveSettings::monitor_audio();
if (profile.isEmpty()) {
profile = KdenliveSettings::current_profile();
//profile = KdenliveSettings::current_profile();
}
buildConsumer(profile);
connect(this, &MltDeviceCapture::unblockPreview, this, &MltDeviceCapture::slotPreparePreview);
......
......@@ -268,14 +268,17 @@ std::unique_ptr<Mlt::Repository> &Core::getMltRepository()
std::unique_ptr<ProfileModel> &Core::getCurrentProfile() const
{
// TODO store locally the profile and not in parameters
QString profile = KdenliveSettings::current_profile();
return ProfileRepository::get()->getProfile(profile);
return ProfileRepository::get()->getProfile(m_currentProfile);
}
bool Core::setCurrentProfile(const QString &profilePath)
{
if (m_currentProfile == profilePath) {
// no change required
return true;
}
if (ProfileRepository::get()->profileExists(profilePath)) {
KdenliveSettings::setCurrent_profile(profilePath);
m_currentProfile = profilePath;
// inform render widget
m_mainWindow->updateRenderWidgetProfile();
return true;
......
......@@ -148,6 +148,8 @@ private:
ProducerQueue *m_producerQueue;
Bin *m_binWidget;
LibraryWidget *m_library;
/** @brief Current project's profile path */
QString m_currentProfile;
std::unique_ptr<MltConnection> m_mltConnection;
......
......@@ -25,6 +25,8 @@
#include "profilesdialog.h"
#include "project/dialogs/profilewidget.h"
#include "renderer.h"
#include "core.h"
#include "profiles/profilemodel.hpp"
#include "utils/KoIconUtils.h"
#ifdef USE_V4L
......@@ -80,7 +82,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString> &map
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());
m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? pCore->getCurrentProfile()->path() : KdenliveSettings::default_profile());
connect(m_pw, &ProfileWidget::profileChanged, this, &KdenliveSettingsDialog::slotDialogModified);
m_page8->setIcon(KoIconUtils::themedIcon(QStringLiteral("project-defaults")));
connect(m_configProject.kcfg_generateproxy, &QAbstractButton::toggled, m_configProject.kcfg_proxyminsize, &QWidget::setEnabled);
......@@ -1436,7 +1438,7 @@ void KdenliveSettingsDialog::slotReloadBlackMagic()
void KdenliveSettingsDialog::checkProfile()
{
m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? KdenliveSettings::current_profile() : KdenliveSettings::default_profile());
m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? pCore->getCurrentProfile()->path() : KdenliveSettings::default_profile());
}
void KdenliveSettingsDialog::slotReloadShuttleDevices()
......@@ -1465,3 +1467,4 @@ void KdenliveSettingsDialog::slotReloadShuttleDevices()
QTimer::singleShot(200, this, SLOT(slotUpdateShuttleDevice()));
#endif // USE_JOGSHUTTLE
}
......@@ -20,7 +20,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kthumb.h"
#include "core.h"
#include "kdenlivesettings.h"
#include "profiles/profilemodel.hpp"
#include <mlt++/Mlt.h>
......@@ -39,7 +41,7 @@ QPixmap KThumb::getImage(const QUrl &url, int width, int height)
// static
QPixmap KThumb::getImage(const QUrl &url, int frame, int width, int height)
{
Mlt::Profile profile(KdenliveSettings::current_profile().toUtf8().constData());
Mlt::Profile profile = pCore->getCurrentProfile()->profile();
if (height == -1) {
height = width * profile.height() / profile.width();
}
......
......@@ -683,10 +683,6 @@
<label>Default project format.</label>
<default></default>
</entry>
<entry name="current_profile" type="String">
<label>active project format.</label>
<default></default>
</entry>
<entry name="showdescriptioncolumn" type="Bool">
<label>Show descriptions in project tree view.</label>
......
......@@ -211,7 +211,8 @@ void MainWindow::init()
m_commandStack = new QUndoGroup();
// If using a custom profile, make sure the file exists or fallback to default
if (KdenliveSettings::current_profile().startsWith(QLatin1Char('/')) && !QFile::exists(KdenliveSettings::current_profile())) {
QString currentProfilePath = pCore->getCurrentProfile()->path();
if (currentProfilePath.startsWith(QLatin1Char('/')) && !QFile::exists(currentProfilePath)) {
KMessageBox::sorry(this, i18n("Cannot find your default profile, switching to ATSC 1080p 25"));
pCore->setCurrentProfile(QStringLiteral("atsc_1080p_25"));
KdenliveSettings::setDefault_profile(QStringLiteral("atsc_1080p_25"));
......
......@@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "clipcontroller.h"
#include "core.h"
#include "dialogs/profilesdialog.h"
#include "profiles/profilemodel.hpp"
#include "doc/kthumb.h"
#include "kdenlivesettings.h"
#include "project/dialogs/slideshowclip.h"
......@@ -324,7 +325,7 @@ void ProducerQueue::processFileProperties()
emit switchProfile(clipProfile, info.clipId, info.xml);
} else if (KdenliveSettings::default_profile().isEmpty()) {
// Confirm default project format
KdenliveSettings::setDefault_profile(KdenliveSettings::current_profile());
KdenliveSettings::setDefault_profile(pCore->getCurrentProfile()->path());
}
}
}
......
......@@ -31,6 +31,7 @@
#include "project/dialogs/profilewidget.h"
#include "project/dialogs/temporarydata.h"
#include "titler/titlewidget.h"
#include "profiles/profilemodel.hpp"
#include "utils/KoIconUtils.h"
#include "kdenlive_debug.h"
......@@ -89,7 +90,7 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metada
QString currentProf;
if (doc) {
currentProf = KdenliveSettings::current_profile();
currentProf = pCore->getCurrentProfile()->path();
enable_proxy->setChecked(doc->getDocumentProperty(QStringLiteral("enableproxy")).toInt() != 0);
generate_proxy->setChecked(doc->getDocumentProperty(QStringLiteral("generateproxy")).toInt() != 0);
proxy_minsize->setValue(doc->getDocumentProperty(QStringLiteral("proxyminsize")).toInt());
......@@ -424,7 +425,7 @@ void ProjectSettings::accept()
}
}
}
if (!m_savedProject && selectedProfile() != KdenliveSettings::current_profile()) {
if (!m_savedProject && selectedProfile() != pCore->getCurrentProfile()->path()) {
if (KMessageBox::warningContinueCancel(
this, i18n("Changing the profile of your project cannot be undone.\nIt is recommended to save your project before attempting this operation "
"that might cause some corruption in transitions.\n Are you sure you want to proceed?"),
......
......@@ -21,6 +21,8 @@
#include "meltjob.h"
#include "doc/kdenlivedoc.h"
#include "kdenlivesettings.h"
#include "core.h"
#include "profiles/profilemodel.hpp"
#include <klocalizedstring.h>
......@@ -98,7 +100,7 @@ void MeltJob::startJob()
setStatus(JobCrashed);
return;
}
Mlt::Profile *projectProfile = new Mlt::Profile(KdenliveSettings::current_profile().toUtf8().constData());
Mlt::Profile *projectProfile = new Mlt::Profile(pCore->getCurrentProfile()->profile());
bool producerProfile = m_extra.contains(QStringLiteral("producer_profile"));
if (producerProfile) {
m_profile = new Mlt::Profile;
......
......@@ -129,7 +129,7 @@ void ProjectManager::newFile(bool showProjectSettings, bool force)
m_fileRevert->setEnabled(false);
QString profileName = KdenliveSettings::default_profile();
if (profileName.isEmpty()) {
profileName = KdenliveSettings::current_profile();
profileName = pCore->getCurrentProfile()->path();
}
QString projectFolder;
QMap<QString, QString> documentProperties;
......@@ -525,7 +525,7 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
m_notesPlugin->clear();
KdenliveDoc *doc = new KdenliveDoc(
stale ? QUrl::fromLocalFile(stale->fileName()) : url, QString(), pCore->window()->m_commandStack,
KdenliveSettings::default_profile().isEmpty() ? KdenliveSettings::current_profile() : KdenliveSettings::default_profile(), QMap<QString, QString>(),
KdenliveSettings::default_profile().isEmpty() ? pCore->getCurrentProfile()->path() : KdenliveSettings::default_profile(), QMap<QString, QString>(),
QMap<QString, QString>(), QPoint(KdenliveSettings::videotracks(), KdenliveSettings::audiotracks()), &openBackup, pCore->window());
if (stale == nullptr) {
stale = new KAutoSaveFile(url, doc);
......
......@@ -12,10 +12,12 @@
#include "waveformgenerator.h"
// For reading out the project resolution
#include "dialogs/profilesdialog.h"
#include "kdenlivesettings.h"
#include "core.h"
#include "profiles/profilemodel.hpp"
#include "klocalizedstring.h"
#include <KSharedConfig>
#include <KConfigGroup>
#include <QPainter>
#include <QPoint>
......@@ -120,7 +122,7 @@ QImage Waveform::renderHUD(uint)
QPainter davinci(&hud);
davinci.setPen(penLight);
QMap<QString, QString> values = ProfilesDialog::getSettingsFromFile(KdenliveSettings::current_profile());
QMap<QString, QString> values = ProfilesDialog::getSettingsFromFile(pCore->getCurrentProfile()->path());
// qCDebug(KDENLIVE_LOG) << values.value("width");
const int rightX = scopeRect().width() - m_textWidth.width() + 3;
......
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