Files
oak-editor/app/window/mainwindow/mainwindow.h
T
Mike-Solar bb40b4923e style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to
.clang-tidy) plus scripted passes, per the updated rules now documented
in CONTRIBUTING.md:

- types (class/struct/enum/alias/template params): PascalCase
- functions, variables, members: snake_case (incl. rational -> Rational)
- private/protected members: trailing underscore; static member
  variables likewise (instance_, available_themes_)
- constants and enum values: snake_case (kLinear -> k_linear,
  F32P -> f32p); ALL_CAPS reserved for macros
- macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG ->
  OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE,
  include guards -> OAK_*)
- file names: all lowercase (Current/Plugin/OliveHost/OliveClip/
  OlivePluginInstance -> current/plugin/olivehost/oliveclip/
  oliveplugininstance)
- getters share the member name sans underscore, setters set_foo()
- Qt and third-party (OpenFX) virtual overrides and framework callbacks
  keep their original names (exempt in .clang-tidy)

Manual follow-ups required where automation could not reach:
- string-based QMetaObject/SIGNAL/SLOT references updated to renamed
  methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...)
- macro bodies referencing renamed methods (OLIVE_CONFIG,
  NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*)
- self-shadowing locals renamed where signals/methods became same-named
  (size_changed, worker_count, selected_items, import param, filters)
- third_party OFX member/namespace usages restored (OFX::Host::*,
  _created, _clipPrefsDirty, createInstance, clearPersistentMessage)
- STL protocol aliases restored (const_iterator) with .clang-tidy
  ignore rules; qHash overloads restored

Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
2026-07-19 16:10:54 +08:00

208 lines
5.3 KiB
C++

/***
Olive - Non-Linear Video Editor
Copyright (C) 2022 Olive Team
Modifications Copyright (C) 2025 mikesolar
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 OAK_MAINWINDOW_H
#define OAK_MAINWINDOW_H
#include <kddockwidgets/Config.h>
#include <kddockwidgets/MainWindow.h>
#include "mainwindowlayoutinfo.h"
#include "node/project.h"
#include "panel/multicam/multicampanel.h"
#include "panel/panelmanager.h"
#include "panel/audiomonitor/audiomonitor.h"
#include "panel/curve/curve.h"
#include "panel/history/historypanel.h"
#include "panel/node/node.h"
#include "panel/param/param.h"
#include "panel/project/project.h"
#include "panel/scope/scope.h"
#include "panel/table/table.h"
#include "panel/taskmanager/taskmanager.h"
#include "panel/timeline/timeline.h"
#include "panel/tool/tool.h"
#include "panel/footageviewer/footageviewer.h"
#include "panel/sequenceviewer/sequenceviewer.h"
#include "panel/pixelsampler/pixelsamplerpanel.h"
#ifdef Q_OS_WINDOWS
#include <shobjidl.h>
#endif
namespace olive
{
/**
* @brief Olive's main window responsible for docking widgets and the main menu bar.
*/
class MainWindow : public KDDockWidgets::QtWidgets::MainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
virtual ~MainWindow() override;
void load_layout(const MainWindowLayoutInfo &info);
MainWindowLayoutInfo save_layout() const;
TimelinePanel *open_sequence(Sequence *sequence, bool enable_focus = true);
void close_sequence(Sequence *sequence);
bool is_sequence_open(Sequence *sequence) const;
void open_folder(Folder *i, bool floating);
void open_node_in_viewer(ViewerOutput *node);
enum ProgressStatus { k_progress_none, k_progress_show, k_progress_error };
/**
* @brief Where applicable, show progress on an operating system level
*
* * For Windows, this is shown as progress in the taskbar.
* * For macOS, this is shown as progress in the dock.
*/
void set_application_progress_status(ProgressStatus status);
/**
* @brief If SetApplicationProgressStatus is set to kShowProgress, set the value with this
*
* Expects a percentage (0-100 inclusive).
*/
void set_application_progress_value(int value);
void select_footage(const QVector<Footage *> &e);
public slots:
void set_project(Project *p);
void set_fullscreen(bool fullscreen);
void toggle_maximized_panel();
void set_default_layout();
protected:
virtual void showEvent(QShowEvent *e) override;
virtual void closeEvent(QCloseEvent *e) override;
#ifdef Q_OS_WINDOWS
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
virtual bool nativeEvent(const QByteArray &eventType, void *message,
qintptr *result) override;
#else
virtual bool nativeEvent(const QByteArray &eventType, void *message,
long *result) override;
#endif
#endif
private:
TimelinePanel *append_timeline_panel();
template <typename T>
T *append_panel_internal(const QString &panel_name, QList<T *> &list);
template <typename T> void remove_panel_internal(QList<T *> &list, T *panel);
void remove_timeline_panel(TimelinePanel *panel);
void timeline_focused(ViewerOutput *viewer);
static QString get_custom_shortcuts_file();
void load_custom_shortcuts();
void save_custom_shortcuts();
void update_audio_monitor_params(ViewerOutput *viewer);
void update_node_panel_context_from_timeline_panel(TimelinePanel *panel);
void select_footage_for_project_panel(const QVector<Footage *> &e,
ProjectPanel *p);
QByteArray premaximized_state_;
// Standard panels
ProjectPanel *project_panel_;
NodePanel *node_panel_;
ParamPanel *param_panel_;
CurvePanel *curve_panel_;
SequenceViewerPanel *sequence_viewer_panel_;
FootageViewerPanel *footage_viewer_panel_;
QList<ProjectPanel *> folder_panels_;
ToolPanel *tool_panel_;
QList<TimelinePanel *> timeline_panels_;
AudioMonitorPanel *audio_monitor_panel_;
TaskManagerPanel *task_man_panel_;
PixelSamplerPanel *pixel_sampler_panel_;
ScopePanel *scope_panel_;
QList<ViewerPanel *> viewer_panels_;
MulticamPanel *multicam_panel_;
HistoryPanel *history_panel_;
#ifdef Q_OS_WINDOWS
unsigned int taskbar_btn_id_;
ITaskbarList3 *taskbar_interface_;
#endif
bool first_show_;
Project *project_;
private slots:
void focused_panel_changed(PanelWidget *panel);
void update_title();
void timeline_close_requested();
void viewer_close_requested();
void viewer_with_panel_removed_from_graph();
void folder_panel_close_requested();
void status_bar_double_clicked();
void node_panel_group_opened_or_closed();
#ifdef Q_OS_LINUX
void show_nouveau_warning();
#endif
void timeline_panel_selection_changed(const QVector<Block *> &blocks);
void show_welcome_dialog();
void reveal_viewer_in_project(ViewerOutput *r);
void reveal_viewer_in_footage_viewer(ViewerOutput *r, const TimeRange &range);
};
}
#endif