mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: remove firstCall static variable
The profile had a static variable which prevented animation when first showing the profile. It appears more logical to don't show the animation when switching from the empty state. This removes global state, as a function static variable exists only once, even if there are multiple objects. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
235146a95f
commit
0a92823af6
3 changed files with 2 additions and 20 deletions
|
@ -51,9 +51,6 @@
|
||||||
|
|
||||||
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
|
#define PP_GRAPHS_ENABLED (prefs.pp_graphs.po2 || prefs.pp_graphs.pn2 || prefs.pp_graphs.phe)
|
||||||
|
|
||||||
// a couple of helpers we need
|
|
||||||
extern bool haveFilesOnCommandLine();
|
|
||||||
|
|
||||||
/* This is the global 'Item position' variable.
|
/* This is the global 'Item position' variable.
|
||||||
* it should tell you where to position things up
|
* it should tell you where to position things up
|
||||||
* on the canvas.
|
* on the canvas.
|
||||||
|
@ -522,7 +519,6 @@ void ProfileWidget2::resetZoom()
|
||||||
// Currently just one dive, but the plan is to enable All of the selected dives.
|
// Currently just one dive, but the plan is to enable All of the selected dives.
|
||||||
void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPictures, bool instant)
|
void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPictures, bool instant)
|
||||||
{
|
{
|
||||||
static bool firstCall = true;
|
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
QElapsedTimer measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later
|
QElapsedTimer measureDuration; // let's measure how long this takes us (maybe we'll turn of TTL calculation later
|
||||||
measureDuration.start();
|
measureDuration.start();
|
||||||
|
@ -564,12 +560,8 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// special handling for the first time we display things
|
// special handling when switching from empty state
|
||||||
animSpeed = instant ? 0 : qPrefDisplay::animation_speed();
|
animSpeed = instant || currentState == EMPTY ? 0 : qPrefDisplay::animation_speed();
|
||||||
if (firstCall && haveFilesOnCommandLine()) {
|
|
||||||
animSpeed = 0;
|
|
||||||
firstCall = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// restore default zoom level
|
// restore default zoom level
|
||||||
resetZoom();
|
resetZoom();
|
||||||
|
|
|
@ -120,11 +120,6 @@ int main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool haveFilesOnCommandLine()
|
|
||||||
{
|
|
||||||
return filesOnCommandLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define VALIDATE_GL_PREFIX "validateGL(): "
|
#define VALIDATE_GL_PREFIX "validateGL(): "
|
||||||
|
|
||||||
void validateGL()
|
void validateGL()
|
||||||
|
|
|
@ -104,8 +104,3 @@ void set_non_bt_addresses()
|
||||||
connectionListModel.addAddress("FTDI");
|
connectionListModel.addAddress("FTDI");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool haveFilesOnCommandLine()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue