diff --git a/Forms/MainWindow.cpp b/Forms/MainWindow.cpp index 89a8d5e..787a46e 100644 --- a/Forms/MainWindow.cpp +++ b/Forms/MainWindow.cpp @@ -342,7 +342,7 @@ void MainWindow::openDenMap() void MainWindow::openEncounterLookup() { - auto *lookup = new EncounterLookup(); + auto *lookup = new EncounterLookup(currentProfile.getVersion()); lookup->show(); } @@ -364,7 +364,7 @@ void MainWindow::openSeedCalculator() { if (!seedCalculator) { - seedCalculator = new SeedCalculator(); + seedCalculator = new SeedCalculator(currentProfile.getVersion()); if (ivCalculator) { connect(ivCalculator, &IVCalculator::sendIVs, seedCalculator, &SeedCalculator::setIVs); diff --git a/Forms/Tools/EncounterLookup.cpp b/Forms/Tools/EncounterLookup.cpp index c719711..38bac54 100644 --- a/Forms/Tools/EncounterLookup.cpp +++ b/Forms/Tools/EncounterLookup.cpp @@ -20,17 +20,17 @@ #include "EncounterLookup.hpp" #include "ui_EncounterLookup.h" #include -#include #include #include -EncounterLookup::EncounterLookup(QWidget *parent) : QWidget(parent), ui(new Ui::EncounterLookup) +EncounterLookup::EncounterLookup(Game version, QWidget *parent) : QWidget(parent), ui(new Ui::EncounterLookup) { ui->setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_DeleteOnClose); setupModels(); + ui->comboBoxGame->setCurrentIndex(ui->comboBoxGame->findData(version)); } EncounterLookup::~EncounterLookup() diff --git a/Forms/Tools/EncounterLookup.hpp b/Forms/Tools/EncounterLookup.hpp index 7d2013f..5db2f09 100644 --- a/Forms/Tools/EncounterLookup.hpp +++ b/Forms/Tools/EncounterLookup.hpp @@ -20,8 +20,9 @@ #ifndef ENCOUNTERLOOKUP_HPP #define ENCOUNTERLOOKUP_HPP -#include #include +#include +#include #include #include #include @@ -31,12 +32,12 @@ namespace Ui class EncounterLookup; } -class EncounterLookup final : public QWidget +class EncounterLookup : public QWidget { Q_OBJECT public: - explicit EncounterLookup(QWidget *parent = nullptr); - ~EncounterLookup() override final; + explicit EncounterLookup(Game version, QWidget *parent = nullptr); + ~EncounterLookup() override; private: Ui::EncounterLookup *ui; diff --git a/Forms/Tools/IVCalculator.hpp b/Forms/Tools/IVCalculator.hpp index ac7f0d0..579af00 100644 --- a/Forms/Tools/IVCalculator.hpp +++ b/Forms/Tools/IVCalculator.hpp @@ -28,7 +28,7 @@ namespace Ui class IVCalculator; } -class IVCalculator final : public QWidget +class IVCalculator : public QWidget { Q_OBJECT signals: @@ -36,7 +36,7 @@ class IVCalculator final : public QWidget public: explicit IVCalculator(QWidget *parent = nullptr); - ~IVCalculator() override final; + ~IVCalculator() override; void setConnected(bool connected); diff --git a/Forms/Tools/SeedCalculator.cpp b/Forms/Tools/SeedCalculator.cpp index 1827f19..b0e927f 100644 --- a/Forms/Tools/SeedCalculator.cpp +++ b/Forms/Tools/SeedCalculator.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -35,12 +34,13 @@ #include #include -SeedCalculator::SeedCalculator(QWidget *parent) : QWidget(parent), ui(new Ui::SeedCalculator) +SeedCalculator::SeedCalculator(Game version, QWidget *parent) : QWidget(parent), ui(new Ui::SeedCalculator) { ui->setupUi(this); setAttribute(Qt::WA_QuitOnClose, false); setupModels(); + ui->comboBoxGame->setCurrentIndex(ui->comboBoxGame->findData(version)); } SeedCalculator::~SeedCalculator() @@ -77,11 +77,11 @@ void SeedCalculator::setupModels() ui->comboBoxDen->addItem(QString("%1: %2").arg(i + 1).arg(location), i); } - denIndexChanged(0); - ui->comboBoxGame->setItemData(0, Game::Sword); ui->comboBoxGame->setItemData(1, Game::Shield); + denIndexChanged(0); + connect(ui->comboBoxDen, QOverload::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::denIndexChanged); connect(ui->comboBoxRarity, QOverload::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::rarityIndexChanged); connect(ui->comboBoxGame, QOverload::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::gameIndexChanged); diff --git a/Forms/Tools/SeedCalculator.hpp b/Forms/Tools/SeedCalculator.hpp index 717f1f4..17d28ae 100644 --- a/Forms/Tools/SeedCalculator.hpp +++ b/Forms/Tools/SeedCalculator.hpp @@ -20,6 +20,7 @@ #ifndef SEEDCALCULATOR_HPP #define SEEDCALCULATOR_HPP +#include #include #include @@ -28,12 +29,12 @@ namespace Ui class SeedCalculator; } -class SeedCalculator final : public QWidget +class SeedCalculator : public QWidget { Q_OBJECT public: - explicit SeedCalculator(QWidget *parent = nullptr); - ~SeedCalculator() override final; + explicit SeedCalculator(Game version, QWidget *parent = nullptr); + ~SeedCalculator() override; public slots: void setIVs(int star, int index, int nature, const QVector &ivs);