From a4c7215a37897e4a875530859c5ac858315edef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 17 Nov 2024 12:58:29 +0100 Subject: [PATCH 1/3] chore: Remove repetetitive logs reporting number of buttons and axes --- src/gamecontroller/gamecontroller.cpp | 8 +------- src/gui/gamecontrollermappingdialog.cpp | 3 --- src/inputdevice.cpp | 6 ++++-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/gamecontroller/gamecontroller.cpp b/src/gamecontroller/gamecontroller.cpp index 27cebf8de..9106bc6a3 100644 --- a/src/gamecontroller/gamecontroller.cpp +++ b/src/gamecontroller/gamecontroller.cpp @@ -25,7 +25,6 @@ #include "globalvariables.h" #include "joybuttontypes/joycontrolstickbutton.h" #include "joycontrolstick.h" -//#include "logger.h" #include @@ -185,12 +184,7 @@ void GameController::closeSDLDevice() int GameController::getNumberRawButtons() { return SDL_CONTROLLER_BUTTON_MAX; } -int GameController::getNumberRawAxes() -{ - qDebug() << "Controller has " << SDL_CONTROLLER_AXIS_MAX << " raw axes"; - - return SDL_CONTROLLER_AXIS_MAX; -} +int GameController::getNumberRawAxes() { return SDL_CONTROLLER_AXIS_MAX; } /** * @brief Queries the data rate of the given sensor from SDL. diff --git a/src/gui/gamecontrollermappingdialog.cpp b/src/gui/gamecontrollermappingdialog.cpp index 124ac0990..826a6d3a0 100644 --- a/src/gui/gamecontrollermappingdialog.cpp +++ b/src/gui/gamecontrollermappingdialog.cpp @@ -345,7 +345,6 @@ void GameControllerMappingDialog::populateGameControllerBindings(GameController { if (controller != nullptr) { - qDebug() << "Controller has " << controller->getNumberButtons() << " buttons"; for (int i = 0; i < controller->getNumberButtons(); i++) { @@ -365,8 +364,6 @@ void GameControllerMappingDialog::populateGameControllerBindings(GameController } } - qDebug() << "Controller has " << controller->getNumberAxes() << " axes"; - for (int i = 0; i < controller->getNumberAxes(); i++) { int associatedRow = axisPlacement.value(static_cast(i)); diff --git a/src/inputdevice.cpp b/src/inputdevice.cpp index d674ddc84..d01ee2f7a 100644 --- a/src/inputdevice.cpp +++ b/src/inputdevice.cpp @@ -1320,8 +1320,10 @@ QString InputDevice::getDescription() QString gameControllerStatus = isGameController() ? QString("Yes") : QString("No"); full_desc = full_desc + " " + QString("Game Controller: %1").arg(gameControllerStatus) + "\n " + - QString("# of Axes: %1").arg(getNumberRawAxes()) + "\n " + - QString("# of Buttons: %1").arg(getNumberRawButtons()) + "\n " + + QString("# of RawAxes: %1").arg(getNumberRawAxes()) + "\n " + + QString("# of Axes: %1").arg(getNumberAxes()) + "\n " + + QString("# of RawButtons: %1").arg(getNumberRawButtons()) + "\n " + + QString("# of Buttons: %1").arg(getNumberButtons()) + "\n " + QString("# of Hats: %1").arg(getNumberHats()) + "\n " + QString("Accelerometer: %1").arg(hasSensor(ACCELEROMETER)) + "\n " + QString("Gyroscope: %1").arg(hasSensor(GYROSCOPE)) + "\n"; From 31d0b839d371075028e3c31a4824150ba8f29b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 17 Nov 2024 13:18:28 +0100 Subject: [PATCH 2/3] fix: ensure printing some startup logs (before proper initialization of logger) --- src/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index e61aff90b..04679b72b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,9 +174,13 @@ static void deleteInputDevices(QMap *joysticks) */ void importLegacySettingsIfExist() { - qDebug() << "Importing settings"; const QFileInfo config(PadderCommon::configFilePath()); const bool configExists = config.exists() && config.isFile(); + if (configExists) + { + DEBUG() << "Found settings file: " << PadderCommon::configFilePath(); + return; + } // 'antimicroX' const QFileInfo legacyConfig(PadderCommon::configLegacyFilePath()); const bool legacyConfigExists = legacyConfig.exists() && legacyConfig.isFile(); @@ -195,7 +199,7 @@ void importLegacySettingsIfExist() #endif QDir(PadderCommon::configPath()).mkpath(PadderCommon::configPath()); const bool copySuccess = QFile::copy(fileToCopy.canonicalFilePath(), PadderCommon::configFilePath()); - qDebug() << "Legacy settings found"; + DEBUG() << "Legacy settings found"; const QString successMessage = QObject::tr("Your original settings (previously stored in %1) have been copied to\n%2\n If you want you can " "delete the original directory or leave it as it is.") @@ -209,12 +213,12 @@ void importLegacySettingsIfExist() QMessageBox msgBox; if (copySuccess) { - qDebug() << "Legacy settings copied"; + DEBUG() << "Legacy settings copied"; msgBox.setText(successMessage); } else { - qWarning() << "Problem with importing settings from: " << fileToCopy.canonicalFilePath() - << " to: " << PadderCommon::configFilePath(); + WARN() << "Problem with importing settings from: " << fileToCopy.canonicalFilePath() + << " to: " << PadderCommon::configFilePath(); msgBox.setText(errorMessage); } msgBox.exec(); @@ -230,7 +234,7 @@ int main(int argc, char *argv[]) QCoreApplication::setApplicationVersion(PadderCommon::programVersion); QTextStream outstream(stdout); - Logger *appLogger = Logger::createInstance(&outstream, Logger::LogLevel::LOG_WARNING); + Logger *appLogger = Logger::createInstance(&outstream, Logger::LogLevel::LOG_DEBUG); qRegisterMetaType(); qRegisterMetaType(); From 6966c7c9ac059ac7c7487c24d3f55a6ab1100f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 17 Nov 2024 13:21:42 +0100 Subject: [PATCH 3/3] chore: Update vscode config for C++ files --- .vscode/settings.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 29add1d4c..6aa882bff 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,6 +19,12 @@ "editor.formatOnType": true, "editor.formatOnSave": true, }, + "[cpp]": { + "editor.defaultFormatter": "xaver.clang-format", + "editor.formatOnPaste": true, + "editor.formatOnType": true, + "editor.formatOnSave": true, + }, "qttools.injectNatvisFile": false, "cmake.debugConfig": { "visualizerFile": "${workspaceFolder}/.vscode/qt5.natvis.xml",