subsurface/desktop-widgets/diveplanner.h
Stefan Fuchs cf409b59ba Planner settings ascend and descende rate: Wire up UI elements correctly
Wire up the UI elements (QSpinBoxes) for ascend rates (4x) and descend rate
(1x) correctly so that the profile and calculation is updated immediately
after the value is changed (e.g. increased/decresed by 1) by clicking
the QSpinBox arrows.
Until now one had to click into the profile or change another planner
preference first before the change became effective.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-10-04 08:41:10 +02:00

110 lines
2.6 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef DIVEPLANNER_H
#define DIVEPLANNER_H
#include <QGraphicsPathItem>
#include <QAbstractTableModel>
#include <QAbstractButton>
#include <QDateTime>
#include <QSignalMapper>
#include "core/dive.h"
class QListView;
class QModelIndex;
class DivePlannerPointsModel;
class DiveHandler : public QObject, public QGraphicsEllipseItem {
Q_OBJECT
public:
DiveHandler();
protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
signals:
void moved();
void clicked();
void released();
private:
int parentIndex();
public
slots:
void selfRemove();
void changeGas();
private:
QTime t;
};
#include "ui_diveplanner.h"
class DivePlannerWidget : public QWidget {
Q_OBJECT
public:
explicit DivePlannerWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
void setReplanButton(bool replan);
public
slots:
void setupStartTime(QDateTime startTime);
void settingsChanged();
void atmPressureChanged(const int pressure);
void heightChanged(const int height);
void salinityChanged(const double salinity);
void printDecoPlan();
void setSurfacePressure(int surface_pressure);
void setSalinity(int salinity);
private:
Ui::DivePlanner ui;
QAbstractButton *replanButton;
};
#include "ui_plannerSettings.h"
class PlannerSettingsWidget : public QWidget {
Q_OBJECT
public:
explicit PlannerSettingsWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
virtual ~PlannerSettingsWidget();
public
slots:
void settingsChanged();
void bottomSacChanged(const double bottomSac);
void decoSacChanged(const double decosac);
void printDecoPlan();
void setAscrate75(int rate);
void setAscrate50(int rate);
void setAscratestops(int rate);
void setAscratelast6m(int rate);
void setDescrate(int rate);
void sacFactorChanged(const double factor);
void problemSolvingTimeChanged(const int min);
void setBottomPo2(double po2);
void setDecoPo2(double po2);
void setBestmixEND(int depth);
void setBackgasBreaks(bool dobreaks);
void disableDecoElements(int mode);
void setDiveMode(int mode);
private:
Ui::plannerSettingsWidget ui;
void updateUnitsUI();
QSignalMapper *modeMapper;
};
#include "ui_plannerDetails.h"
class PlannerDetails : public QWidget {
Q_OBJECT
public:
explicit PlannerDetails(QWidget *parent = 0);
QPushButton *printPlan() const { return ui.printPlan; }
QTextEdit *divePlanOutput() const { return ui.divePlanOutput; }
private:
Ui::plannerDetails ui;
};
#endif // DIVEPLANNER_H