documented (nearly) ever class

This commit is contained in:
itsmattkc
2019-07-06 23:32:01 -05:00
parent a9ff2389e6
commit 5e3c2fb7e4
43 changed files with 284 additions and 62 deletions
+2 -2
View File
@@ -30,9 +30,9 @@
#include "tool/tool.h"
/**
* @brief The Core class
* @brief The main central Olive application instance
*
* The main Olive application instance. This runs both in GUI and CLI modes (and handles what to init based on that).
* This runs both in GUI and CLI modes (and handles what to init based on that).
* It also contains various global functions/variables for use throughout Olive.
*
* The "public slots" are usually user-triggered actions and can be connected to UI elements (e.g. creating a folder,
+2 -2
View File
@@ -29,9 +29,9 @@
#include "decoder/frame.h"
/**
* @brief The Decoder class
* @brief A decoder's is the main class for bringing external media into Olive
*
* A decoder's is the main class for bringing external media into Olive. Its responsibilities are to serve as
* Its responsibilities are to serve as
* abstraction from codecs/decoders and provide complete frames. These frames can be video or audio data and are
* provided as Frame objects in shared pointers to alleviate the responsibility of memory handling.
*
+1 -3
View File
@@ -30,9 +30,7 @@ extern "C" {
#include "rational.h"
/**
* @brief The Frame class
*
* Abstraction from AVFrame. Currently a simple AVFrame wrapper.
* @brief Abstraction from AVFrame. Currently a simple AVFrame wrapper.
*
* This class does not support copying at this time.
*/
+3
View File
@@ -25,6 +25,9 @@
#include "widget/panel/panel.h"
#include "widget/projectexplorer/projectexplorer.h"
/**
* @brief A PanelWidget wrapper around a ProjectExplorer and a ProjectToolbar
*/
class ProjectPanel : public PanelWidget
{
Q_OBJECT
+3
View File
@@ -24,6 +24,9 @@
#include "widget/taskview/taskview.h"
#include "widget/panel/panel.h"
/**
* @brief A PanelWidget wrapper around a TaskView widget
*/
class TaskManagerPanel : public PanelWidget
{
Q_OBJECT
+3
View File
@@ -23,6 +23,9 @@
#include "widget/panel/panel.h"
/**
* @brief A PanelWidget wrapper around a Toolbar
*/
class ToolPanel : public PanelWidget
{
Q_OBJECT
+1 -3
View File
@@ -24,9 +24,7 @@
#include "widget/panel/panel.h"
/**
* @brief The ViewerPanel class
*
* Dockable wrapper around a ViewerWidget
* @brief Dockable wrapper around a ViewerWidget
*/
class ViewerPanel : public PanelWidget {
Q_OBJECT
+5
View File
@@ -31,3 +31,8 @@ Item::Type Folder::type() const
{
return kFolder;
}
bool Folder::CanHaveChildren() const
{
return true;
}
+4 -1
View File
@@ -26,7 +26,8 @@
/**
* @brief The Folder class representing a directory in a project structure
*
*
* The Item base class already has support for children, but this functionality is disabled by default
* (see CanHaveChildren() override). The Folder is a specific type that enables this functionality.
*/
class Folder : public Item
{
@@ -35,6 +36,8 @@ public:
virtual Type type() const override;
virtual bool CanHaveChildren() const override;
private:
};
+3
View File
@@ -28,6 +28,9 @@ extern "C" {
#include "rational.h"
#include "stream.h"
/**
* @brief A Stream derivative containing audio-specific information
*/
class AudioStream : public Stream
{
public:
+7
View File
@@ -29,6 +29,13 @@
#include "project/item/footage/videostream.h"
#include "rational.h"
/**
* @brief A reference to an external media file with metadata in a project structure
*
* Footage objects serve two purposes: storing metadata about external media and storing it as a project item.
* Footage objects store a list of Stream objects which store the majority of video/audio metadata. These streams
* are identical to the stream data in the files.
*/
class Footage : public Item
{
public:
+2 -2
View File
@@ -26,9 +26,9 @@
class Footage;
/**
* @brief The Stream class
* @brief A base class for keeping metadata about a media stream.
*
* A base class for keeping metadata about a media stream. A Stream can contain video data, audio data, subtitle data,
* A Stream can contain video data, audio data, subtitle data,
* etc. and a Stream object stores metadata about it.
*
* The Stream class is fairly simple and is intended to be subclassed for data that pertains specifically to one
+3
View File
@@ -24,6 +24,9 @@
#include "rational.h"
#include "stream.h"
/**
* @brief A Stream derivative containing video-specific information
*/
class VideoStream : public Stream
{
public:
+5
View File
@@ -115,3 +115,8 @@ Item *Item::parent() const
{
return parent_;
}
bool Item::CanHaveChildren() const
{
return false;
}
+8
View File
@@ -29,6 +29,12 @@
class Item;
using ItemPtr = std::shared_ptr<Item>;
/**
* @brief A base-class representing any element in a Project
*
* Project objects implement a parent-child hierarchy of Items that can be used throughout the Project. The Item class
* itself is abstract and will need to be subclassed to be used in a Project.
*/
class Item
{
public:
@@ -88,6 +94,8 @@ public:
Item *parent() const;
virtual bool CanHaveChildren() const;
private:
QList<ItemPtr> children_;
+3 -2
View File
@@ -27,12 +27,13 @@
#include "project/item/folder/folder.h"
/**
* @brief The Project class
* @brief A project instance containing all the data pertaining to the user's project
*
* A project instance containing all the data pertaining to the user's project, including:
* A project instance uses a parent-child hierarchy of Item objects. Projects will usually contain the following:
*
* * Footage
* * Sequences
* * Folders
* * Project Settings
* * Window Layout
*/
+9 -5
View File
@@ -182,7 +182,7 @@ bool ProjectViewModel::hasChildren(const QModelIndex &parent) const
// Check if this item is a kFolder type
// If it's a folder, we always return TRUE in order to always show the "expand triangle" icon,
// even when there are no "physical" children
if (item->type() == Item::kFolder) {
if (item->CanHaveChildren()) {
return true;
}
}
@@ -216,7 +216,7 @@ bool ProjectViewModel::canFetchMore(const QModelIndex &parent) const
// Check if this item is a kFolder type
// If it's a folder, we always return TRUE in order to always show the "expand triangle" icon,
// even when there are no "physical" children
if (item->type() == Item::kFolder) {
if (item->CanHaveChildren()) {
return true;
}
}
@@ -232,7 +232,11 @@ Qt::ItemFlags ProjectViewModel::flags(const QModelIndex &index) const
return Qt::ItemIsDropEnabled;
}
Qt::ItemFlags f = Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | QAbstractItemModel::flags(index);
Qt::ItemFlags f = Qt::ItemIsDragEnabled | QAbstractItemModel::flags(index);
if (GetItemObjectFromIndex(index)->CanHaveChildren()) {
f |= Qt::ItemIsDropEnabled;
}
// If the column is the kName column, that means it's editable
if (columns_.at(index.column()) == kName) {
@@ -308,7 +312,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
Item* drop_location = GetItemObjectFromIndex(drop);
// If this is not a folder, we cannot drop these items here
if (drop_location->type() != Item::kFolder) {
if (!drop_location->CanHaveChildren()) {
return false;
}
@@ -365,7 +369,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
Item* drop_item = GetItemObjectFromIndex(drop);
// If we didn't drop onto an item, find the nearest parent folder (should eventually terminate at root either way)
while (drop_item->type() != Item::kFolder) {
while (!drop_item->CanHaveChildren()) {
drop_item = drop_item->parent();
}
+5 -2
View File
@@ -27,9 +27,12 @@
#include "project.h"
/**
* @brief The ProjectViewModel class
* @brief An adapter that interprets the data in a Project into a Qt item model for usage in ViewModel Views.
*
* An adapter that interprets the data in a Project into a Qt item model for usage in ViewModel Views.
* Assuming a Project is currently "open" (i.e. the Project is connected to a ProjectExplorer/ProjectPanel through
* a ProjectViewModel), it may be better to make modifications (e.g. additions/removals/renames) through the
* ProjectViewModel so that the views can be efficiently and correctly updated. ProjectViewModel contains several
* "wrapper" functions for Project and Item functions that also signal any connected views to update accordingly.
*/
class ProjectViewModel : public QAbstractItemModel
{
+1 -3
View File
@@ -33,9 +33,7 @@ extern "C" {
}
/**
* @brief The Rational class
*
* A rational (numerator/denominator) class with C++ operations built in for ease of use.
* @brief A rational (numerator/denominator) class with C++ operations built in for ease of use.
*
* Rationals in Olive most frequently represent timing information to easily handle timing in various different
* frame/sample rates without the inaccuracy/rounding errors of a floating point type.
+1 -3
View File
@@ -27,9 +27,7 @@
#include "task/taskthread.h"
/**
* @brief The Task class
*
* A base class for background tasks running in Olive.
* @brief A base class for background tasks running in Olive.
*
* Tasks are multithreaded by design (i.e. they will always spawn
* a new thread and run in it).
+12 -1
View File
@@ -27,7 +27,7 @@
#include "task/task.h"
/**
* @brief The TaskManager class
* @brief An object that manages background Task objects, handling their start and end
*
* TaskManager handles the life of a Task object. After a new Task is created, it should be sent to TaskManager through
* AddTask(). TaskManager will take ownership of the task and add it to a queue until it system resources are available
@@ -99,8 +99,19 @@ public:
public:
AddTaskCommand(TaskPtr t, QUndoCommand* parent = nullptr);
/**
* @brief Adds the Task to the TaskManager
*
* If there are available threads, TaskManager will start running it.
*/
virtual void redo() override;
/**
* @brief Undoes adding the Task
*
* If the Task is running, it is cancelled. Then the Task is removed from the TaskManager and the Task's state is
* reset.
*/
virtual void undo() override;
private:
+2 -2
View File
@@ -26,9 +26,9 @@
class Task;
/**
* @brief The TaskThread class
* @brief An internal class only used by Task.
*
* An internal class only used by Task. TaskThread is a simple QThread subclass designed to create a thread and run the
* TaskThread is a simple QThread subclass designed to create a thread and run the
* Task's Action() function. It also stores the result of Action() which can be read using result() when the thread
* signals that it has finished().
*/
+1 -3
View File
@@ -25,9 +25,7 @@ namespace olive {
namespace tool {
/**
* @brief The Tool enum
*
* A list of tools that can be used throughout the application
* @brief A list of tools that can be used throughout the application
*/
enum Tool {
/// No tool. This should never be set as the application tool, its only real purpose is to indicate the lack of
+3
View File
@@ -4,6 +4,9 @@
#include <QUndoStack>
namespace olive {
/**
* @brief A static undo stack for undoable commands throughout Olive
*/
extern QUndoStack undo_stack;
}
+106 -1
View File
@@ -24,24 +24,129 @@
#include <QMenuBar>
#include <QMenu>
/**
* @brief A menu widget for context menus and menu bars
*
* A QMenu subclass with functions for creating menus and menu items that conform to Olive's menu and keyboard shortcut
* system.
*
* In Olive, menu items in the menu bar are also responsible for keyboard shortcuts throughout the application. To allow
* these to be configurable and these configurations saveable, every item needs a unique ID. This ID gets linked to the
* keyboard shortcuts in config files. The ID doesn't get translated so it can also persist through language changes.
*
* The ID gets stored in the QAction's "id" property. If a keyboard shortcut is provided, it gets stored in the
* QAction's "keydefault" property.
*
* It is always recommended to use this over QMenu in any situation.
*/
class Menu : public QMenu
{
public:
/**
* @brief Construct a Menu and add it to a QMenuBar
*
* This Menu can be connected to a slot that's triggered when the Menu is "about to show". Use `receiver` and
* `member` to connect this (same syntax as QObject::connect) or leave as nullptr to not.
*/
Menu(QMenuBar* bar, const QObject* receiver = nullptr, const char* member = nullptr);
/**
* @brief Construct a Menu and add it as a submenu to another Menu
*
* This Menu can be connected to a slot that's triggered when the Menu is "about to show". Use `receiver` and
* `member` to connect this (same syntax as QObject::connect) or leave as nullptr to not.
*/
Menu(Menu* bar, const QObject* receiver = nullptr, const char* member = nullptr);
/**
* @brief Create a menu item and add it to this menu
*
* @param id
*
* The action's unique ID
*
* @param receiver
*
* The QObject to receive the signal when this item is triggered
*
* @param member
*
* The QObject slot to connect this action's triggered signal to
*
* @param key
*
* Default keyboard sequence
*
* @return
*
* The QAction that was created and added to this Menu
*/
QAction* AddItem(const QString& id,
const QObject* receiver,
const char* member,
const QString &key = QString());
/**
* @brief Create a menu item
*
* @param parent
*
* The QAction's parent
*
* @param id
*
* The action's unique ID
*
* @param receiver
*
* The QObject to receive the signal when this item is triggered
*
* @param member
*
* The QObject slot to connect this action's triggered signal to
*
* @param key
*
* Default keyboard sequence
*
* @return
*
* The QAction that was created and added to this Menu
*/
static QAction* CreateItem(QObject* parent,
const QString& id,
const QObject* receiver,
const char* member,
const QString& key = QString());
static void ConformItem(QAction *a, const QString& id,
/**
* @brief Conform a QAction to Olive's ID/keydefault system
*
* If a QAction was created elsewhere (e.g. through QUndoStack::createUndoAction()), this function will give it
* properties conforming it to Olive's menu item system
*
* @param a
*
* The QAction's to conform
*
* @param id
*
* The action's unique ID
*
* @param receiver
*
* The QObject to receive the signal when this item is triggered
*
* @param member
*
* The QObject slot to connect this action's triggered signal to
*
* @param key
*
* Default keyboard sequence
*/
static void ConformItem(QAction *a,
const QString& id,
const QObject* receiver,
const char* member,
const QString& key = QString());
+3
View File
@@ -23,6 +23,9 @@
#include "widget/menu/menu.h"
/**
* @brief A static object that provides various "stock" menus for use throughout the application
*/
class MenuShared : public QObject {
public:
MenuShared();
+1 -3
View File
@@ -25,9 +25,7 @@
#include <QEvent>
/**
* @brief The PanelWidget class
*
* A widget that is always dockable within the MainWindow.
* @brief A widget that is always dockable within the MainWindow.
*/
class PanelWidget : public QDockWidget {
Q_OBJECT
@@ -24,18 +24,45 @@
#include <QWidget>
#include <QLabel>
/**
* @brief A playback controls widget providing buttons for navigating media
*
* This widget optionally features timecode displays for the current timecode and end timecode.
*/
class PlaybackControls : public QWidget
{
public:
PlaybackControls(QWidget* parent);
/**
* @brief Set whether the timecodes should be shown or not
*/
void SetTimecodeEnabled(bool enabled);
signals:
/**
* @brief Signal emitted when "Go to Start" is clicked
*/
void BeginClicked();
/**
* @brief Signal emitted when "Previous Frame" is clicked
*/
void PrevFrameClicked();
/**
* @brief Signal emitted when "Play/Pause" is clicked
*/
void PlayClicked();
/**
* @brief Signal emitted when "Next Frame" is clicked
*/
void NextFrameClicked();
/**
* @brief Signal emitted when "Go to End" is clicked
*/
void EndClicked();
private:
@@ -162,7 +162,7 @@ void ProjectExplorer::DoubleClickViewSlot(const QModelIndex &index)
Item* i = static_cast<Item*>(index.internalPointer());
// If the item is a folder, browse to it
if (i->type() == Item::kFolder
if (i->CanHaveChildren()
&& (view_type() == olive::ListView || view_type() == olive::IconView)) {
BrowseToFolder(index);
@@ -261,10 +261,10 @@ Folder *ProjectExplorer::GetSelectedFolder()
Item* sel_item = selected_items.at(i);
// If this item is not a folder, presumably it's parent is
if (sel_item->type() != Item::kFolder) {
if (!sel_item->CanHaveChildren()) {
sel_item = sel_item->parent();
Q_ASSERT(sel_item->type() == Item::kFolder);
Q_ASSERT(sel_item->CanHaveChildren());
}
if (folder == nullptr) {
+1 -3
View File
@@ -34,9 +34,7 @@
#include "widget/projectexplorer/projectexplorernavigation.h"
/**
* @brief A widget for browsing through Project classes
*
* A widget for browsing through a Project structure.
* @brief A widget for browsing through a Project structure.
*
* ProjectExplorer automatically handles the view<->model system using a ProjectViewModel. Therefore, all that needs to
* be provided is the Project structure itself.
@@ -3,9 +3,13 @@
namespace olive {
/// The minimum size an icon in ProjectExplorer can be
const int kProjectIconSizeMinimum = 16;
/// The maximum size an icon in ProjectExplorer can be
const int kProjectIconSizeMaximum = 256;
/// The default size an icon in ProjectExplorer can be
const int kProjectIconSizeDefault = 64;
}
@@ -23,6 +23,9 @@
#include <QStyledItemDelegate>
/**
* @brief The delegate that's used to draw items when ProjectExplorer is in Icon view
*/
class ProjectExplorerIconViewItemDelegate : public QStyledItemDelegate {
public:
ProjectExplorerIconViewItemDelegate(QObject *parent = nullptr);
@@ -24,6 +24,9 @@
#include "projectexplorerlistviewbase.h"
#include "projectexplorerlistviewitemdelegate.h"
/**
* @brief The view widget used when ProjectExplorer is in List View
*/
class ProjectExplorerListView : public ProjectExplorerListViewBase
{
Q_OBJECT
@@ -23,6 +23,10 @@
#include <QListView>
/**
* @brief A QListView derivative that contains functionality used by both List view and Icon view (which are both based
* on QListView)
*/
class ProjectExplorerListViewBase : public QListView
{
Q_OBJECT
@@ -24,7 +24,7 @@
#include <QTreeView>
/**
* @brief The ProjectExplorerTreeView class
* @brief The view widget used when ProjectExplorer is in Tree View
*
* A fairly simple subclass of QTreeView that provides a double clicked signal whether the index is valid or not
* (QAbstractItemView has a doubleClicked() signal but it's only emitted with a valid index).
+13
View File
@@ -26,6 +26,14 @@
#include "widget/taskview/taskviewitem.h"
/**
* @brief A widget that shows a list of Tasks
*
* TaskView is a fairly simple widget for showing TaskViewItem widgets that each represent a Task object. The main
* entry point is the slot AddTask() which should be connected to a TaskManager's TaskAdded() signal. No more connecting
* is necessary since TaskViewItem will automatically delete itself (thus removing itself from the TaskView) when the
* Task finishes.
*/
class TaskView : public QScrollArea
{
Q_OBJECT
@@ -33,6 +41,11 @@ public:
TaskView(QWidget* parent);
public slots:
/**
* @brief Creates a TaskViewItem, connects it to a Task, and adds it to this widget
*
* Connect this to TaskManager::TaskAdded().
*/
void AddTask(Task* t);
private:
+16
View File
@@ -28,12 +28,28 @@
#include "task/task.h"
/**
* @brief A widget that visually represents the status of a Task
*
* The TaskViewItem widget shows a description of the Task (Task::text(), a progress bar (updated by
* Task::ProgressChanged), the Task's status (text generated from Task::status() or Task::error()), and provides
* a cancel button (triggering Task::Cancel()) for cancelling a Task before it finishes.
*
* The main entry point is SetTask() after a Task and TaskViewItem objects are created.
*/
class TaskViewItem : public QFrame
{
Q_OBJECT
public:
TaskViewItem(QWidget* parent);
/**
* @brief Connects a Task to this object
*
* If a Task has already been connected, this will disconnect this TaskViewItem from the previously connected
* Task before connecting to the next one - however there are very few circumstances where this would be necessary
* since TaskViewItem is designed to delete itself when a Task is complete.
*/
void SetTask(Task* t);
private:
+2 -2
View File
@@ -28,9 +28,9 @@
#include "tool/tool.h"
/**
* @brief The Toolbar class
* @brief A widget containing buttons for all of Olive's application-wide tools.
*
* A widget containing buttons for all of Olive's application-wide tools. Buttons are displayed in a FlowLayout that
* Buttons are displayed in a FlowLayout that
* adjusts and wraps (like text) depending on the widget's size.
*
* By default, this Toolbar is not connected to anything. It's recommended to connect SLOT(SetTool()) and
+1 -3
View File
@@ -26,9 +26,7 @@
#include "tool/tool.h"
/**
* @brief The ToolbarButton class
*
* Simple derived class of QPushButton to contain an Tool ID. Used as the main widget through Toolbar.
* @brief Simple derived class of QPushButton to contain an Tool ID. Used as the main widget through Toolbar.
*/
class ToolbarButton : public QPushButton
{
+1 -3
View File
@@ -29,9 +29,7 @@
#include "widget/playbackcontrols/playbackcontrols.h"
/**
* @brief The ViewerWidget class
*
* An OpenGL-based viewer widget with playback controls.
* @brief An OpenGL-based viewer widget with playback controls (a PlaybackControls widget).
*/
class ViewerWidget : public QWidget
{
+3 -3
View File
@@ -26,10 +26,10 @@
#include "render/gl/shaderptr.h"
/**
* @brief The ViewerGLWidget class
* @brief The inner display/rendering widget of a Viewer class.
*
* The inner display/rendering widget of a Viewer class. Actual rendering/composition occurs elsewhere offscreen and
* multithreaded, so its main purpose is receiving an OpenGL texture to display it.
* Actual composition occurs elsewhere offscreen and
* multithreaded, so its main purpose is receiving a finalized OpenGL texture and displaying it.
*
* The main entry point is SetTexture() which will receive an OpenGL texture ID, store it, and then call update() to
* draw it on screen. The drawing function is in paintGL() (called during the update() process by Qt) and is fairly
+2 -3
View File
@@ -26,10 +26,9 @@
#include "widget/menu/menu.h"
/**
* @brief The MainMenu class
* @brief Olive's main menubar attached to its main window.
*
* Olive's menubar attached to its main window. Responsible for creating the menu, connecting signals/slots, and
* retranslating the items on a language change.
* Responsible for creating the menu, connecting signals/slots, and retranslating the items on a language change.
*/
class MainMenu : public QMenuBar
{
+1 -3
View File
@@ -28,9 +28,7 @@
namespace olive {
/**
* @brief The MainWindow class
*
* Olive's main window responsible for docking widgets and the main menu bar.
* @brief Olive's main window responsible for docking widgets and the main menu bar.
*/
class MainWindow : public QMainWindow {
Q_OBJECT