now attaches to parent console on windows

This commit is contained in:
fourtf 2021-03-13 12:14:40 +01:00
parent baddb60bb9
commit 4ff2de0567
4 changed files with 23 additions and 1 deletions

View file

@ -232,6 +232,7 @@ SOURCES += \
src/singletons/TooltipPreviewImage.cpp \
src/singletons/Updates.cpp \
src/singletons/WindowManager.cpp \
src/util/AttachToConsole.cpp \
src/util/Clipboard.cpp \
src/util/DebugCount.cpp \
src/util/FormatTime.cpp \
@ -464,6 +465,7 @@ HEADERS += \
src/singletons/TooltipPreviewImage.hpp \
src/singletons/Updates.hpp \
src/singletons/WindowManager.hpp \
src/util/AttachToConsole.hpp \
src/util/Clamp.hpp \
src/util/Clipboard.hpp \
src/util/CombinePath.hpp \

View file

@ -7,6 +7,7 @@
#include "common/QLogging.hpp"
#include "singletons/Paths.hpp"
#include "singletons/WindowManager.hpp"
#include "util/AttachToConsole.hpp"
#include "util/CombinePath.hpp"
#include "widgets/Window.hpp"
@ -26,10 +27,17 @@ Args::Args(const QApplication &app)
QCommandLineOption parentWindowOption("parent-window");
parentWindowOption.setFlags(QCommandLineOption::HiddenFromHelp);
// Verbose
QCommandLineOption verboseOption({{"v", "verbose"},
"Attaches to the Console on windows, "
"allowing you to see debug output."});
crashRecoveryOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOptions({
{{"V", "version"}, "Displays version information."},
crashRecoveryOption,
parentWindowOption,
verboseOption,
});
parser.addOption(QCommandLineOption(
{"c", "channels"},
@ -46,6 +54,7 @@ Args::Args(const QApplication &app)
if (parser.isSet("help"))
{
attachToConsole();
qInfo().noquote() << parser.helpText();
::exit(EXIT_SUCCESS);
}
@ -60,7 +69,9 @@ Args::Args(const QApplication &app)
this->applyCustomChannelLayout(parser.value("c"));
}
this->printVersion = parser.isSet("v");
this->verbose = parser.isSet(verboseOption);
this->printVersion = parser.isSet("V");
this->crashRecovery = parser.isSet("crash-recovery");
}

View file

@ -17,6 +17,7 @@ public:
bool shouldRunBrowserExtensionHost{};
bool dontSaveSettings{};
boost::optional<WindowLayout> customChannelLayout;
bool verbose{};
private:
void applyCustomChannelLayout(const QString &argValue);

View file

@ -15,6 +15,7 @@
#include "providers/twitch/api/Kraken.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/AttachToConsole.hpp"
#include "util/IncognitoBrowser.hpp"
using namespace chatterino;
@ -63,6 +64,8 @@ int main(int argc, char **argv)
}
else if (getArgs().printVersion)
{
attachToConsole();
auto version = Version::instance();
qInfo().noquote() << QString("%1 (commit %2%3)")
.arg(version.fullVersion())
@ -73,6 +76,11 @@ int main(int argc, char **argv)
}
else
{
if (getArgs().verbose)
{
attachToConsole();
}
IvrApi::initialize();
Helix::initialize();
Kraken::initialize();