diff --git a/dialogs/mediapropertiesdialog.h b/dialogs/mediapropertiesdialog.h index 8f24eee72..c13e2c1f6 100644 --- a/dialogs/mediapropertiesdialog.h +++ b/dialogs/mediapropertiesdialog.h @@ -31,19 +31,61 @@ #include "project/footage.h" #include "project/media.h" +/** + * @brief The MediaPropertiesDialog class + * + * A dialog for setting properties on Media. + */ class MediaPropertiesDialog : public QDialog { - Q_OBJECT + Q_OBJECT public: - MediaPropertiesDialog(QWidget *parent, Media* i); + /** + * @brief MediaPropertiesDialog Constructor + * + * @param parent + * + * QWidget parent. Usually MainWindow or Project panel. + * + * @param i + * + * Media object to set properties for. + */ + MediaPropertiesDialog(QWidget *parent, Media* i); private: - QComboBox* interlacing_box; - QLineEdit* name_box; - Media* item; - QListWidget* track_list; - QDoubleSpinBox* conform_fr; - QCheckBox* premultiply_alpha_setting; + /** + * @brief ComboBox for interlacing setting + */ + QComboBox* interlacing_box; + + /** + * @brief Media name text field + */ + QLineEdit* name_box; + + /** + * @brief Internal pointer to Media object (set in constructor) + */ + Media* item; + + /** + * @brief A list widget for listing the tracks in Media + */ + QListWidget* track_list; + + /** + * @brief Frame rate to conform to + */ + QDoubleSpinBox* conform_fr; + + /** + * @brief Setting for associated/premultiplied alpha + */ + QCheckBox* premultiply_alpha_setting; private slots: - void accept(); + /** + * @brief Overrided accept function for saving the properties back to the Media class + */ + void accept(); }; #endif // MEDIAPROPERTIESDIALOG_H diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp index 47ead1336..466a431b8 100644 --- a/dialogs/newsequencedialog.cpp +++ b/dialogs/newsequencedialog.cpp @@ -76,15 +76,15 @@ NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) : } } -NewSequenceDialog::~NewSequenceDialog() -{} - void NewSequenceDialog::set_sequence_name(const QString& s) { sequence_name_edit->setText(s); } -void NewSequenceDialog::create() { +void NewSequenceDialog::accept() { if (existing_sequence == nullptr) { + + // The dialog wasn't given an existing Sequence object, so we'll make a new one + SequencePtr s = std::make_shared(); s->name = sequence_name_edit->text(); @@ -97,7 +97,11 @@ void NewSequenceDialog::create() { ComboAction* ca = new ComboAction(); panel_project->create_sequence_internal(ca, s, true, nullptr); olive::UndoStack.push(ca); + } else { + + // The dialog was given an existing Sequence object, so we'll apply the changes to it + ComboAction* ca = new ComboAction(); double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate; @@ -121,7 +125,7 @@ void NewSequenceDialog::create() { olive::UndoStack.push(ca); } - accept(); + QDialog::accept(); } void NewSequenceDialog::preset_changed(int index) { diff --git a/dialogs/newsequencedialog.h b/dialogs/newsequencedialog.h index b71bdc099..4acd69853 100644 --- a/dialogs/newsequencedialog.h +++ b/dialogs/newsequencedialog.h @@ -30,33 +30,115 @@ #include "project/media.h" #include "timeline/sequence.h" +/** + * @brief The NewSequenceDialog class + * + * A dialog that creates a new (or edits an existing) Sequence object. + */ class NewSequenceDialog : public QDialog { Q_OBJECT - public: + /** + * @brief NewSequenceDialog constructor + * + * @param parent + * + * QWidget parent. Usually MainWindow. + * + * @param existing + * + * Set this to a Sequence object (wrapped in a Media object) to edit an existing Sequence, + * or leave as nullptr to create a new one. + */ explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr); - ~NewSequenceDialog(); + /** + * @brief Set the name for the new Sequence + * + * If creating a new Sequence, use this function before calling exec() to set what the new Sequence's + * name will be. + * + * The primary use of this is to set a unique default name (i.e. one that doesn't exist + * in the Sequence already) which is done by Project panel. This is usually "Sequence" followed by a number. + * + * @param s + * + * The name to set the new Sequence. + */ void set_sequence_name(const QString& s); private slots: - void create(); + /** + * @brief Override accept function to create/edit a Sequence + */ + virtual void accept() override; + + /** + * @brief Slot when the user changes the preset + * + * Sets all values according to the preset chosen. + * + * @param index + * + * Currently selected index of preset_combobox; + */ void preset_changed(int index); private: + /** + * @brief Internal reference to an existing Sequence (if one was provided to the constructor) + */ SequencePtr existing_sequence; + + /** + * @brief Internal reference to an existing Media wrapper (if one was provided to the constructor) + */ Media* existing_item; + /** + * @brief Internal function to create the dialog's UI + */ void setup_ui(); + /** + * @brief ComboBox to set the preset + */ QComboBox* preset_combobox; + + /** + * @brief SpinBox to set the Sequence height + */ QSpinBox* height_numeric; + + /** + * @brief SpinBox to set the Sequence width + */ QSpinBox* width_numeric; + + /** + * @brief ComboBox to set the pixel aspect ratio + */ QComboBox* par_combobox; + + /** + * @brief ComboBox to set the interlacing mode + */ QComboBox* interlacing_combobox; + + /** + * @brief ComboBox to set the frame rate + */ QComboBox* frame_rate_combobox; + + /** + * @brief ComboBox to set the audio frequence + */ QComboBox* audio_frequency_combobox; + + /** + * @brief Line edit to set the Sequence's name + */ QLineEdit* sequence_name_edit; };