Upgrade signal/slot connections in all other files

This commit is contained in:
BigBahss 2021-02-14 10:07:55 -05:00 committed by huderlem
parent 51dccf7773
commit 7937c3fe98
4 changed files with 39 additions and 36 deletions

View file

@ -575,7 +575,7 @@ void ProjectConfig::onNewConfigFileCreated() {
form.addRow(new QLabel("Game Version"), baseGameVersionComboBox); form.addRow(new QLabel("Game Version"), baseGameVersionComboBox);
QDialogButtonBox buttonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog); QDialogButtonBox buttonBox(QDialogButtonBox::Ok, Qt::Horizontal, &dialog);
connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
form.addRow(&buttonBox); form.addRow(&buttonBox);
if (dialog.exec() == QDialog::Accepted) { if (dialog.exec() == QDialog::Accepted) {

View file

@ -7,8 +7,7 @@ NewEventToolButton::NewEventToolButton(QWidget *parent) :
QToolButton(parent) QToolButton(parent)
{ {
setPopupMode(QToolButton::MenuButtonPopup); setPopupMode(QToolButton::MenuButtonPopup);
QObject::connect(this, SIGNAL(triggered(QAction*)), QObject::connect(this, &NewEventToolButton::triggered, this, &NewEventToolButton::setDefaultAction);
this, SLOT(setDefaultAction(QAction*)));
this->init(); this->init();
} }
@ -17,11 +16,11 @@ void NewEventToolButton::init()
// Add a context menu to select different types of map events. // Add a context menu to select different types of map events.
this->newObjectAction = new QAction("New Object", this); this->newObjectAction = new QAction("New Object", this);
this->newObjectAction->setIcon(QIcon(":/icons/add.ico")); this->newObjectAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newObjectAction, SIGNAL(triggered(bool)), this, SLOT(newObject())); connect(this->newObjectAction, &QAction::triggered, this, &NewEventToolButton::newObject);
this->newWarpAction = new QAction("New Warp", this); this->newWarpAction = new QAction("New Warp", this);
this->newWarpAction->setIcon(QIcon(":/icons/add.ico")); this->newWarpAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp())); connect(this->newWarpAction, &QAction::triggered, this, &NewEventToolButton::newWarp);
/* // disable this functionality for now /* // disable this functionality for now
this->newHealLocationAction = new QAction("New Heal Location", this); this->newHealLocationAction = new QAction("New Heal Location", this);
@ -31,23 +30,23 @@ void NewEventToolButton::init()
this->newTriggerAction = new QAction("New Trigger", this); this->newTriggerAction = new QAction("New Trigger", this);
this->newTriggerAction->setIcon(QIcon(":/icons/add.ico")); this->newTriggerAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newTrigger())); connect(this->newTriggerAction, &QAction::triggered, this, &NewEventToolButton::newTrigger);
this->newWeatherTriggerAction = new QAction("New Weather Trigger", this); this->newWeatherTriggerAction = new QAction("New Weather Trigger", this);
this->newWeatherTriggerAction->setIcon(QIcon(":/icons/add.ico")); this->newWeatherTriggerAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newWeatherTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newWeatherTrigger())); connect(this->newWeatherTriggerAction, &QAction::triggered, this, &NewEventToolButton::newWeatherTrigger);
this->newSignAction = new QAction("New Sign", this); this->newSignAction = new QAction("New Sign", this);
this->newSignAction->setIcon(QIcon(":/icons/add.ico")); this->newSignAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newSignAction, SIGNAL(triggered(bool)), this, SLOT(newSign())); connect(this->newSignAction, &QAction::triggered, this, &NewEventToolButton::newSign);
this->newHiddenItemAction = new QAction("New Hidden Item", this); this->newHiddenItemAction = new QAction("New Hidden Item", this);
this->newHiddenItemAction->setIcon(QIcon(":/icons/add.ico")); this->newHiddenItemAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newHiddenItemAction, SIGNAL(triggered(bool)), this, SLOT(newHiddenItem())); connect(this->newHiddenItemAction, &QAction::triggered, this, &NewEventToolButton::newHiddenItem);
this->newSecretBaseAction = new QAction("New Secret Base", this); this->newSecretBaseAction = new QAction("New Secret Base", this);
this->newSecretBaseAction->setIcon(QIcon(":/icons/add.ico")); this->newSecretBaseAction->setIcon(QIcon(":/icons/add.ico"));
connect(this->newSecretBaseAction, SIGNAL(triggered(bool)), this, SLOT(newSecretBase())); connect(this->newSecretBaseAction, &QAction::triggered, this, &NewEventToolButton::newSecretBase);
QMenu *alignMenu = new QMenu(); QMenu *alignMenu = new QMenu();
alignMenu->addAction(this->newObjectAction); alignMenu->addAction(this->newObjectAction);

View file

@ -631,7 +631,7 @@ void RegionMapEditor::on_pushButton_CityMap_add_clicked() {
QString name; QString name;
form.addRow(&buttonBox); form.addRow(&buttonBox);
connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject);
connect(&buttonBox, &QDialogButtonBox::accepted, [&popup, &input, &name](){ connect(&buttonBox, &QDialogButtonBox::accepted, [&popup, &input, &name](){
name = input->text().remove(QRegularExpression("[^a-zA-Z0-9_]+")); name = input->text().remove(QRegularExpression("[^a-zA-Z0-9_]+"));
if (!name.isEmpty()) if (!name.isEmpty())
@ -666,8 +666,8 @@ void RegionMapEditor::on_action_RegionMap_Resize_triggered() {
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &popup); QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &popup);
form.addRow(&buttonBox); form.addRow(&buttonBox);
connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject);
connect(&buttonBox, SIGNAL(accepted()), &popup, SLOT(accept())); connect(&buttonBox, &QDialogButtonBox::accepted, &popup, &QDialog::accept);
if (popup.exec() == QDialog::Accepted) { if (popup.exec() == QDialog::Accepted) {
resize(widthSpinBox->value(), heightSpinBox->value()); resize(widthSpinBox->value(), heightSpinBox->value());
@ -760,7 +760,7 @@ void RegionMapEditor::on_action_Swap_triggered() {
QString beforeSection, afterSection; QString beforeSection, afterSection;
uint8_t oldId, newId; uint8_t oldId, newId;
connect(&buttonBox, SIGNAL(rejected()), &popup, SLOT(reject())); connect(&buttonBox, &QDialogButtonBox::rejected, &popup, &QDialog::reject);
connect(&buttonBox, &QDialogButtonBox::accepted, [this, &popup, &oldSecBox, &newSecBox, connect(&buttonBox, &QDialogButtonBox::accepted, [this, &popup, &oldSecBox, &newSecBox,
&beforeSection, &afterSection, &oldId, &newId](){ &beforeSection, &afterSection, &oldId, &newId](){
beforeSection = oldSecBox->currentText(); beforeSection = oldSecBox->currentText();

View file

@ -157,12 +157,12 @@ void TilesetEditor::setMetatileLabelValidator() {
void TilesetEditor::initMetatileSelector() void TilesetEditor::initMetatileSelector()
{ {
this->metatileSelector = new TilesetEditorMetatileSelector(this->primaryTileset, this->secondaryTileset, this->map); this->metatileSelector = new TilesetEditorMetatileSelector(this->primaryTileset, this->secondaryTileset, this->map);
connect(this->metatileSelector, SIGNAL(hoveredMetatileChanged(uint16_t)), connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileChanged,
this, SLOT(onHoveredMetatileChanged(uint16_t))); this, &TilesetEditor::onHoveredMetatileChanged);
connect(this->metatileSelector, SIGNAL(hoveredMetatileCleared()), connect(this->metatileSelector, &TilesetEditorMetatileSelector::hoveredMetatileCleared,
this, SLOT(onHoveredMetatileCleared())); this, &TilesetEditor::onHoveredMetatileCleared);
connect(this->metatileSelector, SIGNAL(selectedMetatileChanged(uint16_t)), connect(this->metatileSelector, &TilesetEditorMetatileSelector::selectedMetatileChanged,
this, SLOT(onSelectedMetatileChanged(uint16_t))); this, &TilesetEditor::onSelectedMetatileChanged);
this->metatilesScene = new QGraphicsScene; this->metatilesScene = new QGraphicsScene;
this->metatilesScene->addItem(this->metatileSelector); this->metatilesScene->addItem(this->metatileSelector);
@ -175,10 +175,10 @@ void TilesetEditor::initMetatileSelector()
void TilesetEditor::initMetatileLayersItem() { void TilesetEditor::initMetatileLayersItem() {
Metatile *metatile = Tileset::getMetatile(this->metatileSelector->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset); Metatile *metatile = Tileset::getMetatile(this->metatileSelector->getSelectedMetatile(), this->primaryTileset, this->secondaryTileset);
this->metatileLayersItem = new MetatileLayersItem(metatile, this->primaryTileset, this->secondaryTileset); this->metatileLayersItem = new MetatileLayersItem(metatile, this->primaryTileset, this->secondaryTileset);
connect(this->metatileLayersItem, SIGNAL(tileChanged(int, int)), connect(this->metatileLayersItem, &MetatileLayersItem::tileChanged,
this, SLOT(onMetatileLayerTileChanged(int, int))); this, &TilesetEditor::onMetatileLayerTileChanged);
connect(this->metatileLayersItem, SIGNAL(selectedTilesChanged(QPoint, int, int)), connect(this->metatileLayersItem, &MetatileLayersItem::selectedTilesChanged,
this, SLOT(onMetatileLayerSelectionChanged(QPoint, int, int))); this, &TilesetEditor::onMetatileLayerSelectionChanged);
this->metatileLayersScene = new QGraphicsScene; this->metatileLayersScene = new QGraphicsScene;
this->metatileLayersScene->addItem(this->metatileLayersItem); this->metatileLayersScene->addItem(this->metatileLayersItem);
@ -187,13 +187,14 @@ void TilesetEditor::initMetatileLayersItem() {
void TilesetEditor::initTileSelector() void TilesetEditor::initTileSelector()
{ {
this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset, projectConfig.getTripleLayerMetatilesEnabled()); this->tileSelector = new TilesetEditorTileSelector(this->primaryTileset, this->secondaryTileset,
connect(this->tileSelector, SIGNAL(hoveredTileChanged(uint16_t)), projectConfig.getTripleLayerMetatilesEnabled());
this, SLOT(onHoveredTileChanged(uint16_t))); connect(this->tileSelector, &TilesetEditorTileSelector::hoveredTileChanged,
connect(this->tileSelector, SIGNAL(hoveredTileCleared()), this, &TilesetEditor::onHoveredTileChanged);
this, SLOT(onHoveredTileCleared())); connect(this->tileSelector, &TilesetEditorTileSelector::hoveredTileCleared,
connect(this->tileSelector, SIGNAL(selectedTilesChanged()), this, &TilesetEditor::onHoveredTileCleared);
this, SLOT(onSelectedTilesChanged())); connect(this->tileSelector, &TilesetEditorTileSelector::selectedTilesChanged,
this, &TilesetEditor::onSelectedTilesChanged);
this->tilesScene = new QGraphicsScene; this->tilesScene = new QGraphicsScene;
this->tilesScene->addItem(this->tileSelector); this->tilesScene->addItem(this->tileSelector);
@ -715,8 +716,8 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
form.addRow(new QLabel("Secondary Tileset"), secondarySpinBox); form.addRow(new QLabel("Secondary Tileset"), secondarySpinBox);
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
connect(&buttonBox, SIGNAL(accepted()), &dialog, SLOT(accept())); connect(&buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept);
connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); connect(&buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject);
form.addRow(&buttonBox); form.addRow(&buttonBox);
if (dialog.exec() == QDialog::Accepted) { if (dialog.exec() == QDialog::Accepted) {
@ -773,9 +774,12 @@ void TilesetEditor::on_actionChange_Metatiles_Count_triggered()
void TilesetEditor::on_actionChange_Palettes_triggered() void TilesetEditor::on_actionChange_Palettes_triggered()
{ {
if (!this->paletteEditor) { if (!this->paletteEditor) {
this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset, this->secondaryTileset, this->paletteId, this); this->paletteEditor = new PaletteEditor(this->project, this->primaryTileset,
connect(this->paletteEditor, SIGNAL(changedPaletteColor()), this, SLOT(onPaletteEditorChangedPaletteColor())); this->secondaryTileset, this->paletteId, this);
connect(this->paletteEditor, SIGNAL(changedPalette(int)), this, SLOT(onPaletteEditorChangedPalette(int))); connect(this->paletteEditor, &PaletteEditor::changedPaletteColor,
this, &TilesetEditor::onPaletteEditorChangedPaletteColor);
connect(this->paletteEditor, &PaletteEditor::changedPalette,
this, &TilesetEditor::onPaletteEditorChangedPalette);
} }
if (!this->paletteEditor->isVisible()) { if (!this->paletteEditor->isVisible()) {