viewer/various: split off color management into separate base class

Also moves scopes to said base class.
This commit is contained in:
itsmattkc
2020-04-24 03:45:07 +10:00
18 changed files with 203 additions and 131 deletions
+6 -2
View File
@@ -110,7 +110,7 @@ QString FileFunctions::GetTempFilePath()
return temp_path;
}
void FileFunctions::CopyDirectory(const QString &source, const QString &dest)
void FileFunctions::CopyDirectory(const QString &source, const QString &dest, bool overwrite)
{
QDir d(source);
@@ -138,9 +138,13 @@ void FileFunctions::CopyDirectory(const QString &source, const QString &dest)
if (info.isDir()) {
// Copy dir
CopyDirectory(info.absoluteFilePath(), dest_file_path);
CopyDirectory(info.absoluteFilePath(), dest_file_path, overwrite);
} else {
// Copy file
if (overwrite && QFile::exists(dest_file_path)) {
QFile::remove(dest_file_path);
}
QFile::copy(info.absoluteFilePath(), dest_file_path);
}
}
+2 -1
View File
@@ -54,7 +54,8 @@ public:
static QString GetTempFilePath();
static void CopyDirectory(const QString& source, const QString& dest);
static void CopyDirectory(const QString& source, const QString& dest, bool overwrite = false);
};
+11 -5
View File
@@ -84,19 +84,25 @@ QString ScopePanel::TypeToName(ScopePanel::Type t)
return QString();
}
void ScopePanel::DrewManagedTexture(OpenGLTexture *texture)
void ScopePanel::SetDisplayReferredTexture(OpenGLTexture *texture)
{
waveform_view_->SetTexture(texture);
Q_UNUSED(texture)
}
void ScopePanel::SetBuffer(Frame *frame)
void ScopePanel::SetReferenceBuffer(Frame *frame)
{
histogram_->SetBuffer(frame);
}
void ScopePanel::SetColorProcessor(ColorProcessorPtr processor)
void ScopePanel::SetReferenceTexture(OpenGLTexture *texture)
{
histogram_->SetColorProcessor(processor);
waveform_view_->SetTexture(texture);
}
void ScopePanel::SetColorManager(ColorManager *manager)
{
histogram_->ConnectColorManager(manager);
waveform_view_->ConnectColorManager(manager);
}
void ScopePanel::Retranslate()
+5 -3
View File
@@ -50,11 +50,13 @@ public:
static QString TypeToName(Type t);
public slots:
void DrewManagedTexture(OpenGLTexture* texture);
void SetDisplayReferredTexture(OpenGLTexture* texture);
void SetBuffer(Frame* frame);
void SetReferenceBuffer(Frame* frame);
void SetColorProcessor(ColorProcessorPtr processor);
void SetReferenceTexture(OpenGLTexture* texture);
void SetColorManager(ColorManager* manager);
protected:
virtual void Retranslate() override;
+6 -3
View File
@@ -105,9 +105,12 @@ void ViewerPanelBase::CreateScopePanel(ScopePanel::Type type)
connect(p, &ScopePanel::CloseRequested, this, &ViewerPanelBase::ScopePanelClosed);
// Connect viewer widget texture drawing to scope panel
connect(vw, &ViewerWidget::DrewManagedTexture, p, &ScopePanel::DrewManagedTexture);
connect(vw, &ViewerWidget::LoadedBuffer, p, &ScopePanel::SetBuffer);
connect(vw, &ViewerWidget::ColorProcessorChanged, p, &ScopePanel::SetColorProcessor);
connect(vw, &ViewerWidget::DrewManagedTexture, p, &ScopePanel::SetDisplayReferredTexture);
connect(vw, &ViewerWidget::LoadedBuffer, p, &ScopePanel::SetReferenceBuffer);
connect(vw, &ViewerWidget::LoadedTexture, p, &ScopePanel::SetReferenceTexture);
connect(vw, &ViewerWidget::ColorManagerChanged, p, &ScopePanel::SetColorManager);
p->SetColorManager(vw->color_manager());
if (!scope_panel_count_) {
vw->SetEmitDrewManagedTextureEnabled(true);
@@ -202,19 +202,19 @@ void OpenGLRenderFunctions::OCIOBlit(OpenGLShader *pipeline,
QOpenGLContext* ctx = QOpenGLContext::currentContext();
QOpenGLExtraFunctions* xf = ctx->extraFunctions();
xf->glActiveTexture(GL_TEXTURE2);
xf->glActiveTexture(GL_TEXTURE1);
xf->glBindTexture(GL_TEXTURE_3D, lut);
xf->glActiveTexture(GL_TEXTURE0);
pipeline->bind();
pipeline->setUniformValue("ove_ociolut", 2);
pipeline->setUniformValue("ove_ociolut", 1);
Blit(pipeline, flipped, matrix);
pipeline->release();
xf->glActiveTexture(GL_TEXTURE2);
xf->glActiveTexture(GL_TEXTURE1);
xf->glBindTexture(GL_TEXTURE_3D, 0);
xf->glActiveTexture(GL_TEXTURE0);
}
+11 -5
View File
@@ -44,7 +44,7 @@ OpenGLShaderPtr OpenGLShader::CreateDefault(const QString &function_name, const
const int OCIO_LUT3D_EDGE_SIZE = 32;
// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE
const int OCIO_NUM_3D_ENTRIES = 98304;
const int OCIO_NUM_3D_ENTRIES = 3*OCIO_LUT3D_EDGE_SIZE*OCIO_LUT3D_EDGE_SIZE*OCIO_LUT3D_EDGE_SIZE;
OpenGLShaderPtr OpenGLShader::CreateOCIO(QOpenGLContext* ctx,
GLuint& lut_texture,
@@ -56,18 +56,19 @@ OpenGLShaderPtr OpenGLShader::CreateOCIO(QOpenGLContext* ctx,
// Set up shader description
OCIO::GpuShaderDesc shaderDesc;
const char* ocio_func_name = "OCIODisplay";
shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_0);
shaderDesc.setLanguage(OCIO::GPU_LANGUAGE_GLSL_1_3);
shaderDesc.setFunctionName(ocio_func_name);
shaderDesc.setLut3DEdgeLen(OCIO_LUT3D_EDGE_SIZE);
// Compute LUT
GLfloat ocio_lut_data[OCIO_NUM_3D_ENTRIES];
GLfloat* ocio_lut_data = new GLfloat[OCIO_NUM_3D_ENTRIES];
processor->getGpuLut3D(ocio_lut_data, shaderDesc);
// Create LUT texture
xf->glGenTextures(1, &lut_texture);
// Bind LUT
xf->glActiveTexture(GL_TEXTURE1);
xf->glBindTexture(GL_TEXTURE_3D, lut_texture);
// Set texture parameters
@@ -78,10 +79,13 @@ OpenGLShaderPtr OpenGLShader::CreateOCIO(QOpenGLContext* ctx,
xf->glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
// Allocate storage for texture
xf->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F_ARB,
xf->glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB16F,
OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE, OCIO_LUT3D_EDGE_SIZE,
0, GL_RGB, GL_FLOAT, ocio_lut_data);
// Delete local copy
delete [] ocio_lut_data;
// Create OCIO shader code
QString shader_text;
@@ -107,7 +111,7 @@ OpenGLShaderPtr OpenGLShader::CreateOCIO(QOpenGLContext* ctx,
shader_text.append(CodeAlphaReassociate(reassociate_func_name));
// Make OCIO call pass through disassociate and reassociate function
shader_call = QStringLiteral("%3(%1(%2(col*1.001), ove_ociolut));").arg(ocio_func_name,
shader_call = QStringLiteral("%3(%1(%2(col), ove_ociolut));").arg(ocio_func_name,
disassociate_func_name,
reassociate_func_name);
@@ -140,6 +144,8 @@ OpenGLShaderPtr OpenGLShader::CreateOCIO(QOpenGLContext* ctx,
// Release LUT
xf->glBindTexture(GL_TEXTURE_3D, 0);
xf->glActiveTexture(GL_TEXTURE0);
return shader;
}
+4 -1
View File
@@ -65,7 +65,10 @@ void ColorManager::SetUpDefaultConfig()
QString dir = QDir(FileFunctions::GetTempFilePath()).filePath(QStringLiteral("ocioconf"));
FileFunctions::CopyDirectory(QStringLiteral(":/ocioconf"),
dir);
dir,
true);
qDebug() << "Extracting default OCIO config to" << dir;
default_config_ = OCIO::Config::CreateFromFile(QDir(dir).filePath(QStringLiteral("config.ocio")).toUtf8());
}
+81 -19
View File
@@ -24,48 +24,50 @@
OLIVE_NAMESPACE_ENTER
ManagedDisplayObject::ManagedDisplayObject(QWidget *parent) :
ManagedDisplayWidget::ManagedDisplayWidget(QWidget *parent) :
QOpenGLWidget(parent),
color_manager_(nullptr),
color_service_(nullptr)
{
setContextMenuPolicy(Qt::CustomContextMenu);
}
void ManagedDisplayObject::ConnectColorManager(ColorManager *color_manager)
void ManagedDisplayWidget::ConnectColorManager(ColorManager *color_manager)
{
if (color_manager_ == color_manager) {
return;
}
if (color_manager_ != nullptr) {
disconnect(color_manager_, &ColorManager::ConfigChanged, this, &ManagedDisplayObject::ColorConfigChanged);
disconnect(color_manager_, &ColorManager::ConfigChanged, this, &ManagedDisplayWidget::ColorConfigChanged);
}
color_manager_ = color_manager;
if (color_manager_ != nullptr) {
connect(color_manager_, &ColorManager::ConfigChanged, this, &ManagedDisplayObject::ColorConfigChanged);
connect(color_manager_, &ColorManager::ConfigChanged, this, &ManagedDisplayWidget::ColorConfigChanged);
}
ColorConfigChanged();
emit ColorManagerChanged(color_manager_);
}
ColorManager *ManagedDisplayObject::color_manager() const
ColorManager *ManagedDisplayWidget::color_manager() const
{
return color_manager_;
}
void ManagedDisplayObject::DisconnectColorManager()
void ManagedDisplayWidget::DisconnectColorManager()
{
ConnectColorManager(nullptr);
}
const ColorTransform &ManagedDisplayObject::GetColorTransform() const
const ColorTransform &ManagedDisplayWidget::GetColorTransform() const
{
return color_transform_;
}
void ManagedDisplayObject::ColorConfigChanged()
void ManagedDisplayWidget::ColorConfigChanged()
{
if (!color_manager_) {
color_service_ = nullptr;
@@ -75,12 +77,12 @@ void ManagedDisplayObject::ColorConfigChanged()
SetColorTransform(color_manager_->GetCompliantColorSpace(color_transform_, true));
}
OpenGLColorProcessorPtr ManagedDisplayObject::color_service()
OpenGLColorProcessorPtr ManagedDisplayWidget::color_service()
{
return color_service_;
}
void ManagedDisplayObject::ContextCleanup()
void ManagedDisplayWidget::ContextCleanup()
{
makeCurrent();
@@ -89,7 +91,23 @@ void ManagedDisplayObject::ContextCleanup()
doneCurrent();
}
void ManagedDisplayObject::MenuDisplaySelect(QAction *action)
void ManagedDisplayWidget::ShowDefaultContextMenu()
{
Menu m(this);
if (color_manager_) {
m.addMenu(GetDisplayMenu(&m));
m.addMenu(GetViewMenu(&m));
m.addMenu(GetLookMenu(&m));
} else {
QAction* a = m.addAction(tr("No color manager connected"));
a->setEnabled(false);
}
m.exec(QCursor::pos());
}
void ManagedDisplayWidget::MenuDisplaySelect(QAction *action)
{
const ColorTransform& old_transform = GetColorTransform();
@@ -100,26 +118,62 @@ void ManagedDisplayObject::MenuDisplaySelect(QAction *action)
SetColorTransform(new_transform);
}
void ManagedDisplayObject::SetColorTransform(const ColorTransform &transform)
void ManagedDisplayWidget::MenuViewSelect(QAction *action)
{
const ColorTransform& old_transform = GetColorTransform();
ColorTransform new_transform = color_manager()->GetCompliantColorSpace(ColorTransform(old_transform.display(),
action->data().toString(),
old_transform.look()));
SetColorTransform(new_transform);
}
void ManagedDisplayWidget::MenuLookSelect(QAction *action)
{
const ColorTransform& old_transform = GetColorTransform();
ColorTransform new_transform = color_manager()->GetCompliantColorSpace(ColorTransform(old_transform.display(),
old_transform.view(),
action->data().toString()));
SetColorTransform(new_transform);
}
void ManagedDisplayWidget::SetColorTransform(const ColorTransform &transform)
{
color_transform_ = transform;
SetupColorProcessor();
update();
ColorProcessorChangedEvent();
}
void ManagedDisplayObject::initializeGL()
void ManagedDisplayWidget::initializeGL()
{
SetupColorProcessor();
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &ManagedDisplayObject::ContextCleanup, Qt::DirectConnection);
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &ManagedDisplayWidget::ContextCleanup, Qt::DirectConnection);
}
Menu* ManagedDisplayObject::GetDisplayMenu(QMenu* parent, bool auto_connect)
void ManagedDisplayWidget::EnableDefaultContextMenu()
{
connect(this, &ManagedDisplayWidget::customContextMenuRequested, this, &ManagedDisplayWidget::ShowDefaultContextMenu);
}
void ManagedDisplayWidget::ColorProcessorChangedEvent()
{
update();
}
Menu* ManagedDisplayWidget::GetDisplayMenu(QMenu* parent, bool auto_connect)
{
QStringList displays = color_manager()->ListAvailableDisplays();
Menu* ocio_display_menu = new Menu(tr("Display"), parent);
if (auto_connect) {
connect(ocio_display_menu, &Menu::triggered, this, &ManagedDisplayWidget::MenuDisplaySelect);
}
foreach (const QString& d, displays) {
QAction* action = ocio_display_menu->addAction(d);
action->setCheckable(true);
@@ -130,12 +184,16 @@ Menu* ManagedDisplayObject::GetDisplayMenu(QMenu* parent, bool auto_connect)
return ocio_display_menu;
}
Menu* ManagedDisplayObject::GetViewMenu(QMenu* parent)
Menu* ManagedDisplayWidget::GetViewMenu(QMenu* parent, bool auto_connect)
{
QStringList views = color_manager()->ListAvailableViews(color_transform_.display());
Menu* ocio_view_menu = new Menu(tr("View"), parent);
if (auto_connect) {
connect(ocio_view_menu, &Menu::triggered, this, &ManagedDisplayWidget::MenuViewSelect);
}
foreach (const QString& v, views) {
QAction* action = ocio_view_menu->addAction(v);
action->setCheckable(true);
@@ -146,12 +204,16 @@ Menu* ManagedDisplayObject::GetViewMenu(QMenu* parent)
return ocio_view_menu;
}
Menu* ManagedDisplayObject::GetLookMenu(QMenu* parent, bool auto_connect)
Menu* ManagedDisplayWidget::GetLookMenu(QMenu* parent, bool auto_connect)
{
QStringList looks = color_manager()->ListAvailableLooks();
Menu* ocio_look_menu = new Menu(tr("Look"), parent);
if (auto_connect) {
connect(ocio_look_menu, &Menu::triggered, this, &ManagedDisplayWidget::MenuLookSelect);
}
// Setup "no look" action
QAction* no_look_action = ocio_look_menu->addAction(tr("(None)"));
no_look_action->setCheckable(true);
@@ -169,7 +231,7 @@ Menu* ManagedDisplayObject::GetLookMenu(QMenu* parent, bool auto_connect)
return ocio_look_menu;
}
void ManagedDisplayObject::SetupColorProcessor()
void ManagedDisplayWidget::SetupColorProcessor()
{
if (!context()) {
return;
+34 -7
View File
@@ -29,16 +29,11 @@
OLIVE_NAMESPACE_ENTER
class ManagedDisplayObject : public QOpenGLWidget
class ManagedDisplayWidget : public QOpenGLWidget
{
Q_OBJECT
public:
ManagedDisplayObject(QWidget* parent = nullptr);
/**
* @brief Connect a ColorManager (ColorManagers usually belong to the Project)
*/
void ConnectColorManager(ColorManager* color_manager);
ManagedDisplayWidget(QWidget* parent = nullptr);
/**
* @brief Disconnect a ColorManager (equivalent to ConnectColorManager(nullptr))
@@ -76,12 +71,22 @@ public slots:
*/
void SetColorTransform(const ColorTransform& transform);
/**
* @brief Connect a ColorManager (ColorManagers usually belong to the Project)
*/
void ConnectColorManager(ColorManager* color_manager);
signals:
/**
* @brief Emitted when the color processor changes
*/
void ColorProcessorChanged(ColorProcessorPtr processor);
/**
* @brief Emitted when a new color manager is connected
*/
void ColorManagerChanged(ColorManager* color_manager);
protected:
/**
* @brief Provides access to the color processor (nullptr if none is set)
@@ -93,6 +98,18 @@ protected:
*/
virtual void initializeGL() override;
/**
* @brief Enables a context menu that allows simple access to the DVL pipeline
*/
void EnableDefaultContextMenu();
/**
* @brief Function called whenever the processor changes
*
* Default functionality is just to call update()
*/
virtual void ColorProcessorChangedEvent();
private:
/**
* @brief Call this if this user has selected a different display/view/look to recreate the processor
@@ -130,6 +147,11 @@ private slots:
*/
void ContextCleanup();
/**
* @brief The default context menu shown
*/
void ShowDefaultContextMenu();
/**
* @brief If GetDisplayMenu() is called with `auto_connect` set to true, it will be connected to this
*/
@@ -140,6 +162,11 @@ private slots:
*/
void MenuViewSelect(QAction* action);
/**
* @brief If GetLookMenu() is called with `auto_connect` set to true, it will be connected to this
*/
void MenuLookSelect(QAction* action);
};
OLIVE_NAMESPACE_EXIT
+10 -11
View File
@@ -29,10 +29,11 @@
OLIVE_NAMESPACE_ENTER
HistogramScope::HistogramScope(QWidget* parent) :
QOpenGLWidget(parent),
buffer_(nullptr),
processor_(nullptr)
ManagedDisplayWidget(parent),
buffer_(nullptr)
{
EnableDefaultContextMenu();
connect(&worker_, &HistogramScopeWorker::Finished, this, &HistogramScope::FinishedProcessing, Qt::QueuedConnection);
worker_.start(QThread::IdlePriority);
}
@@ -51,13 +52,6 @@ void HistogramScope::SetBuffer(Frame* frame)
StartUpdate();
}
void HistogramScope::SetColorProcessor(ColorProcessorPtr processor)
{
processor_ = processor;
StartUpdate();
}
void HistogramScope::FinishedProcessing(QVector<double> red, QVector<double> green, QVector<double> blue)
{
red_val_ = red;
@@ -99,10 +93,15 @@ void HistogramScope::resizeEvent(QResizeEvent *e)
StartUpdate();
}
void HistogramScope::ColorProcessorChangedEvent()
{
StartUpdate();
}
void HistogramScope::StartUpdate()
{
if (buffer_) {
worker_.QueueNext(*buffer_, processor_, width());
worker_.QueueNext(*buffer_, color_service(), width());
} else {
// Update with nothing
red_val_.clear();
+4 -7
View File
@@ -22,12 +22,12 @@
#define HISTOGRAMSCOPE_H
#include <QMutex>
#include <QOpenGLWidget>
#include <QThread>
#include <QWaitCondition>
#include "codec/frame.h"
#include "render/colorprocessor.h"
#include "widget/manageddisplay/manageddisplay.h"
OLIVE_NAMESPACE_ENTER
@@ -60,7 +60,7 @@ private:
};
class HistogramScope : public QOpenGLWidget
class HistogramScope : public ManagedDisplayWidget
{
Q_OBJECT
public:
@@ -71,21 +71,18 @@ public:
public slots:
void SetBuffer(Frame* frame);
void SetColorProcessor(ColorProcessorPtr processor);
protected:
// virtual void paintEvent(QPaintEvent* e) override;
virtual void paintGL() override;
virtual void resizeEvent(QResizeEvent* e) override;
virtual void ColorProcessorChangedEvent() override;
private:
void StartUpdate();
Frame* buffer_;
ColorProcessorPtr processor_;
QVector<double> red_val_;
QVector<double> green_val_;
+4 -2
View File
@@ -27,10 +27,10 @@
OLIVE_NAMESPACE_ENTER
WaveformScope::WaveformScope(QWidget* parent) :
QOpenGLWidget(parent),
ManagedDisplayWidget(parent),
texture_(nullptr)
{
EnableDefaultContextMenu();
}
void WaveformScope::SetTexture(OpenGLTexture *texture)
@@ -42,6 +42,8 @@ void WaveformScope::SetTexture(OpenGLTexture *texture)
void WaveformScope::initializeGL()
{
ManagedDisplayWidget::initializeGL();
pipeline_ = OpenGLShader::Create();
pipeline_->create();
pipeline_->addShaderFromSourceCode(QOpenGLShader::Vertex, OpenGLShader::CodeDefaultVertex());
+2 -3
View File
@@ -21,16 +21,15 @@
#ifndef WAVEFORMSCOPE_H
#define WAVEFORMSCOPE_H
#include <QOpenGLWidget>
#include "codec/frame.h"
#include "render/backend/opengl/openglcolorprocessor.h"
#include "render/backend/opengl/openglshader.h"
#include "render/backend/opengl/opengltexture.h"
#include "widget/manageddisplay/manageddisplay.h"
OLIVE_NAMESPACE_ENTER
class WaveformScope : public QOpenGLWidget
class WaveformScope : public ManagedDisplayWidget
{
Q_OBJECT
public:
+6 -36
View File
@@ -69,6 +69,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
connect(main_widget, &ViewerGLWidget::LoadedTexture, this, &ViewerWidget::LoadedTexture);
connect(main_widget, &ViewerGLWidget::DrewManagedTexture, this, &ViewerWidget::DrewManagedTexture);
connect(main_widget, &ViewerGLWidget::ColorProcessorChanged, this, &ViewerWidget::ColorProcessorChanged);
connect(main_widget, &ViewerGLWidget::ColorManagerChanged, this, &ViewerWidget::ColorManagerChanged);
connect(sizer_, &ViewerSizer::RequestMatrix, main_widget, &ViewerGLWidget::SetMatrix);
sizer_->SetWidget(main_widget);
gl_widgets_.append(main_widget);
@@ -329,6 +330,11 @@ VideoRenderBackend *ViewerWidget::video_renderer() const
return video_renderer_;
}
ColorManager *ViewerWidget::color_manager() const
{
return main_gl_widget()->color_manager();
}
void ViewerWidget::UpdateTextureFromNode(const rational& time)
{
if (!GetConnectedNode() || time >= GetConnectedNode()->Length()) {
@@ -544,19 +550,16 @@ void ViewerWidget::ShowContextMenu(const QPoint &pos)
{
Menu* ocio_display_menu = context_menu_widget_->GetDisplayMenu(&menu);
menu.addMenu(ocio_display_menu);
connect(ocio_display_menu, &QMenu::triggered, this, &ViewerWidget::ContextMenuOCIODisplay);
}
{
Menu* ocio_view_menu = context_menu_widget_->GetViewMenu(&menu);
menu.addMenu(ocio_view_menu);
connect(ocio_view_menu, &QMenu::triggered, this, &ViewerWidget::ContextMenuOCIOView);
}
{
Menu* ocio_look_menu = context_menu_widget_->GetLookMenu(&menu);
menu.addMenu(ocio_look_menu);
connect(ocio_look_menu, &QMenu::triggered, this, &ViewerWidget::ContextMenuOCIOLook);
}
menu.addSeparator();
@@ -847,39 +850,6 @@ void ViewerWidget::LengthChangedSlot(const rational &length)
UpdateMinimumScale();
}
void ViewerWidget::ContextMenuOCIODisplay(QAction* action)
{
const ColorTransform& old_transform = context_menu_widget_->GetColorTransform();
ColorTransform new_transform = context_menu_widget_->color_manager()->GetCompliantColorSpace(ColorTransform(action->data().toString(),
old_transform.view(),
old_transform.look()));
SetColorTransform(new_transform, context_menu_widget_);
}
void ViewerWidget::ContextMenuOCIOView(QAction *action)
{
const ColorTransform& old_transform = context_menu_widget_->GetColorTransform();
ColorTransform new_transform = context_menu_widget_->color_manager()->GetCompliantColorSpace(ColorTransform(old_transform.display(),
action->data().toString(),
old_transform.look()));
SetColorTransform(new_transform, context_menu_widget_);
}
void ViewerWidget::ContextMenuOCIOLook(QAction *action)
{
const ColorTransform& old_transform = context_menu_widget_->GetColorTransform();
ColorTransform new_transform = context_menu_widget_->color_manager()->GetCompliantColorSpace(ColorTransform(old_transform.display(),
old_transform.view(),
action->data().toString()));
SetColorTransform(new_transform, context_menu_widget_);
}
void ViewerWidget::SetDividerFromMenu(QAction *action)
{
int divider = action->data().toInt();
+7 -15
View File
@@ -85,6 +85,8 @@ public:
VideoRenderBackend* video_renderer() const;
ColorManager* color_manager() const;
public slots:
void Play(bool in_to_out_only);
@@ -143,6 +145,11 @@ signals:
*/
void ColorProcessorChanged(ColorProcessorPtr processor);
/**
* @brief Wrapper for ViewerGLWidget::ColorManagerChanged()
*/
void ColorManagerChanged(ColorManager* color_manager);
protected:
virtual void TimebaseChangedEvent(const rational &) override;
virtual void TimeChangedEvent(const int64_t &) override;
@@ -222,21 +229,6 @@ private slots:
void ShowContextMenu(const QPoint& pos);
/**
* @brief Slot called whenever this viewer's OCIO display setting has changed
*/
void ContextMenuOCIODisplay(QAction* action);
/**
* @brief Slot called whenever this viewer's OCIO view setting has changed
*/
void ContextMenuOCIOView(QAction* action);
/**
* @brief Slot called whenever this viewer's OCIO look setting has changed
*/
void ContextMenuOCIOLook(QAction* action);
void SetDividerFromMenu(QAction* action);
void SetZoomFromMenu(QAction* action);
+2 -3
View File
@@ -41,13 +41,12 @@ bool ViewerGLWidget::nouveau_check_done_ = false;
#endif
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
ManagedDisplayObject(parent),
ManagedDisplayWidget(parent),
managed_copy_pipeline_(nullptr),
has_image_(false),
signal_cursor_color_(false),
enable_display_referred_signal_(false)
{
setContextMenuPolicy(Qt::CustomContextMenu);
}
ViewerGLWidget::~ViewerGLWidget()
@@ -212,7 +211,7 @@ void ViewerGLWidget::mouseMoveEvent(QMouseEvent *event)
void ViewerGLWidget::initializeGL()
{
ManagedDisplayObject::initializeGL();
ManagedDisplayWidget::initializeGL();
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &ViewerGLWidget::ContextCleanup, Qt::DirectConnection);
+1 -1
View File
@@ -49,7 +49,7 @@ OLIVE_NAMESPACE_ENTER
* the same texture object, use SetTexture() since it will nearly always be faster to just set it than to check *and*
* set it.
*/
class ViewerGLWidget : public ManagedDisplayObject
class ViewerGLWidget : public ManagedDisplayWidget
{
Q_OBJECT
public: