QtNovelUI/WordsIDE/manager_docs.h

152 lines
4.3 KiB
C
Raw Normal View History

#ifndef VISUABLE_PROJECT_CONTROLLER
#define VISUABLE_PROJECT_CONTROLLER
#include "appcore.h"
2023-03-10 13:01:19 +00:00
#include "route.h"
#include <QTreeView>
#include <QWidget>
#include <libProjectManager.h>
#include <commandsdispatcher.h>
namespace Components {
class PresentContainer
{
public:
virtual ~PresentContainer() = default;
/**
* @brief
* @param ins
*/
virtual void append(MakeTools::ContentPresent *ins) = 0;
/**
* @brief
* @param ins
*/
virtual void active(MakeTools::ContentPresent *ins) = 0;
/**
* @brief
* @param ins
*/
virtual void remove(MakeTools::ContentPresent *ins) = 0;
};
/**
* @brief
*/
2023-03-10 13:01:19 +00:00
class DocumentsManager : public Schedule::AccessibleObject
{
public:
2023-03-10 13:01:19 +00:00
DocumentsManager(Core::AppCore *src, Project::ProjectManager *project, PresentContainer *con);
virtual ~DocumentsManager() = default;
Project::ProjectManager* projectManager() const;
/**
* @brief
* @param path [/x_name]+
*/
2023-03-10 13:01:19 +00:00
void newPackage(const Core::Route &link);
/**
* @brief Index
* @param group
* @param name
* @throw SimpleException
*/
2023-03-10 13:01:19 +00:00
void newPackage(const Core::Route &group, const QString &name);
/**
* @brief
* @return {txt, storychain, }
*/
QList<QString> fileTypes() const;
/**
* @brief
* @param group
* @param name
* @param suffix
* @throw SimpleException
*/
2023-03-10 13:01:19 +00:00
void newFile(const Core::Route &group_path, const QString &name, const QString &suffix);
2023-03-10 13:01:19 +00:00
QModelIndex converter(const Core::Route &path);
Core::Route converter(const QModelIndex &index);
/**
* @brief
* @param node
* @throw SimpleException
*/
2023-03-10 13:01:19 +00:00
void removeNode(const Core::Route &node_path);
/**
* @brief
* @param node Index
* @param name
* @throw SimpleException
*/
2023-03-10 13:01:19 +00:00
void renameNode(const Core::Route &node_path, const QString &name);
/**
* @brief
2023-03-10 13:01:19 +00:00
* @param path_node
* @throw SimpleException
*/
2023-03-10 13:01:19 +00:00
void openFile(const Core::Route &path_node);
/**
* @brief
* @return
*/
2023-03-10 13:01:19 +00:00
QList<Core::Route> actives() const;
/**
* @brief null
* @param node
* @return null或打开的展示实例
*/
2023-03-10 13:01:19 +00:00
MakeTools::ContentPresent* activePresentOf(const Core::Route &node_path);
/**
* @brief
* @param docs
*/
2023-03-10 13:01:19 +00:00
void save(const QList<Core::Route> &docs = QList<Core::Route>());
/**
* @brief
* @param docs
*/
2023-03-10 13:01:19 +00:00
void close(const QList<Core::Route> &doc_paths = QList<Core::Route>());
/**
* @brief ModelIndex
* @param ins
*/
2023-03-10 13:01:19 +00:00
Core::Route pathOf(MakeTools::ContentPresent *ins) const;
Core::Route pathOf(const QModelIndex &p) const;
/**
2023-03-10 13:01:19 +00:00
* @brief
* @param disk
*/
2023-03-10 13:01:19 +00:00
void build(bool disk);
// AccessibleObject interface
public:
virtual QString name() const override;
private:
Core::AppCore *const rtcore;
Project::ProjectManager *pjtins;
2023-03-10 13:01:19 +00:00
PresentContainer *present_ui;
QHash<QString, MakeTools::ContentPresent*> doc_openning;
};
}
#endif // VISUABLE_PROJECT_CONTROLLER