mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:13:24 +00:00
Add refreshProfile member function to MainWindow class
While the whole idea of calling these functions through the MainWindow instance is atrocious, until we change the architecture of all this refreshProfile() is a useful function to have. In order to make this cleaner to implement I allowed an argument to ProfileWidget's replot() which allows picking a specific dive. By defaulting this to 0 we get the previous behavior when calling replot() without an argument. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a761a33069
commit
aeac5fcb6d
4 changed files with 12 additions and 7 deletions
|
@ -648,15 +648,19 @@ bool MainWindow::plannerStateClean()
|
|||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::refreshProfile()
|
||||
{
|
||||
showProfile();
|
||||
graphics()->replot(get_dive(selected_dive));
|
||||
DivePictureModel::instance()->updateDivePictures();
|
||||
}
|
||||
|
||||
void MainWindow::planCanceled()
|
||||
{
|
||||
// while planning we might have modified the displayed_dive
|
||||
// let's refresh what's shown on the profile
|
||||
showProfile();
|
||||
graphics()->replot();
|
||||
refreshProfile();
|
||||
refreshDisplay(false);
|
||||
graphics()->plotDive(get_dive(selected_dive));
|
||||
DivePictureModel::instance()->updateDivePictures();
|
||||
}
|
||||
|
||||
void MainWindow::planCreated()
|
||||
|
|
|
@ -189,6 +189,7 @@ slots:
|
|||
void refreshDisplay(bool doRecreateDiveList = true);
|
||||
void recreateDiveList();
|
||||
void showProfile();
|
||||
void refreshProfile();
|
||||
void editCurrentDive();
|
||||
void planCanceled();
|
||||
void planCreated();
|
||||
|
|
|
@ -342,12 +342,12 @@ void ProfileWidget2::setupItemOnScene()
|
|||
replotEnabled = true;
|
||||
}
|
||||
|
||||
void ProfileWidget2::replot()
|
||||
void ProfileWidget2::replot(struct dive *d)
|
||||
{
|
||||
if (!replotEnabled)
|
||||
return;
|
||||
dataModel->clear();
|
||||
plotDive(0, true); // simply plot the displayed_dive again
|
||||
plotDive(d, true);
|
||||
}
|
||||
|
||||
void ProfileWidget2::setupItemSizes()
|
||||
|
|
|
@ -109,7 +109,7 @@ slots: // Necessary to call from QAction's signals.
|
|||
void pointsRemoved(const QModelIndex &, int start, int end);
|
||||
void plotPictures();
|
||||
void setReplot(bool state);
|
||||
void replot();
|
||||
void replot(dive *d = 0);
|
||||
|
||||
/* this is called for every move on the handlers. maybe we can speed up this a bit? */
|
||||
void recreatePlannedDive();
|
||||
|
|
Loading…
Add table
Reference in a new issue