Ensure we cannot create a project with 0 tracks

BUG: 419019
parent c4564896
......@@ -87,6 +87,16 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
m_page8->setIcon(QIcon::fromTheme(QStringLiteral("project-defaults")));
m_configProject.projecturl->setMode(KFile::Directory);
m_configProject.projecturl->setUrl(QUrl::fromLocalFile(KdenliveSettings::defaultprojectfolder()));
connect(m_configProject.kcfg_videotracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this]() {
if (m_configProject.kcfg_videotracks->value() + m_configProject.kcfg_audiotracks->value() <= 0) {
m_configProject.kcfg_videotracks->setValue(1);
}
});
connect(m_configProject.kcfg_audiotracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this] () {
if (m_configProject.kcfg_videotracks->value() + m_configProject.kcfg_audiotracks->value() <= 0) {
m_configProject.kcfg_audiotracks->setValue(1);
}
});
QWidget *p9 = new QWidget;
m_configProxy.setupUi(p9);
......
......@@ -92,6 +92,16 @@ ProjectSettings::ProjectSettings(KdenliveDoc *doc, QMap<QString, QString> metada
connect(generate_imageproxy, &QAbstractButton::toggled, proxy_imageminsize, &QWidget::setEnabled);
connect(generate_imageproxy, &QAbstractButton::toggled, image_label, &QWidget::setEnabled);
connect(generate_imageproxy, &QAbstractButton::toggled, proxy_imagesize, &QWidget::setEnabled);
connect(video_tracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this]() {
if (video_tracks->value() + audio_tracks->value() <= 0) {
video_tracks->setValue(1);
}
});
connect(audio_tracks, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this] () {
if (video_tracks->value() + audio_tracks->value() <= 0) {
audio_tracks->setValue(1);
}
});
QString currentProf;
if (doc) {
......
......@@ -32,7 +32,7 @@ TrackDialog::TrackDialog(const std::shared_ptr<TimelineItemModel> &model, int tr
setWindowTitle(deleteMode ? i18n("Delete Track") : i18n("Add Track"));
// setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
if (m_model->isAudioTrack(m_trackIndex)) {
if (m_trackIndex > -1 && m_model->isAudioTrack(m_trackIndex)) {
audio_track->setChecked(true);
before_select->setCurrentIndex(1);
}
......
......@@ -63,7 +63,7 @@ TimelineController::TimelineController(QObject *parent)
: QObject(parent)
, m_root(nullptr)
, m_usePreview(false)
, m_activeTrack(0)
, m_activeTrack(-1)
, m_audioRef(-1)
, m_zone(-1, -1)
, m_scale(QFontMetrics(QApplication::font()).maxWidth() / 250)
......
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