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
+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