mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-27 19:16:31 -05:00
Fix deprecated code as of Qt 6.9
This commit is contained in:
@@ -9,6 +9,13 @@ namespace Util {
|
||||
int roundUp(int numToRound, int multiple);
|
||||
QString toDefineCase(QString input);
|
||||
QString toHexString(uint32_t value, int minLength = 0);
|
||||
Qt::Orientations getOrientation(bool xflip, bool yflip);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
typedef Qt::CheckState CheckState;
|
||||
#else
|
||||
typedef int CheckState;
|
||||
#endif
|
||||
|
||||
#endif // UTILITY_H
|
||||
|
||||
@@ -248,8 +248,6 @@ private slots:
|
||||
void on_comboBox_PrimaryTileset_currentTextChanged(const QString &arg1);
|
||||
void on_comboBox_SecondaryTileset_currentTextChanged(const QString &arg1);
|
||||
void on_pushButton_ChangeDimensions_clicked();
|
||||
void on_checkBox_smartPaths_stateChanged(int selected);
|
||||
void on_checkBox_ToggleBorder_stateChanged(int selected);
|
||||
|
||||
void resetMapViewScale();
|
||||
|
||||
@@ -260,7 +258,6 @@ private slots:
|
||||
|
||||
void eventTabChanged(int index);
|
||||
|
||||
void on_checkBox_MirrorConnections_stateChanged(int selected);
|
||||
void on_actionDive_Emerge_Map_triggered();
|
||||
void on_actionShow_Events_In_Map_View_triggered();
|
||||
void on_groupBox_DiveMapOpacity_toggled(bool on);
|
||||
@@ -437,6 +434,10 @@ private:
|
||||
|
||||
void checkForUpdates(bool requestedByUser);
|
||||
void setDivingMapsVisible(bool visible);
|
||||
|
||||
void setSmartPathsEnabled(CheckState state);
|
||||
void setBorderVisibility(CheckState state);
|
||||
void setMirrorConnectionsEnabled(CheckState state);
|
||||
};
|
||||
|
||||
// These are namespaced in a struct to avoid colliding with e.g. class Map.
|
||||
|
||||
@@ -73,11 +73,11 @@ private:
|
||||
void onWeatherChanged(const QString &weather);
|
||||
void onTypeChanged(const QString &type);
|
||||
void onBattleSceneChanged(const QString &battleScene);
|
||||
void onRequiresFlashChanged(int selected);
|
||||
void onShowLocationNameChanged(int selected);
|
||||
void onAllowRunningChanged(int selected);
|
||||
void onAllowBikingChanged(int selected);
|
||||
void onAllowEscapingChanged(int selected);
|
||||
void onRequiresFlashChanged(CheckState selected);
|
||||
void onShowLocationNameChanged(CheckState selected);
|
||||
void onAllowRunningChanged(CheckState selected);
|
||||
void onAllowBikingChanged(CheckState selected);
|
||||
void onAllowEscapingChanged(CheckState selected);
|
||||
void onFloorNumberChanged(int offset);
|
||||
};
|
||||
|
||||
|
||||
@@ -91,30 +91,27 @@ protected:
|
||||
virtual void showEvent(QShowEvent *) override;
|
||||
virtual void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
private slots:
|
||||
void on_checkBox_Objects_stateChanged(int state);
|
||||
void on_checkBox_Warps_stateChanged(int state);
|
||||
void on_checkBox_BGs_stateChanged(int state);
|
||||
void on_checkBox_Triggers_stateChanged(int state);
|
||||
void on_checkBox_HealLocations_stateChanged(int state);
|
||||
void on_checkBox_AllEvents_stateChanged(int state);
|
||||
|
||||
void on_checkBox_ConnectionUp_stateChanged(int state);
|
||||
void on_checkBox_ConnectionDown_stateChanged(int state);
|
||||
void on_checkBox_ConnectionLeft_stateChanged(int state);
|
||||
void on_checkBox_ConnectionRight_stateChanged(int state);
|
||||
void on_checkBox_AllConnections_stateChanged(int state);
|
||||
|
||||
void on_checkBox_Collision_stateChanged(int state);
|
||||
void on_checkBox_Grid_stateChanged(int state);
|
||||
void on_checkBox_Border_stateChanged(int state);
|
||||
private:
|
||||
void setShowGrid(CheckState state);
|
||||
void setShowBorder(CheckState state);
|
||||
void setShowObjects(CheckState state);
|
||||
void setShowWarps(CheckState state);
|
||||
void setShowBgs(CheckState state);
|
||||
void setShowTriggers(CheckState state);
|
||||
void setShowHealLocations(CheckState state);
|
||||
void setShowAllEvents(CheckState state);
|
||||
void setShowConnectionUp(CheckState state);
|
||||
void setShowConnectionDown(CheckState state);
|
||||
void setShowConnectionLeft(CheckState state);
|
||||
void setShowConnectionRight(CheckState state);
|
||||
void setShowAllConnections(CheckState state);
|
||||
void setShowCollision(CheckState state);
|
||||
void setDisablePreviewScaling(CheckState state);
|
||||
void setDisablePreviewUpdates(CheckState state);
|
||||
|
||||
void on_pushButton_Reset_pressed();
|
||||
void on_spinBox_TimelapseDelay_editingFinished();
|
||||
void on_spinBox_FrameSkip_editingFinished();
|
||||
|
||||
void on_checkBox_DisablePreviewScaling_stateChanged(int state);
|
||||
void on_checkBox_DisablePreviewUpdates_stateChanged(int state);
|
||||
};
|
||||
|
||||
#endif // MAPIMAGEEXPORTER_H
|
||||
|
||||
@@ -121,6 +121,9 @@ private:
|
||||
void restoreWindowState();
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
void setTileHFlip(CheckState);
|
||||
void setTileVFlip(CheckState);
|
||||
|
||||
private slots:
|
||||
void on_action_RegionMap_Save_triggered();
|
||||
void on_actionSave_All_triggered();
|
||||
@@ -145,8 +148,6 @@ private slots:
|
||||
void on_spinBox_RM_LayoutWidth_valueChanged(int);
|
||||
void on_spinBox_RM_LayoutHeight_valueChanged(int);
|
||||
void on_spinBox_tilePalette_valueChanged(int);
|
||||
void on_checkBox_tileHFlip_stateChanged(int);
|
||||
void on_checkBox_tileVFlip_stateChanged(int);
|
||||
void on_verticalSlider_Zoom_Map_Image_valueChanged(int);
|
||||
void on_verticalSlider_Zoom_Image_Tiles_valueChanged(int);
|
||||
void onHoveredRegionMapTileChanged(int x, int y);
|
||||
|
||||
@@ -49,9 +49,6 @@ public:
|
||||
void setAutoRepeat(bool on);
|
||||
bool autoRepeat() const;
|
||||
|
||||
int id() const;
|
||||
QList<int> ids() const;
|
||||
|
||||
inline QWidget *parentWidget() const
|
||||
{ return static_cast<QWidget *>(QObject::parent()); }
|
||||
|
||||
|
||||
@@ -71,10 +71,6 @@ private slots:
|
||||
|
||||
void on_spinBox_paletteSelector_valueChanged(int arg1);
|
||||
|
||||
void on_checkBox_xFlip_stateChanged(int arg1);
|
||||
|
||||
void on_checkBox_yFlip_stateChanged(int arg1);
|
||||
|
||||
void on_actionSave_Tileset_triggered();
|
||||
|
||||
void on_actionImport_Primary_Tiles_triggered();
|
||||
@@ -149,6 +145,8 @@ private:
|
||||
void commitTerrainType();
|
||||
void commitLayerType();
|
||||
void setRawAttributesVisible(bool visible);
|
||||
void setXFlip(CheckState state);
|
||||
void setYFlip(CheckState state);
|
||||
|
||||
Ui::TilesetEditor *ui;
|
||||
History<MetatileHistoryItem*> metatileHistory;
|
||||
|
||||
@@ -42,3 +42,10 @@ QString Util::toDefineCase(QString input) {
|
||||
QString Util::toHexString(uint32_t value, int minLength) {
|
||||
return "0x" + QString("%1").arg(value, minLength, 16, QChar('0')).toUpper();
|
||||
}
|
||||
|
||||
Qt::Orientations Util::getOrientation(bool xflip, bool yflip) {
|
||||
Qt::Orientations flags;
|
||||
if (xflip) flags |= Qt::Orientation::Horizontal;
|
||||
if (yflip) flags |= Qt::Orientation::Vertical;
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -296,7 +296,11 @@ void Editor::addNewWildMonGroup(QWidget *window) {
|
||||
form.addRow(new QLabel(monField.name), fieldCheckbox);
|
||||
}
|
||||
// Reading from ui here so not saving to disk before user.
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(copyCheckbox, &QCheckBox::checkStateChanged, [=](Qt::CheckState state){
|
||||
#else
|
||||
connect(copyCheckbox, &QCheckBox::stateChanged, [=](int state){
|
||||
#endif
|
||||
if (state == Qt::Checked) {
|
||||
int fieldIndex = 0;
|
||||
MonTabWidget *monWidget = static_cast<MonTabWidget *>(stack->widget(stack->currentIndex()));
|
||||
|
||||
@@ -299,6 +299,16 @@ void MainWindow::initExtraSignals() {
|
||||
connect(ui->action_NewLayout, &QAction::triggered, this, &MainWindow::openNewLayoutDialog);
|
||||
connect(ui->actionDuplicate_Current_Map_Layout, &QAction::triggered, this, &MainWindow::openDuplicateMapOrLayoutDialog);
|
||||
connect(ui->comboBox_LayoutSelector->lineEdit(), &QLineEdit::editingFinished, this, &MainWindow::onLayoutSelectorEditingFinished);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_smartPaths, &QCheckBox::checkStateChanged, this, &MainWindow::setSmartPathsEnabled);
|
||||
connect(ui->checkBox_ToggleBorder, &QCheckBox::checkStateChanged, this, &MainWindow::setBorderVisibility);
|
||||
connect(ui->checkBox_MirrorConnections, &QCheckBox::checkStateChanged, this, &MainWindow::setMirrorConnectionsEnabled);
|
||||
#else
|
||||
connect(ui->checkBox_smartPaths, &QCheckBox::stateChanged, this, &MainWindow::setSmartPathsEnabled);
|
||||
connect(ui->checkBox_ToggleBorder, &QCheckBox::stateChanged, this, &MainWindow::setBorderVisibility);
|
||||
connect(ui->checkBox_MirrorConnections, &QCheckBox::stateChanged, this, &MainWindow::setMirrorConnectionsEnabled);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCheck_for_Updates_triggered() {
|
||||
@@ -2711,25 +2721,21 @@ void MainWindow::on_pushButton_ChangeDimensions_clicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_checkBox_smartPaths_stateChanged(int selected)
|
||||
void MainWindow::setSmartPathsEnabled(CheckState state)
|
||||
{
|
||||
bool enabled = selected == Qt::Checked;
|
||||
editor->settings->smartPathsEnabled = enabled;
|
||||
if (enabled) {
|
||||
editor->cursorMapTileRect->setSmartPathMode(true);
|
||||
} else {
|
||||
editor->cursorMapTileRect->setSmartPathMode(false);
|
||||
}
|
||||
bool enabled = (state == Qt::Checked);
|
||||
this->editor->settings->smartPathsEnabled = enabled;
|
||||
this->editor->cursorMapTileRect->setSmartPathMode(enabled);
|
||||
}
|
||||
|
||||
void MainWindow::on_checkBox_ToggleBorder_stateChanged(int selected)
|
||||
void MainWindow::setBorderVisibility(CheckState state)
|
||||
{
|
||||
editor->toggleBorderVisibility(selected != 0);
|
||||
editor->toggleBorderVisibility(state == Qt::Checked);
|
||||
}
|
||||
|
||||
void MainWindow::on_checkBox_MirrorConnections_stateChanged(int selected)
|
||||
void MainWindow::setMirrorConnectionsEnabled(CheckState state)
|
||||
{
|
||||
porymapConfig.mirrorConnectingMaps = (selected == Qt::Checked);
|
||||
porymapConfig.mirrorConnectingMaps = (state == Qt::Checked);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionTileset_Editor_triggered()
|
||||
|
||||
@@ -276,7 +276,12 @@ void MapView::addTileImage(int x, int y, int tileId, bool xflip, bool yflip, int
|
||||
this->editor->layout->tileset_primary,
|
||||
this->editor->layout->tileset_secondary,
|
||||
paletteId)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
|
||||
.flipped(Util::getOrientation(xflip, yflip));
|
||||
#else
|
||||
.mirrored(xflip, yflip);
|
||||
#endif
|
||||
|
||||
if (setTransparency)
|
||||
image.setColor(0, qRgba(0, 0, 0, 0));
|
||||
if (this->getOverlay(layer)->addImage(x, y, image))
|
||||
|
||||
@@ -105,7 +105,11 @@ void CustomScriptsEditor::displayScript(const QString &filepath, bool enabled) {
|
||||
connect(widget->ui->b_Choose, &QAbstractButton::clicked, [this, item](bool) { this->replaceScript(item); });
|
||||
connect(widget->ui->b_Edit, &QAbstractButton::clicked, [this, item](bool) { this->openScript(item); });
|
||||
connect(widget->ui->b_Delete, &QAbstractButton::clicked, [this, item](bool) { this->removeScript(item); });
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(widget->ui->checkBox_Enable, &QCheckBox::checkStateChanged, this, &CustomScriptsEditor::markEdited);
|
||||
#else
|
||||
connect(widget->ui->checkBox_Enable, &QCheckBox::stateChanged, this, &CustomScriptsEditor::markEdited);
|
||||
#endif
|
||||
connect(widget->ui->lineEdit_filepath, &QLineEdit::textEdited, this, &CustomScriptsEditor::markEdited);
|
||||
|
||||
// Per the Qt manual, for performance reasons QListWidget::setItemWidget shouldn't be used with non-static items.
|
||||
|
||||
@@ -853,7 +853,11 @@ void HiddenItemFrame::connectSignals(MainWindow *window) {
|
||||
|
||||
// underfoot
|
||||
this->check_itemfinder->disconnect();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(this->check_itemfinder, &QCheckBox::checkStateChanged, [=](Qt::CheckState state) {
|
||||
#else
|
||||
connect(this->check_itemfinder, &QCheckBox::stateChanged, [=](int state) {
|
||||
#endif
|
||||
this->hiddenItem->setUnderfoot(state == Qt::Checked);
|
||||
this->hiddenItem->modify();
|
||||
});
|
||||
|
||||
@@ -127,7 +127,12 @@ QImage getMetatileImage(
|
||||
color.setAlpha(0);
|
||||
tile_image.setColor(0, color.rgba());
|
||||
|
||||
metatile_painter.drawImage(origin, tile_image.mirrored(tile.xflip, tile.yflip));
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
|
||||
tile_image.flip(Util::getOrientation(tile.xflip, tile.yflip));
|
||||
#else
|
||||
tile_image = tile_image.mirrored(tile.xflip, tile.yflip);
|
||||
#endif
|
||||
metatile_painter.drawImage(origin, tile_image);
|
||||
}
|
||||
metatile_painter.end();
|
||||
|
||||
|
||||
@@ -21,11 +21,19 @@ MapHeaderForm::MapHeaderForm(QWidget *parent)
|
||||
connect(ui->comboBox_Type, &QComboBox::currentTextChanged, this, &MapHeaderForm::onTypeChanged);
|
||||
connect(ui->comboBox_BattleScene, &QComboBox::currentTextChanged, this, &MapHeaderForm::onBattleSceneChanged);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_RequiresFlash, &QCheckBox::checkStateChanged, this, &MapHeaderForm::onRequiresFlashChanged);
|
||||
connect(ui->checkBox_ShowLocationName, &QCheckBox::checkStateChanged, this, &MapHeaderForm::onShowLocationNameChanged);
|
||||
connect(ui->checkBox_AllowRunning, &QCheckBox::checkStateChanged, this, &MapHeaderForm::onAllowRunningChanged);
|
||||
connect(ui->checkBox_AllowBiking, &QCheckBox::checkStateChanged, this, &MapHeaderForm::onAllowBikingChanged);
|
||||
connect(ui->checkBox_AllowEscaping, &QCheckBox::checkStateChanged, this, &MapHeaderForm::onAllowEscapingChanged);
|
||||
#else
|
||||
connect(ui->checkBox_RequiresFlash, &QCheckBox::stateChanged, this, &MapHeaderForm::onRequiresFlashChanged);
|
||||
connect(ui->checkBox_ShowLocationName, &QCheckBox::stateChanged, this, &MapHeaderForm::onShowLocationNameChanged);
|
||||
connect(ui->checkBox_AllowRunning, &QCheckBox::stateChanged, this, &MapHeaderForm::onAllowRunningChanged);
|
||||
connect(ui->checkBox_AllowBiking, &QCheckBox::stateChanged, this, &MapHeaderForm::onAllowBikingChanged);
|
||||
connect(ui->checkBox_AllowEscaping, &QCheckBox::stateChanged, this, &MapHeaderForm::onAllowEscapingChanged);
|
||||
#endif
|
||||
|
||||
connect(ui->spinBox_FloorNumber, QOverload<int>::of(&QSpinBox::valueChanged), this, &MapHeaderForm::onFloorNumberChanged);
|
||||
|
||||
@@ -207,11 +215,11 @@ void MapHeaderForm::onSongUpdated(const QString &song) { if (m_hea
|
||||
void MapHeaderForm::onWeatherChanged(const QString &weather) { if (m_header) m_header->setWeather(weather); }
|
||||
void MapHeaderForm::onTypeChanged(const QString &type) { if (m_header) m_header->setType(type); }
|
||||
void MapHeaderForm::onBattleSceneChanged(const QString &battleScene) { if (m_header) m_header->setBattleScene(battleScene); }
|
||||
void MapHeaderForm::onRequiresFlashChanged(int selected) { if (m_header) m_header->setRequiresFlash(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onShowLocationNameChanged(int selected) { if (m_header) m_header->setShowsLocationName(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowRunningChanged(int selected) { if (m_header) m_header->setAllowsRunning(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowBikingChanged(int selected) { if (m_header) m_header->setAllowsBiking(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowEscapingChanged(int selected) { if (m_header) m_header->setAllowsEscaping(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onRequiresFlashChanged(CheckState selected) { if (m_header) m_header->setRequiresFlash(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onShowLocationNameChanged(CheckState selected) { if (m_header) m_header->setShowsLocationName(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowRunningChanged(CheckState selected) { if (m_header) m_header->setAllowsRunning(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowBikingChanged(CheckState selected) { if (m_header) m_header->setAllowsBiking(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onAllowEscapingChanged(CheckState selected) { if (m_header) m_header->setAllowsEscaping(selected == Qt::Checked); }
|
||||
void MapHeaderForm::onFloorNumberChanged(int offset) { if (m_header) m_header->setFloorNumber(offset); }
|
||||
void MapHeaderForm::onLocationChanged(const QString &location) {
|
||||
if (m_header) m_header->setLocation(location);
|
||||
|
||||
@@ -60,6 +60,42 @@ MapImageExporter::MapImageExporter(QWidget *parent, Project *project, Map *map,
|
||||
connect(ui->comboBox_MapSelection, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &MapImageExporter::updateMapSelection);
|
||||
connect(ui->comboBox_MapSelection->lineEdit(), &QLineEdit::editingFinished, this, &MapImageExporter::updateMapSelection);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_Objects, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowObjects);
|
||||
connect(ui->checkBox_Warps, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowWarps);
|
||||
connect(ui->checkBox_BGs, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowBgs);
|
||||
connect(ui->checkBox_Triggers, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowTriggers);
|
||||
connect(ui->checkBox_HealLocations, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowHealLocations);
|
||||
connect(ui->checkBox_AllEvents, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowAllEvents);
|
||||
connect(ui->checkBox_ConnectionUp, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowConnectionUp);
|
||||
connect(ui->checkBox_ConnectionDown, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowConnectionDown);
|
||||
connect(ui->checkBox_ConnectionLeft, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowConnectionLeft);
|
||||
connect(ui->checkBox_ConnectionRight, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowConnectionRight);
|
||||
connect(ui->checkBox_AllConnections, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowAllConnections);
|
||||
connect(ui->checkBox_Collision, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowCollision);
|
||||
connect(ui->checkBox_Grid, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowGrid);
|
||||
connect(ui->checkBox_Border, &QCheckBox::checkStateChanged, this, &MapImageExporter::setShowBorder);
|
||||
connect(ui->checkBox_DisablePreviewScaling, &QCheckBox::checkStateChanged, this, &MapImageExporter::setDisablePreviewScaling);
|
||||
connect(ui->checkBox_DisablePreviewUpdates, &QCheckBox::checkStateChanged, this, &MapImageExporter::setDisablePreviewUpdates);
|
||||
#else
|
||||
connect(ui->checkBox_Objects, &QCheckBox::stateChanged, this, &MapImageExporter::setShowObjects);
|
||||
connect(ui->checkBox_Warps, &QCheckBox::stateChanged, this, &MapImageExporter::setShowWarps);
|
||||
connect(ui->checkBox_BGs, &QCheckBox::stateChanged, this, &MapImageExporter::setShowBgs);
|
||||
connect(ui->checkBox_Triggers, &QCheckBox::stateChanged, this, &MapImageExporter::setShowTriggers);
|
||||
connect(ui->checkBox_HealLocations, &QCheckBox::stateChanged, this, &MapImageExporter::setShowHealLocations);
|
||||
connect(ui->checkBox_AllEvents, &QCheckBox::stateChanged, this, &MapImageExporter::setShowAllEvents);
|
||||
connect(ui->checkBox_ConnectionUp, &QCheckBox::stateChanged, this, &MapImageExporter::setShowConnectionUp);
|
||||
connect(ui->checkBox_ConnectionDown, &QCheckBox::stateChanged, this, &MapImageExporter::setShowConnectionDown);
|
||||
connect(ui->checkBox_ConnectionLeft, &QCheckBox::stateChanged, this, &MapImageExporter::setShowConnectionLeft);
|
||||
connect(ui->checkBox_ConnectionRight, &QCheckBox::stateChanged, this, &MapImageExporter::setShowConnectionRight);
|
||||
connect(ui->checkBox_AllConnections, &QCheckBox::stateChanged, this, &MapImageExporter::setShowAllConnections);
|
||||
connect(ui->checkBox_Collision, &QCheckBox::stateChanged, this, &MapImageExporter::setShowCollision);
|
||||
connect(ui->checkBox_Grid, &QCheckBox::stateChanged, this, &MapImageExporter::setShowGrid);
|
||||
connect(ui->checkBox_Border, &QCheckBox::stateChanged, this, &MapImageExporter::setShowBorder);
|
||||
connect(ui->checkBox_DisablePreviewScaling, &QCheckBox::stateChanged, this, &MapImageExporter::setDisablePreviewScaling);
|
||||
connect(ui->checkBox_DisablePreviewUpdates, &QCheckBox::stateChanged, this, &MapImageExporter::setDisablePreviewUpdates);
|
||||
#endif
|
||||
|
||||
ui->graphicsView_Preview->setFocus();
|
||||
}
|
||||
|
||||
@@ -719,48 +755,48 @@ void MapImageExporter::setConnectionDirectionEnabled(const QString &dir, bool en
|
||||
}
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Collision_stateChanged(int state) {
|
||||
void MapImageExporter::setShowCollision(CheckState state) {
|
||||
m_settings.showCollision = (state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Grid_stateChanged(int state) {
|
||||
void MapImageExporter::setShowGrid(CheckState state) {
|
||||
m_settings.showGrid = (state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Border_stateChanged(int state) {
|
||||
void MapImageExporter::setShowBorder(CheckState state) {
|
||||
m_settings.showBorder = (state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Objects_stateChanged(int state) {
|
||||
void MapImageExporter::setShowObjects(CheckState state) {
|
||||
setEventGroupEnabled(Event::Group::Object, state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Warps_stateChanged(int state) {
|
||||
void MapImageExporter::setShowWarps(CheckState state) {
|
||||
setEventGroupEnabled(Event::Group::Warp, state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_BGs_stateChanged(int state) {
|
||||
void MapImageExporter::setShowBgs(CheckState state) {
|
||||
setEventGroupEnabled(Event::Group::Bg, state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_Triggers_stateChanged(int state) {
|
||||
void MapImageExporter::setShowTriggers(CheckState state) {
|
||||
setEventGroupEnabled(Event::Group::Coord, state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_HealLocations_stateChanged(int state) {
|
||||
void MapImageExporter::setShowHealLocations(CheckState state) {
|
||||
setEventGroupEnabled(Event::Group::Heal, state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
// Shortcut setting for enabling all events
|
||||
void MapImageExporter::on_checkBox_AllEvents_stateChanged(int state) {
|
||||
void MapImageExporter::setShowAllEvents(CheckState state) {
|
||||
bool on = (state == Qt::Checked);
|
||||
|
||||
const QSignalBlocker b_Objects(ui->checkBox_Objects);
|
||||
@@ -791,28 +827,28 @@ void MapImageExporter::on_checkBox_AllEvents_stateChanged(int state) {
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_ConnectionUp_stateChanged(int state) {
|
||||
void MapImageExporter::setShowConnectionUp(CheckState state) {
|
||||
setConnectionDirectionEnabled("up", state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_ConnectionDown_stateChanged(int state) {
|
||||
void MapImageExporter::setShowConnectionDown(CheckState state) {
|
||||
setConnectionDirectionEnabled("down", state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_ConnectionLeft_stateChanged(int state) {
|
||||
void MapImageExporter::setShowConnectionLeft(CheckState state) {
|
||||
setConnectionDirectionEnabled("left", state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_ConnectionRight_stateChanged(int state) {
|
||||
void MapImageExporter::setShowConnectionRight(CheckState state) {
|
||||
setConnectionDirectionEnabled("right", state == Qt::Checked);
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
// Shortcut setting for enabling all connection directions
|
||||
void MapImageExporter::on_checkBox_AllConnections_stateChanged(int state) {
|
||||
void MapImageExporter::setShowAllConnections(CheckState state) {
|
||||
bool on = (state == Qt::Checked);
|
||||
|
||||
const QSignalBlocker b_Up(ui->checkBox_ConnectionUp);
|
||||
@@ -838,7 +874,7 @@ void MapImageExporter::on_checkBox_AllConnections_stateChanged(int state) {
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_DisablePreviewScaling_stateChanged(int state) {
|
||||
void MapImageExporter::setDisablePreviewScaling(CheckState state) {
|
||||
m_settings.disablePreviewScaling = (state == Qt::Checked);
|
||||
if (m_settings.disablePreviewScaling) {
|
||||
ui->graphicsView_Preview->resetTransform();
|
||||
@@ -847,7 +883,7 @@ void MapImageExporter::on_checkBox_DisablePreviewScaling_stateChanged(int state)
|
||||
}
|
||||
}
|
||||
|
||||
void MapImageExporter::on_checkBox_DisablePreviewUpdates_stateChanged(int state) {
|
||||
void MapImageExporter::setDisablePreviewUpdates(CheckState state) {
|
||||
m_settings.disablePreviewUpdates = (state == Qt::Checked);
|
||||
if (m_settings.disablePreviewUpdates) {
|
||||
if (m_timelapseMovie) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "config.h"
|
||||
#include "metatilelayersitem.h"
|
||||
#include "imageproviders.h"
|
||||
#include "utility.h"
|
||||
#include <QPainter>
|
||||
|
||||
static const QList<QPoint> tilePositions = {
|
||||
@@ -28,7 +29,11 @@ void MetatileLayersItem::draw() {
|
||||
for (int i = 0; i < numTiles; i++) {
|
||||
Tile tile = this->metatile->tiles.at(i);
|
||||
QImage tileImage = getPalettedTileImage(tile.tileId, this->primaryTileset, this->secondaryTileset, tile.palette, true)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
|
||||
.flipped(Util::getOrientation(tile.xflip, tile.yflip))
|
||||
#else
|
||||
.mirrored(tile.xflip, tile.yflip)
|
||||
#endif
|
||||
.scaled(16, 16);
|
||||
painter.drawImage(tilePositions.at(i) * 16, tileImage);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,11 @@ void ProjectSettingsEditor::connectSignals() {
|
||||
connect(ui->comboBox_BaseGameVersion, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::promptRestoreDefaults);
|
||||
connect(ui->comboBox_AttributesSize, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::updateAttributeLimits);
|
||||
connect(ui->comboBox_IconSpecies, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::updatePokemonIconPath);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_EnableCustomBorderSize, &QCheckBox::checkStateChanged, [this](Qt::CheckState state) {
|
||||
#else
|
||||
connect(ui->checkBox_EnableCustomBorderSize, &QCheckBox::stateChanged, [this](int state) {
|
||||
#endif
|
||||
bool customSize = (state == Qt::Checked);
|
||||
// When switching between the spin boxes or line edit for border metatiles we set
|
||||
// the newly-shown UI using the values from the hidden UI.
|
||||
@@ -82,8 +86,12 @@ void ProjectSettingsEditor::connectSignals() {
|
||||
connect(combo, &QComboBox::currentTextChanged, this, &ProjectSettingsEditor::markEdited);
|
||||
}
|
||||
for (auto checkBox : ui->centralwidget->findChildren<QCheckBox *>())
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(checkBox, &QCheckBox::checkStateChanged, this, &ProjectSettingsEditor::markEdited);
|
||||
#else
|
||||
connect(checkBox, &QCheckBox::stateChanged, this, &ProjectSettingsEditor::markEdited);
|
||||
for (auto radioButton : ui->centralwidget->findChildren<QRadioButton *>())
|
||||
#endif
|
||||
for (auto radioButton : ui->centralwidget->findChildren<QRadioButton *>())
|
||||
connect(radioButton, &QRadioButton::toggled, this, &ProjectSettingsEditor::markEdited);
|
||||
for (auto lineEdit : ui->centralwidget->findChildren<QLineEdit *>())
|
||||
connect(lineEdit, &QLineEdit::textEdited, this, &ProjectSettingsEditor::markEdited);
|
||||
|
||||
@@ -27,6 +27,15 @@ RegionMapEditor::RegionMapEditor(QWidget *parent, Project *project) :
|
||||
this->ui->setupUi(this);
|
||||
this->project = project;
|
||||
connect(this->project, &Project::mapSectionIdNamesChanged, this, &RegionMapEditor::setLocations);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_tileHFlip, &QCheckBox::checkStateChanged, this, &RegionMapEditor::setTileHFlip);
|
||||
connect(ui->checkBox_tileVFlip, &QCheckBox::checkStateChanged, this, &RegionMapEditor::setTileVFlip);
|
||||
#else
|
||||
connect(ui->checkBox_tileHFlip, &QCheckBox::stateChanged, this, &RegionMapEditor::setTileHFlip);
|
||||
connect(ui->checkBox_tileVFlip, &QCheckBox::stateChanged, this, &RegionMapEditor::setTileVFlip);
|
||||
#endif
|
||||
|
||||
|
||||
this->configFilepath = QString("%1/%2").arg(this->project->root).arg(projectConfig.getFilePath(ProjectFilePath::json_region_porymap_cfg));
|
||||
this->initShortcuts();
|
||||
this->restoreWindowState();
|
||||
@@ -1030,15 +1039,18 @@ void RegionMapEditor::on_pushButton_RM_Options_delete_clicked() {
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_spinBox_tilePalette_valueChanged(int value) {
|
||||
this->mapsquare_selector_item->selectPalette(value);
|
||||
if (this->mapsquare_selector_item)
|
||||
this->mapsquare_selector_item->selectPalette(value);
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_checkBox_tileHFlip_stateChanged(int state) {
|
||||
this->mapsquare_selector_item->selectHFlip(state == Qt::Checked);
|
||||
void RegionMapEditor::setTileHFlip(CheckState state) {
|
||||
if (this->mapsquare_selector_item)
|
||||
this->mapsquare_selector_item->selectHFlip(state == Qt::Checked);
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_checkBox_tileVFlip_stateChanged(int state) {
|
||||
this->mapsquare_selector_item->selectVFlip(state == Qt::Checked);
|
||||
void RegionMapEditor::setTileVFlip(CheckState state) {
|
||||
if (this->mapsquare_selector_item)
|
||||
this->mapsquare_selector_item->selectVFlip(state == Qt::Checked);
|
||||
}
|
||||
|
||||
void RegionMapEditor::on_action_RegionMap_Resize_triggered() {
|
||||
|
||||
@@ -123,21 +123,10 @@ bool Shortcut::autoRepeat() const {
|
||||
return sc_vec.first()->autoRepeat();
|
||||
}
|
||||
|
||||
int Shortcut::id() const {
|
||||
return sc_vec.first()->id();
|
||||
}
|
||||
|
||||
QList<int> Shortcut::ids() const {
|
||||
QList<int> id_list;
|
||||
for (auto *sc : sc_vec)
|
||||
id_list.append(sc->id());
|
||||
return id_list;
|
||||
}
|
||||
|
||||
bool Shortcut::event(QEvent *e) {
|
||||
if (isEnabled() && e->type() == QEvent::Shortcut) {
|
||||
auto se = static_cast<QShortcutEvent *>(e);
|
||||
if (ids().contains(se->shortcutId()) && keys().contains(se->key())) {
|
||||
if (keys().contains(se->key())) {
|
||||
if (QWhatsThis::inWhatsThisMode()) {
|
||||
QWhatsThis::showText(QCursor::pos(), whatsThis());
|
||||
} else {
|
||||
|
||||
@@ -93,7 +93,11 @@ QImage TilemapTileSelector::tileImg(shared_ptr<TilemapTile> tile) {
|
||||
|
||||
// take a tile from the tileset
|
||||
QImage img = tilesetImage.copy(pos.x() * 8, pos.y() * 8, 8, 8);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
|
||||
img.flip(Util::getOrientation(tile->hFlip(), tile->vFlip()));
|
||||
#else
|
||||
img = img.mirrored(tile->hFlip(), tile->vFlip());
|
||||
#endif
|
||||
return img;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,14 @@ TilesetEditor::TilesetEditor(Project *project, Layout *layout, QWidget *parent)
|
||||
setTilesets(this->layout->tileset_primary_label, this->layout->tileset_secondary_label);
|
||||
ui->setupUi(this);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_xFlip, &QCheckBox::checkStateChanged, this, &TilesetEditor::setXFlip);
|
||||
connect(ui->checkBox_yFlip, &QCheckBox::checkStateChanged, this, &TilesetEditor::setYFlip);
|
||||
#else
|
||||
connect(ui->checkBox_xFlip, &QCheckBox::stateChanged, this, &TilesetEditor::setXFlip);
|
||||
connect(ui->checkBox_yFlip, &QCheckBox::stateChanged, this, &TilesetEditor::setYFlip);
|
||||
#endif
|
||||
|
||||
this->tileXFlip = ui->checkBox_xFlip->isChecked();
|
||||
this->tileYFlip = ui->checkBox_yFlip->isChecked();
|
||||
this->paletteId = ui->spinBox_paletteSelector->value();
|
||||
@@ -388,8 +396,13 @@ void TilesetEditor::drawSelectedTiles() {
|
||||
int tileIndex = 0;
|
||||
for (int j = 0; j < dimensions.y(); j++) {
|
||||
for (int i = 0; i < dimensions.x(); i++) {
|
||||
QImage tileImage = getPalettedTileImage(tiles.at(tileIndex).tileId, this->primaryTileset, this->secondaryTileset, tiles.at(tileIndex).palette, true)
|
||||
.mirrored(tiles.at(tileIndex).xflip, tiles.at(tileIndex).yflip)
|
||||
auto tile = tiles.at(tileIndex);
|
||||
QImage tileImage = getPalettedTileImage(tile.tileId, this->primaryTileset, this->secondaryTileset, tile.palette, true)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 9, 0))
|
||||
.flipped(Util::getOrientation(tile.xflip, tile.yflip))
|
||||
#else
|
||||
.mirrored(tile.xflip, tile.yflip)
|
||||
#endif
|
||||
.scaled(16, 16);
|
||||
tileIndex++;
|
||||
painter.drawImage(i * 16, j * 16, tileImage);
|
||||
@@ -540,17 +553,17 @@ void TilesetEditor::on_spinBox_paletteSelector_valueChanged(int paletteId)
|
||||
this->metatileLayersItem->clearLastModifiedCoords();
|
||||
}
|
||||
|
||||
void TilesetEditor::on_checkBox_xFlip_stateChanged(int checked)
|
||||
void TilesetEditor::setXFlip(CheckState state)
|
||||
{
|
||||
this->tileXFlip = checked;
|
||||
this->tileXFlip = (state == Qt::Checked);
|
||||
this->tileSelector->setTileFlips(this->tileXFlip, this->tileYFlip);
|
||||
this->drawSelectedTiles();
|
||||
this->metatileLayersItem->clearLastModifiedCoords();
|
||||
}
|
||||
|
||||
void TilesetEditor::on_checkBox_yFlip_stateChanged(int checked)
|
||||
void TilesetEditor::setYFlip(CheckState state)
|
||||
{
|
||||
this->tileYFlip = checked;
|
||||
this->tileYFlip = (state == Qt::Checked);
|
||||
this->tileSelector->setTileFlips(this->tileXFlip, this->tileYFlip);
|
||||
this->drawSelectedTiles();
|
||||
this->metatileLayersItem->clearLastModifiedCoords();
|
||||
|
||||
@@ -19,7 +19,11 @@ UpdatePromoter::UpdatePromoter(QWidget *parent, NetworkAccessManager *manager)
|
||||
// Set up "Do not alert me" check box
|
||||
this->updatePreferences();
|
||||
ui->checkBox_StopAlerts->setVisible(false);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
|
||||
connect(ui->checkBox_StopAlerts, &QCheckBox::checkStateChanged, [this](Qt::CheckState state) {
|
||||
#else
|
||||
connect(ui->checkBox_StopAlerts, &QCheckBox::stateChanged, [this](int state) {
|
||||
#endif
|
||||
porymapConfig.checkForUpdates = (state != Qt::Checked);
|
||||
emit this->changedPreferences();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user