FOSSredder 0.5.0
Loading...
Searching...
No Matches
MainWindow.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <QMainWindow>
9#include <QUrl>
10
11#include <memory>
12
13#include "ui/shell/AppActions.h"
14#include "ui/shell/Defaults.h"
15#include "ui/shell/Status.h"
22
23QT_FORWARD_DECLARE_CLASS(QQmlImageProviderBase)
24QT_FORWARD_DECLARE_CLASS(QQmlEngine)
25QT_FORWARD_DECLARE_CLASS(QQuickView)
26QT_FORWARD_DECLARE_CLASS(QTimer)
27QT_FORWARD_DECLARE_CLASS(QWidget)
28
29namespace ui::bootstrap {
30class AppContext;
31}
32namespace ui {
33class Settings;
34}
36class IErrorReporter;
37}
38
39class MainWindow : public QMainWindow {
40 Q_OBJECT
41public:
42 explicit MainWindow(
43 std::shared_ptr<core::ports::diagnostics::IErrorReporter> errorReporter,
44 QWidget* parent = nullptr);
46
47 void addImageProvider(const QString& id, QQmlImageProviderBase* provider);
48 void loadQml(const QUrl& source = QUrl());
49 QQmlEngine* qmlEngine() const noexcept;
51 return appContext_;
52 }
54 return workspaceStore_;
55 }
57 return workspaceCommands_;
58 }
60 return workspaceSelection_;
61 }
63 return workspaceSelectors_;
64 }
65 ui::Settings* settings() const noexcept {
66 return settings_;
67 }
68
69public slots:
70 void handleStorageOperationSucceeded(const QString& operation);
71 void handleStorageOperationFailed(const QString& operation,
72 const QString& error);
73
74signals:
75 void newFileRequested(const QString& path);
76 void openFileRequested(const QString& path);
78 void saveFileAsRequested(const QString& path);
79
80private slots:
81 void onAbout();
82 void applyAutosaveSchedule();
83
84protected:
85 bool eventFilter(QObject* obj, QEvent* ev) override;
86 void closeEvent(QCloseEvent* event) override;
87
88private:
89 void setupQuickHost();
90 void setupUiContext();
91 void setupActionRouting();
92 void setupQmlRuntime();
94 void prepareForQmlShutdown();
95 void setupAutosaveTimer();
96
97 QQuickView* m_quickView = nullptr;
98 QTimer* autosaveTimer_ = nullptr;
99 QWidget* m_quickContainer = nullptr;
100 ui::WorkspaceStore* workspaceStore_ = nullptr;
101 ui::WorkspaceCommands* workspaceCommands_ = nullptr;
102 ui::WorkspaceSelection* workspaceSelection_ = nullptr;
103 ui::WorkspaceSelectors* workspaceSelectors_ = nullptr;
104 ui::Settings* settings_ = nullptr;
105 ui::Actions* actions_ = nullptr;
106 ui::Status* status_ = nullptr;
107 ui::bootstrap::AppContext* appContext_ = nullptr;
108 std::shared_ptr<core::ports::diagnostics::IErrorReporter> errorReporter_;
109 bool qmlShutdownPrepared_ = false;
110 ui::window::CloseWorkflow closeWorkflow_;
111 ui::window::DropHandler dropHandler_;
112};
Declares QAction wrappers exposed to the UI layer and QML.
Declarations for the UI CloseWorkflow component.
Defines UI-specific runtime constants that are not shared with core.
Declarations for the UI drop handling component.
Declarations for the UI Status component.
Declares the workspace selection state synchronized with the store.
Declares read-only workspace selectors for QML payloads.
Declares the UI workspace snapshot store.
void closeEvent(QCloseEvent *event) override
void saveFileRequested()
void openFileRequested(const QString &path)
ui::WorkspaceSelectors * workspaceSelectors() const noexcept
Definition MainWindow.h:62
void loadQml(const QUrl &source=QUrl())
void handleStorageOperationSucceeded(const QString &operation)
void handleStorageOperationFailed(const QString &operation, const QString &error)
void newFileRequested(const QString &path)
ui::WorkspaceStore * workspaceStore() const noexcept
Definition MainWindow.h:53
QQmlEngine * qmlEngine() const noexcept
ui::Settings * settings() const noexcept
Definition MainWindow.h:65
ui::bootstrap::AppContext * appContext() const noexcept
Definition MainWindow.h:50
bool eventFilter(QObject *obj, QEvent *ev) override
void saveFileAsRequested(const QString &path)
ui::WorkspaceCommands * workspaceCommands() const noexcept
Definition MainWindow.h:56
void addImageProvider(const QString &id, QQmlImageProviderBase *provider)
MainWindow(std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter, QWidget *parent=nullptr)
ui::WorkspaceSelection * workspaceSelection() const noexcept
Definition MainWindow.h:59
Port for reporting structured diagnostic error events.
Owns the main window actions and exposes them to QML.
Definition AppActions.h:18
Stores and exposes globally persisted UI settings for settings-related views.
Definition Settings.h:19
Exposes the shell status text shown by the main window.
Definition Status.h:16
Maps UI intent to core workspace writer commands.
Tracks the currently selected workspace entities.
Projects workspace store data into QML-facing read models.
Owns the current UI-side workspace snapshot and revision lifecycle.
Coordinates close requests that may need a pending workspace save.
Extracts local file drops from Qt drag/drop events.
Definition DropHandler.h:26
Declares UI-side workspace command submission.