Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-windows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
savoirfairelinux
jami-client-windows
Commits
a7238eec
Commit
a7238eec
authored
Dec 12, 2018
by
Andreas Traczyk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug: add output options --vsconsole and --file
Change-Id: Iff47f25e6b2f545d6315dd85939b6ed0d8bc9573
parent
cba5b527
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
16 deletions
+52
-16
main.cpp
main.cpp
+52
-16
No files found.
main.cpp
View file @
a7238eec
/***************************************************************************
* Copyright (C) 2015-201
7 by Savoir-faire Linux
*
* Copyright (C) 2015-201
8 by Savoir-faire Linux
*
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
...
...
@@ -53,18 +54,9 @@
REGISTER_MEDIA
();
void
Console
()
consoleDebug
()
{
#ifdef Q_OS_WIN
#ifdef _MSC_VER
// Print debug to output window if using VS
QObject
::
connect
(
&
LRCInstance
::
behaviorController
(),
&
lrc
::
api
::
BehaviorController
::
debugMessageReceived
,
[](
const
std
::
string
&
message
)
{
OutputDebugStringA
((
message
+
"
\n
"
).
c_str
());
});
#else
AllocConsole
();
freopen
(
"CONOUT$"
,
"w"
,
stdout
);
freopen
(
"CONOUT$"
,
"w"
,
stderr
);
...
...
@@ -76,7 +68,36 @@ Console()
SetConsoleScreenBufferSize
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
coordInfo
);
SetConsoleMode
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
ENABLE_QUICK_EDIT_MODE
|
ENABLE_EXTENDED_FLAGS
);
#endif
}
#ifdef _MSC_VER
void
vsConsoleDebug
()
{
// Print debug to output window if using VS
QObject
::
connect
(
&
LRCInstance
::
behaviorController
(),
&
lrc
::
api
::
BehaviorController
::
debugMessageReceived
,
[](
const
std
::
string
&
message
)
{
OutputDebugStringA
((
message
+
"
\n
"
).
c_str
());
});
}
#endif
void
fileDebug
(
QFile
&
debugFile
)
{
QObject
::
connect
(
&
LRCInstance
::
behaviorController
(),
&
lrc
::
api
::
BehaviorController
::
debugMessageReceived
,
[
&
debugFile
](
const
std
::
string
&
message
)
{
if
(
debugFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Append
))
{
auto
msg
=
(
message
+
"
\n
"
).
c_str
();
debugFile
.
write
(
msg
,
qstrlen
(
msg
));
debugFile
.
close
();
}
});
}
int
...
...
@@ -89,8 +110,6 @@ main(int argc, char *argv[])
QCoreApplication
::
setOrganizationDomain
(
"jami.net"
);
QCoreApplication
::
setApplicationName
(
"Jami"
);
GlobalInstances
::
setPixmapManipulator
(
std
::
unique_ptr
<
PixbufManipulator
>
(
new
PixbufManipulator
()));
auto
startMinimized
=
false
;
QString
uri
=
""
;
...
...
@@ -98,13 +117,28 @@ main(int argc, char *argv[])
gnutls_global_init
();
#endif
GlobalInstances
::
setPixmapManipulator
(
std
::
unique_ptr
<
PixbufManipulator
>
(
new
PixbufManipulator
()));
LRCInstance
::
init
();
QFile
debugFile
(
"debug.log"
);
for
(
auto
string
:
QCoreApplication
::
arguments
())
{
if
(
string
==
"-m"
||
string
==
"--minimized"
)
if
(
string
==
"-m"
||
string
==
"--minimized"
)
{
startMinimized
=
true
;
if
(
string
==
"-d"
||
string
==
"--debug"
)
Console
();
}
if
(
string
==
"-f"
||
string
==
"--file"
)
{
debugFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Truncate
);
debugFile
.
close
();
fileDebug
(
debugFile
);
}
if
(
string
==
"-d"
||
string
==
"--debug"
)
{
consoleDebug
();
}
#ifdef _MSC_VER
else
if
(
string
==
"-c"
||
string
==
"--vsconsole"
)
{
vsConsoleDebug
();
}
#endif
if
(
string
.
startsWith
(
"ring:"
))
{
uri
=
string
;
}
...
...
@@ -210,6 +244,8 @@ main(int argc, char *argv[])
auto
ret
=
a
.
exec
();
FreeConsole
();
QCoreApplication
::
exit
();
GlobalSystemTray
::
instance
().
deleteLater
();
GlobalSystemTray
::
instance
().
hide
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment