mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: redirect the log to the current console
🎨 apply clang-format changes
This commit is contained in:
parent
e1b844b23d
commit
e66f6d6404
|
@ -77,10 +77,10 @@ IndentCaseBlocks: false
|
||||||
IndentGotoLabels: true
|
IndentGotoLabels: true
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: BeforeHash
|
||||||
IndentExternBlock: AfterExternBlock
|
IndentExternBlock: AfterExternBlock
|
||||||
IndentRequiresClause: true
|
# IndentRequiresClause: true
|
||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
IndentWrappedFunctionNames: false
|
IndentWrappedFunctionNames: false
|
||||||
InsertBraces: false
|
# InsertBraces: false
|
||||||
InsertTrailingCommas: None
|
InsertTrailingCommas: None
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
LambdaBodyIndentation: Signature
|
LambdaBodyIndentation: Signature
|
||||||
|
@ -104,7 +104,7 @@ PPIndentWidth: -1
|
||||||
ReferenceAlignment: Pointer
|
ReferenceAlignment: Pointer
|
||||||
ReflowComments: false
|
ReflowComments: false
|
||||||
SortIncludes: Never
|
SortIncludes: Never
|
||||||
RequiresClausePosition: OwnLine
|
# RequiresClausePosition: OwnLine
|
||||||
RemoveBracesLLVM: false
|
RemoveBracesLLVM: false
|
||||||
SeparateDefinitionBlocks: Leave
|
SeparateDefinitionBlocks: Leave
|
||||||
ShortNamespaceLines: 1
|
ShortNamespaceLines: 1
|
||||||
|
|
37
src/main.cc
37
src/main.cc
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
#include <QtCore/qt_windows.h>
|
#include <QtCore/qt_windows.h>
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "termination.hh"
|
#include "termination.hh"
|
||||||
|
@ -217,18 +218,27 @@ void processCommandLine( QCoreApplication * app, GDOptions * result)
|
||||||
int main( int argc, char ** argv )
|
int main( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
// GoldenDict use lots of X11 functions and it currently cannot work
|
// GoldenDict use lots of X11 functions and it currently cannot work
|
||||||
// natively on Wayland. This workaround will force GoldenDict to use
|
// natively on Wayland. This workaround will force GoldenDict to use
|
||||||
// XWayland.
|
// XWayland.
|
||||||
char * xdg_envc = getenv("XDG_SESSION_TYPE");
|
char * xdg_envc = getenv( "XDG_SESSION_TYPE" );
|
||||||
QString xdg_session = xdg_envc ? QString::fromLatin1(xdg_envc) : QString();
|
QString xdg_session = xdg_envc ? QString::fromLatin1( xdg_envc ) : QString();
|
||||||
if (!QString::compare(xdg_session, QString("wayland"), Qt::CaseInsensitive))
|
if ( !QString::compare( xdg_session, QString( "wayland" ), Qt::CaseInsensitive ) ) {
|
||||||
{
|
setenv( "QT_QPA_PLATFORM", "xcb", 1 );
|
||||||
setenv("QT_QPA_PLATFORM", "xcb", 1);
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setenv("LANG", "en_US.UTF-8", 1);
|
setenv( "LANG", "en_US.UTF-8", 1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
// attach the new console to this application's process
|
||||||
|
if ( AttachConsole( ATTACH_PARENT_PROCESS ) ) {
|
||||||
|
// reopen the std I/O streams to redirect I/O to the new console
|
||||||
|
freopen( "CON", "w", stdout );
|
||||||
|
freopen( "CON", "w", stderr );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -246,7 +256,7 @@ int main( int argc, char ** argv )
|
||||||
int newArgc = argc + 1 + 1;
|
int newArgc = argc + 1 + 1;
|
||||||
char ** newArgv = new char *[ newArgc ];
|
char ** newArgv = new char *[ newArgc ];
|
||||||
for ( int i = 0; i < argc; i++ ) {
|
for ( int i = 0; i < argc; i++ ) {
|
||||||
newArgv[ i ] = argv[ i ];
|
newArgv[ i ] = argv[ i ];
|
||||||
}
|
}
|
||||||
newArgv[ argc ] = ARG_DISABLE_WEB_SECURITY;
|
newArgv[ argc ] = ARG_DISABLE_WEB_SECURITY;
|
||||||
newArgv[ argc + 1 ] = nullptr;
|
newArgv[ argc + 1 ] = nullptr;
|
||||||
|
@ -263,9 +273,8 @@ int main( int argc, char ** argv )
|
||||||
QString appDirPath = QCoreApplication::applicationDirPath() + "/crash";
|
QString appDirPath = QCoreApplication::applicationDirPath() + "/crash";
|
||||||
|
|
||||||
QDir dir;
|
QDir dir;
|
||||||
if (!dir.exists(appDirPath)) {
|
if ( !dir.exists( appDirPath ) ) {
|
||||||
bool res = dir.mkpath(appDirPath);
|
dir.mkpath( appDirPath );
|
||||||
qDebug() << "New mkdir " << appDirPath << " " << res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
google_breakpad::ExceptionHandler eh(
|
google_breakpad::ExceptionHandler eh(
|
||||||
|
|
Loading…
Reference in a new issue