/*** 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 . ***/ #ifndef OAK_MAINWINDOW_H #define OAK_MAINWINDOW_H #include #include #include "common/serializedlayoutinfoapp.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" #include "engineeventbridge.h" #ifdef Q_OS_WINDOWS #include #endif namespace olive { class EngineEventBridge; class MainStatusBar; /** * @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 SerializedLayoutInfo &info); SerializedLayoutInfo save_layout() const; TimelinePanel *open_sequence(OakEngineNode *sequence, bool enable_focus = true); void close_sequence(OakEngineNode *sequence); bool is_sequence_open(OakEngineNode *sequence) const; void open_folder(OakEngineNode *i, bool floating); void open_node_in_viewer(OakEngineNode *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 &e); public: // Not a slot: signature uses an opaque engine handle which must not be // exposed to MOC. It is only ever called directly, never via connect(). void set_project(OakEngineProject *p); public slots: 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 T *append_panel_internal(const QString &panel_name, QList &list); template void remove_panel_internal(QList &list, T *panel); void remove_timeline_panel(TimelinePanel *panel); void timeline_focused(OakEngineNode *viewer); static QString get_custom_shortcuts_file(); void load_custom_shortcuts(); void save_custom_shortcuts(); void update_audio_monitor_params(OakEngineNode *viewer); void update_node_panel_context_from_timeline_panel(TimelinePanel *panel); void select_footage_for_project_panel(const QVector &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 folder_panels_; ToolPanel *tool_panel_; QList timeline_panels_; AudioMonitorPanel *audio_monitor_panel_; TaskManagerPanel *task_man_panel_; EngineEventBridge *event_bridge_; MainStatusBar *status_bar_; PixelSamplerPanel *pixel_sampler_panel_; ScopePanel *scope_panel_; QList viewer_panels_; MulticamPanel *multicam_panel_; HistoryPanel *history_panel_; #ifdef Q_OS_WINDOWS unsigned int taskbar_btn_id_; ITaskbarList3 *taskbar_interface_; #endif bool first_show_; OakEngineProject *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(OakEngineNode *source); 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 show_welcome_dialog(); void reveal_viewer_in_project(OakEngineNode *r); void reveal_viewer_in_footage_viewer(OakEngineNode *r, const TimeRange &range); private: void timeline_panel_selection_changed(const QVector &blocks); EngineEventBridge *bridge_ = nullptr; QHash removed_from_graph_subs_; }; } #endif