implement entire project in nodes
Project items are now represented directly in nodes opening up more versatility and possibilities. This is the first iteration of this and will be buggy. Need to test thoroughly.
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
add_subdirectory(about)
|
||||
add_subdirectory(actionsearch)
|
||||
add_subdirectory(color)
|
||||
add_subdirectory(configbase)
|
||||
add_subdirectory(diskcache)
|
||||
add_subdirectory(export)
|
||||
add_subdirectory(footageproperties)
|
||||
add_subdirectory(footagerelink)
|
||||
add_subdirectory(keyframeproperties)
|
||||
add_subdirectory(preferences)
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
add_subdirectory(streamproperties)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
dialog/footageproperties/footageproperties.h
|
||||
dialog/footageproperties/footageproperties.cpp
|
||||
dialog/configbase/configdialogbase.cpp
|
||||
dialog/configbase/configdialogbase.h
|
||||
dialog/configbase/configdialogbasetab.cpp
|
||||
dialog/configbase/configdialogbasetab.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -0,0 +1,93 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "configdialogbase.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QSplitter>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "core.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
ConfigDialogBase::ConfigDialogBase(QWidget* parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
QSplitter* splitter = new QSplitter();
|
||||
splitter->setChildrenCollapsible(false);
|
||||
layout->addWidget(splitter);
|
||||
|
||||
list_widget_ = new QListWidget();
|
||||
|
||||
preference_pane_stack_ = new QStackedWidget(this);
|
||||
|
||||
splitter->addWidget(list_widget_);
|
||||
splitter->addWidget(preference_pane_stack_);
|
||||
|
||||
QDialogButtonBox* button_box = new QDialogButtonBox(this);
|
||||
button_box->setOrientation(Qt::Horizontal);
|
||||
button_box->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
layout->addWidget(button_box);
|
||||
|
||||
connect(button_box, &QDialogButtonBox::accepted, this, &ConfigDialogBase::accept);
|
||||
connect(button_box, &QDialogButtonBox::rejected, this, &ConfigDialogBase::reject);
|
||||
|
||||
connect(list_widget_,
|
||||
&QListWidget::currentRowChanged,
|
||||
preference_pane_stack_,
|
||||
&QStackedWidget::setCurrentIndex);
|
||||
}
|
||||
|
||||
void ConfigDialogBase::accept()
|
||||
{
|
||||
foreach (ConfigDialogBaseTab* tab, tabs_) {
|
||||
if (!tab->Validate()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MultiUndoCommand* command = new MultiUndoCommand();
|
||||
|
||||
foreach (ConfigDialogBaseTab* tab, tabs_) {
|
||||
tab->Accept(command);
|
||||
}
|
||||
|
||||
if (command->child_count() == 0) {
|
||||
delete command;
|
||||
} else {
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void ConfigDialogBase::AddTab(ConfigDialogBaseTab *tab, const QString &title)
|
||||
{
|
||||
list_widget_->addItem(title);
|
||||
preference_pane_stack_->addWidget(tab);
|
||||
|
||||
tabs_.append(tab);
|
||||
}
|
||||
|
||||
}
|
||||
+25
-9
@@ -18,25 +18,41 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef AUDIOSTREAMPROPERTIES_H
|
||||
#define AUDIOSTREAMPROPERTIES_H
|
||||
#ifndef CONFIGBASE_H
|
||||
#define CONFIGBASE_H
|
||||
|
||||
#include "project/item/footage/audiostream.h"
|
||||
#include "streamproperties.h"
|
||||
#include <QDialog>
|
||||
#include <QListWidget>
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include "configdialogbasetab.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class AudioStreamProperties : public StreamProperties
|
||||
class ConfigDialogBase : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AudioStreamProperties(AudioStream* stream);
|
||||
ConfigDialogBase(QWidget* parent = nullptr);
|
||||
|
||||
virtual void Accept(MultiUndoCommand* parent) override;
|
||||
private slots:
|
||||
/**
|
||||
* @brief Override of accept to save preferences to Config.
|
||||
*/
|
||||
virtual void accept() override;
|
||||
|
||||
protected:
|
||||
void AddTab(ConfigDialogBaseTab* tab, const QString& title);
|
||||
|
||||
private:
|
||||
AudioStream* stream_;
|
||||
QListWidget* list_widget_;
|
||||
|
||||
QStackedWidget* preference_pane_stack_;
|
||||
|
||||
QList<ConfigDialogBaseTab*> tabs_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // AUDIOSTREAMPROPERTIES_H
|
||||
#endif // CONFIGBASE_H
|
||||
+2
-2
@@ -18,11 +18,11 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "configdialogbasetab.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
bool PreferencesTab::Validate()
|
||||
bool ConfigDialogBaseTab::Validate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
+4
-3
@@ -24,17 +24,18 @@
|
||||
#include <QWidget>
|
||||
|
||||
#include "config/config.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesTab : public QWidget
|
||||
class ConfigDialogBaseTab : public QWidget
|
||||
{
|
||||
public:
|
||||
PreferencesTab() = default;
|
||||
ConfigDialogBaseTab() = default;
|
||||
|
||||
virtual bool Validate();
|
||||
|
||||
virtual void Accept() = 0;
|
||||
virtual void Accept(MultiUndoCommand *parent) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -39,10 +39,9 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
ExportDialog::ExportDialog(ViewerOutput *viewer_node, TimelinePoints *points, QWidget *parent) :
|
||||
ExportDialog::ExportDialog(Sequence *sequence, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
viewer_node_(viewer_node),
|
||||
points_(points)
|
||||
sequence_(sequence)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
|
||||
@@ -105,9 +104,8 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, TimelinePoints *points, QW
|
||||
range_combobox_ = new QComboBox();
|
||||
range_combobox_->addItem(tr("Entire Sequence"));
|
||||
range_combobox_->addItem(tr("In to Out"));
|
||||
if (!points_) {
|
||||
range_combobox_->setEnabled(false);
|
||||
}
|
||||
range_combobox_->setEnabled(sequence_->timeline_points()->workarea()->enabled());
|
||||
|
||||
preferences_layout->addWidget(range_combobox_, row, 1, 1, 3);
|
||||
|
||||
row++;
|
||||
@@ -138,7 +136,7 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, TimelinePoints *points, QW
|
||||
|
||||
QTabWidget* preferences_tabs = new QTabWidget();
|
||||
QScrollArea* video_area = new QScrollArea();
|
||||
color_manager_ = static_cast<Sequence*>(viewer_node_->parent())->project()->color_manager();
|
||||
color_manager_ = sequence_->project()->color_manager();
|
||||
video_tab_ = new ExportVideoTab(color_manager_);
|
||||
video_area->setWidgetResizable(true);
|
||||
video_area->setWidget(video_tab_);
|
||||
@@ -190,18 +188,18 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, TimelinePoints *points, QW
|
||||
&ExportDialog::FormatChanged);
|
||||
FormatChanged(ExportFormat::kFormatMPEG4);
|
||||
|
||||
video_tab_->width_slider()->SetValue(viewer_node_->video_params().width());
|
||||
video_tab_->width_slider()->SetDefaultValue(viewer_node_->video_params().width());
|
||||
video_tab_->height_slider()->SetValue(viewer_node_->video_params().height());
|
||||
video_tab_->height_slider()->SetDefaultValue(viewer_node_->video_params().height());
|
||||
video_tab_->frame_rate_combobox()->SetFrameRate(viewer_node_->video_params().time_base().flipped());
|
||||
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(viewer_node_->video_params().pixel_aspect_ratio());
|
||||
video_tab_->width_slider()->SetValue(sequence_->video_params().width());
|
||||
video_tab_->width_slider()->SetDefaultValue(sequence_->video_params().width());
|
||||
video_tab_->height_slider()->SetValue(sequence_->video_params().height());
|
||||
video_tab_->height_slider()->SetDefaultValue(sequence_->video_params().height());
|
||||
video_tab_->frame_rate_combobox()->SetFrameRate(sequence_->video_params().time_base().flipped());
|
||||
video_tab_->pixel_aspect_combobox()->SetPixelAspectRatio(sequence_->video_params().pixel_aspect_ratio());
|
||||
video_tab_->pixel_format_field()->SetPixelFormat(static_cast<VideoParams::Format>(Config::Current()["OnlinePixelFormat"].toInt()));
|
||||
video_tab_->interlaced_combobox()->SetInterlaceMode(viewer_node_->video_params().interlacing());
|
||||
audio_tab_->sample_rate_combobox()->SetSampleRate(viewer_node_->audio_params().sample_rate());
|
||||
audio_tab_->channel_layout_combobox()->SetChannelLayout(viewer_node_->audio_params().channel_layout());
|
||||
video_tab_->interlaced_combobox()->SetInterlaceMode(sequence_->video_params().interlacing());
|
||||
audio_tab_->sample_rate_combobox()->SetSampleRate(sequence_->audio_params().sample_rate());
|
||||
audio_tab_->channel_layout_combobox()->SetChannelLayout(sequence_->audio_params().channel_layout());
|
||||
|
||||
video_aspect_ratio_ = static_cast<double>(viewer_node_->video_params().width()) / static_cast<double>(viewer_node_->video_params().height());
|
||||
video_aspect_ratio_ = static_cast<double>(sequence_->video_params().width()) / static_cast<double>(sequence_->video_params().height());
|
||||
|
||||
connect(video_tab_->width_slider(),
|
||||
&IntegerSlider::ValueChanged,
|
||||
@@ -229,8 +227,8 @@ ExportDialog::ExportDialog(ViewerOutput *viewer_node, TimelinePoints *points, QW
|
||||
static_cast<void(ViewerWidget::*)(const ColorTransform&)>(&ViewerWidget::SetColorTransform));
|
||||
|
||||
// Set viewer to view the node
|
||||
preview_viewer_->ConnectViewerNode(viewer_node_);
|
||||
preview_viewer_->ruler()->ConnectTimelinePoints(points_);
|
||||
preview_viewer_->ConnectViewerNode(sequence_);
|
||||
preview_viewer_->ruler()->ConnectTimelinePoints(sequence_->timeline_points());
|
||||
preview_viewer_->SetColorMenuEnabled(false);
|
||||
preview_viewer_->SetColorTransform(video_tab_->CurrentOCIOColorSpace());
|
||||
}
|
||||
@@ -317,7 +315,7 @@ void ExportDialog::StartExport()
|
||||
return;
|
||||
}
|
||||
|
||||
ExportTask* task = new ExportTask(viewer_node_, color_manager_, GenerateParams());
|
||||
ExportTask* task = new ExportTask(sequence_, color_manager_, GenerateParams());
|
||||
TaskDialog* td = new TaskDialog(task, tr("Export"), this);
|
||||
connect(td, &TaskDialog::TaskSucceeded, this, &ExportDialog::ExportFinished);
|
||||
td->open();
|
||||
@@ -430,8 +428,7 @@ void ExportDialog::LoadPresets()
|
||||
|
||||
void ExportDialog::SetDefaultFilename()
|
||||
{
|
||||
Sequence* s = static_cast<Sequence*>(viewer_node_->parent());
|
||||
Project* p = s->project();
|
||||
Project* p = sequence_->project();
|
||||
|
||||
QDir doc_location;
|
||||
|
||||
@@ -441,7 +438,7 @@ void ExportDialog::SetDefaultFilename()
|
||||
doc_location = QFileInfo(p->filename()).dir();
|
||||
}
|
||||
|
||||
QString file_location = doc_location.filePath(s->name());
|
||||
QString file_location = doc_location.filePath(sequence_->GetLabel());
|
||||
filename_edit_->setText(file_location);
|
||||
}
|
||||
|
||||
@@ -462,12 +459,11 @@ ExportParams ExportDialog::GenerateParams() const
|
||||
|
||||
ExportParams params;
|
||||
params.SetFilename(filename_edit_->text().trimmed());
|
||||
params.SetExportLength(viewer_node_->GetLength());
|
||||
params.SetExportLength(sequence_->GetLength());
|
||||
|
||||
if (range_combobox_->currentIndex() == kRangeInToOut
|
||||
&& points_
|
||||
&& points_->workarea()->enabled()) {
|
||||
params.set_custom_range(points_->workarea()->range());
|
||||
&& sequence_->timeline_points()->workarea()->enabled()) {
|
||||
params.set_custom_range(sequence_->timeline_points()->workarea()->range());
|
||||
}
|
||||
|
||||
if (video_tab_->scaling_method_combobox()->isEnabled()) {
|
||||
@@ -504,8 +500,8 @@ void ExportDialog::UpdateViewerDimensions()
|
||||
|
||||
QMatrix4x4 transform =
|
||||
ExportParams::GenerateMatrix(static_cast<ExportParams::VideoScalingMethod>(video_tab_->scaling_method_combobox()->currentData().toInt()),
|
||||
viewer_node_->video_params().width(),
|
||||
viewer_node_->video_params().height(),
|
||||
sequence_->video_params().width(),
|
||||
sequence_->video_params().height(),
|
||||
static_cast<int>(video_tab_->width_slider()->GetValue()),
|
||||
static_cast<int>(video_tab_->height_slider()->GetValue()));
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class ExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ExportDialog(ViewerOutput* viewer_node, TimelinePoints* points = nullptr, QWidget* parent = nullptr);
|
||||
ExportDialog(Sequence* sequence, QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *e) override;
|
||||
@@ -51,8 +51,7 @@ private:
|
||||
|
||||
ExportParams GenerateParams() const;
|
||||
|
||||
ViewerOutput* viewer_node_;
|
||||
TimelinePoints* points_;
|
||||
Sequence* sequence_;
|
||||
|
||||
ExportFormat::Format previously_selected_format_;
|
||||
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "footageproperties.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QGroupBox>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "core.h"
|
||||
#include "render/colormanager.h"
|
||||
#include "streamproperties/audiostreamproperties.h"
|
||||
#include "streamproperties/videostreamproperties.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *footage) :
|
||||
QDialog(parent),
|
||||
footage_(footage)
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout(this);
|
||||
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(footage_->name()));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
int row = 0;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Name:")), row, 0);
|
||||
|
||||
footage_name_field_ = new QLineEdit(footage_->name());
|
||||
layout->addWidget(footage_name_field_, row, 1);
|
||||
row++;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
track_list = new QListWidget();
|
||||
layout->addWidget(track_list, row, 0, 1, 2);
|
||||
|
||||
row++;
|
||||
|
||||
stacked_widget_ = new QStackedWidget();
|
||||
layout->addWidget(stacked_widget_, row, 0, 1, 2);
|
||||
|
||||
int first_usable_stream = -1;
|
||||
|
||||
for (int i=0;i<footage_->streams().size();i++) {
|
||||
Stream* stream = footage_->stream(i);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(stream->description(), track_list);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(stream->enabled() ? Qt::Checked : Qt::Unchecked);
|
||||
track_list->addItem(item);
|
||||
|
||||
switch (stream->type()) {
|
||||
case Stream::kVideo:
|
||||
stacked_widget_->addWidget(new VideoStreamProperties(static_cast<VideoStream*>(stream)));
|
||||
break;
|
||||
case Stream::kAudio:
|
||||
stacked_widget_->addWidget(new AudioStreamProperties(static_cast<AudioStream*>(stream)));
|
||||
break;
|
||||
default:
|
||||
stacked_widget_->addWidget(new StreamProperties());
|
||||
}
|
||||
|
||||
if (first_usable_stream == -1
|
||||
&& (stream->type() == Stream::kVideo
|
||||
|| stream->type() == Stream::kAudio)) {
|
||||
first_usable_stream = i;
|
||||
}
|
||||
}
|
||||
|
||||
row++;
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
buttons->setCenterButtons(true);
|
||||
layout->addWidget(buttons, row, 0, 1, 2);
|
||||
|
||||
connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
connect(track_list, &QListWidget::currentRowChanged, stacked_widget_, &QStackedWidget::setCurrentIndex);
|
||||
|
||||
// Auto-select first item that actually has properties
|
||||
if (first_usable_stream >= 0) {
|
||||
track_list->setCurrentRow(first_usable_stream);
|
||||
}
|
||||
track_list->setFocus();
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::accept() {
|
||||
// Perform sanity check on all pages
|
||||
for (int i=0;i<stacked_widget_->count();i++) {
|
||||
if (!static_cast<StreamProperties*>(stacked_widget_->widget(i))->SanityCheck()) {
|
||||
// Switch to the failed panel in question
|
||||
stacked_widget_->setCurrentIndex(i);
|
||||
|
||||
// Do nothing (it's up to the property panel itself to throw the error message)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MultiUndoCommand* command = new MultiUndoCommand();
|
||||
|
||||
if (footage_->name() != footage_name_field_->text()) {
|
||||
command->add_child(new FootageChangeCommand(footage_,
|
||||
footage_name_field_->text()));
|
||||
}
|
||||
|
||||
for (int i=0;i<footage_->streams().size();i++) {
|
||||
bool stream_enabled = (track_list->item(i)->checkState() == Qt::Checked);
|
||||
|
||||
if (footage_->stream(i)->enabled() != stream_enabled) {
|
||||
command->add_child(new StreamEnableChangeCommand(footage_->stream(i),
|
||||
stream_enabled));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<stacked_widget_->count();i++) {
|
||||
static_cast<StreamProperties*>(stacked_widget_->widget(i))->Accept(command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
FootagePropertiesDialog::FootageChangeCommand::FootageChangeCommand(Footage *footage, const QString &name) :
|
||||
footage_(footage),
|
||||
new_name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
Project *FootagePropertiesDialog::FootageChangeCommand::GetRelevantProject() const
|
||||
{
|
||||
return footage_->project();
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::FootageChangeCommand::redo()
|
||||
{
|
||||
old_name_ = footage_->name();
|
||||
|
||||
footage_->set_name(new_name_);
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::FootageChangeCommand::undo()
|
||||
{
|
||||
footage_->set_name(old_name_);
|
||||
}
|
||||
|
||||
FootagePropertiesDialog::StreamEnableChangeCommand::StreamEnableChangeCommand(Stream *stream, bool enabled) :
|
||||
stream_(stream),
|
||||
old_enabled_(stream->enabled()),
|
||||
new_enabled_(enabled)
|
||||
{
|
||||
}
|
||||
|
||||
Project *FootagePropertiesDialog::StreamEnableChangeCommand::GetRelevantProject() const
|
||||
{
|
||||
return stream_->footage()->project();
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::StreamEnableChangeCommand::redo()
|
||||
{
|
||||
stream_->set_enabled(new_enabled_);
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::StreamEnableChangeCommand::undo()
|
||||
{
|
||||
stream_->set_enabled(old_enabled_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef MEDIAPROPERTIESDIALOG_H
|
||||
#define MEDIAPROPERTIESDIALOG_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QStackedWidget>
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief The MediaPropertiesDialog class
|
||||
*
|
||||
* A dialog for setting properties on Media. This can be loaded from any part of the application provided it's given
|
||||
* a valid Media object.
|
||||
*/
|
||||
class FootagePropertiesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief MediaPropertiesDialog Constructor
|
||||
*
|
||||
* @param parent
|
||||
*
|
||||
* QWidget parent. Usually MainWindow or Project panel.
|
||||
*
|
||||
* @param i
|
||||
*
|
||||
* Media object to set properties for.
|
||||
*/
|
||||
FootagePropertiesDialog(QWidget *parent, Footage* footage);
|
||||
private:
|
||||
class FootageChangeCommand : public UndoCommand {
|
||||
public:
|
||||
FootageChangeCommand(Footage* footage,
|
||||
const QString& name);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
Footage* footage_;
|
||||
|
||||
QString new_name_;
|
||||
QString old_name_;
|
||||
};
|
||||
|
||||
class StreamEnableChangeCommand : public UndoCommand {
|
||||
public:
|
||||
StreamEnableChangeCommand(Stream* stream,
|
||||
bool enabled);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
Stream* stream_;
|
||||
|
||||
bool old_enabled_;
|
||||
bool new_enabled_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Stack of widgets that changes based on whether the stream is a video or audio stream
|
||||
*/
|
||||
QStackedWidget* stacked_widget_;
|
||||
|
||||
/**
|
||||
* @brief ComboBox for interlacing setting
|
||||
*/
|
||||
QComboBox* interlacing_box;
|
||||
|
||||
/**
|
||||
* @brief Media name text field
|
||||
*/
|
||||
QLineEdit* footage_name_field_;
|
||||
|
||||
/**
|
||||
* @brief Internal pointer to Media object (set in constructor)
|
||||
*/
|
||||
Footage* footage_;
|
||||
|
||||
/**
|
||||
* @brief A list widget for listing the tracks in Media
|
||||
*/
|
||||
QListWidget* track_list;
|
||||
|
||||
/**
|
||||
* @brief Frame rate to conform to
|
||||
*/
|
||||
QDoubleSpinBox* conform_fr;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Overridden accept function for saving the properties back to the Media class
|
||||
*/
|
||||
void accept();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // MEDIAPROPERTIESDIALOG_H
|
||||
@@ -1,26 +0,0 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2020 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
dialog/footageproperties/streamproperties/streamproperties.h
|
||||
dialog/footageproperties/streamproperties/streamproperties.cpp
|
||||
dialog/footageproperties/streamproperties/audiostreamproperties.h
|
||||
dialog/footageproperties/streamproperties/audiostreamproperties.cpp
|
||||
dialog/footageproperties/streamproperties/videostreamproperties.h
|
||||
dialog/footageproperties/streamproperties/videostreamproperties.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -1,35 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "audiostreamproperties.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
AudioStreamProperties::AudioStreamProperties(AudioStream *stream) :
|
||||
stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
void AudioStreamProperties::Accept(MultiUndoCommand*)
|
||||
{
|
||||
Q_UNUSED(stream_)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "streamproperties.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
StreamProperties::StreamProperties(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef STREAMPROPERTIES_H
|
||||
#define STREAMPROPERTIES_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "undo/undocommand.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class StreamProperties : public QWidget
|
||||
{
|
||||
public:
|
||||
StreamProperties(QWidget* parent = nullptr);
|
||||
|
||||
virtual void Accept(MultiUndoCommand*){}
|
||||
|
||||
virtual bool SanityCheck(){return true;}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // STREAMPROPERTIES_H
|
||||
@@ -1,251 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "videostreamproperties.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "common/ocioutils.h"
|
||||
#include "core.h"
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "project/project.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
VideoStreamProperties::VideoStreamProperties(VideoStream *stream) :
|
||||
stream_(stream),
|
||||
video_premultiply_alpha_(nullptr)
|
||||
{
|
||||
QGridLayout* video_layout = new QGridLayout(this);
|
||||
video_layout->setMargin(0);
|
||||
|
||||
int row = 0;
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Pixel Aspect:")), row, 0);
|
||||
|
||||
pixel_aspect_combo_ = new PixelAspectRatioComboBox();
|
||||
pixel_aspect_combo_->SetPixelAspectRatio(stream->pixel_aspect_ratio());
|
||||
video_layout->addWidget(pixel_aspect_combo_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
|
||||
video_interlace_combo_ = new InterlacedComboBox();
|
||||
video_interlace_combo_->SetInterlaceMode(stream->interlacing());
|
||||
|
||||
video_layout->addWidget(video_interlace_combo_, row, 1);
|
||||
|
||||
row++;
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Color Space:")), row, 0);
|
||||
|
||||
video_color_space_ = new QComboBox();
|
||||
OCIO::ConstConfigRcPtr config = stream->footage()->project()->color_manager()->GetConfig();
|
||||
int number_of_colorspaces = config->getNumColorSpaces();
|
||||
|
||||
video_color_space_->addItem(tr("Default (%1)").arg(stream->footage()->project()->color_manager()->GetDefaultInputColorSpace()));
|
||||
|
||||
for (int i=0;i<number_of_colorspaces;i++) {
|
||||
QString colorspace = config->getColorSpaceNameByIndex(i);
|
||||
|
||||
video_color_space_->addItem(colorspace);
|
||||
}
|
||||
|
||||
video_color_space_->setCurrentText(stream_->colorspace(false));
|
||||
|
||||
video_layout->addWidget(video_color_space_, row, 1);
|
||||
|
||||
if (stream->channel_count() == VideoParams::kRGBAChannelCount) {
|
||||
row++;
|
||||
|
||||
video_premultiply_alpha_ = new QCheckBox(tr("Premultiplied Alpha"));
|
||||
video_premultiply_alpha_->setChecked(stream_->premultiplied_alpha());
|
||||
video_layout->addWidget(video_premultiply_alpha_, row, 0, 1, 2);
|
||||
}
|
||||
|
||||
row++;
|
||||
|
||||
if (stream->video_type() == VideoStream::kVideoTypeImageSequence) {
|
||||
QGroupBox* imgseq_group = new QGroupBox(tr("Image Sequence"));
|
||||
QGridLayout* imgseq_layout = new QGridLayout(imgseq_group);
|
||||
|
||||
int imgseq_row = 0;
|
||||
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
imgseq_layout->addWidget(new QLabel(tr("Start Index:")), imgseq_row, 0);
|
||||
|
||||
imgseq_start_time_ = new IntegerSlider();
|
||||
imgseq_start_time_->SetMinimum(0);
|
||||
imgseq_start_time_->SetValue(video_stream->start_time());
|
||||
imgseq_layout->addWidget(imgseq_start_time_, imgseq_row, 1);
|
||||
|
||||
imgseq_row++;
|
||||
|
||||
imgseq_layout->addWidget(new QLabel(tr("End Index:")), imgseq_row, 0);
|
||||
|
||||
imgseq_end_time_ = new IntegerSlider();
|
||||
imgseq_end_time_->SetMinimum(0);
|
||||
imgseq_end_time_->SetValue(video_stream->start_time() + video_stream->duration() - 1);
|
||||
imgseq_layout->addWidget(imgseq_end_time_, imgseq_row, 1);
|
||||
|
||||
imgseq_row++;
|
||||
|
||||
imgseq_layout->addWidget(new QLabel(tr("Frame Rate:")), imgseq_row, 0);
|
||||
|
||||
imgseq_frame_rate_ = new FrameRateComboBox();
|
||||
imgseq_frame_rate_->SetFrameRate(video_stream->frame_rate());
|
||||
imgseq_layout->addWidget(imgseq_frame_rate_, imgseq_row, 1);
|
||||
|
||||
video_layout->addWidget(imgseq_group, row, 0, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void VideoStreamProperties::Accept(MultiUndoCommand *parent)
|
||||
{
|
||||
QString set_colorspace;
|
||||
|
||||
if (video_color_space_->currentIndex() > 0) {
|
||||
set_colorspace = video_color_space_->currentText();
|
||||
}
|
||||
|
||||
if ((video_premultiply_alpha_ && video_premultiply_alpha_->isChecked() != stream_->premultiplied_alpha())
|
||||
|| set_colorspace != stream_->colorspace(false)
|
||||
|| static_cast<VideoParams::Interlacing>(video_interlace_combo_->currentIndex()) != stream_->interlacing()
|
||||
|| pixel_aspect_combo_->GetPixelAspectRatio() != stream_->pixel_aspect_ratio()) {
|
||||
|
||||
parent->add_child(new VideoStreamChangeCommand(stream_,
|
||||
video_premultiply_alpha_ ? video_premultiply_alpha_->isChecked() : stream_->premultiplied_alpha(),
|
||||
set_colorspace,
|
||||
static_cast<VideoParams::Interlacing>(video_interlace_combo_->currentIndex()),
|
||||
pixel_aspect_combo_->GetPixelAspectRatio()));
|
||||
}
|
||||
|
||||
if (stream_->video_type() == VideoStream::kVideoTypeImageSequence) {
|
||||
VideoStream* video_stream = static_cast<VideoStream*>(stream_);
|
||||
|
||||
int64_t new_dur = imgseq_end_time_->GetValue() - imgseq_start_time_->GetValue() + 1;
|
||||
|
||||
if (video_stream->start_time() != imgseq_start_time_->GetValue()
|
||||
|| video_stream->duration() != new_dur
|
||||
|| video_stream->frame_rate() != imgseq_frame_rate_->GetFrameRate()) {
|
||||
parent->add_child(new ImageSequenceChangeCommand(video_stream,
|
||||
imgseq_start_time_->GetValue(),
|
||||
new_dur,
|
||||
imgseq_frame_rate_->GetFrameRate()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool VideoStreamProperties::SanityCheck()
|
||||
{
|
||||
if (stream_->video_type() == VideoStream::kVideoTypeImageSequence) {
|
||||
if (imgseq_start_time_->GetValue() >= imgseq_end_time_->GetValue()) {
|
||||
QMessageBox::critical(this,
|
||||
tr("Invalid Configuration"),
|
||||
tr("Image sequence end index must be a value higher than the start index."),
|
||||
QMessageBox::Ok);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStream *stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
VideoParams::Interlacing interlacing,
|
||||
const rational &pixel_ar) :
|
||||
stream_(stream),
|
||||
new_premultiplied_(premultiplied),
|
||||
new_colorspace_(colorspace),
|
||||
new_interlacing_(interlacing),
|
||||
new_pixel_ar_(pixel_ar)
|
||||
{
|
||||
}
|
||||
|
||||
Project *VideoStreamProperties::VideoStreamChangeCommand::GetRelevantProject() const
|
||||
{
|
||||
return stream_->footage()->project();
|
||||
}
|
||||
|
||||
void VideoStreamProperties::VideoStreamChangeCommand::redo()
|
||||
{
|
||||
old_premultiplied_ = stream_->premultiplied_alpha();
|
||||
old_colorspace_ = stream_->colorspace(false);
|
||||
old_interlacing_ = stream_->interlacing();
|
||||
old_pixel_ar_ = stream_->pixel_aspect_ratio();
|
||||
|
||||
stream_->set_premultiplied_alpha(new_premultiplied_);
|
||||
stream_->set_colorspace(new_colorspace_);
|
||||
stream_->set_interlacing(new_interlacing_);
|
||||
stream_->set_pixel_aspect_ratio(new_pixel_ar_);
|
||||
}
|
||||
|
||||
void VideoStreamProperties::VideoStreamChangeCommand::undo()
|
||||
{
|
||||
stream_->set_premultiplied_alpha(old_premultiplied_);
|
||||
stream_->set_colorspace(old_colorspace_);
|
||||
stream_->set_interlacing(old_interlacing_);
|
||||
stream_->set_pixel_aspect_ratio(old_pixel_ar_);
|
||||
}
|
||||
|
||||
VideoStreamProperties::ImageSequenceChangeCommand::ImageSequenceChangeCommand(VideoStream *video_stream, int64_t start_index, int64_t duration, const rational &frame_rate) :
|
||||
video_stream_(video_stream),
|
||||
new_start_index_(start_index),
|
||||
new_duration_(duration),
|
||||
new_frame_rate_(frame_rate)
|
||||
{
|
||||
}
|
||||
|
||||
Project *VideoStreamProperties::ImageSequenceChangeCommand::GetRelevantProject() const
|
||||
{
|
||||
return video_stream_->footage()->project();
|
||||
}
|
||||
|
||||
void VideoStreamProperties::ImageSequenceChangeCommand::redo()
|
||||
{
|
||||
old_start_index_ = video_stream_->start_time();
|
||||
video_stream_->set_start_time(new_start_index_);
|
||||
|
||||
old_duration_ = video_stream_->duration();
|
||||
video_stream_->set_duration(new_duration_);
|
||||
|
||||
old_frame_rate_ = video_stream_->frame_rate();
|
||||
video_stream_->set_frame_rate(new_frame_rate_);
|
||||
video_stream_->set_timebase(new_frame_rate_.flipped());
|
||||
}
|
||||
|
||||
void VideoStreamProperties::ImageSequenceChangeCommand::undo()
|
||||
{
|
||||
video_stream_->set_start_time(old_start_index_);
|
||||
video_stream_->set_duration(old_duration_);
|
||||
video_stream_->set_frame_rate(old_frame_rate_);
|
||||
video_stream_->set_timebase(old_frame_rate_.flipped());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef VIDEOSTREAMPROPERTIES_H
|
||||
#define VIDEOSTREAMPROPERTIES_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "project/item/footage/videostream.h"
|
||||
#include "streamproperties.h"
|
||||
#include "widget/slider/integerslider.h"
|
||||
#include "widget/standardcombos/standardcombos.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class VideoStreamProperties : public StreamProperties
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VideoStreamProperties(VideoStream* stream);
|
||||
|
||||
virtual void Accept(MultiUndoCommand *parent) override;
|
||||
|
||||
virtual bool SanityCheck() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Attached video stream
|
||||
*/
|
||||
VideoStream* stream_;
|
||||
|
||||
/**
|
||||
* @brief Setting for associated/premultiplied alpha
|
||||
*/
|
||||
QCheckBox* video_premultiply_alpha_;
|
||||
|
||||
/**
|
||||
* @brief Setting for this media's color space
|
||||
*/
|
||||
QComboBox* video_color_space_;
|
||||
|
||||
/**
|
||||
* @brief Setting for video interlacing
|
||||
*/
|
||||
InterlacedComboBox* video_interlace_combo_;
|
||||
|
||||
/**
|
||||
* @brief Sets the start index for image sequences
|
||||
*/
|
||||
IntegerSlider* imgseq_start_time_;
|
||||
|
||||
/**
|
||||
* @brief Sets the end index for image sequences
|
||||
*/
|
||||
IntegerSlider* imgseq_end_time_;
|
||||
|
||||
/**
|
||||
* @brief Sets the frame rate for image sequences
|
||||
*/
|
||||
FrameRateComboBox* imgseq_frame_rate_;
|
||||
|
||||
/**
|
||||
* @brief Sets the pixel aspect ratio of the stream
|
||||
*/
|
||||
PixelAspectRatioComboBox* pixel_aspect_combo_;
|
||||
|
||||
class VideoStreamChangeCommand : public UndoCommand {
|
||||
public:
|
||||
VideoStreamChangeCommand(VideoStream* stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
VideoParams::Interlacing interlacing,
|
||||
const rational& pixel_ar);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
VideoStream* stream_;
|
||||
|
||||
bool new_premultiplied_;
|
||||
QString new_colorspace_;
|
||||
VideoParams::Interlacing new_interlacing_;
|
||||
rational new_pixel_ar_;
|
||||
|
||||
bool old_premultiplied_;
|
||||
QString old_colorspace_;
|
||||
VideoParams::Interlacing old_interlacing_;
|
||||
rational old_pixel_ar_;
|
||||
|
||||
};
|
||||
|
||||
class ImageSequenceChangeCommand : public UndoCommand {
|
||||
public:
|
||||
ImageSequenceChangeCommand(VideoStream* video_stream,
|
||||
int64_t start_index,
|
||||
int64_t duration,
|
||||
const rational& frame_rate);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
VideoStream* video_stream_;
|
||||
|
||||
int64_t new_start_index_;
|
||||
int64_t old_start_index_;
|
||||
|
||||
int64_t new_duration_;
|
||||
int64_t old_duration_;
|
||||
|
||||
rational new_frame_rate_;
|
||||
rational old_frame_rate_;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // VIDEOSTREAMPROPERTIES_H
|
||||
@@ -65,7 +65,7 @@ FootageRelinkDialog::FootageRelinkDialog(const QVector<Footage *> &footage, QWid
|
||||
item_actions_layout->addWidget(item_browse_btn);
|
||||
|
||||
item->setIcon(0, f->icon());
|
||||
item->setText(0, f->name());
|
||||
item->setText(0, f->GetLabel());
|
||||
item->setText(1, f->filename());
|
||||
|
||||
table_->addTopLevelItem(item);
|
||||
@@ -101,7 +101,7 @@ void FootageRelinkDialog::BrowseForFootage()
|
||||
QFileInfo info(f->filename());
|
||||
|
||||
QString new_fn = QFileDialog::getOpenFileName(this,
|
||||
tr("Relink \"%1\"").arg(f->name()),
|
||||
tr("Relink \"%1\"").arg(f->GetLabel()),
|
||||
info.absolutePath(),
|
||||
QStringLiteral("%1;;%2 (**)").arg(info.fileName(), tr("All Files")));
|
||||
|
||||
|
||||
@@ -36,66 +36,16 @@
|
||||
namespace olive {
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar) :
|
||||
QDialog(parent)
|
||||
ConfigDialogBase(parent)
|
||||
{
|
||||
setWindowTitle(tr("Preferences"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
QSplitter* splitter = new QSplitter();
|
||||
splitter->setChildrenCollapsible(false);
|
||||
layout->addWidget(splitter);
|
||||
|
||||
list_widget_ = new QListWidget();
|
||||
|
||||
preference_pane_stack_ = new QStackedWidget(this);
|
||||
|
||||
AddTab(new PreferencesGeneralTab(), tr("General"));
|
||||
AddTab(new PreferencesAppearanceTab(), tr("Appearance"));
|
||||
AddTab(new PreferencesBehaviorTab(), tr("Behavior"));
|
||||
AddTab(new PreferencesDiskTab(), tr("Disk"));
|
||||
AddTab(new PreferencesAudioTab(), tr("Audio"));
|
||||
AddTab(new PreferencesKeyboardTab(main_menu_bar), tr("Keyboard"));
|
||||
|
||||
splitter->addWidget(list_widget_);
|
||||
splitter->addWidget(preference_pane_stack_);
|
||||
|
||||
QDialogButtonBox* button_box = new QDialogButtonBox(this);
|
||||
button_box->setOrientation(Qt::Horizontal);
|
||||
button_box->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
layout->addWidget(button_box);
|
||||
|
||||
connect(button_box, &QDialogButtonBox::accepted, this, &PreferencesDialog::accept);
|
||||
connect(button_box, &QDialogButtonBox::rejected, this, &PreferencesDialog::reject);
|
||||
|
||||
connect(list_widget_,
|
||||
&QListWidget::currentRowChanged,
|
||||
preference_pane_stack_,
|
||||
&QStackedWidget::setCurrentIndex);
|
||||
}
|
||||
|
||||
void PreferencesDialog::accept()
|
||||
{
|
||||
foreach (PreferencesTab* tab, tabs_) {
|
||||
if (!tab->Validate()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (PreferencesTab* tab, tabs_) {
|
||||
tab->Accept();
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void PreferencesDialog::AddTab(PreferencesTab *tab, const QString &title)
|
||||
{
|
||||
list_widget_->addItem(title);
|
||||
preference_pane_stack_->addWidget(tab);
|
||||
|
||||
tabs_.append(tab);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <QStackedWidget>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "tabs/preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace olive {
|
||||
* A dialog for the global application settings. Mostly an interface for Config. Can be loaded from any part of the
|
||||
* application.
|
||||
*/
|
||||
class PreferencesDialog : public QDialog
|
||||
class PreferencesDialog : public ConfigDialogBase
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -50,22 +50,7 @@ public:
|
||||
*
|
||||
* QWidget parent. Usually MainWindow.
|
||||
*/
|
||||
explicit PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar);
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Override of accept to save preferences to Config.
|
||||
*/
|
||||
virtual void accept() override;
|
||||
|
||||
private:
|
||||
void AddTab(PreferencesTab* tab, const QString& title);
|
||||
|
||||
QListWidget* list_widget_;
|
||||
|
||||
QStackedWidget* preference_pane_stack_;
|
||||
|
||||
QList<PreferencesTab*> tabs_;
|
||||
PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,5 @@ set(OLIVE_SOURCES
|
||||
dialog/preferences/tabs/preferencesaudiotab.cpp
|
||||
dialog/preferences/tabs/preferenceskeyboardtab.h
|
||||
dialog/preferences/tabs/preferenceskeyboardtab.cpp
|
||||
dialog/preferences/tabs/preferencestab.h
|
||||
dialog/preferences/tabs/preferencestab.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -86,13 +86,15 @@ PreferencesAppearanceTab::PreferencesAppearanceTab()
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
void PreferencesAppearanceTab::Accept()
|
||||
void PreferencesAppearanceTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
QString style_path = style_combobox_->currentData().toString();
|
||||
|
||||
if (style_path != StyleManager::GetStyle()) {
|
||||
StyleManager::SetStyle(style_path);
|
||||
Config::Current()["Style"] = style_path;
|
||||
Config::Current()[QStringLiteral("Style")] = style_path;
|
||||
}
|
||||
|
||||
for (int i=0; i<color_btns_.size(); i++) {
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
#include "ui/style/style.h"
|
||||
#include "widget/colorlabelmenu/colorcodingcombobox.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesAppearanceTab : public PreferencesTab
|
||||
class PreferencesAppearanceTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesAppearanceTab();
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -91,8 +91,10 @@ PreferencesAudioTab::PreferencesAudioTab()
|
||||
connect(AudioManager::instance(), &AudioManager::InputListReady, this, &PreferencesAudioTab::RetrieveInputList);
|
||||
}
|
||||
|
||||
void PreferencesAudioTab::Accept()
|
||||
void PreferencesAudioTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
// FIXME: Qt documentation states that QAudioDeviceInfo::deviceName() is a "unique identifiers", which would make them
|
||||
// ideal for saving in preferences, but in practice they don't actually appear to be unique.
|
||||
// See: https://bugreports.qt.io/browse/QTBUG-16841
|
||||
|
||||
@@ -25,17 +25,17 @@
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesAudioTab : public PreferencesTab
|
||||
class PreferencesAudioTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesAudioTab();
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -106,8 +106,10 @@ PreferencesBehaviorTab::PreferencesBehaviorTab()
|
||||
node_group);
|
||||
}
|
||||
|
||||
void PreferencesBehaviorTab::Accept()
|
||||
void PreferencesBehaviorTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
QMap<QTreeWidgetItem*, QString>::const_iterator iterator;
|
||||
|
||||
for (iterator=config_map_.begin();iterator!=config_map_.end();iterator++) {
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesBehaviorTab : public PreferencesTab
|
||||
class PreferencesBehaviorTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesBehaviorTab();
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private:
|
||||
QTreeWidgetItem *AddParent(const QString& text, const QString &tooltip, QTreeWidgetItem *parent = nullptr);
|
||||
|
||||
@@ -107,8 +107,10 @@ bool PreferencesDiskTab::Validate()
|
||||
return true;
|
||||
}
|
||||
|
||||
void PreferencesDiskTab::Accept()
|
||||
void PreferencesDiskTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
if (disk_cache_location_->text() != default_disk_cache_folder_->GetPath()) {
|
||||
default_disk_cache_folder_->SetPath(disk_cache_location_->text());
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
#include "render/diskmanager.h"
|
||||
#include "widget/slider/floatslider.h"
|
||||
#include "widget/path/pathwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesDiskTab : public PreferencesTab
|
||||
class PreferencesDiskTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
|
||||
virtual bool Validate() override;
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private:
|
||||
PathWidget* disk_cache_location_;
|
||||
|
||||
@@ -100,8 +100,10 @@ PreferencesGeneralTab::PreferencesGeneralTab()
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
void PreferencesGeneralTab::Accept()
|
||||
void PreferencesGeneralTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
Config::Current()[QStringLiteral("RectifiedWaveforms")] = rectified_waveforms_->isChecked();
|
||||
|
||||
Config::Current()[QStringLiteral("Autoscroll")] = autoscroll_method_->currentData();
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "widget/slider/floatslider.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesGeneralTab : public PreferencesTab
|
||||
class PreferencesGeneralTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesGeneralTab();
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private:
|
||||
void AddLanguage(const QString& locale_name);
|
||||
|
||||
@@ -71,8 +71,10 @@ PreferencesKeyboardTab::PreferencesKeyboardTab(QMenuBar *menubar)
|
||||
setup_kbd_shortcuts(menubar);
|
||||
}
|
||||
|
||||
void PreferencesKeyboardTab::Accept()
|
||||
void PreferencesKeyboardTab::Accept(MultiUndoCommand *command)
|
||||
{
|
||||
Q_UNUSED(command)
|
||||
|
||||
// Save keyboard shortcuts
|
||||
for (int i=0;i<key_shortcut_fields_.size();i++) {
|
||||
key_shortcut_fields_.at(i)->set_action_shortcut();
|
||||
|
||||
@@ -24,18 +24,18 @@
|
||||
#include <QMenuBar>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include "preferencestab.h"
|
||||
#include "dialog/configbase/configdialogbase.h"
|
||||
#include "../keysequenceeditor.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class PreferencesKeyboardTab : public PreferencesTab
|
||||
class PreferencesKeyboardTab : public ConfigDialogBaseTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesKeyboardTab(QMenuBar* menubar);
|
||||
|
||||
virtual void Accept() override;
|
||||
virtual void Accept(MultiUndoCommand* command) override;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef PRESETMANAGER_H
|
||||
#define PRESETMANAGER_H
|
||||
|
||||
#include <memory>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
@@ -62,8 +63,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
using PresetPtr = std::shared_ptr<Preset>;
|
||||
|
||||
template <typename T>
|
||||
class PresetManager
|
||||
{
|
||||
@@ -81,7 +80,7 @@ public:
|
||||
if (reader.name() == QStringLiteral("presets")) {
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
if (reader.name() == QStringLiteral("preset")) {
|
||||
PresetPtr p = std::make_shared<T>();
|
||||
Preset* p = new T();
|
||||
|
||||
p->Load(&reader);
|
||||
|
||||
@@ -111,7 +110,7 @@ public:
|
||||
|
||||
writer.writeStartElement(QStringLiteral("presets"));
|
||||
|
||||
foreach (PresetPtr p, custom_preset_data_) {
|
||||
foreach (Preset* p, custom_preset_data_) {
|
||||
writer.writeStartElement(QStringLiteral("preset"));
|
||||
|
||||
p->Save(&writer);
|
||||
@@ -158,7 +157,7 @@ public:
|
||||
return start;
|
||||
}
|
||||
|
||||
bool SavePreset(PresetPtr preset)
|
||||
bool SavePreset(Preset* preset)
|
||||
{
|
||||
QString preset_name;
|
||||
int existing_preset;
|
||||
@@ -205,7 +204,7 @@ public:
|
||||
return QDir(FileFunctions::GetConfigurationLocation()).filePath(preset_name_);
|
||||
}
|
||||
|
||||
PresetPtr GetPreset(int index)
|
||||
Preset* GetPreset(int index)
|
||||
{
|
||||
return custom_preset_data_.at(index);
|
||||
}
|
||||
@@ -220,13 +219,13 @@ public:
|
||||
return custom_preset_data_.size();
|
||||
}
|
||||
|
||||
const QVector<PresetPtr>& GetPresetData() const
|
||||
const QVector<Preset*>& GetPresetData() const
|
||||
{
|
||||
return custom_preset_data_;
|
||||
}
|
||||
|
||||
private:
|
||||
QVector<PresetPtr> custom_preset_data_;
|
||||
QVector<Preset*> custom_preset_data_;
|
||||
|
||||
QString preset_name_;
|
||||
|
||||
|
||||
@@ -78,11 +78,11 @@ SequenceDialog::SequenceDialog(Sequence* s, Type t, QWidget* parent) :
|
||||
setWindowTitle(tr("New Sequence"));
|
||||
break;
|
||||
case kExisting:
|
||||
setWindowTitle(tr("Editing \"%1\"").arg(sequence_->name()));
|
||||
setWindowTitle(tr("Editing \"%1\"").arg(sequence_->GetLabel()));
|
||||
break;
|
||||
}
|
||||
|
||||
name_field_->setText(sequence_->name());
|
||||
name_field_->setText(sequence_->GetLabel());
|
||||
}
|
||||
|
||||
void SequenceDialog::SetUndoable(bool u)
|
||||
@@ -130,7 +130,7 @@ void SequenceDialog::accept()
|
||||
// Set sequence values directly with no undo command
|
||||
sequence_->set_video_params(video_params);
|
||||
sequence_->set_audio_params(audio_params);
|
||||
sequence_->set_name(name_field_->text());
|
||||
sequence_->SetLabel(name_field_->text());
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
@@ -146,7 +146,7 @@ SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
|
||||
new_name_(name),
|
||||
old_video_params_(s->video_params()),
|
||||
old_audio_params_(s->audio_params()),
|
||||
old_name_(s->name())
|
||||
old_name_(s->GetLabel())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -159,14 +159,14 @@ void SequenceDialog::SequenceParamCommand::redo()
|
||||
{
|
||||
sequence_->set_video_params(new_video_params_);
|
||||
sequence_->set_audio_params(new_audio_params_);
|
||||
sequence_->set_name(new_name_);
|
||||
sequence_->SetLabel(new_name_);
|
||||
}
|
||||
|
||||
void SequenceDialog::SequenceParamCommand::undo()
|
||||
{
|
||||
sequence_->set_video_params(old_video_params_);
|
||||
sequence_->set_audio_params(old_audio_params_);
|
||||
sequence_->set_name(old_name_);
|
||||
sequence_->SetLabel(old_name_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,12 +79,19 @@ SequenceDialogPresetTab::SequenceDialogPresetTab(QWidget* parent) :
|
||||
}
|
||||
}
|
||||
|
||||
SequenceDialogPresetTab::~SequenceDialogPresetTab()
|
||||
{
|
||||
qDeleteAll(child_presets_);
|
||||
}
|
||||
|
||||
void SequenceDialogPresetTab::SaveParametersAsPreset(SequencePreset preset)
|
||||
{
|
||||
PresetPtr preset_ptr = std::make_shared<SequencePreset>(preset);
|
||||
Preset* preset_ptr = new SequencePreset(preset);
|
||||
|
||||
if (SavePreset(preset_ptr)) {
|
||||
AddCustomItem(my_presets_folder_, preset_ptr, GetNumberOfPresets() - 1);
|
||||
} else {
|
||||
delete preset_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,19 +212,19 @@ QTreeWidgetItem *SequenceDialogPresetTab::GetSelectedCustomPreset()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SequenceDialogPresetTab::AddStandardItem(QTreeWidgetItem *folder, PresetPtr preset, const QString& description)
|
||||
void SequenceDialogPresetTab::AddStandardItem(QTreeWidgetItem *folder, Preset* preset, const QString& description)
|
||||
{
|
||||
int index = default_preset_data_.size();
|
||||
default_preset_data_.append(preset);
|
||||
AddItemInternal(folder, preset, false, index, description);
|
||||
}
|
||||
|
||||
void SequenceDialogPresetTab::AddCustomItem(QTreeWidgetItem *folder, PresetPtr preset, int index, const QString &description)
|
||||
void SequenceDialogPresetTab::AddCustomItem(QTreeWidgetItem *folder, Preset* preset, int index, const QString &description)
|
||||
{
|
||||
AddItemInternal(folder, preset, true, index, description);
|
||||
}
|
||||
|
||||
void SequenceDialogPresetTab::AddItemInternal(QTreeWidgetItem *folder, PresetPtr preset, bool is_custom, int index, const QString &description)
|
||||
void SequenceDialogPresetTab::AddItemInternal(QTreeWidgetItem *folder, Preset* preset, bool is_custom, int index, const QString &description)
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
|
||||
@@ -228,6 +235,8 @@ void SequenceDialogPresetTab::AddItemInternal(QTreeWidgetItem *folder, PresetPtr
|
||||
item->setData(0, kDataPresetIsCustomRole, is_custom);
|
||||
item->setData(0, kDataPresetDataRole, index);
|
||||
|
||||
child_presets_.append(preset);
|
||||
|
||||
folder->addChild(item);
|
||||
}
|
||||
|
||||
@@ -238,11 +247,11 @@ void SequenceDialogPresetTab::SelectedItemChanged(QTreeWidgetItem* current, QTre
|
||||
if (current->data(0, kDataIsPreset).toBool()) {
|
||||
int preset_index = current->data(0, kDataPresetDataRole).toInt();
|
||||
|
||||
PresetPtr preset_data = (current->data(0, kDataPresetIsCustomRole).toBool())
|
||||
Preset* preset_data = (current->data(0, kDataPresetIsCustomRole).toBool())
|
||||
? GetPreset(preset_index)
|
||||
: default_preset_data_.at(preset_index);
|
||||
|
||||
emit PresetChanged(*static_cast<SequencePreset*>(preset_data.get()));
|
||||
emit PresetChanged(*static_cast<SequencePreset*>(preset_data));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ class SequenceDialogPresetTab : public QWidget, public PresetManager<SequencePre
|
||||
public:
|
||||
SequenceDialogPresetTab(QWidget* parent = nullptr);
|
||||
|
||||
virtual ~SequenceDialogPresetTab() override;
|
||||
|
||||
public slots:
|
||||
void SaveParametersAsPreset(SequencePreset preset);
|
||||
|
||||
@@ -54,17 +56,19 @@ private:
|
||||
QTreeWidgetItem* GetSelectedItem();
|
||||
QTreeWidgetItem* GetSelectedCustomPreset();
|
||||
|
||||
void AddStandardItem(QTreeWidgetItem* folder, PresetPtr preset, const QString &description = QString());
|
||||
void AddStandardItem(QTreeWidgetItem* folder, Preset* preset, const QString &description = QString());
|
||||
|
||||
void AddCustomItem(QTreeWidgetItem* folder, PresetPtr preset, int index, const QString& description = QString());
|
||||
void AddCustomItem(QTreeWidgetItem* folder, Preset* preset, int index, const QString& description = QString());
|
||||
|
||||
void AddItemInternal(QTreeWidgetItem* folder, PresetPtr preset, bool is_custom, int index, const QString& description = QString());
|
||||
void AddItemInternal(QTreeWidgetItem* folder, Preset* preset, bool is_custom, int index, const QString& description = QString());
|
||||
|
||||
QTreeWidget* preset_tree_;
|
||||
|
||||
QTreeWidgetItem* my_presets_folder_;
|
||||
|
||||
QList<PresetPtr> default_preset_data_;
|
||||
QVector<Preset*> default_preset_data_;
|
||||
|
||||
QVector<Preset*> child_presets_;
|
||||
|
||||
private slots:
|
||||
void SelectedItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
|
||||
@@ -57,20 +57,20 @@ public:
|
||||
SetName(name);
|
||||
}
|
||||
|
||||
static PresetPtr Create(const QString& name,
|
||||
int width,
|
||||
int height,
|
||||
const rational& frame_rate,
|
||||
const rational& pixel_aspect,
|
||||
VideoParams::Interlacing interlacing,
|
||||
int sample_rate,
|
||||
uint64_t channel_layout,
|
||||
int preview_divider,
|
||||
VideoParams::Format preview_format)
|
||||
static Preset* Create(const QString& name,
|
||||
int width,
|
||||
int height,
|
||||
const rational& frame_rate,
|
||||
const rational& pixel_aspect,
|
||||
VideoParams::Interlacing interlacing,
|
||||
int sample_rate,
|
||||
uint64_t channel_layout,
|
||||
int preview_divider,
|
||||
VideoParams::Format preview_format)
|
||||
{
|
||||
return std::make_shared<SequencePreset>(name, width, height, frame_rate, pixel_aspect,
|
||||
interlacing, sample_rate, channel_layout,
|
||||
preview_divider, preview_format);
|
||||
return new SequencePreset(name, width, height, frame_rate, pixel_aspect,
|
||||
interlacing, sample_rate, channel_layout,
|
||||
preview_divider, preview_format);
|
||||
}
|
||||
|
||||
virtual void Load(QXmlStreamReader* reader) override
|
||||
|
||||
Reference in New Issue
Block a user