sequence: move default to sequence dialog

This commit is contained in:
itsmattkc
2021-05-24 10:13:26 +10:00
parent 09dc79f9f6
commit ef31c3fb1a
4 changed files with 26 additions and 33 deletions
@@ -107,14 +107,6 @@ PreferencesGeneralTab::PreferencesGeneralTab()
default_still_length_->SetFormat(tr("%1 seconds"));
default_still_length_->SetValue(Config::Current()["DefaultStillLength"].value<rational>());
timeline_layout->addWidget(default_still_length_);
row++;
timeline_layout->addWidget(new QLabel(tr("Default Sequence Parameters:")), row, 0);
QPushButton* default_sequence_params_btn = new QPushButton(tr("Edit"));
connect(default_sequence_params_btn, &QPushButton::clicked, this, &PreferencesGeneralTab::EditDefaultSequenceSettings);
timeline_layout->addWidget(default_sequence_params_btn, row, 1);
}
{
@@ -187,17 +179,6 @@ void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
Config::Current()[QStringLiteral("AutorecoveryInterval")] = QVariant::fromValue(autorecovery_interval_->GetValue());
Config::Current()[QStringLiteral("AutorecoveryMaximum")] = QVariant::fromValue(autorecovery_maximum_->GetValue());
Core::instance()->SetAutorecoveryInterval(autorecovery_interval_->GetValue());
// Default sequence parameters
VideoParams dsvp = default_sequence_.GetVideoParams();
AudioParams dsap = default_sequence_.GetAudioParams();
Config::Current()[QStringLiteral("DefaultSequenceWidth")] = dsvp.width();
Config::Current()[QStringLiteral("DefaultSequenceHeight")] = dsvp.height();
Config::Current()[QStringLiteral("DefaultSequencePixelAspect")] = QVariant::fromValue(dsvp.pixel_aspect_ratio());
Config::Current()[QStringLiteral("DefaultSequenceFrameRate")] = QVariant::fromValue(dsvp.frame_rate().flipped());
Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = dsvp.interlacing();
Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = dsap.sample_rate();
Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(dsap.channel_layout());
}
void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
@@ -207,11 +188,4 @@ void PreferencesGeneralTab::AddLanguage(const QString &locale_name)
language_combobox_->setItemData(language_combobox_->count() - 1, locale_name);
}
void PreferencesGeneralTab::EditDefaultSequenceSettings()
{
SequenceDialog sd(&default_sequence_, SequenceDialog::kExisting, this);
sd.SetNameIsEditable(false);
sd.exec();
}
}
@@ -57,11 +57,6 @@ private:
IntegerSlider* autorecovery_maximum_;
Sequence default_sequence_;
private slots:
void EditDefaultSequenceSettings();
};
}
+22 -2
View File
@@ -25,11 +25,14 @@
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QSplitter>
#include <QVBoxLayout>
#include "config/config.h"
#include "core.h"
#include "common/channellayout.h"
#include "common/qtutils.h"
#include "common/rational.h"
#include "undo/undostack.h"
@@ -67,9 +70,10 @@ SequenceDialog::SequenceDialog(Sequence* s, Type t, QWidget* parent) :
// Set up dialog buttons
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttons->setCenterButtons(true);
QPushButton *default_btn = buttons->addButton(tr("Set As Default"), QDialogButtonBox::ActionRole);
connect(buttons, &QDialogButtonBox::accepted, this, &SequenceDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &SequenceDialog::reject);
connect(default_btn, &QPushButton::clicked, this, &SequenceDialog::SetAsDefaultClicked);
layout->addWidget(buttons);
// Set window title based on type
@@ -98,7 +102,7 @@ void SequenceDialog::SetNameIsEditable(bool e)
void SequenceDialog::accept()
{
if (name_field_->isEnabled() && name_field_->text().isEmpty()) {
QMessageBox::critical(this, tr("Error editing Sequence"), tr("Please enter a name for this Sequence."));
QtUtils::MessageBox(this, QMessageBox::Critical, tr("Error editing Sequence"), tr("Please enter a name for this Sequence."));
return;
}
@@ -136,6 +140,22 @@ void SequenceDialog::accept()
QDialog::accept();
}
void SequenceDialog::SetAsDefaultClicked()
{
if (QtUtils::MessageBox(this, QMessageBox::Question, tr("Confirm Set As Default"),
tr("Are you sure you want to set the current parameters as defaults?"),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// Maybe replace with Preset system
Config::Current()[QStringLiteral("DefaultSequenceWidth")] = parameter_tab_->GetSelectedVideoWidth();
Config::Current()[QStringLiteral("DefaultSequenceHeight")] = parameter_tab_->GetSelectedVideoHeight();
Config::Current()[QStringLiteral("DefaultSequencePixelAspect")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoPixelAspect());
Config::Current()[QStringLiteral("DefaultSequenceFrameRate")] = QVariant::fromValue(parameter_tab_->GetSelectedVideoFrameRate().flipped());
Config::Current()[QStringLiteral("DefaultSequenceInterlacing")] = parameter_tab_->GetSelectedVideoInterlacingMode();
Config::Current()[QStringLiteral("DefaultSequenceAudioFrequency")] = parameter_tab_->GetSelectedAudioSampleRate();
Config::Current()[QStringLiteral("DefaultSequenceAudioLayout")] = QVariant::fromValue(parameter_tab_->GetSelectedAudioChannelLayout());
}
}
SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
const VideoParams& video_params,
const AudioParams &audio_params,
+4
View File
@@ -129,6 +129,10 @@ private:
AudioParams old_audio_params_;
QString old_name_;
};
private slots:
void SetAsDefaultClicked();
};
}