further development on rewrite

This commit is contained in:
itsmattkc
2019-06-17 16:05:51 -07:00
parent 9afbe92574
commit a468b3727d
314 changed files with 1504 additions and 147 deletions
+2
View File
@@ -16,7 +16,9 @@
add_subdirectory(viewer)
add_subdirectory(panel)
add_subdirectory(playbackcontrols)
add_subdirectory(projectexplorer)
add_subdirectory(projecttoolbar)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
+3 -1
View File
@@ -1,6 +1,8 @@
#include "panel.h"
PanelWidget::PanelWidget(QWidget *parent) {
PanelWidget::PanelWidget(QWidget *parent) :
QDockWidget(parent)
{
}
void PanelWidget::SetTitle(const QString &t)
+1
View File
@@ -2,6 +2,7 @@
#define PANEL_WIDGET_H
#include <QDockWidget>
#include <QEvent>
/**
* @brief The PanelWidget class
@@ -0,0 +1,22 @@
# 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}
widget/playbackcontrols/playbackcontrols.h
widget/playbackcontrols/playbackcontrols.cpp
PARENT_SCOPE
)
@@ -0,0 +1,89 @@
#include "playbackcontrols.h"
#include <QHBoxLayout>
#include <QPushButton>
#include "ui/icons/icons.h"
PlaybackControls::PlaybackControls(QWidget *parent) :
QWidget(parent)
{
// Create lower controls
QHBoxLayout* lower_control_layout = new QHBoxLayout(this);
lower_control_layout->setSpacing(0);
lower_control_layout->setMargin(0);
QSizePolicy lower_container_size_policy = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
// In the lower-left, we create a current timecode label wrapped in a QWidget for fixed sizing
lower_left_container_ = new QWidget();
lower_left_container_->setVisible(false);
lower_left_container_->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_left_container_);
QHBoxLayout* lower_left_layout = new QHBoxLayout(lower_left_container_);
lower_left_layout->setSpacing(0);
lower_left_layout->setMargin(0);
cur_tc_lbl_ = new QLabel("00:00:00;00");
lower_left_layout->addWidget(cur_tc_lbl_);
lower_left_layout->addStretch();
// In the lower-middle, we create playback control buttons
QWidget* lower_middle_container = new QWidget();
lower_middle_container->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_middle_container);
QHBoxLayout* lower_middle_layout = new QHBoxLayout(lower_middle_container);
lower_middle_layout->setSpacing(0);
lower_middle_layout->setMargin(0);
lower_middle_layout->addStretch();
// Go To Start Button
QPushButton* go_to_start_btn = new QPushButton();
go_to_start_btn->setIcon(olive::icon::GoToStart);
lower_middle_layout->addWidget(go_to_start_btn);
// Prev Frame Button
QPushButton* prev_frame_btn = new QPushButton();
prev_frame_btn->setIcon(olive::icon::PrevFrame);
lower_middle_layout->addWidget(prev_frame_btn);
// Play/Pause Button
QPushButton* play_btn = new QPushButton();
play_btn->setIcon(olive::icon::Play);
lower_middle_layout->addWidget(play_btn);
// Next Frame Button
QPushButton* next_frame_btn = new QPushButton();
next_frame_btn->setIcon(olive::icon::NextFrame);
lower_middle_layout->addWidget(next_frame_btn);
// Go To End Button
QPushButton* go_to_end_btn = new QPushButton();
go_to_end_btn->setIcon(olive::icon::GoToEnd);
lower_middle_layout->addWidget(go_to_end_btn);
lower_middle_layout->addStretch();
// The lower-right, we create another timecode label, this time to show the end timecode
lower_right_container_ = new QWidget();
lower_right_container_->setVisible(false);
lower_right_container_->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_right_container_);
QHBoxLayout* lower_right_layout = new QHBoxLayout(lower_right_container_);
lower_right_layout->setSpacing(0);
lower_right_layout->setMargin(0);
lower_right_layout->addStretch();
end_tc_lbl_ = new QLabel("00:00:00;00");
lower_right_layout->addWidget(end_tc_lbl_);
}
void PlaybackControls::SetTimecodeEnabled(bool enabled)
{
lower_left_container_->setVisible(enabled);
lower_right_container_->setVisible(enabled);
}
@@ -0,0 +1,29 @@
#ifndef PLAYBACKCONTROLS_H
#define PLAYBACKCONTROLS_H
#include <QWidget>
#include <QLabel>
class PlaybackControls : public QWidget
{
public:
PlaybackControls(QWidget* parent);
void SetTimecodeEnabled(bool enabled);
signals:
void BeginClicked();
void PrevFrameClicked();
void PlayClicked();
void NextFrameClicked();
void EndClicked();
private:
QWidget* lower_left_container_;
QWidget* lower_right_container_;
QLabel* cur_tc_lbl_;
QLabel* end_tc_lbl_;
};
#endif // PLAYBACKCONTROLS_H
@@ -1,9 +1,11 @@
#include "projectexplorer.h"
ProjectExplorer::ProjectExplorer(QWidget *parent) :
QWidget(parent),
QStackedWidget(parent),
view_type_(TreeView)
{
tree_view_ = new QTreeView(this);
addWidget(tree_view_);
}
const ProjectExplorer::ViewType &ProjectExplorer::view_type()
+4 -2
View File
@@ -1,9 +1,10 @@
#ifndef PROJECTEXPLORER_H
#define PROJECTEXPLORER_H
#include <QWidget>
#include <QStackedWidget>
#include <QTreeView>
class ProjectExplorer : public QWidget
class ProjectExplorer : public QStackedWidget
{
public:
enum ViewType {
@@ -20,6 +21,7 @@ public:
private:
ViewType view_type_;
QTreeView* tree_view_;
};
#endif // PROJECTEXPLORER_H
+22
View File
@@ -0,0 +1,22 @@
# 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}
widget/projecttoolbar/projecttoolbar.h
widget/projecttoolbar/projecttoolbar.cpp
PARENT_SCOPE
)
@@ -0,0 +1,95 @@
#include "projecttoolbar.h"
#include <QHBoxLayout>
#include <QEvent>
#include <QButtonGroup>
#include "ui/icons/icons.h"
ProjectToolbar::ProjectToolbar(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
new_button_ = new QPushButton();
new_button_->setIcon(olive::icon::New);
connect(new_button_, SIGNAL(clicked(bool)), this, SIGNAL(NewClicked()));
layout->addWidget(new_button_);
open_button_ = new QPushButton();
open_button_->setIcon(olive::icon::Open);
connect(open_button_, SIGNAL(clicked(bool)), this, SIGNAL(OpenClicked()));
layout->addWidget(open_button_);
save_button_ = new QPushButton();
save_button_->setIcon(olive::icon::Save);
connect(save_button_, SIGNAL(clicked(bool)), this, SIGNAL(SaveClicked()));
layout->addWidget(save_button_);
undo_button_ = new QPushButton();
undo_button_->setIcon(olive::icon::Undo);
connect(undo_button_, SIGNAL(clicked(bool)), this, SIGNAL(UndoClicked()));
layout->addWidget(undo_button_);
redo_button_ = new QPushButton();
redo_button_->setIcon(olive::icon::Redo);
connect(redo_button_, SIGNAL(clicked(bool)), this, SIGNAL(RedoClicked()));
layout->addWidget(redo_button_);
search_field_ = new QLineEdit();
search_field_->setClearButtonEnabled(true);
connect(search_field_, SIGNAL(textChanged(const QString &)), this, SIGNAL(SearchChanged(const QString&)));
layout->addWidget(search_field_);
tree_button_ = new QPushButton();
tree_button_->setIcon(olive::icon::TreeView);
tree_button_->setCheckable(true);
connect(tree_button_, SIGNAL(clicked(bool)), this, SIGNAL(TreeViewClicked()));
layout->addWidget(tree_button_);
list_button_ = new QPushButton();
list_button_->setIcon(olive::icon::ListView);
list_button_->setCheckable(true);
connect(list_button_, SIGNAL(clicked(bool)), this, SIGNAL(ListViewClicked()));
layout->addWidget(list_button_);
icon_button_ = new QPushButton();
icon_button_->setIcon(olive::icon::IconView);
icon_button_->setCheckable(true);
connect(icon_button_, SIGNAL(clicked(bool)), this, SIGNAL(IconViewClicked()));
layout->addWidget(icon_button_);
// Group Tree/List/Icon view buttons into a button group for easy exclusive-buttons
QButtonGroup* view_button_group = new QButtonGroup(this);
view_button_group->setExclusive(true);
view_button_group->addButton(tree_button_);
view_button_group->addButton(list_button_);
view_button_group->addButton(icon_button_);
Retranslate();
}
void ProjectToolbar::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
Retranslate();
}
QWidget::changeEvent(e);
}
void ProjectToolbar::Retranslate()
{
new_button_->setToolTip(tr("New..."));
open_button_->setToolTip(tr("Open Project"));
save_button_->setToolTip(tr("Save Project"));
undo_button_->setToolTip(tr("Undo"));
redo_button_->setToolTip(tr("Redo"));
search_field_->setPlaceholderText(tr("Search media, markers, etc."));
tree_button_->setToolTip(tr("Switch to Tree View"));
list_button_->setToolTip(tr("Switch to List View"));
icon_button_->setToolTip(tr("Switch to Icon View"));
}
@@ -0,0 +1,44 @@
#ifndef PROJECTTOOLBAR_H
#define PROJECTTOOLBAR_H
#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
class ProjectToolbar : public QWidget
{
Q_OBJECT
public:
ProjectToolbar(QWidget* parent);
protected:
void changeEvent(QEvent *) override;
signals:
void NewClicked();
void OpenClicked();
void SaveClicked();
void UndoClicked();
void RedoClicked();
void SearchChanged(const QString&);
void TreeViewClicked();
void IconViewClicked();
void ListViewClicked();
private:
void Retranslate();
QPushButton* new_button_;
QPushButton* open_button_;
QPushButton* save_button_;
QPushButton* undo_button_;
QPushButton* redo_button_;
QLineEdit* search_field_;
QPushButton* tree_button_;
QPushButton* list_button_;
QPushButton* icon_button_;
};
#endif // PROJECTTOOLBAR_H
+5 -51
View File
@@ -12,58 +12,12 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
layout->setMargin(0);
// Create main OpenGL-based view
gl_widget_ = new ViewerGLWidget();
gl_widget_ = new ViewerGLWidget(this);
layout->addWidget(gl_widget_);
// Create lower controls
QWidget* lower_control_container = new QWidget();
lower_control_container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
QHBoxLayout* lower_control_layout = new QHBoxLayout(lower_control_container);
lower_control_layout->setSpacing(0);
lower_control_layout->setMargin(0);
layout->addWidget(lower_control_container);
QSizePolicy lower_container_size_policy = QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
// In the lower-left, we create a current timecode label wrapped in a QWidget for fixed sizing
QWidget* lower_left_container = new QWidget();
lower_left_container->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_left_container);
QHBoxLayout* lower_left_layout = new QHBoxLayout(lower_left_container);
lower_left_layout->setSpacing(0);
lower_left_layout->setMargin(0);
cur_tc_lbl_ = new QLabel("00:00:00;00");
lower_left_layout->addWidget(cur_tc_lbl_);
lower_left_layout->addStretch();
// In the lower-middle, we create playback control buttons
QWidget* lower_middle_container = new QWidget();
lower_left_container->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_middle_container);
QHBoxLayout* lower_middle_layout = new QHBoxLayout(lower_middle_container);
lower_middle_layout->setSpacing(0);
lower_middle_layout->setMargin(0);
lower_middle_layout->addStretch();
QPushButton* play_button = new QPushButton("Play");
lower_middle_layout->addWidget(play_button);
lower_middle_layout->addStretch();
// The lower-right, we create another timecode label, this time to show the end timecode
QWidget* lower_right_container = new QWidget();
lower_left_container->setSizePolicy(lower_container_size_policy);
lower_control_layout->addWidget(lower_right_container);
QHBoxLayout* lower_right_layout = new QHBoxLayout(lower_right_container);
lower_right_layout->setSpacing(0);
lower_right_layout->setMargin(0);
lower_right_layout->addStretch();
end_tc_lbl_ = new QLabel("00:00:00;00");
lower_right_layout->addWidget(end_tc_lbl_);
controls_ = new PlaybackControls(this);
controls_->SetTimecodeEnabled(true);
controls_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
layout->addWidget(controls_);
}
+4 -2
View File
@@ -6,6 +6,7 @@
#include <QLabel>
#include "viewerglwidget.h"
#include "widget/playbackcontrols/playbackcontrols.h"
/**
* @brief The ViewerWidget class
@@ -18,11 +19,12 @@ class ViewerWidget : public QWidget
public:
ViewerWidget(QWidget* parent);
void SetPlaybackControlsEnabled(bool enabled);
private:
ViewerGLWidget* gl_widget_;
PlaybackControls* controls_;
QLabel* cur_tc_lbl_;
QLabel* end_tc_lbl_;
};
#endif // VIEWER_WIDGET_H
+21 -2
View File
@@ -2,10 +2,17 @@
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QOpenGLTexture>
ViewerGLWidget::ViewerGLWidget()
#include "render/gl/glfunc.h"
#include "render/gl/shadergenerators.h"
QImage img;
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
QOpenGLWidget(parent)
{
img.load("/home/matt/Pictures/heck.png");
}
void ViewerGLWidget::paintGL()
@@ -14,4 +21,16 @@ void ViewerGLWidget::paintGL()
f->glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
f->glClear(GL_COLOR_BUFFER_BIT);
QOpenGLTexture* tex = new QOpenGLTexture(img);
ShaderPtr pipeline = olive::gl::GetDefaultPipeline();
tex->bind();
olive::gl::Blit(pipeline, true);
tex->release();
delete tex;
}
+1 -1
View File
@@ -6,7 +6,7 @@
class ViewerGLWidget : public QOpenGLWidget
{
public:
ViewerGLWidget();
ViewerGLWidget(QWidget* parent);
void SetTexture(GLuint tex);
protected: