feat: default qtlogging.ini file
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
0fb6a2836b
commit
96decbac27
@ -345,6 +345,8 @@ elseif(UNIX)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_SVG} DESTINATION "${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps")
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${Launcher_mrpack_MIMEInfo} DESTINATION ${KDE_INSTALL_MIMEDIR})
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/launcher/qtlogging.ini" DESTINATION "${KDE_INSTALL_DATADIR}/${Launcher_Name}")
|
||||
|
||||
if(Launcher_ManPage)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${Launcher_ManPage} DESTINATION "${KDE_INSTALL_MANDIR}/man6")
|
||||
endif()
|
||||
@ -372,6 +374,8 @@ else()
|
||||
message(FATAL_ERROR "Platform not supported")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
################################ Included Libs ################################
|
||||
|
||||
include(ExternalProject)
|
||||
|
@ -287,6 +287,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
||||
if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
|
||||
dataPath = m_rootPath;
|
||||
adjustedBy = "Portable data path";
|
||||
m_portable = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -411,25 +412,48 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
||||
" " "|" " "
|
||||
"%{if-category}[%{category}]: %{endif}"
|
||||
"%{message}");
|
||||
|
||||
bool foundLoggingRules = false;
|
||||
|
||||
if(QFile::exists("logging.ini")) {
|
||||
// load and set logging rules
|
||||
qDebug() << "Loading logging rules from:" << QString("%1/logging.ini").arg(dataPath);
|
||||
INIFile loggingRules;
|
||||
bool rulesLoaded = loggingRules.loadFile(QString("logging.ini"));
|
||||
if (rulesLoaded) {
|
||||
QStringList rules;
|
||||
qDebug() << "Setting log rules:";
|
||||
for (auto it = loggingRules.begin(); it != loggingRules.end(); ++it) {
|
||||
auto rule = it.key() + "=" + it.value().toString();
|
||||
rules.append(rule);
|
||||
qDebug() << " " << rule;
|
||||
}
|
||||
auto rules_str = rules.join("\n");
|
||||
QLoggingCategory::setFilterRules(rules_str);
|
||||
auto logRulesFile = QStringLiteral("qtlogging.ini");
|
||||
auto logRulesPath = FS::PathCombine(dataPath, logRulesFile);
|
||||
|
||||
qDebug() << "Testing" << logRulesPath << "...";
|
||||
foundLoggingRules = QFile::exists(logRulesPath);
|
||||
|
||||
// search the dataPath()
|
||||
|
||||
if(!foundLoggingRules && ! isPortable()) {
|
||||
logRulesPath = QStandardPaths::locate(QStandardPaths::AppDataLocation, logRulesFile);
|
||||
if(!logRulesPath.isEmpty()) {
|
||||
qDebug() << "Found" << logRulesPath << "...";
|
||||
foundLoggingRules = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!QFile::exists(logRulesPath)) {
|
||||
logRulesPath = FS::PathCombine(m_rootPath, logRulesFile);
|
||||
qDebug() << "Testing" << logRulesPath << "...";
|
||||
foundLoggingRules = QFile::exists(logRulesPath);
|
||||
}
|
||||
|
||||
if(foundLoggingRules) {
|
||||
// load and set logging rules
|
||||
qDebug() << "Loading logging rules from:" << logRulesPath;
|
||||
QSettings loggingRules(logRulesPath, QSettings::IniFormat);
|
||||
loggingRules.beginGroup("Rules");
|
||||
QStringList rule_names = loggingRules.childKeys();
|
||||
QStringList rules;
|
||||
qDebug() << "Setting log rules:";
|
||||
for (auto rule_name : rule_names) {
|
||||
auto rule = QString("%1=%2").arg(rule_name).arg(loggingRules.value(rule_name).toString());
|
||||
rules.append(rule);
|
||||
qDebug() << " " << rule;
|
||||
}
|
||||
auto rules_str = rules.join("\n");
|
||||
QLoggingCategory::setFilterRules(rules_str);
|
||||
}
|
||||
|
||||
qDebug() << "<> Log initialized.";
|
||||
}
|
||||
|
||||
|
@ -187,6 +187,10 @@ public:
|
||||
return m_rootPath;
|
||||
}
|
||||
|
||||
const bool isPortable() {
|
||||
return m_portable;
|
||||
}
|
||||
|
||||
const Capabilities capabilities() {
|
||||
return m_capabilities;
|
||||
}
|
||||
@ -275,6 +279,7 @@ private:
|
||||
QString m_rootPath;
|
||||
Status m_status = Application::StartingUp;
|
||||
Capabilities m_capabilities;
|
||||
bool m_portable = false;
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
Qt::ApplicationState m_prevAppState = Qt::ApplicationInactive;
|
||||
|
@ -1161,6 +1161,12 @@ if(INSTALL_BUNDLE STREQUAL "full")
|
||||
CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
# add qtlogging.ini as a config file
|
||||
install(
|
||||
FILES "qtlogging.ini"
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}
|
||||
COMPONENT Runtime
|
||||
)
|
||||
# Bundle plugins
|
||||
# Image formats
|
||||
install(
|
||||
|
11
launcher/qtlogging.ini
Normal file
11
launcher/qtlogging.ini
Normal file
@ -0,0 +1,11 @@
|
||||
[Rules]
|
||||
*.debug=true
|
||||
# remove the debug lines, other log levels still get through
|
||||
launcher.task.net.download.debug=false
|
||||
# enable or disable whole catageries
|
||||
launcher.task.net=true
|
||||
launcher.task=false
|
||||
launcher.task.net.upload=true
|
||||
launcher.task.net.metacache=false
|
||||
launcher.task.net.metacache.http=true
|
||||
|
@ -282,6 +282,7 @@ Section "@Launcher_DisplayName@"
|
||||
|
||||
File "@Launcher_APP_BINARY_NAME@.exe"
|
||||
File "qt.conf"
|
||||
File "qtlogging.ini"
|
||||
File *.dll
|
||||
File /r "iconengines"
|
||||
File /r "imageformats"
|
||||
|
Loading…
Reference in New Issue
Block a user