From 78e2560296bbcc9209dec947417feb8da5a5107c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 12 Oct 2018 15:07:40 +0200 Subject: Cleanup: Turn widget accessor-functions into simple pointers The keeps track of different sub widgets needed by other parts of the code, notably: MainTab PlannerDetails PlannerSettingsWidget ProfileWidget2 DivePlannerWidget DiveListView Access to these widgets was provided with accessor functions. Now these functions were very weird: instead of simply returning pointers that were stored in the class, they accessed a data structure which describes the different application states. But this data structure was "duck-typed", so there was an implicit agreement at which position the pointers to the widgets were put inside. The widgets were then down-cast by the accessor functions. This might make sense if the individual widgets could for some reason be replaced by other widgets [dynamic plugins?], but even then it would be strange, as one would expect to get a pointer to some base class. Therefore, directly store the properly typed pointers to the widgets and simply remove the accessor functions. Why bother? Signed-off-by: Berthold Stoeger --- desktop-widgets/simplewidgets.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'desktop-widgets/simplewidgets.cpp') diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 6d15da475..367975832 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -159,7 +159,7 @@ void RenumberDialog::renumberOnlySelected(bool selected) void RenumberDialog::buttonClicked(QAbstractButton *button) { if (ui.buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) { - MainWindow::instance()->dive_list()->rememberSelection(); + MainWindow::instance()->dive_list->rememberSelection(); // we remember a list from dive uuid to a new number QVector> renumberedDives; int i; @@ -205,7 +205,7 @@ void SetpointDialog::buttonClicked(QAbstractButton *button) invalidate_dive_cache(current_dive); } mark_divelist_changed(true); - MainWindow::instance()->graphics()->replot(); + MainWindow::instance()->graphics->replot(); } SetpointDialog::SetpointDialog(QWidget *parent) : QDialog(parent), -- cgit v1.2.3-70-g09d2