aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--launcher/Application.cpp52
-rw-r--r--launcher/Application.h5
-rw-r--r--launcher/CMakeLists.txt6
-rw-r--r--launcher/qtlogging.ini11
-rw-r--r--program_info/win_install.nsi.in1
6 files changed, 65 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05c69c89..2ff26aee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index c8855cbc..f7595512 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -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,23 +412,46 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
" " "|" " "
"%{if-category}[%{category}]: %{endif}"
"%{message}");
+
+ bool foundLoggingRules = false;
- if(QFile::exists("logging.ini")) {
+ 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:" << 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);
+ 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.";
diff --git a/launcher/Application.h b/launcher/Application.h
index 0d24a4e9..3d833edc 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -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;
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 5253a517..a3ef20e8 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -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(
diff --git a/launcher/qtlogging.ini b/launcher/qtlogging.ini
new file mode 100644
index 00000000..eba5390d
--- /dev/null
+++ b/launcher/qtlogging.ini
@@ -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
+
diff --git a/program_info/win_install.nsi.in b/program_info/win_install.nsi.in
index 49e22500..a809c55d 100644
--- a/program_info/win_install.nsi.in
+++ b/program_info/win_install.nsi.in
@@ -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"