2012-11-22 12:30:02 +00:00
|
|
|
#include "editor.hpp"
|
|
|
|
|
2012-12-04 19:43:47 +00:00
|
|
|
#include <exception>
|
2014-05-03 11:01:29 +00:00
|
|
|
#include <string>
|
2012-12-04 19:43:47 +00:00
|
|
|
|
2013-08-21 22:14:29 +00:00
|
|
|
#include <QApplication>
|
2013-02-17 13:46:50 +00:00
|
|
|
#include <QIcon>
|
2014-05-03 11:01:29 +00:00
|
|
|
#include <QMetaType>
|
2012-11-22 12:30:02 +00:00
|
|
|
|
2018-08-03 09:19:12 +00:00
|
|
|
#include <components/debug/debugging.hpp>
|
2015-06-20 15:56:42 +00:00
|
|
|
|
2018-08-03 04:58:50 +00:00
|
|
|
#include "model/doc/messages.hpp"
|
2014-05-08 10:42:29 +00:00
|
|
|
#include "model/world/universalid.hpp"
|
|
|
|
|
2013-11-10 18:19:32 +00:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
#include <QDir>
|
2013-11-10 16:39:35 +00:00
|
|
|
#endif
|
|
|
|
|
2014-05-03 11:01:29 +00:00
|
|
|
Q_DECLARE_METATYPE (std::string)
|
|
|
|
|
2012-12-04 19:43:47 +00:00
|
|
|
class Application : public QApplication
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool notify (QObject *receiver, QEvent *event) override
|
2012-12-04 19:43:47 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return QApplication::notify (receiver, event);
|
|
|
|
}
|
|
|
|
catch (const std::exception& exception)
|
|
|
|
{
|
2018-08-14 16:01:09 +00:00
|
|
|
Log(Debug::Error) << "An exception has been caught: " << exception.what();
|
2012-12-04 19:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Application (int& argc, char *argv[]) : QApplication (argc, argv) {}
|
|
|
|
};
|
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
int runApplication(int argc, char *argv[])
|
2012-11-21 16:31:18 +00:00
|
|
|
{
|
2018-08-03 11:51:17 +00:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
2018-08-03 04:58:50 +00:00
|
|
|
#endif
|
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
Q_INIT_RESOURCE (resources);
|
2013-11-02 01:48:30 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
qRegisterMetaType<std::string> ("std::string");
|
|
|
|
qRegisterMetaType<CSMWorld::UniversalId> ("CSMWorld::UniversalId");
|
|
|
|
qRegisterMetaType<CSMDoc::Message> ("CSMDoc::Message");
|
2014-05-03 11:01:29 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
Application application (argc, argv);
|
2012-11-22 12:30:02 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
QDir dir(QCoreApplication::applicationDirPath());
|
|
|
|
QDir::setCurrent(dir.absolutePath());
|
|
|
|
#endif
|
2013-11-10 18:19:32 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
application.setWindowIcon (QIcon (":./openmw-cs.png"));
|
2013-02-17 13:46:50 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
CS::Editor editor(argc, argv);
|
2021-01-18 17:21:02 +00:00
|
|
|
#ifdef __linux__
|
|
|
|
setlocale(LC_NUMERIC,"C");
|
|
|
|
#endif
|
2012-11-21 16:31:18 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
if(!editor.makeIPCServer())
|
2013-09-03 06:44:21 +00:00
|
|
|
{
|
2018-08-03 11:51:17 +00:00
|
|
|
editor.connectToIPCServer();
|
|
|
|
return 0;
|
2013-09-03 06:44:21 +00:00
|
|
|
}
|
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
return editor.run();
|
|
|
|
}
|
|
|
|
|
2018-08-03 04:58:50 +00:00
|
|
|
|
2018-08-03 11:51:17 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2018-08-03 09:19:12 +00:00
|
|
|
return wrapApplication(&runApplication, argc, argv, "OpenMW-CS");
|
2013-02-17 13:46:50 +00:00
|
|
|
}
|