Фазы 2-3: мульти-окна (WindowController, per-window FileStore), файловое дерево (FileStore+FileTreePanel, иконки/раскрытие/ПКМ/+drag&drop/подтверждения), NameDialog/ConfirmDialog; тест filestore (13/13)
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QPointer>
|
||||
#include <QList>
|
||||
|
||||
class FileStore;
|
||||
|
||||
// Создание окон приложения (мульти-хранилища: новое хранилище — новое окно).
|
||||
class WindowController : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(int windowCount READ windowCount NOTIFY windowsChanged)
|
||||
Q_PROPERTY(QStringList openVaults READ openVaults NOTIFY windowsChanged)
|
||||
|
||||
public:
|
||||
WindowController(QQmlApplicationEngine *engine, const QString &mainWindowUrl,
|
||||
QObject *parent = nullptr);
|
||||
|
||||
int windowCount() const;
|
||||
QStringList openVaults() const;
|
||||
|
||||
// Открывает окно с заданным хранилищем. Возвращает nullptr при ошибке.
|
||||
Q_INVOKABLE QObject *openWindow(const QString &vaultPath);
|
||||
|
||||
Q_INVOKABLE int indexOfVault(const QString &vaultPath) const;
|
||||
|
||||
signals:
|
||||
void windowsChanged();
|
||||
void windowOpened(const QString &vaultPath);
|
||||
void windowClosed(const QString &vaultPath);
|
||||
|
||||
private:
|
||||
struct Window {
|
||||
QString vault;
|
||||
QPointer<QObject> object;
|
||||
FileStore *fileStore = nullptr;
|
||||
};
|
||||
|
||||
QQmlApplicationEngine *m_engine;
|
||||
QString m_mainWindowUrl;
|
||||
QList<Window> m_windows;
|
||||
QQmlComponent *m_component = nullptr;
|
||||
};
|
||||
Reference in New Issue
Block a user