58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include "xapp.h"
|
|
#include "command_list.h"
|
|
#include <QDebug>
|
|
#include <iostream>
|
|
#include <xmlconfig.h>
|
|
#include <xmlprojectmanager.h>
|
|
|
|
using namespace Schedule;
|
|
using namespace Config;
|
|
using namespace bridge;
|
|
using namespace Core;
|
|
using namespace Project;
|
|
|
|
XApp::XApp(int argc, char **argv)
|
|
: QApplication(argc, argv),
|
|
parse_service(new ParseBridge()),
|
|
project_manager(new XMLProjectManager(this)),
|
|
active_docscollect(new DocumentsManager(this)) {
|
|
gconfig->loadFile("./software.config");
|
|
|
|
init_commands(disp_core);
|
|
|
|
XApp::disp_core->registerMember(active_docscollect);
|
|
}
|
|
|
|
bool XApp::notify(QObject *receiver, QEvent *event) {
|
|
try {
|
|
return QApplication::notify(receiver, event);
|
|
} catch (std::exception *x) {
|
|
std::cout << QString("XApplication::").toLocal8Bit().toStdString() << x->what() << std::endl;
|
|
delete x;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
ParseBridge *XApp::parseService() const { return parse_service; }
|
|
|
|
ProjectManager *XApp::pjtManager() const { return project_manager; }
|
|
|
|
DocumentsManager *XApp::docsManager() const { return active_docscollect; }
|
|
|
|
using namespace CommandList;
|
|
void XApp::init_commands(Schedule::CommandsDispatcher *host) {
|
|
host->registerCommand(new CloseProject());
|
|
|
|
host->registerCommand(new NewFile(Route(), "", "txt"));
|
|
host->registerCommand(new NewPackage(""));
|
|
host->registerCommand(new NewProject(QDir(), ""));
|
|
host->registerCommand(new OpenFile(Route()));
|
|
host->registerCommand(new OpenProject(""));
|
|
host->registerCommand(new SaveAll());
|
|
host->registerCommand(new DeleteTarget(Route()));
|
|
}
|
|
|
|
CommandsDispatcher *const XApp::disp_core = new CommandsDispatcher(QDir("./"), true);
|
|
Configration *const XApp::gconfig = new XMLConfig();
|