diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 04:33:14 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-01-16 06:45:52 +0100 |
commit | 2b1c5593b0bc1ebfcd2e808f128e4b0312f59d93 (patch) | |
tree | e7e8f5d8d3af88a6df37cbd482edcbd3ff8def26 /gui/init.cpp | |
parent | 3583e3d3cd0b6ca2515ada16ca7dcc8cce83031f (diff) |
gui, variant/default: move default UI
Diffstat (limited to 'gui/init.cpp')
-rw-r--r-- | gui/init.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/gui/init.cpp b/gui/init.cpp index 3ed4ff48..fde6f256 100644 --- a/gui/init.cpp +++ b/gui/init.cpp @@ -12,15 +12,14 @@ #endif #include "migration/migration.hpp" -#include "gui/main-window.hpp" #include "options/options.hpp" using namespace options; #include "opentrack-library-path.h" #include <memory> +#include <cstdlib> #include <cstring> #include <cstdio> -#include <cstdlib> #include <QApplication> #include <QStyleFactory> @@ -94,19 +93,6 @@ void qdebug_to_console(QtMsgType, const QMessageLogContext& ctx, const QString & std::fflush(stderr); } -void attach_parent_console() -{ - if (AttachConsole(ATTACH_PARENT_PROCESS)) - { - // XXX c++ iostreams aren't reopened - - _wfreopen(L"CON", L"w", stdout); - _wfreopen(L"CON", L"w", stderr); - _wfreopen(L"CON", L"r", stdin); - } - (void)qInstallMessageHandler(qdebug_to_console); -} - void add_win32_path() { // see https://software.intel.com/en-us/articles/limitation-to-the-length-of-the-system-path-variable @@ -157,6 +143,8 @@ void add_win32_path() } } +void attach_parent_console(); + #endif int run_window(QApplication& app, std::unique_ptr<QWidget> main_window) @@ -226,3 +214,20 @@ int otr_main(int argc, char** argv, std::function<QWidget*()> make_main_window) return ret; } + +#if defined _WIN32 +#include <windows.h> + +void attach_parent_console() +{ + if (AttachConsole(ATTACH_PARENT_PROCESS)) + { + // XXX c++ iostreams aren't reopened + + _wfreopen(L"CON", L"w", stdout); + _wfreopen(L"CON", L"w", stderr); + _wfreopen(L"CON", L"r", stdin); + } + (void)qInstallMessageHandler(qdebug_to_console); +} +#endif |