Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup in logs #1089

Merged
merged 3 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 1 addition & 7 deletions src/gamecontroller/gamecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "globalvariables.h"
#include "joybuttontypes/joycontrolstickbutton.h"
#include "joycontrolstick.h"
//#include "logger.h"

#include <cmath>

Expand Down Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions src/gui/gamecontrollermappingdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand All @@ -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<SDL_GameControllerAxis>(i));
Expand Down
6 changes: 4 additions & 2 deletions src/inputdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
16 changes: 10 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,13 @@ static void deleteInputDevices(QMap<SDL_JoystickID, InputDevice *> *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();
Expand All @@ -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.")
Expand All @@ -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();
Expand All @@ -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<JoyButtonSlot *>();
qRegisterMetaType<SetJoystick *>();
Expand Down