desktop: make dive site list an independent widget

This used to be one of the tab-widgets, which was illogical
and caused confusion. Notably, erroneously clicking on the
tab header led to a reset of the dive selection.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2022-09-18 13:49:29 +02:00
parent b5889f0f3c
commit 17033d0d83
10 changed files with 94 additions and 65 deletions

View file

@ -39,8 +39,9 @@
#include "desktop-widgets/divelistview.h"
#include "desktop-widgets/divelogexportdialog.h"
#include "desktop-widgets/divelogimportdialog.h"
#include "desktop-widgets/divesiteimportdialog.h"
#include "desktop-widgets/diveplanner.h"
#include "desktop-widgets/divesiteimportdialog.h"
#include "desktop-widgets/divesitelistview.h"
#include "desktop-widgets/downloadfromdivecomputer.h"
#include "desktop-widgets/findmovedimagesdialog.h"
#include "desktop-widgets/locationinformation.h"
@ -139,6 +140,7 @@ MainWindow::MainWindow() :
#endif
plannerWidgets.reset(new PlannerWidgets);
statistics.reset(new StatsWidget);
diveSites.reset(new DiveSiteListView);
profile.reset(new ProfileWidget);
diveSiteEdit.reset(new LocationInformationWidget);
@ -155,6 +157,8 @@ MainWindow::MainWindow() :
{ diveList.get(), FLAG_NONE }, { &filterWidget, FLAG_NONE } });
registerApplicationState(ApplicationState::Statistics, { true, { statistics.get(), FLAG_NONE }, { nullptr, FLAG_NONE },
{ diveList.get(), FLAG_DISABLED }, { &filterWidget, FLAG_NONE } });
registerApplicationState(ApplicationState::DiveSites, { false, { diveSites.get(), FLAG_NONE }, { profile.get(), FLAG_NONE },
{ diveList.get(), FLAG_NONE }, { mapWidget.get(), FLAG_NONE } });
registerApplicationState(ApplicationState::MapMaximized, { true, { nullptr, FLAG_NONE }, { nullptr, FLAG_NONE },
{ nullptr, FLAG_NONE }, { mapWidget.get(), FLAG_NONE } });
registerApplicationState(ApplicationState::ProfileMaximized, { true, { nullptr, FLAG_NONE }, { profile.get(), FLAG_NONE },
@ -757,6 +761,13 @@ void MainWindow::on_actionViewMap_triggered()
setApplicationState(ApplicationState::MapMaximized);
}
void MainWindow::on_actionViewDiveSites_triggered()
{
if (!userMayChangeAppState())
return;
setApplicationState(ApplicationState::DiveSites);
}
void MainWindow::on_actionViewAll_triggered()
{
if (!userMayChangeAppState())
@ -1508,6 +1519,7 @@ void MainWindow::setApplicationState(ApplicationState state)
ui.actionViewProfile->setEnabled(allowChange);
ui.actionViewInfo->setEnabled(allowChange);
ui.actionViewMap->setEnabled(allowChange);
ui.actionViewDiveSites->setEnabled(allowChange);
ui.actionFilterTags->setEnabled(allowChange);
}