Skip to content

Commit

Permalink
Pass selected game
Browse files Browse the repository at this point in the history
Closes #61
  • Loading branch information
Admiral-Fish committed Mar 26, 2020
1 parent 63b71a2 commit 66da6ad
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Forms/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void MainWindow::openDenMap()

void MainWindow::openEncounterLookup()
{
auto *lookup = new EncounterLookup();
auto *lookup = new EncounterLookup(currentProfile.getVersion());
lookup->show();
}

Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Forms/Tools/EncounterLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
#include "EncounterLookup.hpp"
#include "ui_EncounterLookup.h"
#include <Core/Loader/DenLoader.hpp>
#include <Core/Util/Game.hpp>
#include <Core/Util/Translator.hpp>
#include <QCompleter>

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()
Expand Down
9 changes: 5 additions & 4 deletions Forms/Tools/EncounterLookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#ifndef ENCOUNTERLOOKUP_HPP
#define ENCOUNTERLOOKUP_HPP

#include <Core/Util/Global.hpp>
#include <Core/Results/Raid.hpp>
#include <Core/Util/Game.hpp>
#include <Core/Util/Global.hpp>
#include <QStandardItemModel>
#include <QVector>
#include <QWidget>
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Forms/Tools/IVCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace Ui
class IVCalculator;
}

class IVCalculator final : public QWidget
class IVCalculator : public QWidget
{
Q_OBJECT
signals:
void sendIVs(int, int, int, QVector<u8>);

public:
explicit IVCalculator(QWidget *parent = nullptr);
~IVCalculator() override final;
~IVCalculator() override;

void setConnected(bool connected);

Expand Down
8 changes: 4 additions & 4 deletions Forms/Tools/SeedCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <Core/Searcher/SeedSearcher1.hpp>
#include <Core/Searcher/SeedSearcher2.hpp>
#include <Core/Searcher/SeedSearcher3.hpp>
#include <Core/Util/Game.hpp>
#include <Core/Util/Translator.hpp>
#include <QApplication>
#include <QFile>
Expand All @@ -35,12 +34,13 @@
#include <QtConcurrent>
#include <ctime>

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()
Expand Down Expand Up @@ -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<int>::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::denIndexChanged);
connect(ui->comboBoxRarity, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::rarityIndexChanged);
connect(ui->comboBoxGame, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &SeedCalculator::gameIndexChanged);
Expand Down
7 changes: 4 additions & 3 deletions Forms/Tools/SeedCalculator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#ifndef SEEDCALCULATOR_HPP
#define SEEDCALCULATOR_HPP

#include <Core/Util/Game.hpp>
#include <Core/Util/Global.hpp>
#include <QWidget>

Expand All @@ -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<u8> &ivs);
Expand Down

0 comments on commit 66da6ad

Please sign in to comment.