Commit 53133bd0 authored by Nicolas Carion's avatar Nicolas Carion
Browse files

Don't accept kdenliveSetting dialog if no profile selected

parent 6707f48a
......@@ -80,6 +80,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap<QString, QString> &map
m_configProject.profile_box->setLayout(vbox);
// Select profile
m_pw->loadProfile(KdenliveSettings::default_profile().isEmpty() ? KdenliveSettings::current_profile() : 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);
m_configProject.kcfg_proxyminsize->setEnabled(KdenliveSettings::generateproxy());
......@@ -698,10 +699,23 @@ void KdenliveSettingsDialog::updateWidgets()
#endif /* USE_JOGSHUTTLE */
}
void KdenliveSettingsDialog::accept()
{
if (m_pw->selectedProfile().isEmpty()) {
KMessageBox::error(this, i18n("Please select a video profile"));
return;
}
KConfigDialog::accept();
}
void KdenliveSettingsDialog::updateSettings()
{
// Save changes to settings (for example when user pressed "Apply" or "Ok")
// //qCDebug(KDENLIVE_LOG) << "// // // KCONFIG UPDATE called";
if (m_pw->selectedProfile().isEmpty()) {
KMessageBox::error(this, i18n("Please select a video profile"));
return;
}
KdenliveSettings::setDefault_profile(m_pw->selectedProfile());
bool resetProfile = false;
......
......@@ -46,9 +46,10 @@ public:
void checkProfile();
protected slots:
void updateSettings() Q_DECL_OVERRIDE;
void updateWidgets() Q_DECL_OVERRIDE;
bool hasChanged() Q_DECL_OVERRIDE;
void updateSettings() override;
void updateWidgets() override;
bool hasChanged() override;
void accept() override;
private slots:
void slotCheckShuttle(int state = 0);
......
......@@ -41,6 +41,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ProfileWidget::ProfileWidget(QWidget *parent) :
QWidget(parent)
{
m_originalProfile = QStringLiteral("invalid");
QVBoxLayout *lay = new QVBoxLayout;
QHBoxLayout *labelLay = new QHBoxLayout;
......@@ -180,7 +182,7 @@ void ProfileWidget::loadProfile(const QString& profile)
{
auto index = m_treeModel->findProfile(profile);
if (index.isValid()) {
m_currentProfile = m_lastValidProfile = profile;
m_originalProfile = m_currentProfile = m_lastValidProfile = profile;
trySelectProfile(profile);
}
}
......@@ -234,6 +236,9 @@ void ProfileWidget::slotChangeSelection(const QModelIndex &current, const QModel
if (!m_currentProfile.isEmpty()) {
m_lastValidProfile = m_currentProfile;
}
if (m_originalProfile != m_currentProfile) {
emit profileChanged();
}
fillDescriptionPanel(m_currentProfile);
}
......@@ -265,6 +270,7 @@ void ProfileWidget::slotFilterChanged()
if (!trySelectProfile(m_lastValidProfile)) {
//Everything fails, we don't have any profile
m_currentProfile = QString();
emit profileChanged();
fillDescriptionPanel(QString());
}
}
......
......@@ -52,6 +52,7 @@ private:
/** @brief currently selected's profile path */
QString m_currentProfile;
QString m_lastValidProfile;
QString m_originalProfile;
void slotUpdateInfoDisplay();
QCheckBox *m_enableScanning;
......@@ -86,6 +87,10 @@ private:
/** @brief Slot to be called whenever filtering changes */
void slotFilterChanged();
signals:
void profileChanged();
};
#endif
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