96 lines
2.3 KiB
C++
96 lines
2.3 KiB
C++
#include "appcore.h"
|
|
#include "xmlconfig.h"
|
|
#include "storychainsourceeditor.h"
|
|
#include "storyunitsourceedit.h"
|
|
#include "storyboardsourceedit.h"
|
|
#include "storyvolumesourceedit.h"
|
|
#include "SensitiveCore.h"
|
|
|
|
#include <QApplication>
|
|
#include <StoryTool.h>
|
|
|
|
using namespace Core;
|
|
using namespace Components;
|
|
using namespace Parse::Result;
|
|
using namespace MakeTools;
|
|
|
|
AppCore::AppCore(QObject *parent)
|
|
: QObject(parent), global_config(new Config::XMLConfig(this)),
|
|
parse_core(new ParseCore()),
|
|
make_tool(new StoryTool(parse_core)),
|
|
framework(new SensitiveCore(make_tool))
|
|
{
|
|
global_config->loadFile(QDir(QApplication::applicationDirPath()).filePath(".software.xml"));
|
|
extensions_list << new StoryChainSourceEditFactory()
|
|
<< new StoryUnitSourceEditFactory
|
|
<< new StoryBoardSourceEditFactory()
|
|
<< new StoryVolumeSourceEditFactory()
|
|
<< new TextContentEditFactory();
|
|
}
|
|
|
|
void AppCore::save()
|
|
{
|
|
global_config->save();
|
|
}
|
|
|
|
Config::Configration *AppCore::globalConfig() const
|
|
{
|
|
return global_config;
|
|
}
|
|
|
|
void AppCore::setCurrentProject(Project::ProjectManager *project)
|
|
{
|
|
this->current_project = project;
|
|
}
|
|
|
|
Project::ProjectManager *AppCore::currentProject() const
|
|
{
|
|
return this->current_project;
|
|
}
|
|
|
|
QList<Config::Configration *> AppCore::getConfigs(QList<Scale> types) const
|
|
{
|
|
QList<Config::Configration*> rets;
|
|
|
|
for(auto &x : types){
|
|
if(x == Scale::Global)
|
|
rets << global_config;
|
|
if(x == Scale::Project && current_project->isOpen())
|
|
rets << current_project->configraions();
|
|
}
|
|
|
|
return rets;
|
|
}
|
|
|
|
Parse::Result::ParseCore *AppCore::parseCore() const
|
|
{
|
|
return parse_core;
|
|
}
|
|
|
|
QList<FileExtensionFactory *> AppCore::extensions(const QString &suffix) const
|
|
{
|
|
if(suffix.isEmpty())
|
|
return this->extensions_list;
|
|
|
|
QList<FileExtensionFactory*> rets;
|
|
for(auto &ext : extensions_list)
|
|
if(ext->suffixPeers() == suffix)
|
|
rets << ext;
|
|
|
|
for(auto &ext : extensions_list)
|
|
if(ext->suffixPeers()=="*")
|
|
rets << ext;
|
|
|
|
return rets;
|
|
}
|
|
|
|
MakeTools::StoryTool *AppCore::getMake_tool() const
|
|
{
|
|
return make_tool;
|
|
}
|
|
|
|
MakeTools::SensitiveCore *AppCore::getFramework() const
|
|
{
|
|
return framework;
|
|
}
|