Allow changing mission after initial selection
This commit is contained in:
parent
d5b65828aa
commit
a6c55d9869
|
@ -28,6 +28,7 @@ public:
|
||||||
virtual ~AMIPresenter(){};
|
virtual ~AMIPresenter(){};
|
||||||
|
|
||||||
void vehicleStateUpdated() override;
|
void vehicleStateUpdated() override;
|
||||||
|
void nextScreen() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AMIPresenter();
|
AMIPresenter();
|
||||||
|
|
|
@ -17,7 +17,11 @@ public:
|
||||||
model.tick();
|
model.tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBackToMissionSelect(bool backToMissionSelect);
|
||||||
|
bool getBackToMissionSelect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool backToMissionSelect;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRONTENDAPPLICATION_HPP
|
#endif // FRONTENDAPPLICATION_HPP
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef MISSIONSELECTPRESENTER_HPP
|
#ifndef MISSIONSELECTPRESENTER_HPP
|
||||||
#define MISSIONSELECTPRESENTER_HPP
|
#define MISSIONSELECTPRESENTER_HPP
|
||||||
|
|
||||||
|
#include "stw_defines.h"
|
||||||
#include <gui/model/ModelListener.hpp>
|
#include <gui/model/ModelListener.hpp>
|
||||||
#include <mvp/Presenter.hpp>
|
#include <mvp/Presenter.hpp>
|
||||||
|
|
||||||
|
@ -30,10 +31,14 @@ public:
|
||||||
|
|
||||||
void vehicleStateUpdated() override;
|
void vehicleStateUpdated() override;
|
||||||
|
|
||||||
|
void nextScreen() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MissionSelectPresenter();
|
MissionSelectPresenter();
|
||||||
|
|
||||||
MissionSelectView &view;
|
MissionSelectView &view;
|
||||||
|
|
||||||
|
Mission initialMission;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MISSIONSELECTPRESENTER_HPP
|
#endif // MISSIONSELECTPRESENTER_HPP
|
||||||
|
|
|
@ -33,3 +33,9 @@ void AMIPresenter::vehicleStateUpdated() {
|
||||||
}
|
}
|
||||||
view.setConePositions(vehicle_state.cone_pos, cone_count);
|
view.setConePositions(vehicle_state.cone_pos, cone_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AMIPresenter::nextScreen() {
|
||||||
|
FrontendApplication *app =
|
||||||
|
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||||
|
app->gotoDebugViewScreenNoTransition();
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,14 @@
|
||||||
#include "gui/common/NamedField.hpp"
|
#include "gui/common/NamedField.hpp"
|
||||||
|
|
||||||
FrontendApplication::FrontendApplication(Model &m, FrontendHeap &heap)
|
FrontendApplication::FrontendApplication(Model &m, FrontendHeap &heap)
|
||||||
: FrontendApplicationBase(m, heap) {
|
: FrontendApplicationBase(m, heap), backToMissionSelect(false) {
|
||||||
namedFieldSort();
|
namedFieldSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FrontendApplication::setBackToMissionSelect(bool backToMissionSelect) {
|
||||||
|
this->backToMissionSelect = backToMissionSelect;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FrontendApplication::getBackToMissionSelect() const {
|
||||||
|
return backToMissionSelect;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "gui/common/FrontendApplication.hpp"
|
||||||
#include <gui/debugview_screen/DebugViewPresenter.hpp>
|
#include <gui/debugview_screen/DebugViewPresenter.hpp>
|
||||||
#include <gui/debugview_screen/DebugViewView.hpp>
|
#include <gui/debugview_screen/DebugViewView.hpp>
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ void DebugViewPresenter::deactivate() {}
|
||||||
void DebugViewPresenter::vehicleStateUpdated() { view.updateFieldValues(); }
|
void DebugViewPresenter::vehicleStateUpdated() { view.updateFieldValues(); }
|
||||||
|
|
||||||
void DebugViewPresenter::nextScreen() {
|
void DebugViewPresenter::nextScreen() {
|
||||||
static_cast<FrontendApplication *>(Application::getInstance())
|
FrontendApplication *app =
|
||||||
->gotoDriverViewScreenNoTransition();
|
static_cast<FrontendApplication *>(Application::getInstance());
|
||||||
|
app->setBackToMissionSelect(true);
|
||||||
|
app->gotoMissionSelectScreenNoTransition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,19 @@
|
||||||
MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v)
|
MissionSelectPresenter::MissionSelectPresenter(MissionSelectView &v)
|
||||||
: view(v) {}
|
: view(v) {}
|
||||||
|
|
||||||
void MissionSelectPresenter::activate() {}
|
void MissionSelectPresenter::activate() {
|
||||||
|
initialMission = vehicle_state.active_mission;
|
||||||
|
}
|
||||||
|
|
||||||
void MissionSelectPresenter::deactivate() {}
|
void MissionSelectPresenter::deactivate() {}
|
||||||
|
|
||||||
void MissionSelectPresenter::vehicleStateUpdated() {
|
void MissionSelectPresenter::vehicleStateUpdated() {
|
||||||
FrontendApplication *app =
|
FrontendApplication *app =
|
||||||
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||||
|
if (app->getBackToMissionSelect() &&
|
||||||
|
vehicle_state.active_mission == initialMission) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (vehicle_state.active_mission) {
|
switch (vehicle_state.active_mission) {
|
||||||
case MISSION_NONE:
|
case MISSION_NONE:
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@ -27,3 +33,12 @@ void MissionSelectPresenter::vehicleStateUpdated() {
|
||||||
app->gotoAMIScreenNoTransition();
|
app->gotoAMIScreenNoTransition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MissionSelectPresenter::nextScreen() {
|
||||||
|
FrontendApplication *app =
|
||||||
|
static_cast<FrontendApplication *>(FrontendApplication::getInstance());
|
||||||
|
if (app->getBackToMissionSelect()) {
|
||||||
|
app->gotoAMIScreenNoTransition();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue