diff --git a/include/core/wildmoninfo.h b/include/core/wildmoninfo.h index 758188e4..8845bef2 100644 --- a/include/core/wildmoninfo.h +++ b/include/core/wildmoninfo.h @@ -23,6 +23,6 @@ typedef QVector>> Fields; typedef QPair> Field; WildMonInfo getDefaultMonInfo(Field field); -WildMonInfo copyMonInfoFromTab(QTableWidget *table, Field field); +WildMonInfo copyMonInfoFromTab(QTableWidget *table); #endif // GUARD_WILDMONINFO_H diff --git a/src/core/wildmoninfo.cpp b/src/core/wildmoninfo.cpp index f1b97e0b..b0142a5d 100644 --- a/src/core/wildmoninfo.cpp +++ b/src/core/wildmoninfo.cpp @@ -15,7 +15,7 @@ WildMonInfo getDefaultMonInfo(Field field) { return newInfo; } -WildMonInfo copyMonInfoFromTab(QTableWidget *monTable, Field field) { +WildMonInfo copyMonInfoFromTab(QTableWidget *monTable) { WildMonInfo newInfo; QVector newWildMons; @@ -28,7 +28,7 @@ WildMonInfo copyMonInfoFromTab(QTableWidget *monTable, Field field) { } newInfo.active = true; newInfo.wildPokemon = newWildMons; - newInfo.encounterRate = monTable->findChild()->value(); + newInfo.encounterRate = monTable->findChild()->value(); return newInfo; } diff --git a/src/editor.cpp b/src/editor.cpp index 74be8df3..9deeb49b 100644 --- a/src/editor.cpp +++ b/src/editor.cpp @@ -301,7 +301,7 @@ void Editor::addNewWildMonGroup() { if (copyCheckbox->isChecked()) { MonTabWidget *copyFrom = static_cast(stack->widget(stackIndex)); if (copyFrom->isTabEnabled(tabIndex)) - header.wildMons.insert(fieldName, copyMonInfoFromTab(copyFrom->tableAt(tabIndex), monField)); + header.wildMons.insert(fieldName, copyMonInfoFromTab(copyFrom->tableAt(tabIndex))); else header.wildMons.insert(fieldName, getDefaultMonInfo(monField)); } else { @@ -341,7 +341,7 @@ void Editor::configureEncounterJSON() { chanceSpinner->setValue(chance); chanceSpinner->setMinimum(0); chanceSpinner->setMaximum(9999); - connect(chanceSpinner, QOverload::of(&QSpinBox::valueChanged), [&chanceSpinner, &updateTotal, ¤tField](int val) { + connect(chanceSpinner, QOverload::of(&QSpinBox::valueChanged), [&chanceSpinner, &updateTotal, ¤tField](int) { updateTotal(currentField); }); @@ -492,7 +492,7 @@ void Editor::saveEncounterTabData() { QTableWidget *monTable = static_cast(tabWidget->widget(fieldIndex - 1)); QVector newWildMons; - encounterHeader.wildMons[fieldName] = copyMonInfoFromTab(monTable, monField); + encounterHeader.wildMons[fieldName] = copyMonInfoFromTab(monTable); } } } diff --git a/src/ui/montabwidget.cpp b/src/ui/montabwidget.cpp index 2cdc2eff..ad058493 100644 --- a/src/ui/montabwidget.cpp +++ b/src/ui/montabwidget.cpp @@ -78,23 +78,12 @@ void MonTabWidget::populateTab(int tabIndex, WildMonInfo monInfo, QString fieldN QFrame *encounterFrame = new QFrame; QHBoxLayout *encounterLayout = new QHBoxLayout; - QSlider *encounterRate = new QSlider(Qt::Horizontal); + QSpinBox *encounterRate = new QSpinBox; encounterRate->setMinimum(0); - encounterRate->setMaximum(100); - - QLabel *encounterLabel = new QLabel; - connect(encounterRate, &QSlider::valueChanged, [=](int value){ - encounterLabel->setText(QString("%1%").arg(QString::number(value))); - }); + encounterRate->setMaximum(180); encounterRate->setValue(monInfo.encounterRate); - // for some reason the signal is not being emitted above - encounterLabel->setText(QString("%1%").arg(QString::number(monInfo.encounterRate))); - - encounterLayout->addWidget(encounterLabel); encounterLayout->addWidget(encounterRate); - encounterFrame->setLayout(encounterLayout); - speciesTable->setCellWidget(0, 5, encounterFrame); int i = 0;