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;
QVector<uint8_t> tiles;
QString cityMap;
RegionMapHistoryItem(int type, QVector<uint8_t> tiles, QString cityMap) {
RegionMapHistoryItem(int which, QVector<uint8_t> tiles, QString cityMap) {
this->which = which;
this->tiles = tiles;
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->tiles = tiles;
this->mapWidth = width;

View file

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

View file

@ -10,7 +10,7 @@ class OverlayItem {
public:
OverlayItem() {}
virtual ~OverlayItem() {};
virtual void render(QPainter *painter) {};
virtual void render(QPainter *) {};
};
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";
dataString.append(QString("gTilesetPalettes_%1::\n").arg(friendlyName));
for(int i = 0; i < Project::getNumPalettesTotal(); ++i) {
QString paletteString;
paletteString.sprintf("%02d.gbapal", i);
QString paletteString = QString("%1.gbapal").arg(i, 2, 10, QLatin1Char('0'));
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->setMaximum(9999);
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);
});
@ -417,7 +417,7 @@ void Editor::configureEncounterJSON(QWidget *window) {
QVBoxLayout *slotChoiceLayout = new QVBoxLayout;
if (useGroups) {
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) {
if (field.name == currentField.name) {
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.
auto drawSlotWidgets = [this, &dialog, &grid, &createNewSlot, &fieldSlots, &updateTotal, &tempFields](int index) {
auto drawSlotWidgets = [&dialog, &grid, &createNewSlot, &fieldSlots, &updateTotal, &tempFields](int index) {
// Clear them first.
while (!fieldSlots.isEmpty()) {
auto slot = fieldSlots.takeFirst();
@ -536,14 +536,14 @@ void Editor::configureEncounterJSON(QWidget *window) {
QPushButton *addSlotButton = new QPushButton(QIcon(":/icons/add.ico"), "");
addSlotButton->setFlat(true);
connect(addSlotButton, &QPushButton::clicked, [this, &fieldChoices, &drawSlotWidgets, &tempFields]() {
connect(addSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() {
EncounterField &field = tempFields[fieldChoices->currentIndex()];
field.encounterRates.append(1);
drawSlotWidgets(fieldChoices->currentIndex());
});
QPushButton *removeSlotButton = new QPushButton(QIcon(":/icons/delete.ico"), "");
removeSlotButton->setFlat(true);
connect(removeSlotButton, &QPushButton::clicked, [this, &fieldChoices, &drawSlotWidgets, &tempFields]() {
connect(removeSlotButton, &QPushButton::clicked, [&fieldChoices, &drawSlotWidgets, &tempFields]() {
EncounterField &field = tempFields[fieldChoices->currentIndex()];
if (field.encounterRates.size() > 1)
field.encounterRates.removeLast();

View file

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

View file

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

View file

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

View file

@ -1557,10 +1557,10 @@ void Project::loadTilesetAssets(Tileset* tileset) {
QString path = tileset->palettePaths.value(i);
QString text = parser.readTextFile(path);
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") {
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) {
logWarn(QString("Invalid tileset palette RGB value: '%1'").arg(lines[j + 3]));
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);
}
void GraphicsView::drawForeground(QPainter *painter, const QRectF &rect) {
void GraphicsView::drawForeground(QPainter *painter, const QRectF&) {
for (auto item : this->overlay.getItems()) {
item->render(painter);
}

View file

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

View file

@ -13,6 +13,7 @@
#include <QSpinBox>
#include <QColor>
#include <QMessageBox>
#include <QTransform>
#include <math.h>
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) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix;
matrix.scale(scale, scale);
QTransform transform;
transform.scale(scale, 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);
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_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_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);
}
void RegionMapEditor::on_verticalSlider_Zoom_Image_Tiles_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix;
matrix.scale(scale, scale);
QTransform transform;
transform.scale(scale, 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);
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);
}
void RegionMapEditor::on_verticalSlider_Zoom_City_Map_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix;
matrix.scale(scale, scale);
QTransform transform;
transform.scale(scale, 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);
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);
}
void RegionMapEditor::on_verticalSlider_Zoom_City_Tiles_valueChanged(int val) {
double scale = pow(scaleUpFactor, static_cast<double>(val - initialScale) / initialScale);
QMatrix matrix;
matrix.scale(scale, scale);
QTransform transform;
transform.scale(scale, 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);
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);
}