Commit d0240235 authored by hjk's avatar hjk

debugger: use enum for formats instead of magic numbers

parent c58ba011
......@@ -515,12 +515,13 @@ static QString formattedValue(const WatchData &data,
if (isIntType(data.type)) {
int format = individualFormat == -1 ? typeFormat : individualFormat;
int value = data.value.toInt();
if (format == 1)
if (format == HexadecimalFormat)
return ("(hex) ") + QString::number(value, 16);
if (format == 2)
if (format == BinaryFormat)
return ("(bin) ") + QString::number(value, 2);
if (format == 3)
if (format == OctalFormat)
return ("(oct) ") + QString::number(value, 8);
return data.value;
}
return data.value;
......
......@@ -146,6 +146,20 @@ enum WatchRoles
IndividualFormatRole
};
enum IntegerFormat
{
DecimalFormat = 0, // keep that at 0 as default
HexadecimalFormat,
BinaryFormat,
OctalFormat,
};
enum DumpableFormat
{
PrettyFormat = 0, // keep that at 0 as default
PlainFomat,
};
class WatchModel : public QAbstractItemModel
{
Q_OBJECT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment