began implementation of footage properties
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
# 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
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
namespace OCIO = OCIO_NAMESPACE::v1;
|
||||
|
||||
#include "streamproperties/audiostreamproperties.h"
|
||||
#include "streamproperties/videostreamproperties.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, FootagePtr footage) :
|
||||
FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *footage) :
|
||||
QDialog(parent),
|
||||
footage_(footage)
|
||||
{
|
||||
@@ -46,19 +46,41 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, FootagePtr foo
|
||||
|
||||
int row = 0;
|
||||
|
||||
layout->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
||||
layout->addWidget(new QLabel(tr("Name:")), row, 0);
|
||||
|
||||
footage_name_field_ = new QLineEdit(footage_->name());
|
||||
layout->addWidget(footage_name_field_, row, 1);
|
||||
row++;
|
||||
|
||||
track_list = new QListWidget(this);
|
||||
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);
|
||||
|
||||
foreach (StreamPtr stream, footage_->streams()) {
|
||||
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(std::static_pointer_cast<VideoStream>(stream)));
|
||||
break;
|
||||
case Stream::kAudio:
|
||||
stacked_widget_->addWidget(new AudioStreamProperties(std::static_pointer_cast<AudioStream>(stream)));
|
||||
break;
|
||||
default:
|
||||
stacked_widget_->addWidget(new StreamProperties());
|
||||
}
|
||||
}
|
||||
|
||||
layout->addWidget(track_list, row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
/*if (f->video_tracks.size() > 0) {
|
||||
@@ -125,10 +147,7 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, FootagePtr foo
|
||||
}
|
||||
*/
|
||||
|
||||
name_box = new QLineEdit(footage_->name(), this);
|
||||
layout->addWidget(new QLabel(tr("Name:"), this), row, 0);
|
||||
layout->addWidget(name_box, row, 1);
|
||||
row++;
|
||||
connect(track_list, SIGNAL(currentRowChanged(int)), stacked_widget_, SLOT(setCurrentIndex(int)));
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
buttons->setCenterButtons(true);
|
||||
@@ -205,5 +224,67 @@ void FootagePropertiesDialog::accept() {
|
||||
|
||||
olive::undo_stack.push(ca);*/
|
||||
|
||||
QUndoCommand* command = new QUndoCommand();
|
||||
|
||||
if (footage_->name() != footage_name_field_->text()) {
|
||||
new FootageChangeCommand(footage_,
|
||||
footage_name_field_->text(),
|
||||
command);
|
||||
}
|
||||
|
||||
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) {
|
||||
new StreamEnableChangeCommand(footage_->stream(i),
|
||||
stream_enabled,
|
||||
command);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<stacked_widget_->count();i++) {
|
||||
static_cast<StreamProperties*>(stacked_widget_->widget(i))->Accept(command);
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
FootagePropertiesDialog::FootageChangeCommand::FootageChangeCommand(Footage *footage, const QString &name, QUndoCommand* command) :
|
||||
QUndoCommand(command),
|
||||
footage_(footage),
|
||||
new_name_(name)
|
||||
{
|
||||
}
|
||||
|
||||
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(StreamPtr stream, bool enabled, QUndoCommand *command) :
|
||||
QUndoCommand(command),
|
||||
stream_(stream),
|
||||
new_enabled_(enabled)
|
||||
{
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::StreamEnableChangeCommand::redo()
|
||||
{
|
||||
old_enabled_ = stream_->enabled();
|
||||
|
||||
stream_->set_enabled(new_enabled_);
|
||||
}
|
||||
|
||||
void FootagePropertiesDialog::StreamEnableChangeCommand::undo()
|
||||
{
|
||||
stream_->set_enabled(old_enabled_);
|
||||
}
|
||||
|
||||
@@ -21,12 +21,14 @@
|
||||
#ifndef MEDIAPROPERTIESDIALOG_H
|
||||
#define MEDIAPROPERTIESDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QDialog>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QCheckBox>
|
||||
#include <QStackedWidget>
|
||||
#include <QUndoCommand>
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
|
||||
@@ -50,8 +52,45 @@ public:
|
||||
*
|
||||
* Media object to set properties for.
|
||||
*/
|
||||
FootagePropertiesDialog(QWidget *parent, FootagePtr footage);
|
||||
FootagePropertiesDialog(QWidget *parent, Footage* footage);
|
||||
private:
|
||||
class FootageChangeCommand : public QUndoCommand {
|
||||
public:
|
||||
FootageChangeCommand(Footage* footage,
|
||||
const QString& name,
|
||||
QUndoCommand *command = nullptr);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
Footage* footage_;
|
||||
|
||||
QString new_name_;
|
||||
QString old_name_;
|
||||
};
|
||||
|
||||
class StreamEnableChangeCommand : public QUndoCommand {
|
||||
public:
|
||||
StreamEnableChangeCommand(StreamPtr stream,
|
||||
bool enabled,
|
||||
QUndoCommand* command = nullptr);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
StreamPtr 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
|
||||
*/
|
||||
@@ -60,12 +99,12 @@ private:
|
||||
/**
|
||||
* @brief Media name text field
|
||||
*/
|
||||
QLineEdit* name_box;
|
||||
QLineEdit* footage_name_field_;
|
||||
|
||||
/**
|
||||
* @brief Internal pointer to Media object (set in constructor)
|
||||
*/
|
||||
FootagePtr footage_;
|
||||
Footage* footage_;
|
||||
|
||||
/**
|
||||
* @brief A list widget for listing the tracks in Media
|
||||
@@ -77,20 +116,12 @@ private:
|
||||
*/
|
||||
QDoubleSpinBox* conform_fr;
|
||||
|
||||
/**
|
||||
* @brief Setting for associated/premultiplied alpha
|
||||
*/
|
||||
QCheckBox* premultiply_alpha_setting;
|
||||
|
||||
/**
|
||||
* @brief Setting for this media's color space
|
||||
*/
|
||||
QComboBox* input_color_space;
|
||||
private slots:
|
||||
/**
|
||||
* @brief Overridden accept function for saving the properties back to the Media class
|
||||
*/
|
||||
void accept();
|
||||
|
||||
};
|
||||
|
||||
#endif // MEDIAPROPERTIESDIALOG_H
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 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
|
||||
)
|
||||
@@ -0,0 +1,30 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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"
|
||||
|
||||
AudioStreamProperties::AudioStreamProperties(AudioStreamPtr stream) :
|
||||
stream_(stream)
|
||||
{
|
||||
}
|
||||
|
||||
void AudioStreamProperties::Accept(QUndoCommand*)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 AUDIOSTREAMPROPERTIES_H
|
||||
#define AUDIOSTREAMPROPERTIES_H
|
||||
|
||||
#include "project/item/footage/audiostream.h"
|
||||
#include "streamproperties.h"
|
||||
|
||||
class AudioStreamProperties : public StreamProperties
|
||||
{
|
||||
public:
|
||||
AudioStreamProperties(AudioStreamPtr stream);
|
||||
|
||||
virtual void Accept(QUndoCommand* parent) override;
|
||||
|
||||
private:
|
||||
AudioStreamPtr stream_;
|
||||
};
|
||||
|
||||
#endif // AUDIOSTREAMPROPERTIES_H
|
||||
@@ -0,0 +1,26 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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"
|
||||
|
||||
StreamProperties::StreamProperties(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 <QUndoCommand>
|
||||
#include <QWidget>
|
||||
|
||||
class StreamProperties : public QWidget
|
||||
{
|
||||
public:
|
||||
StreamProperties(QWidget* parent = nullptr);
|
||||
|
||||
virtual void Accept(QUndoCommand*){}
|
||||
};
|
||||
|
||||
#endif // STREAMPROPERTIES_H
|
||||
@@ -0,0 +1,92 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 <QLabel>
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
namespace OCIO = OCIO_NAMESPACE::v1;
|
||||
|
||||
#include "undo/undostack.h"
|
||||
|
||||
VideoStreamProperties::VideoStreamProperties(VideoStreamPtr stream) :
|
||||
stream_(stream)
|
||||
{
|
||||
QGridLayout* video_layout = new QGridLayout(this);
|
||||
video_layout->setMargin(0);
|
||||
|
||||
video_layout->addWidget(new QLabel(tr("Color Space:")), 0, 0);
|
||||
|
||||
video_color_space_ = new QComboBox();
|
||||
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
|
||||
int number_of_colorspaces = config->getNumColorSpaces();
|
||||
|
||||
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());
|
||||
|
||||
video_layout->addWidget(video_color_space_, 0, 1);
|
||||
|
||||
video_premultiply_alpha_ = new QCheckBox(tr("Premultiplied Alpha"));
|
||||
video_premultiply_alpha_->setChecked(stream_->premultiplied_alpha());
|
||||
video_layout->addWidget(video_premultiply_alpha_, 1, 0, 1, 2);
|
||||
}
|
||||
|
||||
void VideoStreamProperties::Accept(QUndoCommand *parent)
|
||||
{
|
||||
if (video_premultiply_alpha_->isChecked() != stream_->premultiplied_alpha()
|
||||
|| video_color_space_->currentText() != stream_->colorspace()) {
|
||||
new VideoStreamChangeCommand(stream_,
|
||||
video_premultiply_alpha_->isChecked(),
|
||||
video_color_space_->currentText(),
|
||||
parent);
|
||||
}
|
||||
}
|
||||
|
||||
VideoStreamProperties::VideoStreamChangeCommand::VideoStreamChangeCommand(VideoStreamPtr stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
stream_(stream),
|
||||
new_premultiplied_(premultiplied),
|
||||
new_colorspace_(colorspace)
|
||||
{
|
||||
}
|
||||
|
||||
void VideoStreamProperties::VideoStreamChangeCommand::redo()
|
||||
{
|
||||
old_premultiplied_ = stream_->premultiplied_alpha();
|
||||
old_colorspace_ = stream_->colorspace();
|
||||
|
||||
stream_->set_premultiplied_alpha(new_premultiplied_);
|
||||
stream_->set_colorspace(new_colorspace_);
|
||||
}
|
||||
|
||||
void VideoStreamProperties::VideoStreamChangeCommand::undo()
|
||||
{
|
||||
stream_->set_premultiplied_alpha(old_premultiplied_);
|
||||
stream_->set_colorspace(old_colorspace_);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 <QUndoCommand>
|
||||
|
||||
#include "project/item/footage/videostream.h"
|
||||
#include "streamproperties.h"
|
||||
|
||||
class VideoStreamProperties : public StreamProperties
|
||||
{
|
||||
public:
|
||||
VideoStreamProperties(VideoStreamPtr stream);
|
||||
|
||||
virtual void Accept(QUndoCommand* parent) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Attached video stream
|
||||
*/
|
||||
VideoStreamPtr stream_;
|
||||
|
||||
/**
|
||||
* @brief Setting for associated/premultiplied alpha
|
||||
*/
|
||||
QCheckBox* video_premultiply_alpha_;
|
||||
|
||||
/**
|
||||
* @brief Setting for this media's color space
|
||||
*/
|
||||
QComboBox* video_color_space_;
|
||||
|
||||
class VideoStreamChangeCommand : public QUndoCommand {
|
||||
public:
|
||||
VideoStreamChangeCommand(VideoStreamPtr stream,
|
||||
bool premultiplied,
|
||||
QString colorspace,
|
||||
QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
VideoStreamPtr stream_;
|
||||
|
||||
bool new_premultiplied_;
|
||||
QString new_colorspace_;
|
||||
|
||||
bool old_premultiplied_;
|
||||
QString old_colorspace_;
|
||||
};
|
||||
};
|
||||
|
||||
#endif // VIDEOSTREAMPROPERTIES_H
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "tabs/preferencesappearancetab.h"
|
||||
#include "tabs/preferencesplaybacktab.h"
|
||||
#include "tabs/preferencesaudiotab.h"
|
||||
#include "tabs/preferencescolormanagementtab.h"
|
||||
#include "tabs/preferenceskeyboardtab.h"
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar) :
|
||||
@@ -52,7 +51,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar) :
|
||||
AddTab(new PreferencesGeneralTab(), tr("General"));
|
||||
AddTab(new PreferencesAppearanceTab(), tr("Appearance"));
|
||||
AddTab(new PreferencesBehaviorTab(), tr("Behavior"));
|
||||
AddTab(new PreferencesColorManagementTab(), tr("Color Management"));
|
||||
AddTab(new PreferencesPlaybackTab(), tr("Playback"));
|
||||
AddTab(new PreferencesAudioTab(), tr("Audio"));
|
||||
AddTab(new PreferencesKeyboardTab(main_menu_bar), tr("Keyboard"));
|
||||
|
||||
@@ -28,8 +28,6 @@ set(OLIVE_SOURCES
|
||||
dialog/preferences/tabs/preferencesaudiotab.cpp
|
||||
dialog/preferences/tabs/preferenceskeyboardtab.h
|
||||
dialog/preferences/tabs/preferenceskeyboardtab.cpp
|
||||
dialog/preferences/tabs/preferencescolormanagementtab.h
|
||||
dialog/preferences/tabs/preferencescolormanagementtab.cpp
|
||||
dialog/preferences/tabs/preferencestab.h
|
||||
dialog/preferences/tabs/preferencestab.cpp
|
||||
PARENT_SCOPE
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
#include "preferencescolormanagementtab.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
PreferencesColorManagementTab::PreferencesColorManagementTab()
|
||||
{
|
||||
QGridLayout* color_management_layout = new QGridLayout(this);
|
||||
color_management_layout->setMargin(0);
|
||||
|
||||
int row = 0;
|
||||
|
||||
QGroupBox* opencolorio_groupbox = new QGroupBox();
|
||||
QGridLayout* opencolorio_groupbox_layout = new QGridLayout(opencolorio_groupbox);
|
||||
|
||||
// COLOR MANAGEMENT -> OpenColorIO Config File
|
||||
opencolorio_groupbox_layout->addWidget(new QLabel(tr("OpenColorIO Config File:")), 0, 0);
|
||||
|
||||
ocio_config_file = new QLineEdit();
|
||||
// ocio_config_file->setText(olive::config.ocio_config_path);
|
||||
connect(ocio_config_file, SIGNAL(textChanged(const QString &)), this, SLOT(update_ocio_config(const QString&)));
|
||||
opencolorio_groupbox_layout->addWidget(ocio_config_file, 0, 1, 1, 4);
|
||||
|
||||
QPushButton* ocio_config_browse_btn = new QPushButton(tr("Browse"));
|
||||
connect(ocio_config_browse_btn, SIGNAL(clicked(bool)), this, SLOT(browse_ocio_config()));
|
||||
opencolorio_groupbox_layout->addWidget(ocio_config_browse_btn, 0, 5);
|
||||
|
||||
// COLOR MANAGEMENT -> Default Input Color Space
|
||||
ocio_default_input = new QComboBox();
|
||||
opencolorio_groupbox_layout->addWidget(new QLabel(tr("Default Input Color Space:")), 1, 0);
|
||||
opencolorio_groupbox_layout->addWidget(ocio_default_input, 1, 1, 1, 5);
|
||||
|
||||
// COLOR MANAGEMENT -> Display
|
||||
ocio_display = new QComboBox();
|
||||
connect(ocio_display, SIGNAL(currentIndexChanged(int)), this, SLOT(update_ocio_view_menu()));
|
||||
opencolorio_groupbox_layout->addWidget(new QLabel(tr("Display:")), 2, 0);
|
||||
opencolorio_groupbox_layout->addWidget(ocio_display, 2, 1);
|
||||
|
||||
// COLOR MANAGEMENT -> View
|
||||
ocio_view = new QComboBox();
|
||||
opencolorio_groupbox_layout->addWidget(new QLabel(tr("View:")), 2, 2);
|
||||
opencolorio_groupbox_layout->addWidget(ocio_view, 2, 3);
|
||||
|
||||
// COLOR MANAGEMENT -> Look
|
||||
ocio_look = new QComboBox();
|
||||
opencolorio_groupbox_layout->addWidget(new QLabel(tr("Look:")), 2, 4);
|
||||
opencolorio_groupbox_layout->addWidget(ocio_look, 2, 5);
|
||||
|
||||
color_management_layout->addWidget(opencolorio_groupbox, row, 0);
|
||||
|
||||
row++;
|
||||
|
||||
// COLOR MANAGEMENT -> Bit Depth
|
||||
QGroupBox* bit_depth_groupbox = new QGroupBox(tr("Bit Depth"));
|
||||
QGridLayout* bit_depth_groupbox_layout = new QGridLayout(bit_depth_groupbox);
|
||||
|
||||
// COLOR MANAGEMENT -> Bit Depth -> Playback
|
||||
playback_bit_depth = new QComboBox();
|
||||
/*for (int i=0;i<olive::pixel_formats.size();i++) {
|
||||
playback_bit_depth->addItem(olive::pixel_formats.at(i).name, i);
|
||||
}
|
||||
playback_bit_depth->setCurrentIndex(olive::config.playback_bit_depth);*/
|
||||
bit_depth_groupbox_layout->addWidget(new QLabel(tr("Playback (Offline):")), 0, 0);
|
||||
bit_depth_groupbox_layout->addWidget(playback_bit_depth, 0, 1);
|
||||
|
||||
// COLOR MANAGEMENT -> Bit Depth -> Export
|
||||
export_bit_depth = new QComboBox();
|
||||
/*for (int i=0;i<olive::pixel_formats.size();i++) {
|
||||
export_bit_depth->addItem(olive::pixel_formats.at(i).name, i);
|
||||
}
|
||||
export_bit_depth->setCurrentIndex(olive::config.export_bit_depth);*/
|
||||
bit_depth_groupbox_layout->addWidget(new QLabel(tr("Export (Online):")), 0, 2);
|
||||
bit_depth_groupbox_layout->addWidget(export_bit_depth, 0, 3);
|
||||
|
||||
color_management_layout->addWidget(bit_depth_groupbox, row, 0);
|
||||
|
||||
//row++;
|
||||
|
||||
populate_ocio_menus(OCIO::GetCurrentConfig());
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::Accept()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::populate_ocio_menus(OCIO::ConstConfigRcPtr config)
|
||||
{
|
||||
if (!config) {
|
||||
|
||||
// Just clear everything
|
||||
ocio_display->clear();
|
||||
ocio_default_input->clear();
|
||||
ocio_view->clear();
|
||||
ocio_look->clear();
|
||||
|
||||
} else {
|
||||
|
||||
// Get input color spaces for setting the default input color space
|
||||
ocio_default_input->clear();
|
||||
for (int i=0;i<config->getNumColorSpaces();i++) {
|
||||
QString colorspace = config->getColorSpaceNameByIndex(i);
|
||||
|
||||
ocio_default_input->addItem(colorspace);
|
||||
|
||||
/*if (colorspace == olive::config.ocio_default_input_colorspace) {
|
||||
ocio_default_input->setCurrentIndex(i);
|
||||
}*/
|
||||
}
|
||||
|
||||
// Get current display name (if the config is empty, get the current default display)
|
||||
/*QString current_display = olive::config.ocio_display;
|
||||
if (current_display.isEmpty()) {
|
||||
current_display = config->getDefaultDisplay();
|
||||
}*/
|
||||
|
||||
// Populate the display menu
|
||||
ocio_display->clear();
|
||||
for (int i=0;i<config->getNumDisplays();i++) {
|
||||
ocio_display->addItem(config->getDisplay(i));
|
||||
|
||||
// Check if this index is the currently selected
|
||||
/*if (config->getDisplay(i) == current_display) {
|
||||
ocio_display->setCurrentIndex(i);
|
||||
}*/
|
||||
}
|
||||
|
||||
update_ocio_view_menu(config);
|
||||
|
||||
// Populate the look menu
|
||||
ocio_look->clear();
|
||||
ocio_look->addItem(tr("(None)"), QString());
|
||||
for (int i=0;i<config->getNumLooks();i++) {
|
||||
const char* look = config->getLookNameByIndex(i);
|
||||
|
||||
ocio_look->addItem(look, look);
|
||||
|
||||
/*if (look == olive::config.ocio_look) {
|
||||
ocio_look->setCurrentIndex(i+1);
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
OCIO::ConstConfigRcPtr PreferencesColorManagementTab::TestOCIOConfig(const QString &url)
|
||||
{
|
||||
// Check whether OCIO can load it
|
||||
OCIO::ConstConfigRcPtr config;
|
||||
try {
|
||||
config = OCIO::Config::CreateFromFile(url.toUtf8());
|
||||
} catch (OCIO::Exception& e) {
|
||||
QMessageBox::critical(this,
|
||||
tr("OpenColorIO Config Error"),
|
||||
tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::update_ocio_view_menu(OCIO::ConstConfigRcPtr config)
|
||||
{
|
||||
|
||||
// Get views for the current display set in `ocio_display`
|
||||
QString display = ocio_display->currentText();
|
||||
|
||||
// Get current view
|
||||
/*QString current_view = olive::config.ocio_view;
|
||||
if (current_view.isEmpty()) {
|
||||
current_view = config->getDefaultView(display.toUtf8());
|
||||
}*/
|
||||
|
||||
// Populate the view menu
|
||||
int ocio_view_count = config->getNumViews(display.toUtf8());
|
||||
ocio_view->clear();
|
||||
for (int i=0;i<ocio_view_count;i++) {
|
||||
const char* view = config->getView(display.toUtf8(), i);
|
||||
|
||||
ocio_view->addItem(view);
|
||||
|
||||
/*if (current_view == view) {
|
||||
ocio_view->setCurrentIndex(i);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::update_ocio_config(const QString &s)
|
||||
{
|
||||
OCIO::ConstConfigRcPtr file_config;
|
||||
|
||||
if (!s.isEmpty() && QFileInfo::exists(s)) {
|
||||
file_config = TestOCIOConfig(s);
|
||||
}
|
||||
|
||||
populate_ocio_menus(file_config);
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::browse_ocio_config()
|
||||
{
|
||||
QString fn = QFileDialog::getOpenFileName(this, tr("Browse for OpenColorIO configuration"));
|
||||
if (!fn.isEmpty()) {
|
||||
ocio_config_file->setText(fn);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesColorManagementTab::update_ocio_view_menu()
|
||||
{
|
||||
update_ocio_view_menu(OCIO::GetCurrentConfig());
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#ifndef PREFERENCESCOLORMANAGEMENTTAB_H
|
||||
#define PREFERENCESCOLORMANAGEMENTTAB_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QLineEdit>
|
||||
#include <OpenColorIO/OpenColorIO.h>
|
||||
namespace OCIO = OCIO_NAMESPACE::v1;
|
||||
|
||||
#include "preferencestab.h"
|
||||
|
||||
class PreferencesColorManagementTab : public PreferencesTab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PreferencesColorManagementTab();
|
||||
|
||||
virtual void Accept() override;
|
||||
|
||||
private slots:
|
||||
// OCIO function
|
||||
void browse_ocio_config();
|
||||
void update_ocio_view_menu();
|
||||
void update_ocio_view_menu(OCIO::ConstConfigRcPtr config);
|
||||
void update_ocio_config(const QString&);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Tests an OpenColorIO configuration file to determine whether it's valid and throws a messagebox if not
|
||||
*
|
||||
* @param url
|
||||
*
|
||||
* URL to the OpenColorIO configuration file.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* A OCIO::ConstConfigRcPtr config pointer if the configuration file is valid, nullptr if not.
|
||||
*/
|
||||
OCIO::ConstConfigRcPtr TestOCIOConfig(const QString& url);
|
||||
|
||||
void populate_ocio_menus(OCIO::ConstConfigRcPtr config);
|
||||
|
||||
QLineEdit* ocio_config_file;
|
||||
QComboBox* ocio_default_input;
|
||||
QComboBox* ocio_display;
|
||||
QComboBox* ocio_view;
|
||||
QComboBox* ocio_look;
|
||||
QComboBox* playback_bit_depth;
|
||||
QComboBox* export_bit_depth;
|
||||
};
|
||||
|
||||
#endif // PREFERENCESCOLORMANAGEMENTTAB_H
|
||||
@@ -20,9 +20,14 @@
|
||||
|
||||
#include "imagestream.h"
|
||||
|
||||
ImageStream::ImageStream()
|
||||
#include "render/colormanager.h"
|
||||
|
||||
ImageStream::ImageStream() :
|
||||
premultiplied_alpha_(false)
|
||||
{
|
||||
set_type(kImage);
|
||||
|
||||
connect(ColorManager::instance(), SIGNAL(ConfigChanged()), this, SLOT(ColorConfigChangedSlot()));
|
||||
}
|
||||
|
||||
QString ImageStream::description()
|
||||
@@ -51,3 +56,31 @@ void ImageStream::set_height(const int &height)
|
||||
{
|
||||
height_ = height;
|
||||
}
|
||||
|
||||
bool ImageStream::premultiplied_alpha()
|
||||
{
|
||||
return premultiplied_alpha_;
|
||||
}
|
||||
|
||||
void ImageStream::set_premultiplied_alpha(bool e)
|
||||
{
|
||||
premultiplied_alpha_ = e;
|
||||
}
|
||||
|
||||
const QString &ImageStream::colorspace()
|
||||
{
|
||||
return colorspace_;
|
||||
}
|
||||
|
||||
void ImageStream::set_colorspace(const QString &color)
|
||||
{
|
||||
colorspace_ = color;
|
||||
|
||||
emit ColorSpaceChanged();
|
||||
}
|
||||
|
||||
void ImageStream::ColorConfigChangedSlot()
|
||||
{
|
||||
// FIXME: Update colorspace correctly
|
||||
colorspace_.clear();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/**
|
||||
* @brief A Stream derivative containing video-specific information
|
||||
*/
|
||||
class ImageStream : public Stream
|
||||
class ImageStream : public Stream, public QObject
|
||||
{
|
||||
public:
|
||||
ImageStream();
|
||||
@@ -39,9 +39,23 @@ public:
|
||||
const int& height();
|
||||
void set_height(const int& height);
|
||||
|
||||
bool premultiplied_alpha();
|
||||
void set_premultiplied_alpha(bool e);
|
||||
|
||||
const QString& colorspace();
|
||||
void set_colorspace(const QString& color);
|
||||
|
||||
signals:
|
||||
void ColorSpaceChanged();
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
bool premultiplied_alpha_;
|
||||
QString colorspace_;
|
||||
|
||||
private slots:
|
||||
void ColorConfigChangedSlot();
|
||||
};
|
||||
|
||||
using ImageStreamPtr = std::shared_ptr<ImageStream>;
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
rational frame_rate_;
|
||||
|
||||
};
|
||||
|
||||
using VideoStreamPtr = std::shared_ptr<VideoStream>;
|
||||
|
||||
@@ -113,7 +113,7 @@ PlaybackControls::PlaybackControls(QWidget *parent) :
|
||||
lower_right_layout->setMargin(0);
|
||||
|
||||
lower_right_layout->addStretch();
|
||||
end_tc_lbl_ = new QLabel("00:00:00;00");
|
||||
end_tc_lbl_ = new QLabel();
|
||||
lower_right_layout->addWidget(end_tc_lbl_);
|
||||
|
||||
UpdateIcons();
|
||||
@@ -132,7 +132,9 @@ void PlaybackControls::SetTimebase(const rational &r)
|
||||
|
||||
void PlaybackControls::SetTime(const int64_t &r)
|
||||
{
|
||||
Q_ASSERT(time_base_.denominator() != 0);
|
||||
if (time_base_.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
cur_tc_lbl_->setText(olive::timestamp_to_timecode(r,
|
||||
time_base_,
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "dialog/footageproperties/footageproperties.h"
|
||||
#include "projectexplorerdefines.h"
|
||||
|
||||
ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
@@ -47,14 +49,17 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
|
||||
// Add tree view to stacked widget
|
||||
tree_view_ = new ProjectExplorerTreeView(stacked_widget_);
|
||||
tree_view_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
AddView(tree_view_);
|
||||
|
||||
// Add list view to stacked widget
|
||||
list_view_ = new ProjectExplorerListView(stacked_widget_);
|
||||
list_view_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
AddView(list_view_);
|
||||
|
||||
// Add icon view to stacked widget
|
||||
icon_view_ = new ProjectExplorerIconView(stacked_widget_);
|
||||
icon_view_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
AddView(icon_view_);
|
||||
|
||||
// Set default view to tree view
|
||||
@@ -66,6 +71,10 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
// Set rename timer timeout
|
||||
rename_timer_.setInterval(500);
|
||||
connect(&rename_timer_, SIGNAL(timeout()), this, SLOT(RenameTimerSlot()));
|
||||
|
||||
connect(tree_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
connect(list_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
connect(icon_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
}
|
||||
|
||||
const olive::ProjectViewType &ProjectExplorer::view_type()
|
||||
@@ -210,6 +219,29 @@ void ProjectExplorer::RenameTimerSlot()
|
||||
rename_timer_.stop();
|
||||
}
|
||||
|
||||
void ProjectExplorer::ShowContextMenu()
|
||||
{
|
||||
QMenu menu;
|
||||
|
||||
// FIXME: Support for multiple items and items other than Footage
|
||||
QList<Item*> selected_items = SelectedItems();
|
||||
|
||||
QAction* properties_action = menu.addAction(tr("P&roperties"));
|
||||
|
||||
if (selected_items.first()->type() == Item::kFootage) {
|
||||
connect(properties_action, SIGNAL(triggered(bool)), this, SLOT(ShowFootagePropertiesDialog()));
|
||||
}
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void ProjectExplorer::ShowFootagePropertiesDialog()
|
||||
{
|
||||
// FIXME: Support for multiple items and items other than Footage
|
||||
FootagePropertiesDialog fpd(this, static_cast<Footage*>(SelectedItems().first()));
|
||||
fpd.exec();
|
||||
}
|
||||
|
||||
Project *ProjectExplorer::project()
|
||||
{
|
||||
return model_.project();
|
||||
|
||||
@@ -142,6 +142,10 @@ private slots:
|
||||
void DirUpSlot();
|
||||
|
||||
void RenameTimerSlot();
|
||||
|
||||
void ShowContextMenu();
|
||||
|
||||
void ShowFootagePropertiesDialog();
|
||||
};
|
||||
|
||||
#endif // PROJECTEXPLORER_H
|
||||
|
||||
Reference in New Issue
Block a user