updated scope panel to be permanent

Never liked how this was set up before. This makes more sense to me.
This commit is contained in:
itsmattkc
2022-01-02 14:05:25 -08:00
parent 61f65a3def
commit f6f67e895d
10 changed files with 88 additions and 59 deletions
+27 -2
View File
@@ -27,7 +27,8 @@
namespace olive {
ScopePanel::ScopePanel(QWidget* parent) :
PanelWidget(QStringLiteral("ScopePanel"), parent)
PanelWidget(QStringLiteral("ScopePanel"), parent),
viewer_(nullptr)
{
QWidget* central = new QWidget();
setWidget(central);
@@ -84,6 +85,30 @@ QString ScopePanel::TypeToName(ScopePanel::Type t)
return QString();
}
void ScopePanel::SetViewerPanel(ViewerPanelBase *vp)
{
if (viewer_ == vp) {
return;
}
if (viewer_) {
disconnect(viewer_, &ViewerPanelBase::TextureChanged, this, &ScopePanel::SetReferenceBuffer);
disconnect(viewer_, &ViewerPanelBase::ColorManagerChanged, this, &ScopePanel::SetColorManager);
}
viewer_ = vp;
if (viewer_) {
// Connect viewer widget texture drawing to scope panel
connect(viewer_, &ViewerPanelBase::TextureChanged, this, &ScopePanel::SetReferenceBuffer);
connect(viewer_, &ViewerPanelBase::ColorManagerChanged, this, &ScopePanel::SetColorManager);
SetColorManager(viewer_->GetColorManager());
viewer_->UpdateTextureFromNode();
}
}
void ScopePanel::SetReferenceBuffer(TexturePtr frame)
{
histogram_->SetBuffer(frame);
@@ -98,7 +123,7 @@ void ScopePanel::SetColorManager(ColorManager *manager)
void ScopePanel::Retranslate()
{
SetTitle(tr("Scope"));
SetTitle(tr("Scopes"));
for (int i=0;i<ScopePanel::kTypeCount;i++) {
scope_type_combobox_->setItemText(i, TypeToName(static_cast<Type>(i)));
+10 -2
View File
@@ -24,14 +24,13 @@
#include <QComboBox>
#include <QStackedWidget>
#include "panel/viewer/viewerbase.h"
#include "widget/panel/panel.h"
#include "widget/scope/histogram/histogram.h"
#include "widget/scope/waveform/waveform.h"
namespace olive {
class ViewerPanel;
class ScopePanel : public PanelWidget
{
Q_OBJECT
@@ -49,6 +48,13 @@ public:
static QString TypeToName(Type t);
void SetViewerPanel(ViewerPanelBase *vp);
ViewerPanelBase *GetConnectedViewerPanel() const
{
return viewer_;
}
public slots:
void SetReferenceBuffer(TexturePtr frame);
@@ -68,6 +74,8 @@ private:
HistogramScope* histogram_;
ViewerPanelBase *viewer_;
};
}