profile: implement "empty state" in desktop's ProfileWidget

The profile has an "empty state" showing the subsurface logo,
which is active when no dive is selected.

Switching to/from this mode is quite complex, because all the
chart features have to be hidden/shown, etc. Moreover, this mode
is not needed on mobile, where multiple ProfileWidgets can
be active at the same time and every dive has at least a
"faked" profile.

Therefore, implement this mode directly in the desktop
version of the widget. This makes the rescaling distinctly
less cumbersome. It is implemented using a QStackedWidget,
which switches between the profile and the logo.

This commit does not remove the empty state from the profile.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-06-30 07:17:40 +02:00 committed by Dirk Hohndel
parent 9f6e487790
commit 787a23f017
2 changed files with 78 additions and 4 deletions

View file

@ -10,6 +10,8 @@
#include <memory>
class ProfileWidget2;
class EmptyView;
class QStackedWidget;
class ProfileWidget : public QWidget {
Q_OBJECT
@ -26,8 +28,10 @@ slots:
void unsetProfHR();
void unsetProfTissues();
private:
std::unique_ptr<EmptyView> emptyView;
std::vector<QAction *> toolbarActions;
Ui::ProfileWidget ui;
QStackedWidget *stack;
void setDive(const struct dive *d);
};