2015-12-15 02:07:22 +00:00
|
|
|
#include "CStartWindow.h"
|
2016-07-08 07:10:07 +00:00
|
|
|
#include "CProjectOverviewDialog.h"
|
2016-02-15 12:28:20 +00:00
|
|
|
#include <Common/Log.h>
|
2015-12-15 02:07:22 +00:00
|
|
|
#include <Core/Resource/Factory/CTemplateLoader.h>
|
|
|
|
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <QApplication>
|
2016-02-15 12:28:20 +00:00
|
|
|
#include <QMessageBox>
|
2015-07-26 21:39:49 +00:00
|
|
|
#include <QStyleFactory>
|
2016-01-30 04:43:22 +00:00
|
|
|
#include <QtGlobal>
|
|
|
|
|
|
|
|
// Redirect qDebug output to the log file
|
|
|
|
void QtLogRedirect(QtMsgType Type, const QMessageLogContext& /*rkContext*/, const QString& rkMessage)
|
|
|
|
{
|
|
|
|
switch (Type)
|
|
|
|
{
|
|
|
|
case QtDebugMsg: Log::Write(TString("Qt Debug: ") + TO_TSTRING(rkMessage)); break;
|
|
|
|
case QtWarningMsg: Log::Write(TString("Qt Warning: ") + TO_TSTRING(rkMessage)); break;
|
|
|
|
case QtCriticalMsg: Log::Write(TString("Qt Critical: ") + TO_TSTRING(rkMessage)); break;
|
|
|
|
case QtFatalMsg: Log::Write(TString("Qt Fatal: ") + TO_TSTRING(rkMessage)); break;
|
|
|
|
}
|
|
|
|
}
|
2015-07-26 21:39:49 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2016-01-15 23:36:58 +00:00
|
|
|
// Create application
|
2015-07-26 21:39:49 +00:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
2016-03-27 19:09:38 +00:00
|
|
|
QApplication App(argc, argv);
|
|
|
|
App.setWindowIcon(QIcon(":/icons/AppIcon.ico"));
|
2015-07-26 21:39:49 +00:00
|
|
|
|
2016-02-15 12:28:20 +00:00
|
|
|
// Init log
|
|
|
|
bool Initialized = Log::InitLog("primeworldeditor.log");
|
|
|
|
if (!Initialized) QMessageBox::warning(0, "Error", "Couldn't open log file. Logging will not work for this session.");
|
2016-01-30 04:43:22 +00:00
|
|
|
qInstallMessageHandler(QtLogRedirect);
|
|
|
|
|
2016-01-15 23:36:58 +00:00
|
|
|
// Load templates
|
2015-07-26 21:39:49 +00:00
|
|
|
CTemplateLoader::LoadGameList();
|
|
|
|
|
2016-03-27 19:09:38 +00:00
|
|
|
// Set up dark theme
|
2015-07-26 21:39:49 +00:00
|
|
|
qApp->setStyle(QStyleFactory::create("Fusion"));
|
2016-03-27 19:09:38 +00:00
|
|
|
QPalette DarkPalette;
|
|
|
|
DarkPalette.setColor(QPalette::Window, QColor(53,53,53));
|
|
|
|
DarkPalette.setColor(QPalette::WindowText, Qt::white);
|
|
|
|
DarkPalette.setColor(QPalette::Base, QColor(25,25,25));
|
|
|
|
DarkPalette.setColor(QPalette::AlternateBase, QColor(35,35,35));
|
|
|
|
DarkPalette.setColor(QPalette::ToolTipBase, Qt::white);
|
|
|
|
DarkPalette.setColor(QPalette::ToolTipText, Qt::white);
|
|
|
|
DarkPalette.setColor(QPalette::Text, Qt::white);
|
|
|
|
DarkPalette.setColor(QPalette::Button, QColor(53,53,53));
|
|
|
|
DarkPalette.setColor(QPalette::ButtonText, Qt::white);
|
|
|
|
DarkPalette.setColor(QPalette::BrightText, Qt::red);
|
|
|
|
DarkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
|
|
|
|
DarkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
|
|
|
DarkPalette.setColor(QPalette::HighlightedText, Qt::white);
|
|
|
|
qApp->setPalette(DarkPalette);
|
2015-07-26 21:39:49 +00:00
|
|
|
|
2016-01-15 23:36:58 +00:00
|
|
|
// Execute application
|
2016-07-08 07:10:07 +00:00
|
|
|
CProjectOverviewDialog Dialog;
|
|
|
|
Dialog.show();
|
2016-02-15 12:28:20 +00:00
|
|
|
|
2016-03-27 19:09:38 +00:00
|
|
|
return App.exec();
|
2015-07-26 21:39:49 +00:00
|
|
|
}
|