mirror of https://github.com/mgba-emu/mgba.git
Qt: Add placeholders, minor revamps
This commit is contained in:
parent
ce419ee1c6
commit
64ad73c9f9
Binary file not shown.
After Width: | Height: | Size: 483 B |
Binary file not shown.
After Width: | Height: | Size: 475 B |
Binary file not shown.
After Width: | Height: | Size: 476 B |
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <QtAlgorithms>
|
#include <QtAlgorithms>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QFontMetrics>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
@ -32,6 +33,13 @@ BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, QWidg
|
||||||
core->getGameCode(core, title);
|
core->getGameCode(core, title);
|
||||||
QString qtitle(title);
|
QString qtitle(title);
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||||
|
int size = QFontMetrics(QFont()).height() / ((int) ceil(devicePixelRatioF()) * 16);
|
||||||
|
#else
|
||||||
|
int size = QFontMetrics(QFont()).height() / (devicePixelRatio() * 16);
|
||||||
|
#endif
|
||||||
|
m_ui.chipList->setGridSize(m_ui.chipList->gridSize() * size);
|
||||||
|
m_ui.chipList->setIconSize(m_ui.chipList->iconSize() * size);
|
||||||
|
|
||||||
connect(m_ui.chipId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_ui.inserted, [this]() {
|
connect(m_ui.chipId, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_ui.inserted, [this]() {
|
||||||
m_ui.inserted->setChecked(Qt::Unchecked);
|
m_ui.inserted->setChecked(Qt::Unchecked);
|
||||||
|
@ -124,7 +132,11 @@ void BattleChipView::addChip() {
|
||||||
}
|
}
|
||||||
QListWidgetItem* add = new QListWidgetItem(m_chipIdToName[insertedChip]);
|
QListWidgetItem* add = new QListWidgetItem(m_chipIdToName[insertedChip]);
|
||||||
add->setData(Qt::UserRole, insertedChip);
|
add->setData(Qt::UserRole, insertedChip);
|
||||||
add->setIcon(QIcon(QString(":/res/exe%1/%2.png").arg(m_flavor).arg(insertedChip, 3, 10, QLatin1Char('0'))));
|
QString path = QString(":/res/exe%1/%2.png").arg(m_flavor).arg(insertedChip, 3, 10, QLatin1Char('0'));
|
||||||
|
if (!QFile(path).exists()) {
|
||||||
|
path = QString(":/res/exe%1/placeholder.png").arg(m_flavor);
|
||||||
|
}
|
||||||
|
add->setIcon(QIcon(path));
|
||||||
m_ui.chipList->addItem(add);
|
m_ui.chipList->addItem(add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +155,7 @@ void BattleChipView::loadChipNames(int flavor) {
|
||||||
}
|
}
|
||||||
m_flavor = flavor;
|
m_flavor = flavor;
|
||||||
|
|
||||||
QFile file(QString(":/res/chip-names-%1.txt").arg(flavor));
|
QFile file(QString(":/res/exe%1/chip-names.txt").arg(flavor));
|
||||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
int id = 0;
|
int id = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
|
@ -151,8 +151,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="gridSize">
|
<property name="gridSize">
|
||||||
<size>
|
<size>
|
||||||
<width>160</width>
|
<width>80</width>
|
||||||
<height>128</height>
|
<height>72</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="viewMode">
|
<property name="viewMode">
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
<file>../../../res/keymap.qpic</file>
|
<file>../../../res/keymap.qpic</file>
|
||||||
<file>../../../res/patrons.txt</file>
|
<file>../../../res/patrons.txt</file>
|
||||||
<file>../../../res/no-cam.png</file>
|
<file>../../../res/no-cam.png</file>
|
||||||
<file>../../../res/chip-names-4.txt</file>
|
<file>../../../res/exe4/chip-names.txt</file>
|
||||||
<file>../../../res/chip-names-5.txt</file>
|
<file>../../../res/exe4/placeholder.png</file>
|
||||||
<file>../../../res/chip-names-6.txt</file>
|
<file>../../../res/exe5/chip-names.txt</file>
|
||||||
|
<file>../../../res/exe5/placeholder.png</file>
|
||||||
|
<file>../../../res/exe6/chip-names.txt</file>
|
||||||
|
<file>../../../res/exe6/placeholder.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Reference in New Issue