began large scale restructure

This commit is contained in:
itsmattkc
2019-06-17 10:17:04 -07:00
parent 0acee942f4
commit 9afbe92574
39 changed files with 1179 additions and 884 deletions
+178
View File
@@ -0,0 +1,178 @@
# 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}
main.cpp
)
add_subdirectory(panel)
add_subdirectory(project)
add_subdirectory(render)
add_subdirectory(widget)
add_subdirectory(window)
set(OLIVE_TARGET "olive-editor")
if(APPLE)
set(OLIVE_TARGET "Olive")
endif()
add_executable(${OLIVE_TARGET}
${OLIVE_SOURCES}
${OLIVE_RESOURCES}
${OLIVE_EFFECTS}
${OLIVE_QM_FILES}
)
target_compile_definitions(${OLIVE_TARGET} PRIVATE ${OLIVE_DEFINITIONS})
target_compile_options(${OLIVE_TARGET} PRIVATE $<$<CXX_COMPILER_ID:GNU>:-Wno-reorder>)
target_link_libraries(${OLIVE_TARGET}
PRIVATE
OpenGL::GL
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Multimedia
Qt5::OpenGL
Qt5::Svg
FFMPEG::avutil
FFMPEG::avcodec
FFMPEG::avformat
FFMPEG::avfilter
FFMPEG::swscale
FFMPEG::swresample
OpenColorIO
)
set(OLIVE_RESOURCES
cursors/cursors.qrc
effects/internal/internalshaders.qrc
icons/icons.qrc
)
set(OLIVE_EFFECTS
effects/internal/cornerpin.frag
effects/internal/dropshadow.frag
effects/internal/ocio.frag
effects/internal/premultiply.frag
effects/shaders/boxblur.frag
effects/shaders/boxblur.xml
effects/shaders/bulge.frag
effects/shaders/bulge.xml
effects/shaders/chromaticaberration.frag
effects/shaders/chromaticaberration.xml
effects/shaders/crop.frag
effects/shaders/crop.xml
effects/shaders/despill.frag
effects/shaders/despill.xml
effects/shaders/directionalblur.frag
effects/shaders/directionalblur.xml
effects/shaders/flip.frag
effects/shaders/flip.xml
effects/shaders/gaussianblur.frag
effects/shaders/gaussianblur.xml
effects/shaders/need\ checking/chromakey.frag
effects/shaders/need\ checking/chromakey.xml
effects/shaders/need\ checking/colorcorrection.frag
effects/shaders/need\ checking/colorcorrection.xml
effects/shaders/need\ checking/colorsel.frag
effects/shaders/need\ checking/colorsel.xml
effects/shaders/need\ checking/common.frag
effects/shaders/need\ checking/crossstitch.frag
effects/shaders/need\ checking/crossstitch.xml
effects/shaders/need\ checking/emboss.frag
effects/shaders/need\ checking/emboss.xml
effects/shaders/need\ checking/findedges.frag
effects/shaders/need\ checking/fisheye.frag
effects/shaders/need\ checking/fisheye.xml
effects/shaders/need\ checking/huesatbri.frag
effects/shaders/need\ checking/huesatbri.xml
effects/shaders/need\ checking/invert.frag
effects/shaders/need\ checking/invert.xml
effects/shaders/need\ checking/lumakey.frag
effects/shaders/need\ checking/lumakey.xml
effects/shaders/need\ checking/posterize.frag
effects/shaders/need\ checking/posterize.xml
effects/shaders/need\ checking/toonify.frag
effects/shaders/need\ checking/toonify.xml
effects/shaders/need\ checking/volumetriclight.frag
effects/shaders/need\ checking/volumetriclight.xml
effects/shaders/noise.frag
effects/shaders/noise.xml
effects/shaders/pixelate.frag
effects/shaders/pixelate.xml
effects/shaders/radialblur.frag
effects/shaders/radialblur.xml
effects/shaders/ripple.frag
effects/shaders/ripple.xml
effects/shaders/sphere.frag
effects/shaders/sphere.xml
effects/shaders/swirl.frag
effects/shaders/swirl.xml
effects/shaders/tile.frag
effects/shaders/tile.xml
effects/shaders/vignette.frag
effects/shaders/vignette.xml
effects/shaders/wave.frag
effects/shaders/wave.xml
)
qt5_create_translation(OLIVE_QM_FILES
${CMAKE_SOURCE_DIR}
ts/olive_ar.ts
ts/olive_bs.ts
ts/olive_cs.ts
ts/olive_de.ts
ts/olive_es.ts
ts/olive_fr.ts
ts/olive_it.ts
ts/olive_ru.ts
ts/olive_sr.ts
ts/olive_id.ts
)
if(UNIX AND NOT APPLE)
install(TARGETS ${OLIVE_TARGET} RUNTIME DESTINATION bin)
install(FILES ${OLIVE_EFFECTS} DESTINATION share/olive-editor/effects)
install(FILES packaging/linux/org.olivevideoeditor.Olive.desktop DESTINATION share/applications)
install(FILES packaging/linux/org.olivevideoeditor.Olive.appdata.xml DESTINATION share/metainfo)
install(FILES packaging/linux/org.olivevideoeditor.Olive.xml DESTINATION share/mime/packages)
install(FILES packaging/linux/icons/16x16/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/16x16/apps)
install(FILES packaging/linux/icons/32x32/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/32x32/apps)
install(FILES packaging/linux/icons/48x48/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/48x48/apps)
install(FILES packaging/linux/icons/64x64/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/64x64/apps)
install(FILES packaging/linux/icons/128x128/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/128x128/apps)
install(FILES packaging/linux/icons/256x256/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/256x256/apps)
install(FILES packaging/linux/icons/512x512/org.olivevideoeditor.Olive.png DESTINATION share/icons/hicolor/512x512/apps)
install(FILES packaging/linux/icons/16x16/application-vnd.olive-project.png DESTINATION share/icons/hicolor/16x16/mimetypes)
install(FILES packaging/linux/icons/32x32/application-vnd.olive-project.png DESTINATION share/icons/hicolor/32x32/mimetypes)
install(FILES packaging/linux/icons/48x48/application-vnd.olive-project.png DESTINATION share/icons/hicolor/48x48/mimetypes)
install(FILES packaging/linux/icons/64x64/application-vnd.olive-project.png DESTINATION share/icons/hicolor/64x64/mimetypes)
install(FILES packaging/linux/icons/128x128/application-vnd.olive-project.png DESTINATION share/icons/hicolor/128x128/mimetypes)
install(FILES packaging/linux/icons/256x256/application-vnd.olive-project.png DESTINATION share/icons/hicolor/256x256/mimetypes)
install(FILES packaging/linux/icons/512x512/application-vnd.olive-project.png DESTINATION share/icons/hicolor/512x512/mimetypes)
install(FILES ${OLIVE_QM_FILES} DESTINATION share/olive-editor/ts)
endif()
if(DOXYGEN_FOUND AND BUILD_DOXYGEN)
set(DOXYGEN_PROJECT_NAME "Olive")
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/docs")
set(DOXYGEN_EXTRACT_ALL "YES")
set(DOXYGEN_EXTRACT_PRIVATE "YES")
doxygen_add_docs(docs ALL ${OLIVE_SOURCES})
endif()
+53
View File
@@ -0,0 +1,53 @@
/***
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 <QApplication>
#include <QSurfaceFormat>
#include "window/mainwindow/mainwindow.h"
int main(int argc, char *argv[]) {
// Create application instance
QApplication a(argc, argv);
// Set application metadata
QCoreApplication::setOrganizationName("olivevideoeditor.org");
QCoreApplication::setOrganizationDomain("olivevideoeditor.org");
QCoreApplication::setApplicationName("Olive");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 7, 0))
QGuiApplication::setDesktopFileName("org.olivevideoeditor.Olive");
#endif
// Set OpenGL display profile (3.2 Core)
QSurfaceFormat format;
format.setVersion(3, 2);
format.setDepthBufferSize(24);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
// Create main window instance
olive::MainWindow w;
// Show main window
w.showMaximized();
return a.exec();
}
+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/>.
add_subdirectory(viewer)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
PARENT_SCOPE
)
+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}
panel/viewer/viewer.h
panel/viewer/viewer.cpp
PARENT_SCOPE
)
+16
View File
@@ -0,0 +1,16 @@
#include "viewer.h"
#include "widget/viewer/viewer.h"
ViewerPanel::ViewerPanel(QWidget *parent) :
PanelWidget(parent)
{
SetTitle(tr("Viewer"));
SetSubtitle(tr("(None)"));
// QObject system handles deleting this
ViewerWidget* viewer = new ViewerWidget(this);
// Set ViewerWidget as the central widget
setWidget(viewer);
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef VIEWER_PANEL_H
#define VIEWER_PANEL_H
#include "widget/panel/panel.h"
/**
* @brief The ViewerPanel class
*
* Dockable wrapper around a ViewerWidget
*/
class ViewerPanel : public PanelWidget {
Q_OBJECT
public:
ViewerPanel(QWidget* parent);
private:
};
#endif // VIEWER_PANEL_H
+16
View File
@@ -0,0 +1,16 @@
# 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/>.
+23
View File
@@ -0,0 +1,23 @@
# 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}
render/glfunc.h
render/glfunc.cpp
render/qopenglshaderprogramptr.h
PARENT_SCOPE
)
+90
View File
@@ -0,0 +1,90 @@
#include "glfunc.h"
#include <QOpenGLFunctions>
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
const GLfloat blit_vertices[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
-1.0f, -1.0f, 0.0f,
-1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f
};
const GLfloat blit_texcoords[] = {
0.0, 0.0,
1.0, 0.0,
1.0, 1.0,
0.0, 0.0,
0.0, 1.0,
1.0, 1.0
};
const GLfloat flipped_blit_texcoords[] = {
0.0, 1.0,
1.0, 1.0,
1.0, 0.0,
0.0, 1.0,
0.0, 0.0,
1.0, 0.0
};
/**
* @brief Set up texture mipmaps
* @param f
*/
void PrepareToDraw(QOpenGLFunctions* f) {
f->glGenerateMipmap(GL_TEXTURE_2D);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
void olive::gl::Blit(QOpenGLShaderProgram* pipeline, bool flipped, QMatrix4x4 matrix) {
QOpenGLFunctions* func = QOpenGLContext::currentContext()->functions();
PrepareToDraw(func);
QOpenGLVertexArrayObject m_vao;
m_vao.create();
m_vao.bind();
QOpenGLBuffer m_vbo;
m_vbo.create();
m_vbo.bind();
m_vbo.allocate(blit_vertices, 18 * sizeof(GLfloat));
m_vbo.release();
QOpenGLBuffer m_vbo2;
m_vbo2.create();
m_vbo2.bind();
m_vbo2.allocate(flipped ? flipped_blit_texcoords : blit_texcoords, 12 * sizeof(GLfloat));
m_vbo2.release();
pipeline->bind();
pipeline->setUniformValue("mvp_matrix", matrix);
pipeline->setUniformValue("texture", 0);
GLuint vertex_location = pipeline->attributeLocation("a_position");
m_vbo.bind();
func->glEnableVertexAttribArray(vertex_location);
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, 0);
m_vbo.release();
GLuint tex_location = pipeline->attributeLocation("a_texcoord");
m_vbo2.bind();
func->glEnableVertexAttribArray(tex_location);
func->glVertexAttribPointer(tex_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
m_vbo2.release();
func->glDrawArrays(GL_TRIANGLES, 0, 6);
pipeline->release();
}
+30
View File
@@ -0,0 +1,30 @@
#ifndef GLFUNC_H
#define GLFUNC_H
#include <QOpenGLShaderProgram>
#include <QMatrix4x4>
namespace olive {
namespace gl {
/**
* @brief Draw texture on screen
*
* @param pipeline
*
* Shader to use for the texture drawing
*
* @param flipped
*
* Draw the texture vertically flipped (defaults to FALSE)
*
* @param matrix
*
* Transformation matrix to use when drawing (defaults to no transform)
*/
void Blit(QOpenGLShaderProgram* pipeline, bool flipped = false, QMatrix4x4 matrix = QMatrix4x4());
}
}
#endif // GLFUNC_H
+29
View File
@@ -0,0 +1,29 @@
/***
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 QOPENGLSHADERPROGRAMPTR_H
#define QOPENGLSHADERPROGRAMPTR_H
#include <QOpenGLShaderProgram>
#include <memory>
using QOpenGLShaderProgramPtr = std::shared_ptr<QOpenGLShaderProgram>;
#endif // QOPENGLSHADERPROGRAMPTR_H
+24
View File
@@ -0,0 +1,24 @@
# 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/>.
add_subdirectory(viewer)
add_subdirectory(panel)
add_subdirectory(projectexplorer)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
PARENT_SCOPE
)
+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/panel/panel.h
widget/panel/panel.cpp
PARENT_SCOPE
)
+25
View File
@@ -0,0 +1,25 @@
#include "panel.h"
PanelWidget::PanelWidget(QWidget *parent) {
}
void PanelWidget::SetTitle(const QString &t)
{
title_ = t;
UpdateTitle();
}
void PanelWidget::SetSubtitle(const QString &t)
{
subtitle_ = t;
UpdateTitle();
}
void PanelWidget::UpdateTitle()
{
if (subtitle_.isEmpty()) {
setWindowTitle(title_);
} else {
setWindowTitle(tr("%1: %2").arg(title_, subtitle_));
}
}
+70
View File
@@ -0,0 +1,70 @@
#ifndef PANEL_WIDGET_H
#define PANEL_WIDGET_H
#include <QDockWidget>
/**
* @brief The PanelWidget class
*
* A widget that is always dockable within the MainWindow.
*/
class PanelWidget : public QDockWidget {
Q_OBJECT
public:
/**
* @brief PanelWidget Constructor
*
* @param parent
*
* The PanelWidget's parent, enforced to help with memory handling. Most of the time this will be an instance of
* MainWindow.
*/
PanelWidget(QWidget* parent);
protected:
/**
* @brief Set panel's title
*
* Use this function to set the title of the panel.
*
* A PanelWidget has the default format of "Title: Subtitle" (can differ depending on translation). If no Subtitle
* is set, the title will just be formatted "Title".
*
* @param t
*
* String to set the title to
*/
void SetTitle(const QString& t);
/**
* @brief Set panel's subtitle
*
* Use this function to set the subtitle of the panel.
*
* A PanelWidget has the default format of "Title: Subtitle" (can differ depending on translation). If no Subtitle
* is set, the title will just be formatted "Title".
*
* @param t
*
* String to set the subtitle to
*/
void SetSubtitle(const QString& t);
private:
/**
* @brief Internal function that sets the QDockWidget's window title whenever the title/subtitle change.
*
* Should be called any time a change is made to title_ or subtitle_
*/
void UpdateTitle();
/**
* @brief Internal title string
*/
QString title_;
/**
* @brief Internal subtitle string
*/
QString subtitle_;
};
#endif // PANEL_WIDGET_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/projectexplorer/projectexplorer.h
widget/projectexplorer/projectexplorer.cpp
PARENT_SCOPE
)
@@ -0,0 +1,17 @@
#include "projectexplorer.h"
ProjectExplorer::ProjectExplorer(QWidget *parent) :
QWidget(parent),
view_type_(TreeView)
{
}
const ProjectExplorer::ViewType &ProjectExplorer::view_type()
{
return view_type_;
}
void ProjectExplorer::set_view_type(const ProjectExplorer::ViewType &type)
{
view_type_ = type;
}
@@ -0,0 +1,25 @@
#ifndef PROJECTEXPLORER_H
#define PROJECTEXPLORER_H
#include <QWidget>
class ProjectExplorer : public QWidget
{
public:
enum ViewType {
TreeView,
ListView,
IconView
};
ProjectExplorer(QWidget* parent);
const ViewType& view_type();
void set_view_type(const ViewType& type);
private:
ViewType view_type_;
};
#endif // PROJECTEXPLORER_H
+24
View File
@@ -0,0 +1,24 @@
# 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/viewer/viewer.h
widget/viewer/viewer.cpp
widget/viewer/viewerglwidget.h
widget/viewer/viewerglwidget.cpp
PARENT_SCOPE
)
+69
View File
@@ -0,0 +1,69 @@
#include "viewer.h"
#include <QVBoxLayout>
#include <QLabel>
ViewerWidget::ViewerWidget(QWidget *parent) :
QWidget(parent)
{
// Set up main layout
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setSpacing(0);
layout->setMargin(0);
// Create main OpenGL-based view
gl_widget_ = new ViewerGLWidget();
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_);
}
+28
View File
@@ -0,0 +1,28 @@
#ifndef VIEWER_WIDGET_H
#define VIEWER_WIDGET_H
#include <QWidget>
#include <QPushButton>
#include <QLabel>
#include "viewerglwidget.h"
/**
* @brief The ViewerWidget class
*
* An OpenGL-based viewer widget with playback controls.
*/
class ViewerWidget : public QWidget
{
Q_OBJECT
public:
ViewerWidget(QWidget* parent);
private:
ViewerGLWidget* gl_widget_;
QLabel* cur_tc_lbl_;
QLabel* end_tc_lbl_;
};
#endif // VIEWER_WIDGET_H
+17
View File
@@ -0,0 +1,17 @@
#include "viewerglwidget.h"
#include <QOpenGLContext>
#include <QOpenGLFunctions>
ViewerGLWidget::ViewerGLWidget()
{
}
void ViewerGLWidget::paintGL()
{
QOpenGLFunctions* f = context()->functions();
f->glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
f->glClear(GL_COLOR_BUFFER_BIT);
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef VIEWERGLWIDGET_H
#define VIEWERGLWIDGET_H
#include <QOpenGLWidget>
class ViewerGLWidget : public QOpenGLWidget
{
public:
ViewerGLWidget();
void SetTexture(GLuint tex);
protected:
virtual void paintGL() override;
private:
GLuint texture_;
};
#endif // VIEWERGLWIDGET_H
+23
View File
@@ -0,0 +1,23 @@
# 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/>.
add_subdirectory(mainwindow)
set(OLIVE_SOURCES
${OLIVE_SOURCES}
PARENT_SCOPE
)
+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}
window/mainwindow/mainwindow.h
window/mainwindow/mainwindow.cpp
PARENT_SCOPE
)
+30
View File
@@ -0,0 +1,30 @@
#include "mainwindow.h"
// Panel objects
#include "panel/viewer/viewer.h"
olive::MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
// Create empty central widget - we don't actually want a central widget but some of Qt's docking/undocking fails
// without it
QWidget* centralWidget = new QWidget(this);
centralWidget->setMaximumSize(QSize(0, 0));
setCentralWidget(centralWidget);
// Set tabs to be on top of panels (default behavior is bottom)
setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
// Allow panels to be tabbed within each other
setDockNestingEnabled(true);
// TODO Use settings data to create panels and restore state if they exist
ViewerPanel* viewer_panel = new ViewerPanel(this);
addDockWidget(Qt::TopDockWidgetArea, viewer_panel);
ViewerPanel* viewer_panel2 = new ViewerPanel(this);
addDockWidget(Qt::TopDockWidgetArea, viewer_panel2);
ViewerPanel* viewer_panel3 = new ViewerPanel(this);
addDockWidget(Qt::BottomDockWidgetArea, viewer_panel3);
ViewerPanel* viewer_panel4 = new ViewerPanel(this);
addDockWidget(Qt::BottomDockWidgetArea, viewer_panel4);
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace olive {
/**
* @brief The MainWindow class
*
* Olive's main window responsible for docking widgets.
*/
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget* parent = nullptr);
private:
};
}
#endif