diff --git a/include/core/regionmap.h b/include/core/regionmap.h index 8c279cac..a8158395 100644 --- a/include/core/regionmap.h +++ b/include/core/regionmap.h @@ -26,12 +26,12 @@ public: int mapHeight = 0; QVector tiles; QString cityMap; - RegionMapHistoryItem(int type, QVector tiles, QString cityMap) { + RegionMapHistoryItem(int which, QVector tiles, QString cityMap) { this->which = which; this->tiles = tiles; this->cityMap = cityMap; } - RegionMapHistoryItem(int type, QVector tiles, int width, int height) { + RegionMapHistoryItem(int which, QVector tiles, int width, int height) { this->which = which; this->tiles = tiles; this->mapWidth = width; diff --git a/include/ui/noscrollspinbox.h b/include/ui/noscrollspinbox.h index 86f0a76f..0cc11043 100644 --- a/include/ui/noscrollspinbox.h +++ b/include/ui/noscrollspinbox.h @@ -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(); diff --git a/include/ui/overlay.h b/include/ui/overlay.h index a8e13337..87be19bd 100644 --- a/include/ui/overlay.h +++ b/include/ui/overlay.h @@ -10,7 +10,7 @@ class OverlayItem { public: OverlayItem() {} virtual ~OverlayItem() {}; - virtual void render(QPainter *painter) {}; + virtual void render(QPainter *) {}; }; class OverlayText : public OverlayItem { diff --git a/src/core/tileset.cpp b/src/core/tileset.cpp index 9dbc51cb..b3c81bc5 100644 --- a/src/core/tileset.cpp +++ b/src/core/tileset.cpp @@ -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)); } diff --git a/src/editor.cpp b/src/editor.cpp index 9ef28371..bab20ee8 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -407,7 +407,7 @@ void Editor::configureEncounterJSON(QWidget *window) { chanceSpinner->setMinimum(1); chanceSpinner->setMaximum(9999); chanceSpinner->setValue(chance); - connect(chanceSpinner, QOverload::of(&QSpinBox::valueChanged), [&chanceSpinner, &updateTotal, ¤tField](int) { + connect(chanceSpinner, QOverload::of(&QSpinBox::valueChanged), [&updateTotal, ¤tField](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::of(&QComboBox::activated), [&tempFields, ¤tField, index](QString newGroupName) { + connect(groupCombo, QOverload::of(&QComboBox::textActivated), [&tempFields, ¤tField, 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(); diff --git a/src/log.cpp b/src/log.cpp index a4005657..3b5d5eb0 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -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() { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ec0b00a2..b9bd94c9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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); diff --git a/src/mainwindow_scriptapi.cpp b/src/mainwindow_scriptapi.cpp index 18c8a7ec..cc89fc0b 100644 --- a/src/mainwindow_scriptapi.cpp +++ b/src/mainwindow_scriptapi.cpp @@ -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(); diff --git a/src/project.cpp b/src/project.cpp index 9569add4..3ef73e35 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -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)); diff --git a/src/ui/graphicsview.cpp b/src/ui/graphicsview.cpp index 19cf1a76..f0b73aa3 100644 --- a/src/ui/graphicsview.cpp +++ b/src/ui/graphicsview.cpp @@ -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); } diff --git a/src/ui/montabwidget.cpp b/src/ui/montabwidget.cpp index 829bacd6..bc3c24e8 100644 --- a/src/ui/montabwidget.cpp +++ b/src/ui/montabwidget.cpp @@ -147,7 +147,7 @@ void MonTabWidget::createSpeciesTableRow(QTableWidget *table, WildPokemon mon, i emit editor->wildMonDataChanged(); }); - connect(maxLevel, QOverload::of(&QSpinBox::valueChanged), [maxLevel, this](int) { + connect(maxLevel, QOverload::of(&QSpinBox::valueChanged), [this](int) { editor->saveEncounterTabData(); emit editor->wildMonDataChanged(); }); diff --git a/src/ui/regionmapeditor.cpp b/src/ui/regionmapeditor.cpp index 07415297..1fe23056 100644 --- a/src/ui/regionmapeditor.cpp +++ b/src/ui/regionmapeditor.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include 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(val - initialScale) / initialScale); - QMatrix matrix; - matrix.scale(scale, scale); + QTransform transform; + transform.scale(scale, scale); int width = ceil(static_cast(this->region_map->imgSize().width()) * scale); int height = ceil(static_cast(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(val - initialScale) / initialScale); - QMatrix matrix; - matrix.scale(scale, scale); + QTransform transform; + transform.scale(scale, scale); int width = ceil(static_cast(this->mapsquare_selector_item->pixelWidth) * scale); int height = ceil(static_cast(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(val - initialScale) / initialScale); - QMatrix matrix; - matrix.scale(scale, scale); + QTransform transform; + transform.scale(scale, scale); int width = ceil(static_cast(8 * city_map_item->width()) * scale); int height = ceil(static_cast(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(val - initialScale) / initialScale); - QMatrix matrix; - matrix.scale(scale, scale); + QTransform transform; + transform.scale(scale, scale); int width = ceil(static_cast(this->city_map_selector_item->pixelWidth) * scale); int height = ceil(static_cast(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); }