mirror of https://github.com/mgba-emu/mgba.git
Qt: More warning fixes
This commit is contained in:
parent
b9acc05292
commit
639c0bf0e9
|
@ -130,8 +130,6 @@ void AssetTile::setFlip(bool h, bool v) {
|
||||||
void AssetTile::selectColor(int index) {
|
void AssetTile::selectColor(int index) {
|
||||||
const color_t* data;
|
const color_t* data;
|
||||||
mTileCache* tileCache = m_tileCaches[m_index >= m_boundary];
|
mTileCache* tileCache = m_tileCaches[m_index >= m_boundary];
|
||||||
unsigned bpp = 8 << tileCache->bpp;
|
|
||||||
int paletteId = m_paletteId;
|
|
||||||
data = mTileCacheGetTile(tileCache, m_index >= m_boundary ? m_index - m_boundary : m_index, m_paletteId);
|
data = mTileCacheGetTile(tileCache, m_index >= m_boundary ? m_index - m_boundary : m_index, m_paletteId);
|
||||||
color_t color = data[index];
|
color_t color = data[index];
|
||||||
m_ui.color->setColor(0, color);
|
m_ui.color->setColor(0, color);
|
||||||
|
|
|
@ -144,8 +144,8 @@ QImage AssetView::compositeObj(const ObjInfo& objInfo) {
|
||||||
image.setColorTable(palette);
|
image.setColorTable(palette);
|
||||||
uchar* bits = image.bits();
|
uchar* bits = image.bits();
|
||||||
unsigned t = objInfo.tile;
|
unsigned t = objInfo.tile;
|
||||||
for (int y = 0; y < objInfo.height; ++y) {
|
for (unsigned y = 0; y < objInfo.height; ++y) {
|
||||||
for (int x = 0; x < objInfo.width; ++x, ++t) {
|
for (unsigned x = 0; x < objInfo.width; ++x, ++t) {
|
||||||
compositeTile(static_cast<const void*>(mTileCacheGetVRAM(tileCache, t)), bits, objInfo.width * 8, x * 8, y * 8, objInfo.bits);
|
compositeTile(static_cast<const void*>(mTileCacheGetVRAM(tileCache, t)), bits, objInfo.width * 8, x * 8, y * 8, objInfo.bits);
|
||||||
}
|
}
|
||||||
t += objInfo.stride - objInfo.width;
|
t += objInfo.stride - objInfo.width;
|
||||||
|
@ -183,7 +183,6 @@ bool AssetView::lookupObjGBA(int id, struct ObjInfo* info) {
|
||||||
unsigned height = GBAVideoObjSizes[shape * 4 + size][1];
|
unsigned height = GBAVideoObjSizes[shape * 4 + size][1];
|
||||||
unsigned tile = GBAObjAttributesCGetTile(obj->c);
|
unsigned tile = GBAObjAttributesCGetTile(obj->c);
|
||||||
unsigned palette = GBAObjAttributesCGetPalette(obj->c);
|
unsigned palette = GBAObjAttributesCGetPalette(obj->c);
|
||||||
unsigned tileBase = tile;
|
|
||||||
unsigned paletteSet;
|
unsigned paletteSet;
|
||||||
unsigned bits;
|
unsigned bits;
|
||||||
if (GBAObjAttributesAIs256Color(obj->a)) {
|
if (GBAObjAttributesAIs256Color(obj->a)) {
|
||||||
|
@ -237,7 +236,6 @@ bool AssetView::lookupObjGB(int id, struct ObjInfo* info) {
|
||||||
const GB* gb = static_cast<const GB*>(m_controller->thread()->core->board);
|
const GB* gb = static_cast<const GB*>(m_controller->thread()->core->board);
|
||||||
const GBObj* obj = &gb->video.oam.obj[id];
|
const GBObj* obj = &gb->video.oam.obj[id];
|
||||||
|
|
||||||
unsigned width = 8;
|
|
||||||
unsigned height = 8;
|
unsigned height = 8;
|
||||||
GBRegisterLCDC lcdc = gb->memory.io[REG_LCDC];
|
GBRegisterLCDC lcdc = gb->memory.io[REG_LCDC];
|
||||||
if (GBRegisterLCDCIsObjSize(lcdc)) {
|
if (GBRegisterLCDCIsObjSize(lcdc)) {
|
||||||
|
|
|
@ -42,11 +42,10 @@ QVariant CheatsModel::data(const QModelIndex& index, int role) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
if ((size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = index.row();
|
|
||||||
const mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
const mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
|
@ -60,11 +59,10 @@ QVariant CheatsModel::data(const QModelIndex& index, int role) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheatsModel::setData(const QModelIndex& index, const QVariant& value, int role) {
|
bool CheatsModel::setData(const QModelIndex& index, const QVariant& value, int role) {
|
||||||
if (!index.isValid() || index.parent().isValid() || index.row() > mCheatSetsSize(&m_device->cheats)) {
|
if (!index.isValid() || index.parent().isValid() || (size_t) index.row() > mCheatSetsSize(&m_device->cheats)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int row = index.row();
|
|
||||||
mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
mCheatSet* cheats = *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
|
@ -119,7 +117,7 @@ Qt::ItemFlags CheatsModel::flags(const QModelIndex& index) const {
|
||||||
return Qt::ItemIsUserCheckable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsUserCheckable | Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CheatsModel::columnCount(const QModelIndex& parent) const {
|
int CheatsModel::columnCount(const QModelIndex&) const {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +139,14 @@ mCheatSet* CheatsModel::itemAt(const QModelIndex& index) {
|
||||||
if (index.parent().isValid()) {
|
if (index.parent().isValid()) {
|
||||||
return static_cast<mCheatSet*>(index.internalPointer());
|
return static_cast<mCheatSet*>(index.internalPointer());
|
||||||
}
|
}
|
||||||
if (index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
if ((size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
return *mCheatSetsGetPointer(&m_device->cheats, index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatsModel::removeAt(const QModelIndex& index) {
|
void CheatsModel::removeAt(const QModelIndex& index) {
|
||||||
if (!index.isValid() || index.parent().isValid() || index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
if (!index.isValid() || index.parent().isValid() || (size_t) index.row() >= mCheatSetsSize(&m_device->cheats)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
|
|
|
@ -46,7 +46,6 @@ bool ColorPicker::eventFilter(QObject* obj, QEvent* event) {
|
||||||
if (event->type() != QEvent::MouseButtonRelease) {
|
if (event->type() != QEvent::MouseButtonRelease) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int colorId;
|
|
||||||
if (obj != m_parent) {
|
if (obj != m_parent) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
virtual bool supportsShaders() const = 0;
|
virtual bool supportsShaders() const = 0;
|
||||||
virtual VideoShader* shaders() = 0;
|
virtual VideoShader* shaders() = 0;
|
||||||
virtual int framebufferHandle() { return -1; }
|
virtual int framebufferHandle() { return -1; }
|
||||||
virtual void setVideoScale(int scale) {}
|
virtual void setVideoScale(int) {}
|
||||||
|
|
||||||
virtual void setVideoProxy(std::shared_ptr<VideoProxy> proxy) { m_videoProxy = proxy; }
|
virtual void setVideoProxy(std::shared_ptr<VideoProxy> proxy) { m_videoProxy = proxy; }
|
||||||
std::shared_ptr<VideoProxy> videoProxy() { return m_videoProxy; }
|
std::shared_ptr<VideoProxy> videoProxy() { return m_videoProxy; }
|
||||||
|
|
|
@ -96,6 +96,7 @@ void DisplayQt::paintEvent(QPaintEvent*) {
|
||||||
if (isFiltered()) {
|
if (isFiltered()) {
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
}
|
}
|
||||||
|
// TODO: Refactor this code out (since it's copied in like 3 places)
|
||||||
QSize s = size();
|
QSize s = size();
|
||||||
QSize ds = s;
|
QSize ds = s;
|
||||||
if (isAspectRatioLocked()) {
|
if (isAspectRatioLocked()) {
|
||||||
|
|
|
@ -42,8 +42,8 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isDrawing = false;
|
bool m_isDrawing = false;
|
||||||
unsigned m_width;
|
int m_width;
|
||||||
unsigned m_height;
|
int m_height;
|
||||||
QImage m_backing{nullptr};
|
QImage m_backing{nullptr};
|
||||||
QImage m_oldBacking{nullptr};
|
QImage m_oldBacking{nullptr};
|
||||||
std::shared_ptr<CoreController> m_context = nullptr;
|
std::shared_ptr<CoreController> m_context = nullptr;
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
|
|
||||||
Action* action() { return m_action; }
|
Action* action() { return m_action; }
|
||||||
const Action* action() const { return m_action; }
|
const Action* action() const { return m_action; }
|
||||||
const int shortcut() const { return m_shortcut; }
|
int shortcut() const { return m_shortcut; }
|
||||||
QString visibleName() const { return m_action ? m_action->visibleName() : QString(); }
|
QString visibleName() const { return m_action ? m_action->visibleName() : QString(); }
|
||||||
QString name() const { return m_action ? m_action->name() : QString(); }
|
QString name() const { return m_action ? m_action->name() : QString(); }
|
||||||
int button() const { return m_button; }
|
int button() const { return m_button; }
|
||||||
|
|
|
@ -27,7 +27,6 @@ QVariant ShortcutModel::data(const QModelIndex& index, int role) const {
|
||||||
if (role != Qt::DisplayRole || !index.isValid()) {
|
if (role != Qt::DisplayRole || !index.isValid()) {
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
int row = index.row();
|
|
||||||
const Item* item = static_cast<Item*>(index.internalPointer());
|
const Item* item = static_cast<Item*>(index.internalPointer());
|
||||||
const Shortcut* shortcut = item->shortcut;
|
const Shortcut* shortcut = item->shortcut;
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
|
@ -101,7 +100,7 @@ QModelIndex ShortcutModel::parent(const QModelIndex& index) const {
|
||||||
return createIndex(m_controller->indexIn(parent), 0, pitem);
|
return createIndex(m_controller->indexIn(parent), 0, pitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ShortcutModel::columnCount(const QModelIndex& index) const {
|
int ShortcutModel::columnCount(const QModelIndex&) const {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +130,7 @@ void ShortcutModel::addRowNamed(const QString& name) {
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShortcutModel::clearMenu(const QString& name) {
|
void ShortcutModel::clearMenu(const QString&) {
|
||||||
// TODO
|
// TODO
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
Loading…
Reference in New Issue