mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-19 23:25:09 -05:00
Display decimal tile/metatile IDs alongside hex by default
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "block.h"
|
||||
#include "events.h"
|
||||
#include "log.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include <QColorSpace>
|
||||
#include <QFontDatabase>
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
bool monitorFiles = true;
|
||||
bool tilesetCheckerboardFill = true;
|
||||
bool newMapHeaderSectionExpanded = false;
|
||||
bool displayIdsHexadecimal = true;
|
||||
NumberSystemMode tileNumberSystem = NumberSystemMode::Both;
|
||||
QString theme = QStringLiteral("default");
|
||||
QString wildMonChartTheme;
|
||||
QString textEditorOpenFolder;
|
||||
@@ -141,7 +142,7 @@ public:
|
||||
m_fm->addField(&this->monitorFiles, "monitor_files");
|
||||
m_fm->addField(&this->tilesetCheckerboardFill, "tileset_checkerboard_fill");
|
||||
m_fm->addField(&this->newMapHeaderSectionExpanded, "new_map_header_section_expanded");
|
||||
m_fm->addField(&this->displayIdsHexadecimal, "display_ids_hexadecimal");
|
||||
m_fm->addField(&this->tileNumberSystem, "tile_number_system");
|
||||
m_fm->addField(&this->theme, "theme");
|
||||
m_fm->addField(&this->wildMonChartTheme, "wild_mon_chart_theme");
|
||||
m_fm->addField(&this->textEditorOpenFolder, "text_editor_open_folder");
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
#include <QLineEdit>
|
||||
#include <QColorSpace>
|
||||
|
||||
enum NumberSystemMode {
|
||||
Both,
|
||||
Decimal,
|
||||
Hexadecimal,
|
||||
};
|
||||
|
||||
namespace Util {
|
||||
void numericalModeSort(QStringList &list);
|
||||
int roundUpToMultiple(int numToRound, int multiple);
|
||||
@@ -21,6 +27,19 @@ namespace Util {
|
||||
QString mkpath(const QString& dirPath);
|
||||
QString getFileHash(const QString &filepath);
|
||||
|
||||
template <typename T>
|
||||
QString getNumberSystemString(T value, NumberSystemMode mode, int minHexLength = 0) {
|
||||
switch (mode) {
|
||||
case NumberSystemMode::Hexadecimal: return toHexString(value, minHexLength);
|
||||
case NumberSystemMode::Decimal: return QString::number(value);
|
||||
case NumberSystemMode::Both: return QString("%1 (%2)")
|
||||
.arg(getNumberSystemString(value, NumberSystemMode::Hexadecimal, minHexLength))
|
||||
.arg(getNumberSystemString(value, NumberSystemMode::Decimal));
|
||||
}
|
||||
Q_ASSERT("Cannot get string for invalid NumberSystemMode.");
|
||||
return QString();
|
||||
}
|
||||
|
||||
// Given a QMap<T,QString>, erases all entries with empty strings.
|
||||
// Returns the number of entries erased.
|
||||
template <typename T>
|
||||
|
||||
Reference in New Issue
Block a user