Commit d21f2e46 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix startup crash on empty config file.

Fixes #1002
parent 54ca0bae
...@@ -385,9 +385,9 @@ bool Core::setCurrentProfile(const QString &profilePath) ...@@ -385,9 +385,9 @@ bool Core::setCurrentProfile(const QString &profilePath)
m_timecode.setFormat(getCurrentProfile()->fps()); m_timecode.setFormat(getCurrentProfile()->fps());
profileChanged(); profileChanged();
emit m_mainWindow->updateRenderWidgetProfile(); emit m_mainWindow->updateRenderWidgetProfile();
pCore->monitorManager()->resetProfiles(); m_monitorManager->resetProfiles();
emit pCore->monitorManager()->updatePreviewScaling(); emit m_monitorManager->updatePreviewScaling();
if (m_guiConstructed && m_mainWindow->getCurrentTimeline()->controller()->getModel()) { if (m_guiConstructed && m_mainWindow->hasTimeline() && m_mainWindow->getCurrentTimeline()->controller()->getModel()) {
m_mainWindow->getCurrentTimeline()->controller()->getModel()->updateProfile(getProjectProfile()); m_mainWindow->getCurrentTimeline()->controller()->getModel()->updateProfile(getProjectProfile());
checkProfileValidity(); checkProfileValidity();
emit m_mainWindow->getCurrentTimeline()->controller()->frameFormatChanged(); emit m_mainWindow->getCurrentTimeline()->controller()->frameFormatChanged();
......
...@@ -140,7 +140,6 @@ static QString defaultStyle(const char *fallback = nullptr) ...@@ -140,7 +140,6 @@ static QString defaultStyle(const char *fallback = nullptr)
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: KXmlGuiWindow(parent) : KXmlGuiWindow(parent)
{ {
} }
...@@ -207,7 +206,6 @@ void MainWindow::init(const QString &mltPath) ...@@ -207,7 +206,6 @@ void MainWindow::init(const QString &mltPath)
// Initialise MLT connection // Initialise MLT connection
MltConnection::construct(mltPath); MltConnection::construct(mltPath);
pCore->setCurrentProfile(defaultProfile.isEmpty() ? ProjectManager::getDefaultProjectFormat() : defaultProfile); pCore->setCurrentProfile(defaultProfile.isEmpty() ? ProjectManager::getDefaultProjectFormat() : defaultProfile);
m_commandStack = new QUndoGroup(); m_commandStack = new QUndoGroup();
...@@ -4180,6 +4178,11 @@ TimelineWidget *MainWindow::getCurrentTimeline() const ...@@ -4180,6 +4178,11 @@ TimelineWidget *MainWindow::getCurrentTimeline() const
return m_timelineTabs->getCurrentTimeline(); return m_timelineTabs->getCurrentTimeline();
} }
bool MainWindow::hasTimeline() const
{
return m_timelineTabs != nullptr;
}
void MainWindow::resetTimelineTracks() void MainWindow::resetTimelineTracks()
{ {
TimelineWidget *current = getCurrentTimeline(); TimelineWidget *current = getCurrentTimeline();
......
...@@ -132,6 +132,9 @@ public: ...@@ -132,6 +132,9 @@ public:
/** @brief Returns a pointer to the current timeline */ /** @brief Returns a pointer to the current timeline */
TimelineWidget *getCurrentTimeline() const; TimelineWidget *getCurrentTimeline() const;
/** @brief Returns true if a timeline widget is available */
bool hasTimeline() const;
/** @brief Returns true if the timeline widget is visible */ /** @brief Returns true if the timeline widget is visible */
bool timelineVisible() const; bool timelineVisible() const;
......
...@@ -315,8 +315,12 @@ void MonitorManager::slotEnd() ...@@ -315,8 +315,12 @@ void MonitorManager::slotEnd()
void MonitorManager::resetProfiles() void MonitorManager::resetProfiles()
{ {
if (m_clipMonitor) {
m_clipMonitor->resetProfile(); m_clipMonitor->resetProfile();
}
if (m_projectMonitor) {
m_projectMonitor->resetProfile(); m_projectMonitor->resetProfile();
}
} }
void MonitorManager::resetConsumers(bool fullReset) void MonitorManager::resetConsumers(bool fullReset)
......
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