2021-04-12 21:34:28 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
// The profile and its toolbars.
|
|
|
|
|
|
|
|
#ifndef PROFILEWIDGET_H
|
|
|
|
#define PROFILEWIDGET_H
|
|
|
|
|
|
|
|
#include "ui_profilewidget.h"
|
2022-11-06 11:18:27 +00:00
|
|
|
#include "core/owning_ptrs.h"
|
2022-03-02 19:50:50 +00:00
|
|
|
#include "core/subsurface-qt/divelistnotifier.h"
|
2021-04-12 21:34:28 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2022-02-19 10:58:36 +00:00
|
|
|
struct dive;
|
2021-04-12 21:34:28 +00:00
|
|
|
class ProfileWidget2;
|
2021-06-30 05:17:40 +00:00
|
|
|
class EmptyView;
|
|
|
|
class QStackedWidget;
|
2021-04-12 21:34:28 +00:00
|
|
|
|
2022-02-19 10:58:36 +00:00
|
|
|
extern "C" void free_dive(struct dive *);
|
|
|
|
|
2021-04-12 21:34:28 +00:00
|
|
|
class ProfileWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
ProfileWidget();
|
|
|
|
~ProfileWidget();
|
|
|
|
std::unique_ptr<ProfileWidget2> view;
|
2022-09-17 17:07:35 +00:00
|
|
|
void plotDive(struct dive *d, int dc); // Attempt to keep DC number id dc < 0
|
2021-04-12 21:34:28 +00:00
|
|
|
void plotCurrentDive();
|
|
|
|
void setPlanState(const struct dive *d, int dc);
|
|
|
|
void setEnabledToolbar(bool enabled);
|
2022-09-17 17:07:35 +00:00
|
|
|
void nextDC();
|
|
|
|
void prevDC();
|
|
|
|
dive *d;
|
|
|
|
int dc;
|
2021-04-12 21:34:28 +00:00
|
|
|
private
|
|
|
|
slots:
|
2022-03-02 19:50:50 +00:00
|
|
|
void divesChanged(const QVector<dive *> &dives, DiveField field);
|
2021-04-12 21:34:28 +00:00
|
|
|
void unsetProfHR();
|
|
|
|
void unsetProfTissues();
|
2022-02-19 10:58:36 +00:00
|
|
|
void stopAdded();
|
|
|
|
void stopRemoved(int count);
|
|
|
|
void stopMoved(int count);
|
2021-04-12 21:34:28 +00:00
|
|
|
private:
|
2021-06-30 05:17:40 +00:00
|
|
|
std::unique_ptr<EmptyView> emptyView;
|
2021-04-12 21:34:28 +00:00
|
|
|
std::vector<QAction *> toolbarActions;
|
|
|
|
Ui::ProfileWidget ui;
|
2021-06-30 05:17:40 +00:00
|
|
|
QStackedWidget *stack;
|
2021-04-12 21:34:28 +00:00
|
|
|
void setDive(const struct dive *d);
|
2022-02-19 10:58:36 +00:00
|
|
|
void editDive();
|
|
|
|
void exitEditMode();
|
2022-09-17 17:07:35 +00:00
|
|
|
void rotateDC(int dir);
|
2022-11-06 11:18:27 +00:00
|
|
|
OwningDivePtr editedDive;
|
2022-09-17 17:07:35 +00:00
|
|
|
int editedDc;
|
2022-02-19 10:58:36 +00:00
|
|
|
dive *originalDive;
|
2022-03-02 19:50:50 +00:00
|
|
|
bool placingCommand;
|
2021-04-12 21:34:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROFILEWIDGET_H
|