2015-11-27 08:33:07 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2+
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2016-05-12 01:18:30 +00:00
|
|
|
#include <QAbstractEventDispatcher>
|
2015-11-27 08:33:07 +00:00
|
|
|
#include <QApplication>
|
2017-05-20 21:41:02 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QObject>
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2017-05-20 21:41:02 +00:00
|
|
|
#include "Core/Analytics.h"
|
2015-11-27 08:33:07 +00:00
|
|
|
#include "Core/BootManager.h"
|
|
|
|
#include "Core/Core.h"
|
|
|
|
#include "DolphinQt2/Host.h"
|
2016-07-13 05:52:45 +00:00
|
|
|
#include "DolphinQt2/InDevelopmentWarning.h"
|
2015-11-27 08:33:07 +00:00
|
|
|
#include "DolphinQt2/MainWindow.h"
|
|
|
|
#include "DolphinQt2/Resources.h"
|
2016-07-13 05:52:45 +00:00
|
|
|
#include "DolphinQt2/Settings.h"
|
2015-11-27 08:33:07 +00:00
|
|
|
#include "UICommon/UICommon.h"
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
2017-05-30 20:42:21 +00:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
QApplication app(argc, argv);
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
UICommon::SetUserDirectory("");
|
|
|
|
UICommon::CreateDirectories();
|
|
|
|
UICommon::Init();
|
|
|
|
Resources::Init();
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
// Whenever the event loop is about to go to sleep, dispatch the jobs
|
|
|
|
// queued in the Core first.
|
|
|
|
QObject::connect(QAbstractEventDispatcher::instance(), &QAbstractEventDispatcher::aboutToBlock,
|
|
|
|
&app, &Core::HostDispatchJobs);
|
2016-05-12 01:18:30 +00:00
|
|
|
|
2016-07-13 05:52:45 +00:00
|
|
|
int retval = 0;
|
|
|
|
if (Settings().IsInDevelopmentWarningEnabled())
|
|
|
|
{
|
|
|
|
InDevelopmentWarning warning_box;
|
|
|
|
retval = warning_box.exec() == QDialog::Rejected;
|
|
|
|
}
|
|
|
|
if (!retval)
|
|
|
|
{
|
2017-05-20 21:41:02 +00:00
|
|
|
DolphinAnalytics::Instance()->ReportDolphinStart("qt");
|
|
|
|
|
2016-07-13 05:52:45 +00:00
|
|
|
MainWindow win;
|
|
|
|
win.show();
|
2017-05-20 21:41:02 +00:00
|
|
|
|
|
|
|
#if defined(USE_ANALYTICS) && USE_ANALYTICS
|
|
|
|
if (!Settings().HasAskedForAnalyticsPermission())
|
|
|
|
{
|
|
|
|
QMessageBox analytics_prompt(&win);
|
|
|
|
|
|
|
|
analytics_prompt.setIcon(QMessageBox::Question);
|
|
|
|
analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
|
|
|
analytics_prompt.setText(QObject::tr(
|
|
|
|
"Do you authorize Dolphin to report this information to Dolphin's developers?"));
|
|
|
|
analytics_prompt.setInformativeText(
|
|
|
|
QObject::tr("If authorized, Dolphin can collect data on its performance, "
|
|
|
|
"feature usage, and configuration, as well as data on your system's "
|
|
|
|
"hardware and operating system.\n\n"
|
|
|
|
"No private data is ever collected. This data helps us understand "
|
|
|
|
"how people and emulated games use Dolphin and prioritize our "
|
|
|
|
"efforts. It also helps us identify rare configurations that are "
|
|
|
|
"causing bugs, performance and stability issues.\n"
|
|
|
|
"This authorization can be revoked at any time through Dolphin's "
|
|
|
|
"settings.\n\n"));
|
|
|
|
|
|
|
|
const int answer = analytics_prompt.exec();
|
|
|
|
|
|
|
|
Settings().SetAskedForAnalyticsPermission(true);
|
|
|
|
Settings().SetAnalyticsEnabled(answer == QMessageBox::Yes);
|
|
|
|
Settings().Save();
|
|
|
|
|
|
|
|
DolphinAnalytics::Instance()->ReloadConfig();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-07-13 05:52:45 +00:00
|
|
|
retval = app.exec();
|
|
|
|
}
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
BootManager::Stop();
|
|
|
|
Core::Shutdown();
|
|
|
|
UICommon::Shutdown();
|
|
|
|
Host::GetInstance()->deleteLater();
|
2015-11-27 08:33:07 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
return retval;
|
2015-11-27 08:33:07 +00:00
|
|
|
}
|