2018-08-02 14:23:27 +02:00
|
|
|
#include "BrowserExtension.hpp"
|
2019-09-22 15:32:36 +02:00
|
|
|
#include "common/Args.hpp"
|
2023-02-12 00:16:51 +01:00
|
|
|
#include "common/Env.hpp"
|
2019-10-05 16:40:04 +02:00
|
|
|
#include "common/Modes.hpp"
|
2020-11-21 16:20:10 +01:00
|
|
|
#include "common/QLogging.hpp"
|
2019-10-07 18:57:33 +02:00
|
|
|
#include "common/Version.hpp"
|
2020-10-04 18:32:52 +02:00
|
|
|
#include "providers/IvrApi.hpp"
|
2023-02-12 00:16:51 +01:00
|
|
|
#include "providers/NetworkConfigurationProvider.hpp"
|
2020-03-14 12:13:57 +01:00
|
|
|
#include "providers/twitch/api/Helix.hpp"
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "RunGui.hpp"
|
2023-12-24 15:38:58 +01:00
|
|
|
#include "singletons/CrashHandler.hpp"
|
2018-06-28 19:46:45 +02:00
|
|
|
#include "singletons/Paths.hpp"
|
2018-08-02 14:23:27 +02:00
|
|
|
#include "singletons/Settings.hpp"
|
2024-01-16 21:56:43 +01:00
|
|
|
#include "singletons/Updates.hpp"
|
2021-03-13 12:14:40 +01:00
|
|
|
#include "util/AttachToConsole.hpp"
|
2017-01-11 01:08:20 +01:00
|
|
|
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
using namespace chatterino;
|
2018-04-09 22:59:19 +02:00
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
int main(int argc, char **argv)
|
2018-04-09 22:59:19 +02:00
|
|
|
{
|
2023-08-27 12:32:09 +02:00
|
|
|
// TODO: This is a temporary fix (see #4552).
|
|
|
|
#if defined(Q_OS_WINDOWS) && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
qputenv("QT_ENABLE_HIGHDPI_SCALING", "0");
|
|
|
|
#endif
|
|
|
|
|
2018-06-13 13:27:10 +02:00
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
2020-05-10 10:54:55 +02:00
|
|
|
QCoreApplication::setApplicationName("chatterino");
|
|
|
|
QCoreApplication::setApplicationVersion(CHATTERINO_VERSION);
|
2022-12-24 12:25:05 +01:00
|
|
|
QCoreApplication::setOrganizationDomain("chatterino.com");
|
2020-05-10 10:54:55 +02:00
|
|
|
|
2024-01-16 21:56:43 +01:00
|
|
|
std::unique_ptr<Paths> paths;
|
2021-01-23 16:26:42 +01:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2024-01-16 21:56:43 +01:00
|
|
|
paths = std::make_unique<Paths>();
|
2021-01-23 16:26:42 +01:00
|
|
|
}
|
|
|
|
catch (std::runtime_error &error)
|
|
|
|
{
|
|
|
|
QMessageBox box;
|
|
|
|
if (Modes::instance().isPortable)
|
|
|
|
{
|
|
|
|
box.setText(
|
|
|
|
error.what() +
|
|
|
|
QStringLiteral(
|
|
|
|
"\n\nInfo: Portable mode requires the application to "
|
|
|
|
"be in a writeable location. If you don't want "
|
|
|
|
"portable mode reinstall the application. "
|
|
|
|
"https://chatterino.com."));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
box.setText(error.what());
|
|
|
|
}
|
|
|
|
box.exec();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2024-01-16 21:56:43 +01:00
|
|
|
const Args args(a, *paths);
|
2018-04-09 22:59:19 +02:00
|
|
|
|
2023-02-12 20:36:58 +01:00
|
|
|
#ifdef CHATTERINO_WITH_CRASHPAD
|
2024-01-16 21:56:43 +01:00
|
|
|
const auto crashpadHandler = installCrashHandler(args, *paths);
|
2023-02-12 20:36:58 +01:00
|
|
|
#endif
|
|
|
|
|
2018-08-02 14:23:27 +02:00
|
|
|
// run in gui mode or browser extension host mode
|
2023-12-29 15:40:31 +01:00
|
|
|
if (args.shouldRunBrowserExtensionHost)
|
2018-08-02 14:23:27 +02:00
|
|
|
{
|
|
|
|
runBrowserExtensionHost();
|
2018-04-20 00:15:57 +02:00
|
|
|
}
|
2023-12-29 15:40:31 +01:00
|
|
|
else if (args.printVersion)
|
2019-10-07 18:57:33 +02:00
|
|
|
{
|
2021-03-13 12:14:40 +01:00
|
|
|
attachToConsole();
|
|
|
|
|
2020-06-16 09:30:35 +02:00
|
|
|
auto version = Version::instance();
|
2021-01-23 16:26:42 +01:00
|
|
|
qInfo().noquote() << QString("%1 (commit %2%3)")
|
|
|
|
.arg(version.fullVersion())
|
|
|
|
.arg(version.commitHash())
|
|
|
|
.arg(Modes::instance().isNightly
|
|
|
|
? ", " + version.dateOfBuild()
|
|
|
|
: "");
|
2019-10-07 18:57:33 +02:00
|
|
|
}
|
2018-04-20 00:15:57 +02:00
|
|
|
else
|
|
|
|
{
|
2023-12-29 15:40:31 +01:00
|
|
|
if (args.verbose)
|
2021-03-13 12:14:40 +01:00
|
|
|
{
|
|
|
|
attachToConsole();
|
|
|
|
}
|
|
|
|
|
2024-01-16 21:56:43 +01:00
|
|
|
Updates updates(*paths);
|
|
|
|
|
2023-02-12 00:16:51 +01:00
|
|
|
NetworkConfigurationProvider::applyFromEnv(Env::get());
|
|
|
|
|
2020-10-04 18:32:52 +02:00
|
|
|
IvrApi::initialize();
|
2020-03-14 12:13:57 +01:00
|
|
|
Helix::initialize();
|
|
|
|
|
2019-10-05 16:40:04 +02:00
|
|
|
Settings settings(paths->settingsDirectory);
|
|
|
|
|
2024-01-16 21:56:43 +01:00
|
|
|
runGui(a, *paths, settings, args, updates);
|
2018-05-28 18:25:19 +02:00
|
|
|
}
|
2019-10-07 18:57:33 +02:00
|
|
|
return 0;
|
2018-05-28 18:25:19 +02:00
|
|
|
}
|