mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
add debug settings; option to show cardIds (#5404)
* add debug settings; option to show cardIds * pass param by const ref * change group structure again * create debug.ini if not exists
This commit is contained in:
parent
62f60867a9
commit
f924b04efd
7 changed files with 50 additions and 2 deletions
|
|
@ -130,6 +130,7 @@ set(cockatrice_SOURCES
|
||||||
src/settings/shortcuts_settings.cpp
|
src/settings/shortcuts_settings.cpp
|
||||||
src/settings/shortcut_treeview.cpp
|
src/settings/shortcut_treeview.cpp
|
||||||
src/settings/card_override_settings.cpp
|
src/settings/card_override_settings.cpp
|
||||||
|
src/settings/debug_settings.cpp
|
||||||
src/client/sound_engine.cpp
|
src/client/sound_engine.cpp
|
||||||
src/client/network/spoiler_background_updater.cpp
|
src/client/network/spoiler_background_updater.cpp
|
||||||
src/game/zones/stack_zone.cpp
|
src/game/zones/stack_zone.cpp
|
||||||
|
|
|
||||||
|
|
@ -141,8 +141,13 @@ void AbstractCardItem::paintPicture(QPainter *painter, const QSizeF &translatedS
|
||||||
QString nameStr;
|
QString nameStr;
|
||||||
if (facedown)
|
if (facedown)
|
||||||
nameStr = "# " + QString::number(id);
|
nameStr = "# " + QString::number(id);
|
||||||
else
|
else {
|
||||||
nameStr = name;
|
QString prefix = "";
|
||||||
|
if (SettingsCache::instance().debug().getShowCardId()) {
|
||||||
|
prefix = "#" + QString::number(id) + " ";
|
||||||
|
}
|
||||||
|
nameStr = prefix + name;
|
||||||
|
}
|
||||||
painter->drawText(QRectF(3 * scaleFactor, 3 * scaleFactor, translatedSize.width() - 6 * scaleFactor,
|
painter->drawText(QRectF(3 * scaleFactor, 3 * scaleFactor, translatedSize.width() - 6 * scaleFactor,
|
||||||
translatedSize.height() - 6 * scaleFactor),
|
translatedSize.height() - 6 * scaleFactor),
|
||||||
Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, nameStr);
|
Qt::AlignTop | Qt::AlignLeft | Qt::TextWrapAnywhere, nameStr);
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ SettingsCache::SettingsCache()
|
||||||
downloadSettings = new DownloadSettings(settingsPath, this);
|
downloadSettings = new DownloadSettings(settingsPath, this);
|
||||||
recentsSettings = new RecentsSettings(settingsPath, this);
|
recentsSettings = new RecentsSettings(settingsPath, this);
|
||||||
cardOverrideSettings = new CardOverrideSettings(settingsPath, this);
|
cardOverrideSettings = new CardOverrideSettings(settingsPath, this);
|
||||||
|
debugSettings = new DebugSettings(settingsPath, this);
|
||||||
|
|
||||||
if (!QFile(settingsPath + "global.ini").exists())
|
if (!QFile(settingsPath + "global.ini").exists())
|
||||||
translateLegacySettings();
|
translateLegacySettings();
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include "../utility/macros.h"
|
#include "../utility/macros.h"
|
||||||
#include "card_database_settings.h"
|
#include "card_database_settings.h"
|
||||||
#include "card_override_settings.h"
|
#include "card_override_settings.h"
|
||||||
|
#include "debug_settings.h"
|
||||||
#include "download_settings.h"
|
#include "download_settings.h"
|
||||||
#include "game_filters_settings.h"
|
#include "game_filters_settings.h"
|
||||||
#include "layouts_settings.h"
|
#include "layouts_settings.h"
|
||||||
|
|
@ -86,6 +87,7 @@ private:
|
||||||
DownloadSettings *downloadSettings;
|
DownloadSettings *downloadSettings;
|
||||||
RecentsSettings *recentsSettings;
|
RecentsSettings *recentsSettings;
|
||||||
CardOverrideSettings *cardOverrideSettings;
|
CardOverrideSettings *cardOverrideSettings;
|
||||||
|
DebugSettings *debugSettings;
|
||||||
|
|
||||||
QByteArray mainWindowGeometry;
|
QByteArray mainWindowGeometry;
|
||||||
QByteArray tokenDialogGeometry;
|
QByteArray tokenDialogGeometry;
|
||||||
|
|
@ -619,6 +621,10 @@ public:
|
||||||
{
|
{
|
||||||
return *cardOverrideSettings;
|
return *cardOverrideSettings;
|
||||||
}
|
}
|
||||||
|
DebugSettings &debug() const
|
||||||
|
{
|
||||||
|
return *debugSettings;
|
||||||
|
}
|
||||||
bool getIsPortableBuild() const
|
bool getIsPortableBuild() const
|
||||||
{
|
{
|
||||||
return isPortableBuild;
|
return isPortableBuild;
|
||||||
|
|
|
||||||
17
cockatrice/src/settings/debug_settings.cpp
Normal file
17
cockatrice/src/settings/debug_settings.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include "debug_settings.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFile>
|
||||||
|
|
||||||
|
DebugSettings::DebugSettings(const QString &settingPath, QObject *parent)
|
||||||
|
: SettingsManager(settingPath + "debug.ini", parent)
|
||||||
|
{
|
||||||
|
// force debug.ini to be created if it doesn't exist yet
|
||||||
|
if (!QFile(settingPath + "debug.ini").exists()) {
|
||||||
|
setValue(false, "showCardId", "debug");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DebugSettings::getShowCardId()
|
||||||
|
{
|
||||||
|
return getValue("showCardId", "debug").toBool();
|
||||||
|
}
|
||||||
17
cockatrice/src/settings/debug_settings.h
Normal file
17
cockatrice/src/settings/debug_settings.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef DEBUG_SETTINGS_H
|
||||||
|
#define DEBUG_SETTINGS_H
|
||||||
|
#include "settings_manager.h"
|
||||||
|
|
||||||
|
class DebugSettings : public SettingsManager
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
friend class SettingsCache;
|
||||||
|
|
||||||
|
explicit DebugSettings(const QString &settingPath, QObject *parent = nullptr);
|
||||||
|
DebugSettings(const DebugSettings & /*other*/);
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool getShowCardId();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEBUG_SETTINGS_H
|
||||||
|
|
@ -33,6 +33,7 @@ set(oracle_SOURCES
|
||||||
../cockatrice/src/settings/layouts_settings.cpp
|
../cockatrice/src/settings/layouts_settings.cpp
|
||||||
../cockatrice/src/settings/download_settings.cpp
|
../cockatrice/src/settings/download_settings.cpp
|
||||||
../cockatrice/src/settings/card_override_settings.cpp
|
../cockatrice/src/settings/card_override_settings.cpp
|
||||||
|
../cockatrice/src/settings/debug_settings.cpp
|
||||||
../cockatrice/src/client/ui/theme_manager.cpp
|
../cockatrice/src/client/ui/theme_manager.cpp
|
||||||
../cockatrice/src/client/network/release_channel.cpp
|
../cockatrice/src/client/network/release_channel.cpp
|
||||||
${VERSION_STRING_CPP}
|
${VERSION_STRING_CPP}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue