Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
70953c46
Commit
70953c46
authored
May 25, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log selection support fron Settings/Console
parent
7f1d60e3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
99 deletions
+103
-99
QGCApplication.cc
src/QGCApplication.cc
+2
-66
QGCLoggingCategory.cc
src/QGCLoggingCategory.cc
+66
-0
QGCLoggingCategory.h
src/QGCLoggingCategory.h
+22
-4
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+13
-0
MainWindowLeftPanel.qml
src/ui/MainWindowLeftPanel.qml
+0
-29
No files found.
src/QGCApplication.cc
View file @
70953c46
...
...
@@ -268,72 +268,8 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
ParseCmdLineOptions
(
argc
,
argv
,
rgCmdLineOptions
,
sizeof
(
rgCmdLineOptions
)
/
sizeof
(
rgCmdLineOptions
[
0
]),
false
);
#ifdef __mobile__
QLoggingCategory
::
setFilterRules
(
QStringLiteral
(
"*Log.debug=false"
));
#else
QString
filterRules
;
// Turn off bogus ssl warning
filterRules
+=
"qt.network.ssl.warning=false
\n
"
;
if
(
logging
)
{
QStringList
logList
=
loggingOptions
.
split
(
","
);
if
(
logList
[
0
]
==
"full"
)
{
filterRules
+=
"*Log.debug=true
\n
"
;
for
(
int
i
=
1
;
i
<
logList
.
count
();
i
++
)
{
filterRules
+=
logList
[
i
];
filterRules
+=
".debug=false
\n
"
;
}
}
else
{
foreach
(
const
QString
&
rule
,
logList
)
{
filterRules
+=
rule
;
filterRules
+=
".debug=true
\n
"
;
}
}
}
else
{
// First thing we want to do is set up the qtlogging.ini file. If it doesn't already exist we copy
// it to the correct location. This way default debug builds will have logging turned off.
static
const
char
*
qtProjectDir
=
"QtProject"
;
static
const
char
*
qtLoggingFile
=
"qtlogging.ini"
;
bool
loggingDirectoryOk
=
false
;
QDir
iniFileLocation
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericConfigLocation
));
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
if
(
!
iniFileLocation
.
mkdir
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to create qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);
}
else
{
if
(
!
iniFileLocation
.
cd
(
qtProjectDir
))
{
qDebug
()
<<
"Unable to access qtlogging.ini directory"
<<
iniFileLocation
.
filePath
(
qtProjectDir
);;
}
loggingDirectoryOk
=
true
;
}
}
else
{
loggingDirectoryOk
=
true
;
}
if
(
loggingDirectoryOk
)
{
qDebug
()
<<
"Logging ini file directory"
<<
iniFileLocation
.
absolutePath
();
if
(
!
iniFileLocation
.
exists
(
qtLoggingFile
))
{
QFile
loggingFile
(
iniFileLocation
.
filePath
(
qtLoggingFile
));
if
(
loggingFile
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
QTextStream
out
(
&
loggingFile
);
out
<<
"[Rules]
\n
"
;
out
<<
"*Log.debug=false
\n
"
;
foreach
(
const
QString
&
category
,
QGCLoggingCategoryRegister
::
instance
()
->
registeredCategories
())
{
out
<<
category
<<
".debug=false
\n
"
;
}
}
else
{
qDebug
()
<<
"Unable to create logging file"
<<
QString
(
qtLoggingFile
)
<<
"in"
<<
iniFileLocation
;
}
}
}
}
qDebug
()
<<
"Filter rules"
<<
filterRules
;
QLoggingCategory
::
setFilterRules
(
filterRules
);
#endif
// Set up our logging filters
QGCLoggingCategoryRegister
::
instance
()
->
setFilterRulesFromSettings
(
loggingOptions
);
// Set up timer for delayed missing fact display
_missingParamsDelayedDisplayTimer
.
setSingleShot
(
true
);
...
...
src/QGCLoggingCategory.cc
View file @
70953c46
...
...
@@ -26,6 +26,8 @@
#include "QGCLoggingCategory.h"
#include <QSettings>
// Add Global logging categories (not class specific) here using QGC_LOGGING_CATEGORY
QGC_LOGGING_CATEGORY
(
FirmwareUpgradeLog
,
"FirmwareUpgradeLog"
)
QGC_LOGGING_CATEGORY
(
FirmwareUpgradeVerboseLog
,
"FirmwareUpgradeVerboseLog"
)
...
...
@@ -34,6 +36,7 @@ QGC_LOGGING_CATEGORY(MissionItemLog, "MissionItemLog")
QGC_LOGGING_CATEGORY
(
ParameterLoaderLog
,
"ParameterLoaderLog"
)
QGCLoggingCategoryRegister
*
_instance
=
NULL
;
const
char
*
QGCLoggingCategoryRegister
::
_filterRulesSettingsGroup
=
"LoggingFilters"
;
QGCLoggingCategoryRegister
*
QGCLoggingCategoryRegister
::
instance
(
void
)
{
...
...
@@ -44,3 +47,66 @@ QGCLoggingCategoryRegister* QGCLoggingCategoryRegister::instance(void)
return
_instance
;
}
QStringList
QGCLoggingCategoryRegister
::
registeredCategories
(
void
)
{
_registeredCategories
.
sort
();
return
_registeredCategories
;
}
void
QGCLoggingCategoryRegister
::
setCategoryLoggingOn
(
const
QString
&
category
,
bool
enable
)
{
QSettings
settings
;
settings
.
beginGroup
(
_filterRulesSettingsGroup
);
settings
.
setValue
(
category
,
enable
);
}
bool
QGCLoggingCategoryRegister
::
categoryLoggingOn
(
const
QString
&
category
)
{
QSettings
settings
;
settings
.
beginGroup
(
_filterRulesSettingsGroup
);
return
settings
.
value
(
category
,
false
).
toBool
();
}
void
QGCLoggingCategoryRegister
::
setFilterRulesFromSettings
(
const
QString
&
commandLineLoggingOptions
)
{
if
(
!
commandLineLoggingOptions
.
isEmpty
())
{
_commandLineLoggingOptions
=
commandLineLoggingOptions
;
}
QString
filterRules
;
// Turn off bogus ssl warning
filterRules
+=
"qt.network.ssl.warning=false
\n
"
;
filterRules
+=
"*Log.debug=false
\n
"
;
// Set up filters defined in settings
foreach
(
QString
category
,
_registeredCategories
)
{
if
(
categoryLoggingOn
(
category
))
{
filterRules
+=
category
;
filterRules
+=
".debug=true
\n
"
;
}
}
// Command line rules take precedence, so they go last in the list
if
(
!
_commandLineLoggingOptions
.
isEmpty
())
{
QStringList
logList
=
_commandLineLoggingOptions
.
split
(
","
);
if
(
logList
[
0
]
==
"full"
)
{
filterRules
+=
"*Log.debug=true
\n
"
;
for
(
int
i
=
1
;
i
<
logList
.
count
();
i
++
)
{
filterRules
+=
logList
[
i
];
filterRules
+=
".debug=false
\n
"
;
}
}
else
{
foreach
(
const
QString
&
rule
,
logList
)
{
filterRules
+=
rule
;
filterRules
+=
".debug=true
\n
"
;
}
}
}
qDebug
()
<<
"Filter rules"
<<
filterRules
;
QLoggingCategory
::
setFilterRules
(
filterRules
);
}
src/QGCLoggingCategory.h
View file @
70953c46
...
...
@@ -44,18 +44,36 @@ Q_DECLARE_LOGGING_CATEGORY(ParameterLoaderLog)
static QGCLoggingCategory qgcCategory ## name (__VA_ARGS__); \
Q_LOGGING_CATEGORY(name, __VA_ARGS__)
class
QGCLoggingCategoryRegister
class
QGCLoggingCategoryRegister
:
public
QObject
{
Q_OBJECT
public:
static
QGCLoggingCategoryRegister
*
instance
(
void
);
/// Registers the specified logging category to the system.
void
registerCategory
(
const
char
*
category
)
{
_registeredCategories
<<
category
;
}
const
QStringList
&
registeredCategories
(
void
)
{
return
_registeredCategories
;
}
/// Returns the list of available logging category names.
Q_INVOKABLE
QStringList
registeredCategories
(
void
);
/// Turns on/off logging for the specified category. State is saved in app settings.
Q_INVOKABLE
void
setCategoryLoggingOn
(
const
QString
&
category
,
bool
enable
);
/// Returns true if logging is turned on for the specified category.
Q_INVOKABLE
bool
categoryLoggingOn
(
const
QString
&
category
);
/// Sets the logging filters rules from saved settings.
/// @param commandLineLogggingOptions Logging options which were specified on the command line
void
setFilterRulesFromSettings
(
const
QString
&
commandLineLoggingOptions
);
private:
QGCLoggingCategoryRegister
(
void
)
{
}
QStringList
_registeredCategories
;
QString
_commandLineLoggingOptions
;
static
const
char
*
_filterRulesSettingsGroup
;
};
class
QGCLoggingCategory
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
70953c46
...
...
@@ -36,6 +36,7 @@
#include "SettingsFact.h"
#include "FactMetaData.h"
#include "SimulatedPosition.h"
#include "QGCLoggingCategory.h"
#ifdef QT_DEBUG
#include "MockLink.h"
...
...
@@ -133,6 +134,18 @@ public:
QString
appSettingsDistanceUnitsString
(
void
)
const
{
return
FactMetaData
::
appSettingsDistanceUnitsString
();
}
/// Returns the list of available logging category names.
Q_INVOKABLE
QStringList
loggingCategories
(
void
)
const
{
return
QGCLoggingCategoryRegister
::
instance
()
->
registeredCategories
();
}
/// Turns on/off logging for the specified category. State is saved in app settings.
Q_INVOKABLE
void
setCategoryLoggingOn
(
const
QString
&
category
,
bool
enable
)
{
QGCLoggingCategoryRegister
::
instance
()
->
setCategoryLoggingOn
(
category
,
enable
);
};
/// Returns true if logging is turned on for the specified category.
Q_INVOKABLE
bool
categoryLoggingOn
(
const
QString
&
category
)
{
return
QGCLoggingCategoryRegister
::
instance
()
->
categoryLoggingOn
(
category
);
};
/// Updates the logging filter rules after settings have changed
Q_INVOKABLE
void
updateLoggingFilterRules
(
void
)
{
QGCLoggingCategoryRegister
::
instance
()
->
setFilterRulesFromSettings
(
QString
());
}
// Property accesors
FlightMapSettings
*
flightMapSettings
()
{
return
_flightMapSettings
;
}
...
...
src/ui/MainWindowLeftPanel.qml
View file @
70953c46
...
...
@@ -302,34 +302,5 @@ Item {
id
:
__rightPanel
anchors.fill
:
parent
}
//-- Dismiss it all
Item
{
id
:
closeButton
width
:
__closeButtonSize
height
:
__closeButtonSize
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
QGCColoredImage
{
source
:
"
/res/XDelete.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
width
:
parent
.
width
*
0.75
height
:
parent
.
height
*
0.75
sourceSize.height
:
height
anchors.centerIn
:
parent
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
!
__animateShowDialog
.
running
)
{
__rightPanel
.
source
=
""
mainWindow
.
hideLeftMenu
()
}
}
}
}
}
}
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