From 6f3a826da78956118c9fd5626cb136735174a079 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 30 Jan 2019 17:36:54 +1100 Subject: [PATCH] ensured parenting of qwidgets --- dialogs/aboutdialog.cpp | 1 - dialogs/actionsearch.cpp | 2 - dialogs/debugdialog.cpp | 1 - dialogs/demonotice.cpp | 1 - dialogs/exportdialog.cpp | 20 ++--- dialogs/loaddialog.cpp | 13 ++- dialogs/mediapropertiesdialog.cpp | 29 +++--- dialogs/newsequencedialog.cpp | 19 ++-- dialogs/preferencesdialog.cpp | 48 +++++----- dialogs/replaceclipmediadialog.cpp | 66 +++++++------- dialogs/speeddialog.cpp | 27 +++--- dialogs/stabilizerdialog.cpp | 127 ++++++++++++++------------- dialogs/texteditdialog.cpp | 9 +- effects/internal/cornerpineffect.cpp | 10 +-- effects/internal/voideffect.cpp | 4 +- effects/internal/vsthost.cpp | 3 + mainwindow.cpp | 9 +- panels/effectcontrols.cpp | 27 +++--- panels/grapheditor.cpp | 53 ++++++----- panels/project.cpp | 16 ++-- panels/timeline.cpp | 84 +++++++++--------- panels/viewer.cpp | 3 +- playback/playback.cpp | 10 ++- project/effect.cpp | 7 +- project/effectfield.cpp | 2 + project/effectfield.h | 4 +- project/effectrow.cpp | 13 +-- project/effectrow.h | 1 + project/media.cpp | 2 +- ui/collapsiblewidget.cpp | 67 +++++++------- ui/embeddedfilechooser.cpp | 9 +- ui/keyframenavigator.cpp | 20 ++--- 32 files changed, 350 insertions(+), 357 deletions(-) diff --git a/dialogs/aboutdialog.cpp b/dialogs/aboutdialog.cpp index a62caee6a..3f595143c 100644 --- a/dialogs/aboutdialog.cpp +++ b/dialogs/aboutdialog.cpp @@ -12,7 +12,6 @@ AboutDialog::AboutDialog(QWidget *parent) : QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(20); - setLayout(layout); QLabel* label = new QLabel("" diff --git a/dialogs/actionsearch.cpp b/dialogs/actionsearch.cpp index 355a111e3..13c7f3c3b 100644 --- a/dialogs/actionsearch.cpp +++ b/dialogs/actionsearch.cpp @@ -37,8 +37,6 @@ ActionSearch::ActionSearch(QWidget *parent) : layout->addWidget(list_widget); connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action())); - setLayout(layout); - entry_field->setFocus(); } diff --git a/dialogs/debugdialog.cpp b/dialogs/debugdialog.cpp index daba96b91..6d2718bec 100644 --- a/dialogs/debugdialog.cpp +++ b/dialogs/debugdialog.cpp @@ -12,7 +12,6 @@ DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) { setWindowTitle(tr("Debug Log")); QVBoxLayout* layout = new QVBoxLayout(this); - setLayout(layout); textEdit = new QTextEdit(this); textEdit->setWordWrapMode(QTextOption::NoWrap); diff --git a/dialogs/demonotice.cpp b/dialogs/demonotice.cpp index adfda7792..9f3055426 100644 --- a/dialogs/demonotice.cpp +++ b/dialogs/demonotice.cpp @@ -11,7 +11,6 @@ DemoNotice::DemoNotice(QWidget *parent) : setMaximumWidth(600); QVBoxLayout* vlayout = new QVBoxLayout(this); - setLayout(vlayout); QHBoxLayout* layout = new QHBoxLayout(this); layout->setMargin(10); diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp index 3bad14add..98c4089b2 100644 --- a/dialogs/exportdialog.cpp +++ b/dialogs/exportdialog.cpp @@ -628,27 +628,27 @@ void ExportDialog::setup_ui() { QGridLayout* videoGridLayout = new QGridLayout(videoGroupbox); - videoGridLayout->addWidget(new QLabel(tr("Codec:")), 0, 0, 1, 1); + videoGridLayout->addWidget(new QLabel(tr("Codec:"), this), 0, 0, 1, 1); vcodecCombobox = new QComboBox(videoGroupbox); videoGridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1); - videoGridLayout->addWidget(new QLabel(tr("Width:")), 1, 0, 1, 1); + videoGridLayout->addWidget(new QLabel(tr("Width:"), this), 1, 0, 1, 1); widthSpinbox = new QSpinBox(videoGroupbox); widthSpinbox->setMaximum(16777216); videoGridLayout->addWidget(widthSpinbox, 1, 1, 1, 1); - videoGridLayout->addWidget(new QLabel(tr("Height:")), 2, 0, 1, 1); + videoGridLayout->addWidget(new QLabel(tr("Height:"), this), 2, 0, 1, 1); heightSpinbox = new QSpinBox(videoGroupbox); heightSpinbox->setMaximum(16777216); videoGridLayout->addWidget(heightSpinbox, 2, 1, 1, 1); - videoGridLayout->addWidget(new QLabel(tr("Frame Rate:")), 3, 0, 1, 1); + videoGridLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 3, 0, 1, 1); framerateSpinbox = new QDoubleSpinBox(videoGroupbox); framerateSpinbox->setMaximum(60); framerateSpinbox->setValue(0); videoGridLayout->addWidget(framerateSpinbox, 3, 1, 1, 1); - videoGridLayout->addWidget(new QLabel(tr("Compression Type:")), 4, 0, 1, 1); + videoGridLayout->addWidget(new QLabel(tr("Compression Type:"), this), 4, 0, 1, 1); compressionTypeCombobox = new QComboBox(videoGroupbox); videoGridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1); @@ -667,17 +667,17 @@ void ExportDialog::setup_ui() { QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox); - audioGridLayout->addWidget(new QLabel(tr("Codec:")), 0, 0, 1, 1); + audioGridLayout->addWidget(new QLabel(tr("Codec:"), this), 0, 0, 1, 1); acodecCombobox = new QComboBox(audioGroupbox); audioGridLayout->addWidget(acodecCombobox, 0, 1, 1, 1); - audioGridLayout->addWidget(new QLabel(tr("Sampling Rate:")), 1, 0, 1, 1); + audioGridLayout->addWidget(new QLabel(tr("Sampling Rate:"), this), 1, 0, 1, 1); samplingRateSpinbox = new QSpinBox(audioGroupbox); samplingRateSpinbox->setMaximum(96000); samplingRateSpinbox->setValue(0); audioGridLayout->addWidget(samplingRateSpinbox, 1, 1, 1, 1); - audioGridLayout->addWidget(new QLabel(tr("Bitrate (Kbps/CBR):")), 3, 0, 1, 1); + audioGridLayout->addWidget(new QLabel(tr("Bitrate (Kbps/CBR):"), this), 3, 0, 1, 1); audiobitrateSpinbox = new QSpinBox(audioGroupbox); audiobitrateSpinbox->setMaximum(320); audiobitrateSpinbox->setValue(256); @@ -685,7 +685,7 @@ void ExportDialog::setup_ui() { verticalLayout->addWidget(audioGroupbox); - QHBoxLayout* progressLayout = new QHBoxLayout(); + QHBoxLayout* progressLayout = new QHBoxLayout(this); progressBar = new QProgressBar(this); progressBar->setFormat("%p% (ETA: 0:00:00)"); progressBar->setEnabled(false); @@ -701,7 +701,7 @@ void ExportDialog::setup_ui() { verticalLayout->addLayout(progressLayout); - QHBoxLayout* buttonLayout = new QHBoxLayout(); + QHBoxLayout* buttonLayout = new QHBoxLayout(this); buttonLayout->addStretch(); export_button = new QPushButton(this); diff --git a/dialogs/loaddialog.cpp b/dialogs/loaddialog.cpp index a0ac2a434..4c666cd82 100644 --- a/dialogs/loaddialog.cpp +++ b/dialogs/loaddialog.cpp @@ -14,22 +14,21 @@ #include "mainwindow.h" LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) { - setWindowTitle(tr("Loading...")); + setWindowTitle(tr("Loading...")); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - QVBoxLayout* layout = new QVBoxLayout(); - setLayout(layout); + QVBoxLayout* layout = new QVBoxLayout(this); - layout->addWidget(new QLabel(tr("Loading '%1'...").arg(project_url.mid(project_url.lastIndexOf('/')+1)))); + layout->addWidget(new QLabel(tr("Loading '%1'...").arg(project_url.mid(project_url.lastIndexOf('/')+1)), this)); - bar = new QProgressBar(); + bar = new QProgressBar(this); bar->setValue(0); layout->addWidget(bar); - cancel_button = new QPushButton(tr("Cancel")); + cancel_button = new QPushButton(tr("Cancel"), this); connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(cancel())); - hboxLayout = new QHBoxLayout(); + hboxLayout = new QHBoxLayout(this); hboxLayout->addStretch(); hboxLayout->addWidget(cancel_button); hboxLayout->addStretch(); diff --git a/dialogs/mediapropertiesdialog.cpp b/dialogs/mediapropertiesdialog.cpp index bacc74cea..a2cf5fc67 100644 --- a/dialogs/mediapropertiesdialog.cpp +++ b/dialogs/mediapropertiesdialog.cpp @@ -23,17 +23,16 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : setWindowTitle(tr("\"%1\" Properties").arg(i->get_name())); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - QGridLayout* grid = new QGridLayout(); - setLayout(grid); + QGridLayout* grid = new QGridLayout(this); int row = 0; Footage* f = item->to_footage(); - grid->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2); + grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2); row++; - track_list = new QListWidget(); + track_list = new QListWidget(this); for (int i=0;ivideo_tracks.size();i++) { const FootageStream& fs = f->video_tracks.at(i); @@ -43,7 +42,8 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : QString::number(fs.video_width), QString::number(fs.video_height), QString::number(fs.video_frame_rate) - ) + ), + track_list ); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked); @@ -57,7 +57,8 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : QString::number(fs.file_index), QString::number(fs.audio_frequency), QString::number(fs.audio_channels) - ) + ), + track_list ); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked); @@ -70,8 +71,8 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : if (f->video_tracks.size() > 0) { // frame conforming if (!f->video_tracks.at(0).infinite_length) { - grid->addWidget(new QLabel(tr("Conform to Frame Rate:")), row, 0); - conform_fr = new QDoubleSpinBox(); + grid->addWidget(new QLabel(tr("Conform to Frame Rate:"), this), row, 0); + conform_fr = new QDoubleSpinBox(this); conform_fr->setMinimum(0.01); conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed); grid->addWidget(conform_fr, row, 1); @@ -80,14 +81,14 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : row++; // premultiplied alpha mode - premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied")); + premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"), this); premultiply_alpha_setting->setChecked(f->alpha_is_premultiplied); grid->addWidget(premultiply_alpha_setting, row, 0); row++; // deinterlacing mode - interlacing_box = new QComboBox(); + interlacing_box = new QComboBox(this); interlacing_box->addItem( tr("Auto (%1)").arg( get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing) @@ -102,18 +103,18 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : ? 0 : f->video_tracks.at(0).video_interlacing + 1); - grid->addWidget(new QLabel(tr("Interlacing:")), row, 0); + grid->addWidget(new QLabel(tr("Interlacing:"), this), row, 0); grid->addWidget(interlacing_box, row, 1); row++; } - name_box = new QLineEdit(item->get_name()); - grid->addWidget(new QLabel(tr("Name:")), row, 0); + name_box = new QLineEdit(item->get_name(), this); + grid->addWidget(new QLabel(tr("Name:"), this), row, 0); grid->addWidget(name_box, row, 1); row++; - QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); buttons->setCenterButtons(true); grid->addWidget(buttons, row, 0, 1, 2); diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp index 567f12a24..9eaf35367 100644 --- a/dialogs/newsequencedialog.cpp +++ b/dialogs/newsequencedialog.cpp @@ -103,8 +103,7 @@ void NewSequenceDialog::create() { accept(); } -void NewSequenceDialog::preset_changed(int index) -{ +void NewSequenceDialog::preset_changed(int index) { switch (index) { case 0: // FILM 4K width_numeric->setValue(4096); @@ -157,7 +156,7 @@ void NewSequenceDialog::setup_ui() { QHBoxLayout* preset_layout = new QHBoxLayout(widget); preset_layout->setContentsMargins(0, 0, 0, 0); - preset_layout->addWidget(new QLabel(tr("Preset:"))); + preset_layout->addWidget(new QLabel(tr("Preset:"), this)); preset_combobox = new QComboBox(widget); @@ -183,19 +182,19 @@ void NewSequenceDialog::setup_ui() { QGridLayout* videoLayout = new QGridLayout(videoGroupBox); - videoLayout->addWidget(new QLabel(tr("Width:")), 0, 0, 1, 1); + videoLayout->addWidget(new QLabel(tr("Width:"), this), 0, 0, 1, 1); width_numeric = new QSpinBox(videoGroupBox); width_numeric->setMaximum(9999); width_numeric->setValue(1920); videoLayout->addWidget(width_numeric, 0, 2, 1, 2); - videoLayout->addWidget(new QLabel(tr("Height:")), 1, 0, 1, 2); + videoLayout->addWidget(new QLabel(tr("Height:"), this), 1, 0, 1, 2); height_numeric = new QSpinBox(videoGroupBox); height_numeric->setMaximum(9999); height_numeric->setValue(1080); videoLayout->addWidget(height_numeric, 1, 2, 1, 2); - videoLayout->addWidget(new QLabel(tr("Frame Rate:")), 2, 0, 1, 1); + videoLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 2, 0, 1, 1); frame_rate_combobox = new QComboBox(videoGroupBox); frame_rate_combobox->addItem("10 FPS", 10.0); frame_rate_combobox->addItem("12.5 FPS", 12.5); @@ -211,12 +210,12 @@ void NewSequenceDialog::setup_ui() { frame_rate_combobox->setCurrentIndex(6); videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2); - videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), 4, 0, 1, 1); + videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:"), this), 4, 0, 1, 1); par_combobox = new QComboBox(videoGroupBox); par_combobox->addItem(tr("Square Pixels (1.0)")); videoLayout->addWidget(par_combobox, 4, 2, 1, 2); - videoLayout->addWidget(new QLabel(tr("Interlacing:")), 6, 0, 1, 1); + videoLayout->addWidget(new QLabel(tr("Interlacing:"), this), 6, 0, 1, 1); interlacing_combobox = new QComboBox(videoGroupBox); interlacing_combobox->addItem(tr("None (Progressive)")); // interlacing_combobox->addItem("Upper Field First"); @@ -230,7 +229,7 @@ void NewSequenceDialog::setup_ui() { QGridLayout* audioLayout = new QGridLayout(audioGroupBox); - audioLayout->addWidget(new QLabel(tr("Sample Rate: ")), 0, 0, 1, 1); + audioLayout->addWidget(new QLabel(tr("Sample Rate: "), this), 0, 0, 1, 1); audio_frequency_combobox = new QComboBox(audioGroupBox); audio_frequency_combobox->addItem("22050 Hz", 22050); @@ -250,7 +249,7 @@ void NewSequenceDialog::setup_ui() { QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget); nameLayout->setContentsMargins(0, 0, 0, 0); - nameLayout->addWidget(new QLabel("Name:")); + nameLayout->addWidget(new QLabel(tr("Name:"), this)); sequence_name_edit = new QLineEdit(nameWidget); diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp index 4415db6ab..37b54958a 100644 --- a/dialogs/preferencesdialog.cpp +++ b/dialogs/preferencesdialog.cpp @@ -71,7 +71,7 @@ void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* QAction* a = actions.at(i); if (!a->isSeparator() && a->property("keyignore").isNull()) { - QTreeWidgetItem* item = new QTreeWidgetItem(); + QTreeWidgetItem* item = new QTreeWidgetItem(parent); item->setText(0, a->text().replace("&", "")); parent->addChild(item); @@ -93,7 +93,7 @@ void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) { for (int i=0;imenu(); - QTreeWidgetItem* item = new QTreeWidgetItem(); + QTreeWidgetItem* item = new QTreeWidgetItem(keyboard_tree); item->setText(0, menu->title().replace("&", "")); keyboard_tree->addTopLevelItem(item); @@ -286,11 +286,11 @@ void PreferencesDialog::setup_ui() { QTabWidget* tabWidget = new QTabWidget(this); // General - QTabWidget* general_tab = new QTabWidget(); + QTabWidget* general_tab = new QTabWidget(this); QGridLayout* general_layout = new QGridLayout(general_tab); // General -> Custom CSS - general_layout->addWidget(new QLabel(tr("Custom CSS:")), 0, 0, 1, 1); + general_layout->addWidget(new QLabel(tr("Custom CSS:"), this), 0, 0, 1, 1); custom_css_fn = new QLineEdit(general_tab); custom_css_fn->setText(config.css_path); @@ -301,14 +301,14 @@ void PreferencesDialog::setup_ui() { general_layout->addWidget(custom_css_browse, 0, 2, 1, 1); // General -> Image Sequence Formats - general_layout->addWidget(new QLabel(tr("Image sequence formats:")), 1, 0, 1, 1); + general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), 1, 0, 1, 1); imgSeqFormatEdit = new QLineEdit(general_tab); general_layout->addWidget(imgSeqFormatEdit, 1, 1, 1, 2); // General -> Audio Recording - general_layout->addWidget(new QLabel(tr("Audio Recording:")), 2, 0, 1, 1); + general_layout->addWidget(new QLabel(tr("Audio Recording:"), this), 2, 0, 1, 1); recordingComboBox = new QComboBox(general_tab); recordingComboBox->addItem(tr("Mono")); @@ -316,7 +316,7 @@ void PreferencesDialog::setup_ui() { general_layout->addWidget(recordingComboBox, 2, 1, 1, 2); // General -> Effect Textbox Lines - general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:")), 3, 0, 1, 1); + general_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), 3, 0, 1, 1); effect_textbox_lines_field = new QSpinBox(general_tab); effect_textbox_lines_field->setMinimum(1); @@ -332,15 +332,15 @@ void PreferencesDialog::setup_ui() { tabWidget->addTab(general_tab, tr("General")); // Behavior - QWidget* behavior_tab = new QWidget(); + QWidget* behavior_tab = new QWidget(this); tabWidget->addTab(behavior_tab, tr("Behavior")); // Playback - QWidget* playback_tab = new QWidget(); + QWidget* playback_tab = new QWidget(this); QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab); // Playback -> Disable Multithreading on Images - disable_img_multithread = new QCheckBox(tr("Disable Multithreading on Images")); + disable_img_multithread = new QCheckBox(tr("Disable Multithreading on Images"), playback_tab); disable_img_multithread->setChecked(config.disable_multithreading_for_images); playback_tab_layout->addWidget(disable_img_multithread); @@ -360,20 +360,20 @@ void PreferencesDialog::setup_ui() { QGroupBox* memory_usage_group = new QGroupBox(playback_tab); memory_usage_group->setTitle(tr("Memory Usage")); QGridLayout* memory_usage_layout = new QGridLayout(memory_usage_group); - memory_usage_layout->addWidget(new QLabel(tr("Upcoming Frame Queue:")), 0, 0); - upcoming_queue_spinbox = new QDoubleSpinBox(); + memory_usage_layout->addWidget(new QLabel(tr("Upcoming Frame Queue:"), playback_tab), 0, 0); + upcoming_queue_spinbox = new QDoubleSpinBox(playback_tab); upcoming_queue_spinbox->setValue(config.upcoming_queue_size); memory_usage_layout->addWidget(upcoming_queue_spinbox, 0, 1); - upcoming_queue_type = new QComboBox(); + upcoming_queue_type = new QComboBox(playback_tab); upcoming_queue_type->addItem(tr("frames")); upcoming_queue_type->addItem(tr("seconds")); upcoming_queue_type->setCurrentIndex(config.upcoming_queue_type); memory_usage_layout->addWidget(upcoming_queue_type, 0, 2); - memory_usage_layout->addWidget(new QLabel(tr("Previous Frame Queue:")), 1, 0); - previous_queue_spinbox = new QDoubleSpinBox(); + memory_usage_layout->addWidget(new QLabel(tr("Previous Frame Queue:"), playback_tab), 1, 0); + previous_queue_spinbox = new QDoubleSpinBox(playback_tab); previous_queue_spinbox->setValue(config.previous_queue_size); memory_usage_layout->addWidget(previous_queue_spinbox, 1, 1); - previous_queue_type = new QComboBox(); + previous_queue_type = new QComboBox(playback_tab); previous_queue_type->addItem(tr("frames")); previous_queue_type->addItem(tr("seconds")); previous_queue_type->setCurrentIndex(config.previous_queue_type); @@ -382,39 +382,39 @@ void PreferencesDialog::setup_ui() { tabWidget->addTab(playback_tab, tr("Playback")); - QWidget* shortcut_tab = new QWidget(); + QWidget* shortcut_tab = new QWidget(this); QVBoxLayout* shortcut_layout = new QVBoxLayout(shortcut_tab); - QLineEdit* key_search_line = new QLineEdit(); + QLineEdit* key_search_line = new QLineEdit(shortcut_tab); key_search_line->setPlaceholderText(tr("Search for action or shortcut")); connect(key_search_line, SIGNAL(textChanged(const QString &)), this, SLOT(refine_shortcut_list(const QString &))); shortcut_layout->addWidget(key_search_line); - keyboard_tree = new QTreeWidget(); + keyboard_tree = new QTreeWidget(shortcut_tab); QTreeWidgetItem* tree_header = keyboard_tree->headerItem(); tree_header->setText(0, tr("Action")); tree_header->setText(1, tr("Shortcut")); shortcut_layout->addWidget(keyboard_tree); - QHBoxLayout* reset_shortcut_layout = new QHBoxLayout(); + QHBoxLayout* reset_shortcut_layout = new QHBoxLayout(shortcut_tab); - QPushButton* import_shortcut_button = new QPushButton(tr("Import")); + QPushButton* import_shortcut_button = new QPushButton(tr("Import"), shortcut_tab); reset_shortcut_layout->addWidget(import_shortcut_button); connect(import_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(load_shortcut_file())); - QPushButton* export_shortcut_button = new QPushButton(tr("Export")); + QPushButton* export_shortcut_button = new QPushButton(tr("Export"), shortcut_tab); reset_shortcut_layout->addWidget(export_shortcut_button); connect(export_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(save_shortcut_file())); reset_shortcut_layout->addStretch(); - QPushButton* reset_selected_shortcut_button = new QPushButton(tr("Reset Selected")); + QPushButton* reset_selected_shortcut_button = new QPushButton(tr("Reset Selected"), shortcut_tab); reset_shortcut_layout->addWidget(reset_selected_shortcut_button); connect(reset_selected_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(reset_default_shortcut())); - QPushButton* reset_all_shortcut_button = new QPushButton(tr("Reset All")); + QPushButton* reset_all_shortcut_button = new QPushButton(tr("Reset All"), shortcut_tab); reset_shortcut_layout->addWidget(reset_all_shortcut_button); connect(reset_all_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(reset_all_shortcuts())); diff --git a/dialogs/replaceclipmediadialog.cpp b/dialogs/replaceclipmediadialog.cpp index c677232f4..41a337610 100644 --- a/dialogs/replaceclipmediadialog.cpp +++ b/dialogs/replaceclipmediadialog.cpp @@ -23,31 +23,31 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media QDialog(parent), media(old_media) { - setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name())); + setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name())); resize(300, 400); - QVBoxLayout* layout = new QVBoxLayout(); + QVBoxLayout* layout = new QVBoxLayout(this); - layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"))); + layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"), this)); - tree = new QTreeView(); + tree = new QTreeView(this); layout->addWidget(tree); - use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points")); + use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points"), this); use_same_media_in_points->setChecked(true); layout->addWidget(use_same_media_in_points); - QHBoxLayout* buttons = new QHBoxLayout(); + QHBoxLayout* buttons = new QHBoxLayout(this); buttons->addStretch(); - QPushButton* replace_button = new QPushButton(tr("Replace")); + QPushButton* replace_button = new QPushButton(tr("Replace"), this); connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace())); buttons->addWidget(replace_button); - QPushButton* cancel_button = new QPushButton(tr("Cancel")); + QPushButton* cancel_button = new QPushButton(tr("Cancel"), this); connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close())); buttons->addWidget(cancel_button); @@ -55,44 +55,42 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media layout->addLayout(buttons); - setLayout(layout); - tree->setModel(&project_model); } void ReplaceClipMediaDialog::replace() { QModelIndexList selected_items = tree->selectionModel()->selectedRows(); if (selected_items.size() != 1) { - QMessageBox::critical( - this, - tr("No media selected"), - tr("Please select a media to replace with or click 'Cancel'."), - QMessageBox::Ok - ); + QMessageBox::critical( + this, + tr("No media selected"), + tr("Please select a media to replace with or click 'Cancel'."), + QMessageBox::Ok + ); } else { Media* new_item = static_cast(selected_items.at(0).internalPointer()); if (media == new_item) { - QMessageBox::critical( - this, - tr("Same media selected"), - tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."), - QMessageBox::Ok - ); + QMessageBox::critical( + this, + tr("Same media selected"), + tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."), + QMessageBox::Ok + ); } else if (new_item->get_type() == MEDIA_TYPE_FOLDER) { - QMessageBox::critical( - this, - tr("Folder selected"), - tr("You cannot replace footage with a folder."), - QMessageBox::Ok - ); + QMessageBox::critical( + this, + tr("Folder selected"), + tr("You cannot replace footage with a folder."), + QMessageBox::Ok + ); } else { if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == new_item->to_sequence()) { - QMessageBox::critical( - this, - tr("Active sequence selected"), - tr("You cannot insert a sequence into itself."), - QMessageBox::Ok - ); + QMessageBox::critical( + this, + tr("Active sequence selected"), + tr("You cannot insert a sequence into itself."), + QMessageBox::Ok + ); } else { ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand( media, diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp index b63419347..d03f6c3e9 100644 --- a/dialogs/speeddialog.cpp +++ b/dialogs/speeddialog.cpp @@ -19,43 +19,42 @@ #include "project/media.h" SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) { - setWindowTitle(tr("Speed/Duration")); + setWindowTitle(tr("Speed/Duration")); - QVBoxLayout* main_layout = new QVBoxLayout(); - setLayout(main_layout); + QVBoxLayout* main_layout = new QVBoxLayout(this); - QGridLayout* grid = new QGridLayout(); + QGridLayout* grid = new QGridLayout(this); grid->setSpacing(6); - grid->addWidget(new QLabel(tr("Speed:")), 0, 0); - percent = new LabelSlider(); + grid->addWidget(new QLabel(tr("Speed:"), this), 0, 0); + percent = new LabelSlider(this); percent->decimal_places = 2; percent->set_display_type(LABELSLIDER_PERCENT); percent->set_default_value(1); grid->addWidget(percent, 0, 1); - grid->addWidget(new QLabel(tr("Frame Rate:")), 1, 0); - frame_rate = new LabelSlider(); + grid->addWidget(new QLabel(tr("Frame Rate:"), this), 1, 0); + frame_rate = new LabelSlider(this); frame_rate->decimal_places = 3; grid->addWidget(frame_rate, 1, 1); - grid->addWidget(new QLabel(tr("Duration:")), 2, 0); - duration = new LabelSlider(); + grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0); + duration = new LabelSlider(this); duration->set_display_type(LABELSLIDER_FRAMENUMBER); duration->set_frame_rate(sequence->frame_rate); grid->addWidget(duration, 2, 1); main_layout->addLayout(grid); - reverse = new QCheckBox(tr("Reverse")); - maintain_pitch = new QCheckBox(tr("Maintain Audio Pitch")); - ripple = new QCheckBox(tr("Ripple Changes")); + reverse = new QCheckBox(tr("Reverse"), this); + maintain_pitch = new QCheckBox(tr("Maintain Audio Pitch"), this); + ripple = new QCheckBox(tr("Ripple Changes"), this); main_layout->addWidget(reverse); main_layout->addWidget(maintain_pitch); main_layout->addWidget(ripple); - QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); buttonBox->setCenterButtons(true); main_layout->addWidget(buttonBox); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); diff --git a/dialogs/stabilizerdialog.cpp b/dialogs/stabilizerdialog.cpp index 5e0738d80..0330fd81b 100644 --- a/dialogs/stabilizerdialog.cpp +++ b/dialogs/stabilizerdialog.cpp @@ -8,96 +8,97 @@ #include "ui/labelslider.h" +// NOTE: this is never used in Olive, hasn't been maintained, and needs to be written + StabilizerDialog::StabilizerDialog(QWidget *parent) : QDialog(parent) { - setWindowTitle("Stabilizer"); + setWindowTitle("Stabilizer"); - layout = new QVBoxLayout(this); - setLayout(layout); + layout = new QVBoxLayout(this); - enable_stab = new QCheckBox(this); - enable_stab->setText("Enable Stabilizer"); - layout->addWidget(enable_stab); + enable_stab = new QCheckBox(this); + enable_stab->setText("Enable Stabilizer"); + layout->addWidget(enable_stab); - analysis = new QGroupBox("Analysis", this); - layout->addWidget(analysis); + analysis = new QGroupBox("Analysis", this); + layout->addWidget(analysis); - analysis_layout = new QGridLayout(analysis); - analysis->setLayout(analysis_layout); + analysis_layout = new QGridLayout(analysis); + analysis->setLayout(analysis_layout); - analysis_layout->addWidget(new QLabel("Shakiness:"), 0, 0); + analysis_layout->addWidget(new QLabel("Shakiness:", this), 0, 0); - shakiness_slider = new LabelSlider(); - shakiness_slider->set_minimum_value(1); - shakiness_slider->set_default_value(5); - shakiness_slider->set_maximum_value(10); - analysis_layout->addWidget(shakiness_slider, 0, 1); + shakiness_slider = new LabelSlider(this); + shakiness_slider->set_minimum_value(1); + shakiness_slider->set_default_value(5); + shakiness_slider->set_maximum_value(10); + analysis_layout->addWidget(shakiness_slider, 0, 1); - analysis_layout->addWidget(new QLabel("Accuracy:"), 1, 0); + analysis_layout->addWidget(new QLabel("Accuracy:", this), 1, 0); - accuracy_slider = new LabelSlider(); - accuracy_slider->set_minimum_value(1); - accuracy_slider->set_default_value(15); - accuracy_slider->set_maximum_value(15); - analysis_layout->addWidget(accuracy_slider, 1, 1); + accuracy_slider = new LabelSlider(this); + accuracy_slider->set_minimum_value(1); + accuracy_slider->set_default_value(15); + accuracy_slider->set_maximum_value(15); + analysis_layout->addWidget(accuracy_slider, 1, 1); - analysis_layout->addWidget(new QLabel("Step Size:"), 2, 0); + analysis_layout->addWidget(new QLabel("Step Size:", this), 2, 0); - stepsize_slider = new LabelSlider(); - stepsize_slider->set_minimum_value(1); - stepsize_slider->set_default_value(6); - analysis_layout->addWidget(stepsize_slider, 2, 1); + stepsize_slider = new LabelSlider(this); + stepsize_slider->set_minimum_value(1); + stepsize_slider->set_default_value(6); + analysis_layout->addWidget(stepsize_slider, 2, 1); - analysis_layout->addWidget(new QLabel("Minimum Contrast:"), 3, 0); + analysis_layout->addWidget(new QLabel("Minimum Contrast:", this), 3, 0); - mincontrast_slider = new LabelSlider(); - mincontrast_slider->set_minimum_value(0); - mincontrast_slider->set_default_value(0.3); - mincontrast_slider->set_maximum_value(1); - analysis_layout->addWidget(mincontrast_slider, 3, 1); + mincontrast_slider = new LabelSlider(this); + mincontrast_slider->set_minimum_value(0); + mincontrast_slider->set_default_value(0.3); + mincontrast_slider->set_maximum_value(1); + analysis_layout->addWidget(mincontrast_slider, 3, 1); - /*analysis_layout->addWidget(new QLabel("Tripod Mode:"), 4, 0); + /*analysis_layout->addWidget(new QLabel("Tripod Mode:"), 4, 0); - tripod_mode_box = new QCheckBox(); - analysis_layout->addWidget(tripod_mode_box, 4, 1);*/ + tripod_mode_box = new QCheckBox(); + analysis_layout->addWidget(tripod_mode_box, 4, 1);*/ - stabilization = new QGroupBox("Stabilization", this); - layout->addWidget(stabilization); + stabilization = new QGroupBox("Stabilization", this); + layout->addWidget(stabilization); - stabilization_layout = new QGridLayout(); - stabilization->setLayout(stabilization_layout); + stabilization_layout = new QGridLayout(this); + stabilization->setLayout(stabilization_layout); - stabilization_layout->addWidget(new QLabel("Smoothing:"), 0, 0); + stabilization_layout->addWidget(new QLabel("Smoothing:", this), 0, 0); - smoothing_slider = new LabelSlider(); - smoothing_slider->set_minimum_value(0); - smoothing_slider->set_default_value(10); - stabilization_layout->addWidget(smoothing_slider, 0, 1); + smoothing_slider = new LabelSlider(); + smoothing_slider->set_minimum_value(0); + smoothing_slider->set_default_value(10); + stabilization_layout->addWidget(smoothing_slider, 0, 1); - stabilization_layout->addWidget(new QLabel("Gaussian Motion:"), 1, 0); + stabilization_layout->addWidget(new QLabel("Gaussian Motion:"), 1, 0); - gaussian_motion = new QCheckBox(); - gaussian_motion->setChecked(true); - stabilization_layout->addWidget(gaussian_motion, 1, 1); + gaussian_motion = new QCheckBox(); + gaussian_motion->setChecked(true); + stabilization_layout->addWidget(gaussian_motion, 1, 1); - stabilization_layout->addWidget(new QLabel("Maximum Movement:"), 2, 0); - stabilization_layout->addWidget(new QLabel("Maximum Rotation:"), 3, 0); - stabilization_layout->addWidget(new QLabel("Crop:"), 4, 0); - stabilization_layout->addWidget(new QLabel("Zoom Behavior:"), 5, 0); - stabilization_layout->addWidget(new QLabel("Zoom Speed:"), 6, 0); - stabilization_layout->addWidget(new QLabel("Interpolation Quality:"), 7, 0); + stabilization_layout->addWidget(new QLabel("Maximum Movement:"), 2, 0); + stabilization_layout->addWidget(new QLabel("Maximum Rotation:"), 3, 0); + stabilization_layout->addWidget(new QLabel("Crop:"), 4, 0); + stabilization_layout->addWidget(new QLabel("Zoom Behavior:"), 5, 0); + stabilization_layout->addWidget(new QLabel("Zoom Speed:"), 6, 0); + stabilization_layout->addWidget(new QLabel("Interpolation Quality:"), 7, 0); - buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - layout->addWidget(buttons); + buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); + layout->addWidget(buttons); - connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); - connect(enable_stab, SIGNAL(toggled(bool)), this, SLOT(set_all_enabled(bool))); + connect(enable_stab, SIGNAL(toggled(bool)), this, SLOT(set_all_enabled(bool))); - set_all_enabled(false); + set_all_enabled(false); } void StabilizerDialog::set_all_enabled(bool e) { - analysis->setEnabled(e); - stabilization->setEnabled(e); + analysis->setEnabled(e); + stabilization->setEnabled(e); } diff --git a/dialogs/texteditdialog.cpp b/dialogs/texteditdialog.cpp index 51337a637..1c71999df 100644 --- a/dialogs/texteditdialog.cpp +++ b/dialogs/texteditdialog.cpp @@ -7,16 +7,15 @@ TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) : QDialog(parent) { - setWindowTitle(tr("Edit Text")); + setWindowTitle(tr("Edit Text")); - QVBoxLayout* layout = new QVBoxLayout(); - setLayout(layout); + QVBoxLayout* layout = new QVBoxLayout(this); - textEdit = new QPlainTextEdit(); + textEdit = new QPlainTextEdit(this); textEdit->setPlainText(s); layout->addWidget(textEdit); - QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); layout->addWidget(buttons); connect(buttons, SIGNAL(accepted()), this, SLOT(save())); connect(buttons, SIGNAL(rejected()), this, SLOT(cancel())); diff --git a/effects/internal/cornerpineffect.cpp b/effects/internal/cornerpineffect.cpp index d23525e2c..883dcbdb8 100644 --- a/effects/internal/cornerpineffect.cpp +++ b/effects/internal/cornerpineffect.cpp @@ -61,11 +61,11 @@ void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, i coords.vertexBottomRightY += bottom_right_y->get_double_value(timecode); } -void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords, int iterations) { - glslProgram->setUniformValue("p0", (GLfloat) coords.vertexBottomLeftX, (GLfloat) coords.vertexBottomLeftY); - glslProgram->setUniformValue("p1", (GLfloat) coords.vertexBottomRightX, (GLfloat) coords.vertexBottomRightY); - glslProgram->setUniformValue("p2", (GLfloat) coords.vertexTopLeftX, (GLfloat) coords.vertexTopLeftY); - glslProgram->setUniformValue("p3", (GLfloat) coords.vertexTopRightX, (GLfloat) coords.vertexTopRightY); +void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords, int) { + glslProgram->setUniformValue("p0", GLfloat(coords.vertexBottomLeftX), GLfloat(coords.vertexBottomLeftY)); + glslProgram->setUniformValue("p1", GLfloat(coords.vertexBottomRightX), GLfloat(coords.vertexBottomRightY)); + glslProgram->setUniformValue("p2", GLfloat(coords.vertexTopLeftX), GLfloat(coords.vertexTopLeftY)); + glslProgram->setUniformValue("p3", GLfloat(coords.vertexTopRightX), GLfloat(coords.vertexTopRightY)); glslProgram->setUniformValue("perspective", perspective->get_bool_value(timecode)); } diff --git a/effects/internal/voideffect.cpp b/effects/internal/voideffect.cpp index e27d08844..70762cff2 100644 --- a/effects/internal/voideffect.cpp +++ b/effects/internal/voideffect.cpp @@ -11,11 +11,11 @@ VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) { name = n; QString display_name; if (n.isEmpty()) { - display_name = tr("(unknown)"); + display_name = tr("(unknown)"); } else { display_name = n; } - EffectRow* row = add_row(tr("Missing Effect"), false, false); + EffectRow* row = add_row(tr("Missing Effect"), false, false); row->add_widget(new QLabel(display_name)); container->setText(display_name); } diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index 481341b15..71a54a92e 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -240,6 +240,9 @@ VSTHost::~VSTHost() { delete [] inputs; freePlugin(); + + delete show_interface_btn; + delete dialog; } void VSTHost::process_audio(double, double, quint8* samples, int nb_bytes, int) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 881ec2cef..042c52f7a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -558,6 +558,7 @@ bool MainWindow::can_close_project() { ); m->setWindowModality(Qt::WindowModal); int r = m->exec(); + delete m; if (r == QMessageBox::Yes) { return save_project(); } else if (r == QMessageBox::Cancel) { @@ -581,7 +582,7 @@ void MainWindow::setup_menus() { file_menu->addAction(tr("&Open Project"), this, SLOT(open_project()), QKeySequence("Ctrl+O"))->setProperty("id", "openproj"); - clear_open_recent_action = new QAction(tr("Clear Recent List")); + clear_open_recent_action = new QAction(tr("Clear Recent List"), menuBar); clear_open_recent_action->setProperty("id", "clearopenrecent"); connect(clear_open_recent_action, SIGNAL(triggered()), panel_project, SLOT(clear_recent_projects())); @@ -1037,12 +1038,8 @@ void MainWindow::paintEvent(QPaintEvent *event) { #ifndef QT_DEBUG DemoNotice* d = new DemoNotice(this); d->open(); + connect(d, SIGNAL(finished()), d, SLOT(deleteLater())); #endif - /*if (windowState() != Qt::WindowFullScreen) { - // workaround for setting to maximized - on some systems, setting - // to maximized doesn't work until after the paintEvent - setWindowState(Qt::WindowMaximized); - }*/ demoNoticeShown = true; } diff --git a/panels/effectcontrols.cpp b/panels/effectcontrols.cpp index 8dd574166..935ecd63f 100644 --- a/panels/effectcontrols.cpp +++ b/panels/effectcontrols.cpp @@ -172,8 +172,7 @@ void EffectControls::show_effect_menu(int type, int subtype) { const EffectMeta& em = effects.at(i); if (em.type == type && em.subtype == subtype) { - QAction* action = new QAction(&effects_menu); - action->setText(em.name); + QAction* action = effects_menu.addAction(em.name); action->setData(reinterpret_cast(&em)); if (!em.tooltip.isEmpty()) { action->setToolTip(em.tooltip); @@ -193,9 +192,8 @@ void EffectControls::show_effect_menu(int type, int subtype) { } } if (!found) { - parent = new QMenu(&effects_menu); + parent = effects_menu.addMenu(em.category); parent->setToolTipsVisible(true); - parent->setTitle(em.category); bool found = false; for (int i=0;isetSpacing(0); @@ -293,7 +291,7 @@ void EffectControls::setup_ui() { scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); scrollArea->setWidgetResizable(true); - QWidget* scrollAreaWidgetContents = new QWidget(); + QWidget* scrollAreaWidgetContents = new QWidget(scrollArea); QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents); scrollAreaLayout->setSpacing(0); @@ -308,7 +306,7 @@ void EffectControls::setup_ui() { effects_area_layout->setMargin(0); vcontainer = new QWidget(effects_area); - QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer); + QVBoxLayout* vcontainerLayout = new QVBoxLayout(); vcontainerLayout->setSpacing(0); vcontainerLayout->setMargin(0); @@ -320,7 +318,7 @@ void EffectControls::setup_ui() { veHeaderLayout->setSpacing(0); veHeaderLayout->setMargin(0); - QPushButton* btnAddVideoEffect = new QPushButton(veHeader); + QPushButton* btnAddVideoEffect = new QPushButton(); btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png")); btnAddVideoEffect->setToolTip(tr("Add Video Effect")); veHeaderLayout->addWidget(btnAddVideoEffect); @@ -328,7 +326,7 @@ void EffectControls::setup_ui() { veHeaderLayout->addStretch(); - QLabel* lblVideoEffects = new QLabel(veHeader); + QLabel* lblVideoEffects = new QLabel(); QFont font; font.setPointSize(9); lblVideoEffects->setFont(font); @@ -338,16 +336,15 @@ void EffectControls::setup_ui() { veHeaderLayout->addStretch(); - QPushButton* btnAddVideoTransition = new QPushButton(veHeader); + QPushButton* btnAddVideoTransition = new QPushButton(); btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png")); btnAddVideoTransition->setToolTip(tr("Add Video Transition")); connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click())); - veHeaderLayout->addWidget(btnAddVideoTransition); vcontainerLayout->addWidget(veHeader); - video_effect_area = new QWidget(vcontainer); + video_effect_area = new QWidget(); QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area); veAreaLayout->setSpacing(0); veAreaLayout->setMargin(0); @@ -368,7 +365,7 @@ void EffectControls::setup_ui() { aeHeaderLayout->setSpacing(0); aeHeaderLayout->setMargin(0); - QPushButton* btnAddAudioEffect = new QPushButton(aeHeader); + QPushButton* btnAddAudioEffect = new QPushButton(); btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png")); btnAddAudioEffect->setToolTip(tr("Add Audio Effect")); connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click())); @@ -376,7 +373,7 @@ void EffectControls::setup_ui() { aeHeaderLayout->addStretch(); - QLabel* lblAudioEffects = new QLabel(aeHeader); + QLabel* lblAudioEffects = new QLabel(); lblAudioEffects->setFont(font); lblAudioEffects->setAlignment(Qt::AlignCenter); lblAudioEffects->setText(tr("AUDIO EFFECTS")); @@ -384,7 +381,7 @@ void EffectControls::setup_ui() { aeHeaderLayout->addStretch(); - QPushButton* btnAddAudioTransition = new QPushButton(aeHeader); + QPushButton* btnAddAudioTransition = new QPushButton(); btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png")); btnAddAudioTransition->setToolTip(tr("Add Audio Transition")); connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click())); diff --git a/panels/grapheditor.cpp b/panels/grapheditor.cpp index faaf91235..cb4bda3c2 100644 --- a/panels/grapheditor.cpp +++ b/panels/grapheditor.cpp @@ -23,48 +23,47 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) { setWindowTitle(tr("Graph Editor")); resize(720, 480); - QWidget* main_widget = new QWidget(); + QWidget* main_widget = new QWidget(this); setWidget(main_widget); - QVBoxLayout* layout = new QVBoxLayout(); - main_widget->setLayout(layout); + QVBoxLayout* layout = new QVBoxLayout(main_widget); - QWidget* tool_widget = new QWidget(); + QWidget* tool_widget = new QWidget(this); tool_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QHBoxLayout* tools = new QHBoxLayout(); + QHBoxLayout* tools = new QHBoxLayout(this); tool_widget->setLayout(tools); - QWidget* left_tool_widget = new QWidget(); - QHBoxLayout* left_tool_layout = new QHBoxLayout(); + QWidget* left_tool_widget = new QWidget(this); + QHBoxLayout* left_tool_layout = new QHBoxLayout(this); left_tool_layout->setSpacing(0); left_tool_layout->setMargin(0); left_tool_widget->setLayout(left_tool_layout); tools->addWidget(left_tool_widget); - QWidget* center_tool_widget = new QWidget(); - QHBoxLayout* center_tool_layout = new QHBoxLayout(); + QWidget* center_tool_widget = new QWidget(this); + QHBoxLayout* center_tool_layout = new QHBoxLayout(this); center_tool_layout->setSpacing(0); center_tool_layout->setMargin(0); center_tool_widget->setLayout(center_tool_layout); tools->addWidget(center_tool_widget); - QWidget* right_tool_widget = new QWidget(); - QHBoxLayout* right_tool_layout = new QHBoxLayout(); + QWidget* right_tool_widget = new QWidget(this); + QHBoxLayout* right_tool_layout = new QHBoxLayout(this); right_tool_layout->setSpacing(0); right_tool_layout->setMargin(0); right_tool_widget->setLayout(right_tool_layout); tools->addWidget(right_tool_widget); - keyframe_nav = new KeyframeNavigator(0, false); + keyframe_nav = new KeyframeNavigator(this, false); keyframe_nav->enable_keyframes(true); keyframe_nav->enable_keyframe_toggle(false); left_tool_layout->addWidget(keyframe_nav); left_tool_layout->addStretch(); - linear_button = new QPushButton(tr("Linear")); + linear_button = new QPushButton(tr("Linear"), this); linear_button->setProperty("type", EFFECT_KEYFRAME_LINEAR); linear_button->setCheckable(true); - bezier_button = new QPushButton(tr("Bezier")); + bezier_button = new QPushButton(tr("Bezier"), this); bezier_button->setProperty("type", EFFECT_KEYFRAME_BEZIER); bezier_button->setCheckable(true); - hold_button = new QPushButton(tr("Hold")); + hold_button = new QPushButton(tr("Hold"), this); hold_button->setProperty("type", EFFECT_KEYFRAME_HOLD); hold_button->setCheckable(true); @@ -75,36 +74,36 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) { layout->addWidget(tool_widget); - QWidget* central_widget = new QWidget(); - QVBoxLayout* central_layout = new QVBoxLayout(); + QWidget* central_widget = new QWidget(this); + QVBoxLayout* central_layout = new QVBoxLayout(this); central_widget->setLayout(central_layout); central_layout->setSpacing(0); central_layout->setMargin(0); - header = new TimelineHeader(); + header = new TimelineHeader(this); header->viewer = panel_sequence_viewer; central_layout->addWidget(header); - view = new GraphView(); + view = new GraphView(this); central_layout->addWidget(view); layout->addWidget(central_widget); - QWidget* value_widget = new QWidget(); + QWidget* value_widget = new QWidget(this); value_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); - QHBoxLayout* values = new QHBoxLayout(); + QHBoxLayout* values = new QHBoxLayout(this); value_widget->setLayout(values); values->addStretch(); - QWidget* central_value_widget = new QWidget(); - value_layout = new QHBoxLayout(); + QWidget* central_value_widget = new QWidget(this); + value_layout = new QHBoxLayout(this); value_layout->setMargin(0); - value_layout->addWidget(new QLabel("")); // a spacer so the layout doesn't jump + value_layout->addWidget(new QLabel("", this)); // a spacer so the layout doesn't jump central_value_widget->setLayout(value_layout); values->addWidget(central_value_widget); values->addStretch(); layout->addWidget(value_widget); - current_row_desc = new QLabel(); + current_row_desc = new QLabel(this); current_row_desc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); current_row_desc->setAlignment(Qt::AlignCenter); layout->addWidget(current_row_desc); @@ -158,7 +157,7 @@ void GraphEditor::set_row(EffectRow *r) { for (int i=0;ifieldCount();i++) { EffectField* field = r->field(i); if (field->type == EFFECT_FIELD_DOUBLE) { - QPushButton* slider_button = new QPushButton(); + QPushButton* slider_button = new QPushButton(this); slider_button->setCheckable(true); slider_button->setChecked(field->is_enabled()); slider_button->setIcon(QIcon(":/icons/record.png")); @@ -168,7 +167,7 @@ void GraphEditor::set_row(EffectRow *r) { slider_proxy_buttons.append(slider_button); value_layout->addWidget(slider_button); - LabelSlider* slider = new LabelSlider(); + LabelSlider* slider = new LabelSlider(this); slider->set_color(get_curve_color(i, r->fieldCount()).name()); connect(slider, SIGNAL(valueChanged()), this, SLOT(passthrough_slider_value())); slider_proxies.append(slider); diff --git a/panels/project.cpp b/panels/project.cpp index 5ae0a8432..71a57c9e0 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -63,7 +63,7 @@ Project::Project(QWidget *parent) : { setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - QWidget* dockWidgetContents = new QWidget(); + QWidget* dockWidgetContents = new QWidget(this); QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents); verticalLayout->setContentsMargins(0, 0, 0, 0); verticalLayout->setSpacing(0); @@ -76,10 +76,10 @@ Project::Project(QWidget *parent) : sorter->setSourceModel(&project_model); // optional toolbar - toolbar_widget = new QWidget(); + toolbar_widget = new QWidget(this); toolbar_widget->setVisible(config.show_project_toolbar); toolbar_widget->setObjectName("project_toolbar"); - QHBoxLayout* toolbar = new QHBoxLayout(); + QHBoxLayout* toolbar = new QHBoxLayout(toolbar_widget); toolbar->setMargin(0); toolbar->setSpacing(0); toolbar_widget->setLayout(toolbar); @@ -157,14 +157,14 @@ Project::Project(QWidget *parent) : verticalLayout->addWidget(tree_view); // icon view - icon_view_container = new QWidget(); + icon_view_container = new QWidget(dockWidgetContents); - QVBoxLayout* icon_view_container_layout = new QVBoxLayout(); + QVBoxLayout* icon_view_container_layout = new QVBoxLayout(icon_view_container); icon_view_container_layout->setMargin(0); icon_view_container_layout->setSpacing(0); icon_view_container->setLayout(icon_view_container_layout); - QHBoxLayout* icon_view_controls = new QHBoxLayout(); + QHBoxLayout* icon_view_controls = new QHBoxLayout(icon_view_container); icon_view_controls->setMargin(0); icon_view_controls->setSpacing(0); @@ -172,14 +172,14 @@ Project::Project(QWidget *parent) : directory_up_button.addFile(":/icons/dirup.png", QSize(), QIcon::Normal); directory_up_button.addFile(":/icons/dirup-disabled.png", QSize(), QIcon::Disabled); - directory_up = new QPushButton(); + directory_up = new QPushButton(icon_view_container); directory_up->setIcon(directory_up_button); directory_up->setEnabled(false); icon_view_controls->addWidget(directory_up); icon_view_controls->addStretch(); - QSlider* icon_size_slider = new QSlider(Qt::Horizontal); + QSlider* icon_size_slider = new QSlider(Qt::Horizontal, icon_view_container); icon_size_slider->setMinimum(16); icon_size_slider->setMaximum(120); icon_view_controls->addWidget(icon_size_slider); diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 7626318e2..b7cfe2b5f 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -540,7 +540,7 @@ void Timeline::resizeEvent(QResizeEvent *) { } int comp_height = tool_button_widget->height(); int cols = qCeil(double(total_client_height)/double(comp_height)); - tool_button_widget->setFixedWidth((tool_button_children.at(0)->width())*cols + horizontal_spacing*(cols-1) + 1); + tool_button_widget->setFixedWidth((tool_button_children.at(0)->sizeHint().width())*cols + horizontal_spacing*(cols-1) + 1); } void Timeline::delete_in_out(bool ripple) { @@ -1097,7 +1097,7 @@ void Timeline::paste(bool insert) { QPushButton* replace_button = box.addButton(tr("Replace"), QMessageBox::NoRole); QPushButton* skip_button = box.addButton(tr("Skip"), QMessageBox::RejectRole); - QCheckBox* future_box = new QCheckBox(tr("Do this for all conflicts found")); + QCheckBox* future_box = new QCheckBox(tr("Do this for all conflicts found"), &box); box.setCheckBox(future_box); box.exec(); @@ -1645,18 +1645,19 @@ void Timeline::setup_ui() { QHBoxLayout* horizontalLayout = new QHBoxLayout(dockWidgetContents); horizontalLayout->setSpacing(0); - horizontalLayout->setContentsMargins(0, 0, 0, 0); + horizontalLayout->setMargin(0); - tool_button_widget = new QWidget(dockWidgetContents); - tool_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + setWidget(dockWidgetContents); + + tool_button_widget = new QWidget(); tool_button_widget->setObjectName("timeline_toolbar"); + tool_button_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); FlowLayout* tool_buttons_layout = new FlowLayout(tool_button_widget); -// tool_buttons_layout->setSizeConstraint(QLayout::SetNoConstraint); tool_buttons_layout->setSpacing(4); - tool_buttons_layout->setContentsMargins(0, 0, 0, 0); + tool_buttons_layout->setMargin(0); - toolArrowButton = new QPushButton(tool_button_widget); + toolArrowButton = new QPushButton(); QIcon arrow_icon; arrow_icon.addFile(QStringLiteral(":/icons/arrow.png"), QSize(), QIcon::Normal, QIcon::Off); arrow_icon.addFile(QStringLiteral(":/icons/arrow-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); @@ -1667,7 +1668,7 @@ void Timeline::setup_ui() { connect(toolArrowButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolArrowButton); - toolEditButton = new QPushButton(tool_button_widget); + toolEditButton = new QPushButton(); QIcon icon1; icon1.addFile(QStringLiteral(":/icons/beam.png"), QSize(), QIcon::Normal, QIcon::Off); icon1.addFile(QStringLiteral(":/icons/beam-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); @@ -1678,7 +1679,7 @@ void Timeline::setup_ui() { connect(toolEditButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolEditButton); - toolRippleButton = new QPushButton(tool_button_widget); + toolRippleButton = new QPushButton(); QIcon icon2; icon2.addFile(QStringLiteral(":/icons/ripple.png"), QSize(), QIcon::Normal, QIcon::Off); icon2.addFile(QStringLiteral(":/icons/ripple-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); @@ -1689,7 +1690,7 @@ void Timeline::setup_ui() { connect(toolRippleButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolRippleButton); - toolRazorButton = new QPushButton(tool_button_widget); + toolRazorButton = new QPushButton(); QIcon icon4; icon4.addFile(QStringLiteral(":/icons/razor.png"), QSize(), QIcon::Normal, QIcon::Off); icon4.addFile(QStringLiteral(":/icons/razor-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off); @@ -1700,7 +1701,7 @@ void Timeline::setup_ui() { connect(toolRazorButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolRazorButton); - toolSlipButton = new QPushButton(tool_button_widget); + toolSlipButton = new QPushButton(); QIcon icon5; icon5.addFile(QStringLiteral(":/icons/slip.png"), QSize(), QIcon::Normal, QIcon::On); icon5.addFile(QStringLiteral(":/icons/slip-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1711,7 +1712,7 @@ void Timeline::setup_ui() { connect(toolSlipButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolSlipButton); - toolSlideButton = new QPushButton(tool_button_widget); + toolSlideButton = new QPushButton(); QIcon icon6; icon6.addFile(QStringLiteral(":/icons/slide.png"), QSize(), QIcon::Normal, QIcon::On); icon6.addFile(QStringLiteral(":/icons/slide-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1722,7 +1723,7 @@ void Timeline::setup_ui() { connect(toolSlideButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolSlideButton); - toolHandButton = new QPushButton(tool_button_widget); + toolHandButton = new QPushButton(); QIcon icon7; icon7.addFile(QStringLiteral(":/icons/hand.png"), QSize(), QIcon::Normal, QIcon::On); icon7.addFile(QStringLiteral(":/icons/hand-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1733,7 +1734,7 @@ void Timeline::setup_ui() { connect(toolHandButton, SIGNAL(clicked(bool)), this, SLOT(set_tool())); tool_buttons_layout->addWidget(toolHandButton); - toolTransitionButton = new QPushButton(tool_button_widget); + toolTransitionButton = new QPushButton(); QIcon icon8; icon8.addFile(QStringLiteral(":/icons/transition-tool.png"), QSize(), QIcon::Normal, QIcon::On); icon8.addFile(QStringLiteral(":/icons/transition-tool-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1743,7 +1744,7 @@ void Timeline::setup_ui() { connect(toolTransitionButton, SIGNAL(clicked(bool)), this, SLOT(transition_tool_click())); tool_buttons_layout->addWidget(toolTransitionButton); - snappingButton = new QPushButton(tool_button_widget); + snappingButton = new QPushButton(); QIcon icon9; icon9.addFile(QStringLiteral(":/icons/magnet.png"), QSize(), QIcon::Normal, QIcon::On); icon9.addFile(QStringLiteral(":/icons/magnet-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1754,7 +1755,7 @@ void Timeline::setup_ui() { connect(snappingButton, SIGNAL(toggled(bool)), this, SLOT(snapping_clicked(bool))); tool_buttons_layout->addWidget(snappingButton); - zoomInButton = new QPushButton(tool_button_widget); + zoomInButton = new QPushButton(); QIcon icon10; icon10.addFile(QStringLiteral(":/icons/zoomin.png"), QSize(), QIcon::Normal, QIcon::On); icon10.addFile(QStringLiteral(":/icons/zoomin-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1763,7 +1764,7 @@ void Timeline::setup_ui() { connect(zoomInButton, SIGNAL(clicked(bool)), this, SLOT(zoom_in())); tool_buttons_layout->addWidget(zoomInButton); - zoomOutButton = new QPushButton(tool_button_widget); + zoomOutButton = new QPushButton(); QIcon icon11; icon11.addFile(QStringLiteral(":/icons/zoomout.png"), QSize(), QIcon::Normal, QIcon::On); icon11.addFile(QStringLiteral(":/icons/zoomout-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1772,17 +1773,16 @@ void Timeline::setup_ui() { connect(zoomOutButton, SIGNAL(clicked(bool)), this, SLOT(zoom_out())); tool_buttons_layout->addWidget(zoomOutButton); - recordButton = new QPushButton(tool_button_widget); + recordButton = new QPushButton(); QIcon icon12; icon12.addFile(QStringLiteral(":/icons/record.png"), QSize(), QIcon::Normal, QIcon::On); icon12.addFile(QStringLiteral(":/icons/record-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); recordButton->setIcon(icon12); recordButton->setToolTip(tr("Record audio")); connect(recordButton, SIGNAL(clicked(bool)), this, SLOT(record_btn_click())); - tool_buttons_layout->addWidget(recordButton); - addButton = new QPushButton(tool_button_widget); + addButton = new QPushButton(); QIcon icon13; icon13.addFile(QStringLiteral(":/icons/add-button.png"), QSize(), QIcon::Normal, QIcon::On); icon13.addFile(QStringLiteral(":/icons/add-button-disabled.png"), QSize(), QIcon::Disabled, QIcon::On); @@ -1793,54 +1793,58 @@ void Timeline::setup_ui() { horizontalLayout->addWidget(tool_button_widget); - timeline_area = new QWidget(dockWidgetContents); - QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum); - sizePolicy2.setHorizontalStretch(1); - sizePolicy2.setVerticalStretch(0); - sizePolicy2.setHeightForWidth(timeline_area->sizePolicy().hasHeightForWidth()); - timeline_area->setSizePolicy(sizePolicy2); + timeline_area = new QWidget(); + QSizePolicy timeline_area_policy(QSizePolicy::Minimum, QSizePolicy::Minimum); + timeline_area_policy.setHorizontalStretch(1); + timeline_area_policy.setVerticalStretch(0); + timeline_area_policy.setHeightForWidth(timeline_area->sizePolicy().hasHeightForWidth()); + timeline_area->setSizePolicy(timeline_area_policy); + QVBoxLayout* timeline_area_layout = new QVBoxLayout(timeline_area); timeline_area_layout->setSpacing(0); timeline_area_layout->setContentsMargins(0, 0, 0, 0); - headers = new TimelineHeader(timeline_area); + headers = new TimelineHeader(); timeline_area_layout->addWidget(headers); - editAreas = new QWidget(timeline_area); + editAreas = new QWidget(); QHBoxLayout* editAreaLayout = new QHBoxLayout(editAreas); editAreaLayout->setSpacing(0); editAreaLayout->setContentsMargins(0, 0, 0, 0); - QSplitter* splitter = new QSplitter(editAreas); + + QSplitter* splitter = new QSplitter(); splitter->setChildrenCollapsible(false); splitter->setOrientation(Qt::Vertical); - QWidget* videoContainer = new QWidget(splitter); + + QWidget* videoContainer = new QWidget(); + QHBoxLayout* videoContainerLayout = new QHBoxLayout(videoContainer); videoContainerLayout->setSpacing(0); videoContainerLayout->setContentsMargins(0, 0, 0, 0); - video_area = new TimelineWidget(videoContainer); - video_area->setFocusPolicy(Qt::ClickFocus); + video_area = new TimelineWidget(); + video_area->setFocusPolicy(Qt::ClickFocus); videoContainerLayout->addWidget(video_area); - videoScrollbar = new QScrollBar(videoContainer); + videoScrollbar = new QScrollBar(); videoScrollbar->setMaximum(0); videoScrollbar->setSingleStep(20); videoScrollbar->setOrientation(Qt::Vertical); - videoContainerLayout->addWidget(videoScrollbar); splitter->addWidget(videoContainer); - QWidget* audioContainer = new QWidget(splitter); + QWidget* audioContainer = new QWidget(); QHBoxLayout* audioContainerLayout = new QHBoxLayout(audioContainer); audioContainerLayout->setSpacing(0); audioContainerLayout->setContentsMargins(0, 0, 0, 0); - audio_area = new TimelineWidget(audioContainer); + + audio_area = new TimelineWidget(); audio_area->setFocusPolicy(Qt::ClickFocus); audioContainerLayout->addWidget(audio_area); - audioScrollbar = new QScrollBar(audioContainer); + audioScrollbar = new QScrollBar(); audioScrollbar->setMaximum(0); audioScrollbar->setOrientation(Qt::Vertical); @@ -1852,7 +1856,7 @@ void Timeline::setup_ui() { timeline_area_layout->addWidget(editAreas); - horizontalScrollBar = new ResizableScrollBar(timeline_area); + horizontalScrollBar = new ResizableScrollBar(); horizontalScrollBar->setMaximum(0); horizontalScrollBar->setSingleStep(20); horizontalScrollBar->setOrientation(Qt::Horizontal); @@ -1861,7 +1865,7 @@ void Timeline::setup_ui() { horizontalLayout->addWidget(timeline_area); - audio_monitor = new AudioMonitor(dockWidgetContents); + audio_monitor = new AudioMonitor(); audio_monitor->setMinimumSize(QSize(50, 0)); horizontalLayout->addWidget(audio_monitor); diff --git a/panels/viewer.cpp b/panels/viewer.cpp index 741ff166c..c2e99c8e8 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -481,6 +481,7 @@ int Viewer::get_playback_speed() { void Viewer::resizeEvent(QResizeEvent *) { if (seq != nullptr) { set_sb_max(); + viewer_widget->update(); } } @@ -586,7 +587,7 @@ long Viewer::get_seq_out() { } void Viewer::setup_ui() { - QWidget* contents = new QWidget(); + QWidget* contents = new QWidget(this); QVBoxLayout* layout = new QVBoxLayout(contents); layout->setSpacing(0); diff --git a/playback/playback.cpp b/playback/playback.cpp index 1d6289ce8..744723c4e 100644 --- a/playback/playback.cpp +++ b/playback/playback.cpp @@ -79,9 +79,15 @@ void close_clip(Clip* clip, bool wait) { } if (clip->fbo != nullptr) { - delete clip->fbo[0]; - delete clip->fbo[1]; + // delete 3 fbos for nested sequences, 2 for most clips + int fbo_count = (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_SEQUENCE) ? 3 : 2; + + for (int j=0;jfbo[j]; + } + delete [] clip->fbo; + clip->fbo = nullptr; } diff --git a/project/effect.cpp b/project/effect.cpp index 7bb583bb4..81d686053 100644 --- a/project/effect.cpp +++ b/project/effect.cpp @@ -108,10 +108,9 @@ Effect::Effect(Clip* c, const EffectMeta *em) : // set up base UI container = new CollapsibleWidget(); connect(container->enabled_check, SIGNAL(clicked(bool)), this, SLOT(field_changed())); - ui = new QWidget(); - ui_layout = new QGridLayout(); + ui = new QWidget(container); + ui_layout = new QGridLayout(ui); ui_layout->setSpacing(4); - ui->setLayout(ui_layout); container->setContents(ui); connect(container->title_bar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&))); @@ -314,7 +313,7 @@ Effect::~Effect() { close(); } - //delete container; + delete container; for (int i=0;iaddWidget(w, ui_row, column_count); column_count++; } -EffectRow::~EffectRow() { - for (int i=0;iplayhead-parent_effect->parent_clip->timeline_in+parent_effect->parent_clip->clip_in; diff --git a/project/effectrow.h b/project/effectrow.h index 8ad91be23..1d71a07a4 100644 --- a/project/effectrow.h +++ b/project/effectrow.h @@ -45,6 +45,7 @@ private: QString name; int ui_row; QVector fields; + QVector widgets; KeyframeNavigator* keyframe_nav; diff --git a/project/media.cpp b/project/media.cpp index c27f068b8..083da219d 100644 --- a/project/media.cpp +++ b/project/media.cpp @@ -53,7 +53,7 @@ Media::~Media() { case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break; } if (throbber != nullptr) delete throbber; - qDeleteAll(children); +// qDeleteAll(children); } Footage *Media::to_footage() { diff --git a/ui/collapsiblewidget.cpp b/ui/collapsiblewidget.cpp index 324f8627d..2b17ce57b 100644 --- a/ui/collapsiblewidget.cpp +++ b/ui/collapsiblewidget.cpp @@ -15,62 +15,61 @@ #include "debug.h" CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) { - selected = false; + selected = false; layout = new QVBoxLayout(this); layout->setMargin(0); layout->setSpacing(0); - title_bar = new CollapsibleWidgetHeader(); + title_bar = new CollapsibleWidgetHeader(this); title_bar->setFocusPolicy(Qt::ClickFocus); title_bar->setAutoFillBackground(true); - title_bar_layout = new QHBoxLayout(); + title_bar_layout = new QHBoxLayout(title_bar); title_bar_layout->setMargin(5); - title_bar->setLayout(title_bar_layout); - enabled_check = new CheckboxEx(); + enabled_check = new CheckboxEx(title_bar); enabled_check->setChecked(true); - header = new QLabel(); - collapse_button = new QPushButton(); - collapse_button->setIconSize(collapse_button->iconSize()*0.5); - collapse_button->setStyleSheet("QPushButton { border: none; }"); - setText(tr("")); - title_bar_layout->addWidget(collapse_button); - title_bar_layout->addWidget(enabled_check); - title_bar_layout->addWidget(header); - title_bar_layout->addStretch(); - layout->addWidget(title_bar); + header = new QLabel(title_bar); + collapse_button = new QPushButton(title_bar); + collapse_button->setIconSize(collapse_button->iconSize()*0.5); + collapse_button->setStyleSheet("QPushButton { border: none; }"); + setText(tr("")); + title_bar_layout->addWidget(collapse_button); + title_bar_layout->addWidget(enabled_check); + title_bar_layout->addWidget(header); + title_bar_layout->addStretch(); + layout->addWidget(title_bar); connect(title_bar, SIGNAL(select(bool, bool)), this, SLOT(header_click(bool, bool))); - set_button_icon(true); + set_button_icon(true); contents = nullptr; } void CollapsibleWidget::header_click(bool s, bool deselect) { - selected = s; - title_bar->selected = s; - if (s) { + selected = s; + title_bar->selected = s; + if (s) { QPalette p = title_bar->palette(); - p.setColor(QPalette::Background, QColor(255, 255, 255, 64)); + p.setColor(QPalette::Background, QColor(255, 255, 255, 64)); title_bar->setPalette(p); } else { title_bar->setPalette(palette()); } - if (deselect) emit deselect_others(this); + if (deselect) emit deselect_others(this); } bool CollapsibleWidget::is_focused() { - if (hasFocus()) return true; - return title_bar->hasFocus(); + if (hasFocus()) return true; + return title_bar->hasFocus(); } bool CollapsibleWidget::is_expanded() { - return contents->isVisible(); + return contents->isVisible(); } void CollapsibleWidget::set_button_icon(bool open) { - collapse_button->setIcon(open ? QIcon(":/icons/tri-down.png") : QIcon(":/icons/tri-right.png")); + collapse_button->setIcon(open ? QIcon(":/icons/tri-down.png") : QIcon(":/icons/tri-right.png")); } void CollapsibleWidget::setContents(QWidget* c) { @@ -93,7 +92,7 @@ void CollapsibleWidget::on_enabled_change(bool b) { void CollapsibleWidget::on_visible_change() { contents->setVisible(!contents->isVisible()); - set_button_icon(contents->isVisible()); + set_button_icon(contents->isVisible()); emit visibleChanged(); } @@ -102,14 +101,14 @@ CollapsibleWidgetHeader::CollapsibleWidgetHeader(QWidget* parent) : QWidget(pare } void CollapsibleWidgetHeader::mousePressEvent(QMouseEvent* event) { - if (selected) { - if ((event->modifiers() & Qt::ShiftModifier)) { - selected = false; - emit select(selected, false); - } - } else { - selected = true; - emit select(selected, !(event->modifiers() & Qt::ShiftModifier)); + if (selected) { + if ((event->modifiers() & Qt::ShiftModifier)) { + selected = false; + emit select(selected, false); + } + } else { + selected = true; + emit select(selected, !(event->modifiers() & Qt::ShiftModifier)); } } diff --git a/ui/embeddedfilechooser.cpp b/ui/embeddedfilechooser.cpp index 140149a25..2de15500f 100644 --- a/ui/embeddedfilechooser.cpp +++ b/ui/embeddedfilechooser.cpp @@ -7,13 +7,12 @@ #include EmbeddedFileChooser::EmbeddedFileChooser(QWidget* parent) : QWidget(parent) { - QHBoxLayout* layout = new QHBoxLayout(); + QHBoxLayout* layout = new QHBoxLayout(this); layout->setMargin(0); - setLayout(layout); - file_label = new QLabel(); + file_label = new QLabel(this); update_label(); layout->addWidget(file_label); - QPushButton* browse_button = new QPushButton("..."); + QPushButton* browse_button = new QPushButton("...", this); browse_button->setFixedWidth(25); layout->addWidget(browse_button); connect(browse_button, SIGNAL(clicked(bool)), this, SLOT(browse())); @@ -35,7 +34,7 @@ void EmbeddedFileChooser::setFilename(const QString &s) { } void EmbeddedFileChooser::update_label() { - QString l = "" + tr("File:") + " "; + QString l = "" + tr("File:") + " "; if (filename.isEmpty()) { l += "(none)"; } else { diff --git a/ui/keyframenavigator.cpp b/ui/keyframenavigator.cpp index baa87fc12..c6c726cf1 100644 --- a/ui/keyframenavigator.cpp +++ b/ui/keyframenavigator.cpp @@ -6,7 +6,7 @@ #include KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget(parent) { - key_controls = new QHBoxLayout(); + key_controls = new QHBoxLayout(this); key_controls->setSpacing(0); key_controls->setMargin(0); @@ -14,9 +14,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget key_controls->addStretch(); } - setLayout(key_controls); - - left_key_nav = new QPushButton(); + left_key_nav = new QPushButton(this); left_key_nav->setIcon(QIcon(":/icons/tri-left.png")); left_key_nav->setIconSize(left_key_nav->iconSize()*0.5); left_key_nav->setVisible(false); @@ -24,7 +22,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_previous_key())); connect(left_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked())); - key_addremove = new QPushButton(); + key_addremove = new QPushButton(this); key_addremove->setIcon(QIcon(":/icons/diamond.png")); key_addremove->setIconSize(key_addremove->iconSize()*0.5); key_addremove->setVisible(false); @@ -32,7 +30,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(toggle_key())); connect(key_addremove, SIGNAL(clicked(bool)), this, SIGNAL(clicked())); - right_key_nav = new QPushButton(); + right_key_nav = new QPushButton(this); right_key_nav->setIcon(QIcon(":/icons/tri-right.png")); right_key_nav->setIconSize(right_key_nav->iconSize()*0.5); right_key_nav->setVisible(false); @@ -40,7 +38,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(goto_next_key())); connect(right_key_nav, SIGNAL(clicked(bool)), this, SIGNAL(clicked())); - keyframe_enable = new QPushButton(QIcon(":/icons/clock.png"), ""); + keyframe_enable = new QPushButton(QIcon(":/icons/clock.png"), "", this); keyframe_enable->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); keyframe_enable->setIconSize(keyframe_enable->iconSize()*0.75); keyframe_enable->setCheckable(true); @@ -51,13 +49,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent, bool addLeftPad) : QWidget key_controls->addWidget(keyframe_enable); } -KeyframeNavigator::~KeyframeNavigator() { - delete keyframe_enable; - delete right_key_nav; - delete key_addremove; - delete left_key_nav; - delete key_controls; -} +KeyframeNavigator::~KeyframeNavigator() {} void KeyframeNavigator::enable_keyframes(bool b) { keyframe_enable->setChecked(b);