Change screens if both left and right are pressed
This commit is contained in:
		@ -27,7 +27,8 @@ public:
 | 
			
		||||
 | 
			
		||||
  virtual ~DebugViewPresenter(){};
 | 
			
		||||
 | 
			
		||||
  virtual void vehicleStateUpdated() override;
 | 
			
		||||
  void vehicleStateUpdated() override;
 | 
			
		||||
  void nextScreen() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  DebugViewPresenter();
 | 
			
		||||
 | 
			
		||||
@ -30,6 +30,7 @@ public:
 | 
			
		||||
  virtual ~DriverViewPresenter(){};
 | 
			
		||||
 | 
			
		||||
  void vehicleStateUpdated() override;
 | 
			
		||||
  void nextScreen() override;
 | 
			
		||||
 | 
			
		||||
  void setFieldType(size_t i, DataFieldType type);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,6 +14,7 @@ public:
 | 
			
		||||
  void bind(Model *m) { model = m; }
 | 
			
		||||
 | 
			
		||||
  virtual void vehicleStateUpdated(){};
 | 
			
		||||
  virtual void nextScreen(){};
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  Model *model;
 | 
			
		||||
 | 
			
		||||
@ -8,29 +8,32 @@ using namespace touchgfx;
 | 
			
		||||
 | 
			
		||||
class VehicleConfigView;
 | 
			
		||||
 | 
			
		||||
class VehicleConfigPresenter : public touchgfx::Presenter, public ModelListener
 | 
			
		||||
{
 | 
			
		||||
class VehicleConfigPresenter : public touchgfx::Presenter,
 | 
			
		||||
                               public ModelListener {
 | 
			
		||||
public:
 | 
			
		||||
    VehicleConfigPresenter(VehicleConfigView& v);
 | 
			
		||||
  VehicleConfigPresenter(VehicleConfigView &v);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The activate function is called automatically when this screen is "switched in"
 | 
			
		||||
     * (ie. made active). Initialization logic can be placed here.
 | 
			
		||||
     */
 | 
			
		||||
    virtual void activate();
 | 
			
		||||
  /**
 | 
			
		||||
   * The activate function is called automatically when this screen is "switched
 | 
			
		||||
   * in" (ie. made active). Initialization logic can be placed here.
 | 
			
		||||
   */
 | 
			
		||||
  virtual void activate();
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The deactivate function is called automatically when this screen is "switched out"
 | 
			
		||||
     * (ie. made inactive). Teardown functionality can be placed here.
 | 
			
		||||
     */
 | 
			
		||||
    virtual void deactivate();
 | 
			
		||||
  /**
 | 
			
		||||
   * The deactivate function is called automatically when this screen is
 | 
			
		||||
   * "switched out" (ie. made inactive). Teardown functionality can be placed
 | 
			
		||||
   * here.
 | 
			
		||||
   */
 | 
			
		||||
  virtual void deactivate();
 | 
			
		||||
 | 
			
		||||
    virtual ~VehicleConfigPresenter() {};
 | 
			
		||||
  virtual ~VehicleConfigPresenter(){};
 | 
			
		||||
 | 
			
		||||
  void nextScreen() override;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    VehicleConfigPresenter();
 | 
			
		||||
  VehicleConfigPresenter();
 | 
			
		||||
 | 
			
		||||
    VehicleConfigView& view;
 | 
			
		||||
  VehicleConfigView &view;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // VEHICLECONFIGPRESENTER_HPP
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,6 @@
 | 
			
		||||
#include <gui/debugview_screen/DebugViewPresenter.hpp>
 | 
			
		||||
#include <gui/debugview_screen/DebugViewView.hpp>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DebugViewPresenter::DebugViewPresenter(DebugViewView &v) : view(v) {}
 | 
			
		||||
 | 
			
		||||
void DebugViewPresenter::activate() {}
 | 
			
		||||
@ -9,3 +8,8 @@ void DebugViewPresenter::activate() {}
 | 
			
		||||
void DebugViewPresenter::deactivate() {}
 | 
			
		||||
 | 
			
		||||
void DebugViewPresenter::vehicleStateUpdated() { view.updateFieldValues(); }
 | 
			
		||||
 | 
			
		||||
void DebugViewPresenter::nextScreen() {
 | 
			
		||||
  static_cast<FrontendApplication *>(Application::getInstance())
 | 
			
		||||
      ->gotoDriverViewScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,11 @@ void DriverViewPresenter::vehicleStateUpdated() {
 | 
			
		||||
  view.updateFieldValues();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DriverViewPresenter::nextScreen() {
 | 
			
		||||
  static_cast<FrontendApplication *>(Application::getInstance())
 | 
			
		||||
      ->gotoVehicleConfigScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DriverViewPresenter::setFieldType(size_t i, DataFieldType type) {
 | 
			
		||||
  fields[i] = type;
 | 
			
		||||
  view.setFieldType(i, type);
 | 
			
		||||
 | 
			
		||||
@ -13,10 +13,14 @@ Model::Model() : modelListener(0) {}
 | 
			
		||||
 | 
			
		||||
void Model::tick() {
 | 
			
		||||
  ULONG events;
 | 
			
		||||
  if (tx_event_flags_get(&gui_update_events, GUI_UPDATE_VEHICLE_STATE,
 | 
			
		||||
  if (tx_event_flags_get(&gui_update_events,
 | 
			
		||||
                         GUI_UPDATE_VEHICLE_STATE | GUI_UPDATE_NEXT_SCREEN,
 | 
			
		||||
                         TX_OR_CLEAR, &events, TX_NO_WAIT) != TX_SUCCESS) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  if (events & GUI_UPDATE_NEXT_SCREEN) {
 | 
			
		||||
    modelListener->nextScreen();
 | 
			
		||||
  }
 | 
			
		||||
  if (events & GUI_UPDATE_VEHICLE_STATE) {
 | 
			
		||||
    modelListener->vehicleStateUpdated();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -1,18 +1,14 @@
 | 
			
		||||
#include <gui/vehicleconfig_screen/VehicleConfigView.hpp>
 | 
			
		||||
#include <gui/vehicleconfig_screen/VehicleConfigPresenter.hpp>
 | 
			
		||||
#include <gui/vehicleconfig_screen/VehicleConfigView.hpp>
 | 
			
		||||
 | 
			
		||||
VehicleConfigPresenter::VehicleConfigPresenter(VehicleConfigView& v)
 | 
			
		||||
    : view(v)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::activate()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::deactivate()
 | 
			
		||||
{
 | 
			
		||||
VehicleConfigPresenter::VehicleConfigPresenter(VehicleConfigView &v)
 | 
			
		||||
    : view(v) {}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::activate() {}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::deactivate() {}
 | 
			
		||||
 | 
			
		||||
void VehicleConfigPresenter::nextScreen() {
 | 
			
		||||
  static_cast<FrontendApplication *>(Application::getInstance())
 | 
			
		||||
      ->gotoDebugViewScreenNoTransition();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user