Browse Source

Show size as hex too if requested

Michael Hansen 11 years ago
parent
commit
c2754b3993
  1. 7
      Sources/Tools/plResBrowser/plResBrowser.cpp
  2. 100
      Sources/Tools/plResBrowser/res/ResBrowser.ui

7
Sources/Tools/plResBrowser/plResBrowser.cpp

@ -321,12 +321,19 @@ void plResBrowser::UpdateInfoPage()
else
fUI->fStartPos->setText(QString::number(imp->GetStartPos()));
if (showAsHex)
{
fUI->fObjectSize->setText(QString("0x%1").arg(imp->GetDataLen(), 0, 16));
}
else
{
if (imp->GetDataLen() < 1024)
fUI->fObjectSize->setText(QString("%1 bytes").arg(imp->GetDataLen()));
else if (imp->GetDataLen() < 1024 * 1024)
fUI->fObjectSize->setText(QString("%1 kB").arg(imp->GetDataLen() / 1024.f, 0, 'f', 2));
else
fUI->fObjectSize->setText(QString("%1 MB").arg(imp->GetDataLen() / 1024.f / 1024.f, 0, 'f', 2));
}
fUI->fSaveSelectedAction->setEnabled(true);
fUI->fSaveButton->setEnabled(true);

100
Sources/Tools/plResBrowser/res/ResBrowser.ui

@ -342,30 +342,26 @@
<string>Object Information</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Start Pos:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<item row="2" column="0" colspan="4">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Name:</string>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<item row="3" column="2">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Class:</string>
<string>Size:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -380,68 +376,56 @@
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_10">
<widget class="QLineEdit" name="fObjectSize">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Size:</string>
<string>Start Pos:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0" colspan="5">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Name:</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>20</height>
</size>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</spacer>
</widget>
</item>
<item row="3" column="4">
<widget class="QLineEdit" name="fObjectSize">
<property name="readOnly">
<bool>true</bool>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Class:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLineEdit" name="fObjectName">
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="fObjectClass">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="fObjectClass">
<item row="0" column="1" colspan="3">
<widget class="QLineEdit" name="fObjectName">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>16</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>

Loading…
Cancel
Save