Skip to content

Commit 144822c

Browse files
committed
Appease GCC / Clang
Appease GCC This is a silly error AAAAAGH Fix Model Sick of this Fix Supposed Shadowing Hopefully the last Or maybe not Please
1 parent 0b24125 commit 144822c

File tree

8 files changed

+43
-41
lines changed

8 files changed

+43
-41
lines changed

qtfred/source_groups.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ add_file_folder("Source/UI/Widgets"
182182
src/ui/widgets/ShipFlagCheckbox.cpp
183183
src/ui/widgets/weaponList.cpp
184184
src/ui/widgets/weaponList.h
185-
src/ui/widgets/BankTree.cpp
186-
src/ui/widgets/BankTree.h
185+
src/ui/widgets/bankTree.cpp
186+
src/ui/widgets/bankTree.h
187187
)
188188

189189
add_file_folder("UI"

qtfred/src/mission/dialogs/ShipEditor/ShipWeaponsDialogModel.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include "ShipWeaponsDialogModel.h"
22
namespace fso {
33
namespace fred {
4-
Banks::Banks(const SCP_string& name, int aiIndex, int ship, int multiedit, ship_subsys* subsys)
5-
: name(name), subsys(subsys), ship(ship), m_isMultiEdit(multiedit), initalAI(aiIndex)
4+
Banks::Banks(const SCP_string& _name, int aiIndex, int _ship, int multiedit, ship_subsys* _subsys)
5+
: m_isMultiEdit(multiedit) ,name(_name), subsys(_subsys), initalAI(aiIndex), ship(_ship)
66
{
77
aiClass = aiIndex;
88
}
@@ -74,13 +74,13 @@ int Banks::getInitalAI()
7474
{
7575
return initalAI;
7676
}
77-
Bank::Bank(const int weaponId, const int bankId, const int ammoMax, const int ammo, Banks* parent)
77+
Bank::Bank(const int _weaponId, const int _bankId, const int _ammoMax, const int _ammo, Banks* _parent)
7878
{
79-
this->weaponId = weaponId;
80-
this->bankId = bankId;
81-
this->ammo = ammo;
82-
this->ammoMax = ammoMax;
83-
this->parent = parent;
79+
this->weaponId = _weaponId;
80+
this->bankId = _bankId;
81+
this->ammo = _ammo;
82+
this->ammoMax = _ammoMax;
83+
this->parent = _parent;
8484
}
8585
int Bank::getWeaponId() const
8686
{

qtfred/src/ui/dialogs/ShipEditor/BankModel.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <weapon/weapon.h>
55
namespace fso {
66
namespace fred {
7-
BankTreeItem::BankTreeItem(BankTreeItem* parentItem) : m_parentItem(parentItem) {}
7+
BankTreeItem::BankTreeItem(BankTreeItem* parentItem, const QString& inName) : name(inName), m_parentItem(parentItem) {
8+
}
89
BankTreeItem::~BankTreeItem()
910
{
1011
qDeleteAll(m_childItems);
@@ -66,9 +67,8 @@ int BankTreeBank::getId() const
6667
return bank->getWeaponId();
6768
}
6869

69-
BankTreeBank::BankTreeBank(Bank* bank, BankTreeItem* parentItem) : BankTreeItem(parentItem)
70+
BankTreeBank::BankTreeBank(Bank* inBank, BankTreeItem* parentItem) : BankTreeItem(parentItem), bank(inBank)
7071
{
71-
this->bank = bank;
7272
switch (bank->getWeaponId()) {
7373
case -2:
7474
this->name = "CONFLICT";
@@ -125,11 +125,9 @@ void BankTreeBank::setAmmo(int value)
125125
bank->setAmmo(value);
126126
}
127127

128-
BankTreeLabel::BankTreeLabel(const QString& name, Banks* banks, BankTreeItem* parentItem) : BankTreeItem(parentItem)
129-
{
130-
this->name = name;
131-
this->banks = banks;
132-
}
128+
BankTreeLabel::BankTreeLabel(const QString& inName, Banks* inBanks, BankTreeItem* parentItem)
129+
: BankTreeItem(parentItem, inName), banks(inBanks)
130+
{}
133131

134132
QVariant BankTreeLabel::data(int column) const
135133
{
@@ -145,6 +143,7 @@ QVariant BankTreeLabel::data(int column) const
145143

146144
Qt::ItemFlags BankTreeLabel::getFlags(int column) const
147145
{
146+
Q_UNUSED(column);
148147
return Qt::ItemIsSelectable;
149148
}
150149

@@ -156,6 +155,7 @@ void BankTreeLabel::setAIClass(int value)
156155

157156
bool BankTreeLabel::setData(int column, const QVariant& value)
158157
{
158+
Q_UNUSED(column);
159159
setAIClass(value.toInt());
160160
return true;
161161
}
@@ -191,6 +191,7 @@ void BankTreeModel::setupModelData(const SCP_vector<Banks*>& data, BankTreeItem*
191191

192192
QVariant BankTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
193193
{
194+
Q_UNUSED(orientation);
194195
if (role == Qt::DisplayRole) {
195196
switch (section) {
196197
case 0:
@@ -336,13 +337,7 @@ bool BankTreeModel::dropMimeData(const QMimeData* data,
336337
if (action == Qt::IgnoreAction)
337338
return true;
338339

339-
int beginRow;
340-
341-
if (row != -1)
342-
beginRow = row;
343-
else if (parent.isValid())
344-
beginRow = parent.row();
345-
else
340+
if (!(row != -1 || parent.isValid()))
346341
return false;
347342

348343
QByteArray encodedData = data->data("application/weaponid");
@@ -366,6 +361,8 @@ void BankTreeModel::setWeapon(const QModelIndex& index, int data) const
366361

367362
bool BankTreeRoot::setData(int column, const QVariant& value)
368363
{
364+
Q_UNUSED(column);
365+
Q_UNUSED(value);
369366
return false;
370367
}
371368
QVariant BankTreeRoot::data(int column) const
@@ -383,6 +380,7 @@ QVariant BankTreeRoot::data(int column) const
383380
}
384381
Qt::ItemFlags BankTreeRoot::getFlags(int column) const
385382
{
383+
Q_UNUSED(column);
386384
return {};
387385
}
388386

qtfred/src/ui/dialogs/ShipEditor/BankModel.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace fso {
55
namespace fred {
66
class BankTreeItem {
77
public:
8-
explicit BankTreeItem(BankTreeItem* parentItem = nullptr);
8+
explicit BankTreeItem(BankTreeItem* parentItem = nullptr, const QString& inName = "");
99
virtual ~BankTreeItem();
1010
virtual QVariant data(int column) const = 0;
1111
void appendChild(BankTreeItem* child);
@@ -34,7 +34,7 @@ class BankTreeRoot : public BankTreeItem {
3434
};
3535
class BankTreeBank : public BankTreeItem {
3636
public:
37-
explicit BankTreeBank(Bank* bank, BankTreeItem* parentItem = nullptr);
37+
explicit BankTreeBank(Bank* inBank, BankTreeItem* parentItem = nullptr);
3838
void setWeapon(int id);
3939
void setAmmo(int value);
4040
int getId() const;
@@ -73,8 +73,11 @@ class BankTreeModel : public QAbstractItemModel {
7373
Qt::ItemFlags flags(const QModelIndex& index) const override;
7474

7575
QStringList mimeTypes() const override;
76-
bool
77-
canDropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) const;
76+
bool canDropMimeData(const QMimeData* data,
77+
Qt::DropAction action,
78+
int row,
79+
int column,
80+
const QModelIndex& parent) const override;
7881
bool
7982
dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
8083
void setWeapon(const QModelIndex& index, int data) const;

qtfred/src/ui/dialogs/ShipEditor/ShipWeaponsDialog.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ void ShipWeaponsDialog::closeEvent(QCloseEvent* event)
7878
}
7979
void ShipWeaponsDialog::on_setAllButton_clicked()
8080
{
81-
int test = 0;
8281
for (auto& index : ui->treeBanks->selectionModel()->selectedIndexes()) {
8382
bankModel->setWeapon(index, ui->listWeapons->currentIndex().data(Qt::UserRole).toInt());
8483
}
@@ -112,7 +111,7 @@ void ShipWeaponsDialog::modeChanged(const bool enabled, const int mode)
112111
} else {
113112
_viewport->dialogProvider->showButtonDialog(DialogType::Error,
114113
"Illegal Mode",
115-
"Somehow an Illegal mode has been set. Get a coder.\n Illegal mode is " + mode,
114+
"Somehow an Illegal mode has been set. Get a coder.\n Illegal mode is " + std::to_string(mode),
116115
{DialogButton::Ok});
117116
ui->radioPrimary->toggled(true);
118117
bankModel = new BankTreeModel(_model->getPrimaryBanks(), this);

qtfred/src/ui/dialogs/ShipEditor/WeaponsTBLViewer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "WeaponsTBLViewer.h"
2+
23
#include "ui_ShipTBLViewer.h"
34

45
#include <ui/util/SignalBlockers.h>
@@ -9,8 +10,8 @@ namespace fso {
910
namespace fred {
1011
namespace dialogs {
1112
WeaponsTBLViewer::WeaponsTBLViewer(QWidget* parent, EditorViewport* viewport, int wc)
12-
: QDialog(parent), ui(new Ui::ShipTBLViewer()), _viewport(viewport),
13-
_model(new WeaponsTBLViewerModel(this, viewport, wc))
13+
: QDialog(parent), ui(new Ui::ShipTBLViewer()), _model(new WeaponsTBLViewerModel(this, viewport, wc)),
14+
_viewport(viewport)
1415
{
1516

1617
ui->setupUi(this);

qtfred/src/ui/widgets/weaponList.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ weaponList::weaponList(QWidget* parent) : QListView(parent) {}
66

77
void weaponList::mousePressEvent(QMouseEvent* event)
88
{
9-
if (event->button() == Qt::LeftButton)
9+
if (event->button() == Qt::LeftButton) {
1010
dragStartPosition = event->pos();
11-
QListView::mousePressEvent(event);
11+
}
12+
QListView::mousePressEvent(event);
1213
}
1314
void weaponList::mouseMoveEvent(QMouseEvent* event)
1415
{
@@ -30,7 +31,7 @@ void weaponList::mouseMoveEvent(QMouseEvent* event)
3031
painter.drawText(QPoint(100, 100), model()->data(idx, Qt::DisplayRole).toString());
3132
drag->setPixmap(*iconPixmap);
3233
drag->setMimeData(mimeData);
33-
Qt::DropAction dropAction = drag->exec();
34+
drag->exec();
3435
}
3536

3637
WeaponModel::WeaponModel(int type)
@@ -67,17 +68,17 @@ WeaponModel::~WeaponModel()
6768
}
6869
int WeaponModel::rowCount(const QModelIndex& parent) const
6970
{
71+
Q_UNUSED(parent);
7072
return static_cast<int>(weapons.size());
7173
}
7274
QVariant WeaponModel::data(const QModelIndex& index, int role) const
7375
{
7476
if (role == Qt::DisplayRole) {
75-
const QString out =
76-
weapons[index.row()]->name;
77+
const QString out = weapons[index.row()]->name;
7778
return out;
7879
}
7980
if (role == Qt::UserRole) {
80-
const size_t id = weapons[index.row()]->id;
81+
const int id = weapons[index.row()]->id;
8182
return id;
8283
}
8384
return {};
@@ -98,6 +99,6 @@ QMimeData* WeaponModel::mimeData(const QModelIndexList& indexes) const
9899

99100
return mimeData;
100101
}
101-
WeaponItem::WeaponItem(const int id, const QString& name) : name(name), id(id) {}
102+
WeaponItem::WeaponItem(const int inID, const QString& inName) : name(inName), id(inID) {}
102103
} // namespace fred
103104
} // namespace fso

qtfred/src/ui/widgets/weaponList.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class WeaponModel : public QAbstractListModel {
2020
~WeaponModel();
2121
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
2222
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
23-
QMimeData* mimeData(const QModelIndexList& indexes) const;
23+
QMimeData* mimeData(const QModelIndexList& indexes) const override;
2424
QVector<WeaponItem*> weapons;
2525
};
2626
class weaponList : public QListView {

0 commit comments

Comments
 (0)