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_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_mrpack_MIMEInfo} DESTINATION ${KDE_INSTALL_MIMEDIR})
|
||||||
|
|
||||||
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/launcher/qtlogging.ini" DESTINATION "${KDE_INSTALL_DATADIR}/${Launcher_Name}")
|
||||||
|
|
||||||
if(Launcher_ManPage)
|
if(Launcher_ManPage)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${Launcher_ManPage} DESTINATION "${KDE_INSTALL_MANDIR}/man6")
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${Launcher_ManPage} DESTINATION "${KDE_INSTALL_MANDIR}/man6")
|
||||||
endif()
|
endif()
|
||||||
@ -372,6 +374,8 @@ else()
|
|||||||
message(FATAL_ERROR "Platform not supported")
|
message(FATAL_ERROR "Platform not supported")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################ Included Libs ################################
|
################################ Included Libs ################################
|
||||||
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
|
@ -287,6 +287,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
|
if (QFile::exists(FS::PathCombine(m_rootPath, "portable.txt"))) {
|
||||||
dataPath = m_rootPath;
|
dataPath = m_rootPath;
|
||||||
adjustedBy = "Portable data path";
|
adjustedBy = "Portable data path";
|
||||||
|
m_portable = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -412,23 +413,46 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
"%{if-category}[%{category}]: %{endif}"
|
"%{if-category}[%{category}]: %{endif}"
|
||||||
"%{message}");
|
"%{message}");
|
||||||
|
|
||||||
if(QFile::exists("logging.ini")) {
|
bool foundLoggingRules = false;
|
||||||
|
|
||||||
|
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
|
// load and set logging rules
|
||||||
qDebug() << "Loading logging rules from:" << QString("%1/logging.ini").arg(dataPath);
|
qDebug() << "Loading logging rules from:" << logRulesPath;
|
||||||
INIFile loggingRules;
|
QSettings loggingRules(logRulesPath, QSettings::IniFormat);
|
||||||
bool rulesLoaded = loggingRules.loadFile(QString("logging.ini"));
|
loggingRules.beginGroup("Rules");
|
||||||
if (rulesLoaded) {
|
QStringList rule_names = loggingRules.childKeys();
|
||||||
QStringList rules;
|
QStringList rules;
|
||||||
qDebug() << "Setting log rules:";
|
qDebug() << "Setting log rules:";
|
||||||
for (auto it = loggingRules.begin(); it != loggingRules.end(); ++it) {
|
for (auto rule_name : rule_names) {
|
||||||
auto rule = it.key() + "=" + it.value().toString();
|
auto rule = QString("%1=%2").arg(rule_name).arg(loggingRules.value(rule_name).toString());
|
||||||
rules.append(rule);
|
rules.append(rule);
|
||||||
qDebug() << " " << rule;
|
qDebug() << " " << rule;
|
||||||
}
|
}
|
||||||
auto rules_str = rules.join("\n");
|
auto rules_str = rules.join("\n");
|
||||||
QLoggingCategory::setFilterRules(rules_str);
|
QLoggingCategory::setFilterRules(rules_str);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
qDebug() << "<> Log initialized.";
|
qDebug() << "<> Log initialized.";
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,10 @@ public:
|
|||||||
return m_rootPath;
|
return m_rootPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool isPortable() {
|
||||||
|
return m_portable;
|
||||||
|
}
|
||||||
|
|
||||||
const Capabilities capabilities() {
|
const Capabilities capabilities() {
|
||||||
return m_capabilities;
|
return m_capabilities;
|
||||||
}
|
}
|
||||||
@ -275,6 +279,7 @@ private:
|
|||||||
QString m_rootPath;
|
QString m_rootPath;
|
||||||
Status m_status = Application::StartingUp;
|
Status m_status = Application::StartingUp;
|
||||||
Capabilities m_capabilities;
|
Capabilities m_capabilities;
|
||||||
|
bool m_portable = false;
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
Qt::ApplicationState m_prevAppState = Qt::ApplicationInactive;
|
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\" \" \")"
|
CODE "file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}/qt.conf\" \" \")"
|
||||||
COMPONENT Runtime
|
COMPONENT Runtime
|
||||||
)
|
)
|
||||||
|
# add qtlogging.ini as a config file
|
||||||
|
install(
|
||||||
|
FILES "qtlogging.ini"
|
||||||
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/${RESOURCES_DEST_DIR}
|
||||||
|
COMPONENT Runtime
|
||||||
|
)
|
||||||
# Bundle plugins
|
# Bundle plugins
|
||||||
# Image formats
|
# Image formats
|
||||||
install(
|
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 "@Launcher_APP_BINARY_NAME@.exe"
|
||||||
File "qt.conf"
|
File "qt.conf"
|
||||||
|
File "qtlogging.ini"
|
||||||
File *.dll
|
File *.dll
|
||||||
File /r "iconengines"
|
File /r "iconengines"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
|
Loading…
Reference in New Issue
Block a user