silence deprecation warnings

This commit is contained in:
garakmon 2020-08-26 20:42:42 -04:00
parent 3ac1fce840
commit 68098b8220
12 changed files with 33 additions and 36 deletions

View file

@ -26,12 +26,12 @@ public:
int mapHeight = 0; int mapHeight = 0;
QVector<uint8_t> tiles; QVector<uint8_t> tiles;
QString cityMap; QString cityMap;
RegionMapHistoryItem(int type, QVector<uint8_t> tiles, QString cityMap) { RegionMapHistoryItem(int which, QVector<uint8_t> tiles, QString cityMap) {
this->which = which; this->which = which;
this->tiles = tiles; this->tiles = tiles;
this->cityMap = cityMap; this->cityMap = cityMap;
} }
RegionMapHistoryItem(int type, QVector<uint8_t> tiles, int width, int height) { RegionMapHistoryItem(int which, QVector<uint8_t> tiles, int width, int height) {
this->which = which; this->which = which;
this->tiles = tiles; this->tiles = tiles;
this->mapWidth = width; this->mapWidth = width;

View file

@ -9,7 +9,7 @@ class NoScrollSpinBox : public QSpinBox
public: public:
explicit NoScrollSpinBox(QWidget *parent = nullptr); explicit NoScrollSpinBox(QWidget *parent = nullptr);
void wheelEvent(QWheelEvent *event); void wheelEvent(QWheelEvent *event) override;
void focusOutEvent(QFocusEvent *event) override; void focusOutEvent(QFocusEvent *event) override;
unsigned getActionId(); unsigned getActionId();

View file

@ -10,7 +10,7 @@ class OverlayItem {
public: public:
OverlayItem() {} OverlayItem() {}
virtual ~OverlayItem() {}; virtual ~OverlayItem() {};
virtual void render(QPainter *painter) {}; virtual void render(QPainter *) {};
}; };
class OverlayText : public OverlayItem { class OverlayText : public OverlayItem {

View file

@ -150,8 +150,7 @@ bool Tileset::appendToGraphics(QString graphicsFile, QString friendlyName, bool
QString dataString = "\n\t.align 2\n"; QString dataString = "\n\t.align 2\n";
dataString.append(QString("gTilesetPalettes_%1::\n").arg(friendlyName)); dataString.append(QString("gTilesetPalettes_%1::\n").arg(friendlyName));
for(int i = 0; i < Project::getNumPalettesTotal(); ++i) { for(int i = 0; i < Project::getNumPalettesTotal(); ++i) {
QString paletteString; QString paletteString = QString("%1.gbapal").arg(i, 2, 10, QLatin1Char('0'));
paletteString.sprintf("%02d.gbapal", i);
dataString.append(QString("\t.incbin \"data/tilesets/%1/%2/palettes/%3\"\n").arg(primaryString, friendlyName.toLower(), paletteString)); dataString.append(QString("\t.incbin \"data/tilesets/%1/%2/palettes/%3\"\n").arg(primaryString, friendlyName.toLower(), paletteString));
} }

View file

@ -407,7 +407,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
chanceSpinner->setMinimum(1); chanceSpinner->setMinimum(1);
chanceSpinner->setMaximum(9999); chanceSpinner->setMaximum(9999);
chanceSpinner->setValue(chance); chanceSpinner->setValue(chance);
connect(chanceSpinner, QOverload<int>::of(&QSpinBox::valueChanged), [&chanceSpinner, &updateTotal, &currentField](int) { connect(chanceSpinner, QOverload<int>::of(&QSpinBox::valueChanged), [&updateTotal, &currentField](int) {
updateTotal(currentField); updateTotal(currentField);
}); });
@ -417,7 +417,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
QVBoxLayout *slotChoiceLayout = new QVBoxLayout; QVBoxLayout *slotChoiceLayout = new QVBoxLayout;
if (useGroups) { if (useGroups) {
QComboBox *groupCombo = new QComboBox; QComboBox *groupCombo = new QComboBox;
connect(groupCombo, QOverload<const QString &>::of(&QComboBox::activated), [&tempFields, &currentField, index](QString newGroupName) { connect(groupCombo, QOverload<const QString &>::of(&QComboBox::textActivated), [&tempFields, &currentField, index](QString newGroupName) {
for (EncounterField &field : tempFields) { for (EncounterField &field : tempFields) {
if (field.name == currentField.name) { if (field.name == currentField.name) {
for (QString groupName : field.groups.keys()) { for (QString groupName : field.groups.keys()) {
@ -478,7 +478,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
}; };
// lambda: Draws the slot widgets onto a grid (4 wide) on the dialog window. // lambda: Draws the slot widgets onto a grid (4 wide) on the dialog window.
auto drawSlotWidgets = [this, &dialog, &grid, &createNewSlot, &fieldSlots, &updateTotal, &tempFields](int index) { auto drawSlotWidgets = [&dialog, &grid, &createNewSlot, &fieldSlots, &updateTotal, &tempFields](int index) {
// Clear them first. // Clear them first.
while (!fieldSlots.isEmpty()) { while (!fieldSlots.isEmpty()) {
auto slot = fieldSlots.takeFirst(); auto slot = fieldSlots.takeFirst();
@ -536,14 +536,14 @@ void Editor::configureEncounterJSON(QWidget *window) {
QPushButton *addSlotButton = new QPushButton(QIcon(":/icons/add.ico"), ""); QPushButton *addSlotButton = new QPushButton(QIcon(":/icons/add.ico"), "");
addSlotButton->setFlat(true); addSlotButton->setFlat(true);
connect(addSlotButton, &QPushButton::clicked, [this, &fieldChoices, &drawSlotWidgets, &tempFields]() { connect(addSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() {
EncounterField &field = tempFields[fieldChoices->currentIndex()]; EncounterField &field = tempFields[fieldChoices->currentIndex()];
field.encounterRates.append(1); field.encounterRates.append(1);
drawSlotWidgets(fieldChoices->currentIndex()); drawSlotWidgets(fieldChoices->currentIndex());
}); });
QPushButton *removeSlotButton = new QPushButton(QIcon(":/icons/delete.ico"), ""); QPushButton *removeSlotButton = new QPushButton(QIcon(":/icons/delete.ico"), "");
removeSlotButton->setFlat(true); removeSlotButton->setFlat(true);
connect(removeSlotButton, &QPushButton::clicked, [this, &fieldChoices, &drawSlotWidgets, &tempFields]() { connect(removeSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() {
EncounterField &field = tempFields[fieldChoices->currentIndex()]; EncounterField &field = tempFields[fieldChoices->currentIndex()];
if (field.encounterRates.size() > 1) if (field.encounterRates.size() > 1)
field.encounterRates.removeLast(); field.encounterRates.removeLast();

View file

@ -72,7 +72,7 @@ void log(QString message, LogType type) {
QFile outFile(getLogPath()); QFile outFile(getLogPath());
outFile.open(QIODevice::WriteOnly | QIODevice::Append); outFile.open(QIODevice::WriteOnly | QIODevice::Append);
QTextStream ts(&outFile); QTextStream ts(&outFile);
ts << message << endl; ts << message << Qt::endl;
} }
QString getLogPath() { QString getLogPath() {

View file

@ -1166,8 +1166,7 @@ void MainWindow::on_actionNew_Tileset_triggered() {
} }
newSet->palettes->append(*currentPal); newSet->palettes->append(*currentPal);
newSet->palettePreviews->append(*currentPal); newSet->palettePreviews->append(*currentPal);
QString fileName; QString fileName = QString("%1.pal").arg(i, 2, 10, QLatin1Char('0'));
fileName.sprintf("%02d.pal", i);
newSet->palettePaths.append(fullDirectoryPath+"/palettes/" + fileName); newSet->palettePaths.append(fullDirectoryPath+"/palettes/" + fileName);
} }
(*newSet->palettes)[0][1] = qRgb(255,0,255); (*newSet->palettes)[0][1] = qRgb(255,0,255);
@ -2270,7 +2269,7 @@ void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
editor->setSelectedConnectionFromMap(fromMapName); editor->setSelectedConnectionFromMap(fromMapName);
} }
void MainWindow::onMapChanged(Map *map) { void MainWindow::onMapChanged(Map *) {
updateMapList(); updateMapList();
} }
@ -2566,7 +2565,7 @@ void MainWindow::on_actionThemes_triggered()
QDialogButtonBox buttonBox(QDialogButtonBox::Apply | QDialogButtonBox::Close, Qt::Horizontal, &themeSelectorWindow); QDialogButtonBox buttonBox(QDialogButtonBox::Apply | QDialogButtonBox::Close, Qt::Horizontal, &themeSelectorWindow);
form.addRow(&buttonBox); form.addRow(&buttonBox);
connect(&buttonBox, &QDialogButtonBox::clicked, [&themeSelectorWindow, &buttonBox, themeSelector, this](QAbstractButton *button){ connect(&buttonBox, &QDialogButtonBox::clicked, [&buttonBox, themeSelector, this](QAbstractButton *button){
if (button == buttonBox.button(QDialogButtonBox::Apply)) { if (button == buttonBox.button(QDialogButtonBox::Apply)) {
QString theme = themeSelector->currentText(); QString theme = themeSelector->currentText();
porymapConfig.setTheme(theme); porymapConfig.setTheme(theme);

View file

@ -3,8 +3,6 @@
#include "scripting.h" #include "scripting.h"
#include "editcommands.h" #include "editcommands.h"
static Blockdata *oldBlockdata;
QJSValue MainWindow::getBlock(int x, int y) { QJSValue MainWindow::getBlock(int x, int y) {
if (!this->editor || !this->editor->map) if (!this->editor || !this->editor->map)
return QJSValue(); return QJSValue();

View file

@ -1557,10 +1557,10 @@ void Project::loadTilesetAssets(Tileset* tileset) {
QString path = tileset->palettePaths.value(i); QString path = tileset->palettePaths.value(i);
QString text = parser.readTextFile(path); QString text = parser.readTextFile(path);
if (!text.isNull()) { if (!text.isNull()) {
QStringList lines = text.split(QRegExp("[\r\n]"),QString::SkipEmptyParts); QStringList lines = text.split(QRegExp("[\r\n]"), Qt::SkipEmptyParts);
if (lines.length() == 19 && lines[0] == "JASC-PAL" && lines[1] == "0100" && lines[2] == "16") { if (lines.length() == 19 && lines[0] == "JASC-PAL" && lines[1] == "0100" && lines[2] == "16") {
for (int j = 0; j < 16; j++) { for (int j = 0; j < 16; j++) {
QStringList rgb = lines[j + 3].split(QRegExp(" "), QString::SkipEmptyParts); QStringList rgb = lines[j + 3].split(QRegExp(" "), Qt::SkipEmptyParts);
if (rgb.length() != 3) { if (rgb.length() != 3) {
logWarn(QString("Invalid tileset palette RGB value: '%1'").arg(lines[j + 3])); logWarn(QString("Invalid tileset palette RGB value: '%1'").arg(lines[j + 3]));
palette.append(qRgb((j - 3) * 16, (j - 3) * 16, (j - 3) * 16)); palette.append(qRgb((j - 3) * 16, (j - 3) * 16, (j - 3) * 16));

View file

@ -16,7 +16,7 @@ void GraphicsView::mouseReleaseEvent(QMouseEvent *event) {
QGraphicsView::mouseReleaseEvent(event); QGraphicsView::mouseReleaseEvent(event);
} }
void GraphicsView::drawForeground(QPainter *painter, const QRectF &rect) { void GraphicsView::drawForeground(QPainter *painter, const QRectF&) {
for (auto item : this->overlay.getItems()) { for (auto item : this->overlay.getItems()) {
item->render(painter); item->render(painter);
} }

View file

@ -147,7 +147,7 @@ void MonTabWidget::createSpeciesTableRow(QTableWidget *table, WildPokemon mon, i
emit editor->wildMonDataChanged(); emit editor->wildMonDataChanged();
}); });
connect(maxLevel, QOverload<int>::of(&QSpinBox::valueChanged), [maxLevel, this](int) { connect(maxLevel, QOverload<int>::of(&QSpinBox::valueChanged), [this](int) {
editor->saveEncounterTabData(); editor->saveEncounterTabData();
emit editor->wildMonDataChanged(); emit editor->wildMonDataChanged();
}); });

View file

@ -13,6 +13,7 @@
#include <QSpinBox> #include <QSpinBox>
#include <QColor> #include <QColor>
#include <QMessageBox> #include <QMessageBox>
#include <QTransform>
#include <math.h> #include <math.h>
RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) : RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project_) :
@ -902,57 +903,57 @@ void RegionMapEditor::closeEvent(QCloseEvent *event)
void RegionMapEditor::on_verticalSlider_Zoom_Map_Image_valueChanged(int val) { void RegionMapEditor::on_verticalSlider_Zoom_Map_Image_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale); double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix; QTransform transform;
matrix.scale(scale, scale); transform.scale(scale, scale);
int width = ceil(static_cast<double>(this->region_map->imgSize().width()) * scale); int width = ceil(static_cast<double>(this->region_map->imgSize().width()) * scale);
int height = ceil(static_cast<double>(this->region_map->imgSize().height()) * scale); int height = ceil(static_cast<double>(this->region_map->imgSize().height()) * scale);
ui->graphicsView_Region_Map_BkgImg->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_Region_Map_BkgImg->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_Region_Map_BkgImg->setMatrix(matrix); ui->graphicsView_Region_Map_BkgImg->setTransform(transform);
ui->graphicsView_Region_Map_BkgImg->setFixedSize(width + 2, height + 2); ui->graphicsView_Region_Map_BkgImg->setFixedSize(width + 2, height + 2);
ui->graphicsView_Region_Map_Layout->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_Region_Map_Layout->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_Region_Map_Layout->setMatrix(matrix); ui->graphicsView_Region_Map_Layout->setTransform(transform);
ui->graphicsView_Region_Map_Layout->setFixedSize(width + 2, height + 2); ui->graphicsView_Region_Map_Layout->setFixedSize(width + 2, height + 2);
ui->graphicsView_Region_Map_Entries->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_Region_Map_Entries->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_Region_Map_Entries->setMatrix(matrix); ui->graphicsView_Region_Map_Entries->setTransform(transform);
ui->graphicsView_Region_Map_Entries->setFixedSize(width + 2, height + 2); ui->graphicsView_Region_Map_Entries->setFixedSize(width + 2, height + 2);
} }
void RegionMapEditor::on_verticalSlider_Zoom_Image_Tiles_valueChanged(int val) { void RegionMapEditor::on_verticalSlider_Zoom_Image_Tiles_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale); double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix; QTransform transform;
matrix.scale(scale, scale); transform.scale(scale, scale);
int width = ceil(static_cast<double>(this->mapsquare_selector_item->pixelWidth) * scale); int width = ceil(static_cast<double>(this->mapsquare_selector_item->pixelWidth) * scale);
int height = ceil(static_cast<double>(this->mapsquare_selector_item->pixelHeight) * scale); int height = ceil(static_cast<double>(this->mapsquare_selector_item->pixelHeight) * scale);
ui->graphicsView_RegionMap_Tiles->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_RegionMap_Tiles->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_RegionMap_Tiles->setMatrix(matrix); ui->graphicsView_RegionMap_Tiles->setTransform(transform);
ui->graphicsView_RegionMap_Tiles->setFixedSize(width + 2, height + 2); ui->graphicsView_RegionMap_Tiles->setFixedSize(width + 2, height + 2);
} }
void RegionMapEditor::on_verticalSlider_Zoom_City_Map_valueChanged(int val) { void RegionMapEditor::on_verticalSlider_Zoom_City_Map_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale); double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix; QTransform transform;
matrix.scale(scale, scale); transform.scale(scale, scale);
int width = ceil(static_cast<double>(8 * city_map_item->width()) * scale); int width = ceil(static_cast<double>(8 * city_map_item->width()) * scale);
int height = ceil(static_cast<double>(8 * city_map_item->height()) * scale); int height = ceil(static_cast<double>(8 * city_map_item->height()) * scale);
ui->graphicsView_City_Map->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_City_Map->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_City_Map->setMatrix(matrix); ui->graphicsView_City_Map->setTransform(transform);
ui->graphicsView_City_Map->setFixedSize(width + 2, height + 2); ui->graphicsView_City_Map->setFixedSize(width + 2, height + 2);
} }
void RegionMapEditor::on_verticalSlider_Zoom_City_Tiles_valueChanged(int val) { void RegionMapEditor::on_verticalSlider_Zoom_City_Tiles_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale); double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix; QTransform transform;
matrix.scale(scale, scale); transform.scale(scale, scale);
int width = ceil(static_cast<double>(this->city_map_selector_item->pixelWidth) * scale); int width = ceil(static_cast<double>(this->city_map_selector_item->pixelWidth) * scale);
int height = ceil(static_cast<double>(this->city_map_selector_item->pixelHeight) * scale); int height = ceil(static_cast<double>(this->city_map_selector_item->pixelHeight) * scale);
ui->graphicsView_City_Map_Tiles->setResizeAnchor(QGraphicsView::NoAnchor); ui->graphicsView_City_Map_Tiles->setResizeAnchor(QGraphicsView::NoAnchor);
ui->graphicsView_City_Map_Tiles->setMatrix(matrix); ui->graphicsView_City_Map_Tiles->setTransform(transform);
ui->graphicsView_City_Map_Tiles->setFixedSize(width + 2, height + 2); ui->graphicsView_City_Map_Tiles->setFixedSize(width + 2, height + 2);
} }