Files
chatterino2/src/main.cpp
Paweł 776ce8bdbc Added subage and followage to usercard (#2023)
* Added subage and followage information to usercard

We are using Leppunen's API here to determine user's subage to the current channel and since that API call also returns followage information I decided to utilize that and save ourselves an extra Helix API call.
I also added new files specifying new class and methods for Ivr API, which can be very easily expanded with new methods in the future if we ever have to do that.
When I was coding I also saw couple unnecessary nitpicks which I fixed :)

* Added changelog entry

* remove empty lambda

* Update UserInfoPopup.cpp

* xd

Co-authored-by: fourtf <tf.four@gmail.com>
2020-10-04 18:32:52 +02:00

86 lines
2.3 KiB
C++

#include <QApplication>
#include <QCommandLineParser>
#include <QDebug>
#include <QMessageBox>
#include <QStringList>
#include <memory>
#include "BrowserExtension.hpp"
#include "RunGui.hpp"
#include "common/Args.hpp"
#include "common/Modes.hpp"
#include "common/Version.hpp"
#include "providers/IvrApi.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/api/Kraken.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/IncognitoBrowser.hpp"
using namespace chatterino;
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QCoreApplication::setApplicationName("chatterino");
QCoreApplication::setApplicationVersion(CHATTERINO_VERSION);
QCoreApplication::setOrganizationDomain("https://www.chatterino.com");
initArgs(a);
// run in gui mode or browser extension host mode
if (getArgs().shouldRunBrowserExtensionHost)
{
runBrowserExtensionHost();
}
else if (getArgs().printVersion)
{
auto version = Version::instance();
qInfo().noquote() << QString("%1 (commit %2%3)")
.arg(version.fullVersion())
.arg(version.commitHash())
.arg(Modes::instance().isNightly
? ", " + version.dateOfBuild()
: "");
}
else
{
IvrApi::initialize();
Helix::initialize();
Kraken::initialize();
Paths *paths{};
try
{
paths = new Paths;
}
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;
}
Settings settings(paths->settingsDirectory);
runGui(a, *paths, settings);
}
return 0;
}