summaryrefslogtreecommitdiffstats
path: root/qt-ui
AgeCommit message (Collapse)Author
2014-02-13Automated whitespace / coding style correctionGravatar Dirk Hohndel
First attempt to use the tools on one of our source files. So far so good. Not perfect, but a HUGE improvement. Most importantly it effortlessly fixed the Allman style braces introduced in commit 51220f26ef71 ("Add recent files to main menu."). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-13Add recent files to main menu.Gravatar Boris Barbulovski
Add(up to four) recent files to File main menu. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Ensure the correct parent is used in the dialogGravatar Dirk Hohndel
This way the dialog is centered and the main window gets dimmed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Don't redeclare variables of the same nameGravatar Dirk Hohndel
This isn't broken, but it's confusing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Replace mainWindow() with MainWindow::instance()Gravatar Boris Barbulovski
C++ style of accessing single instance class object. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Make the mean depth line follow the size of the axis.Gravatar Tomaz Canabrava
When we move, shrink or expand the depth axis, the meandepth should also change it's position. this patch adds that. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Hide the extra axis labels on release mode, show on debug mode.Gravatar Tomaz Canabrava
The extra axis labels on the Temperature and Cylinder Pressure graphs are not wanted in release mode as they create a lot of visual clutter, but they are useful to have in debug mode since we can then better understand what went wrong. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Added cylinder pressure shrinking on show/hide partial pressure.Gravatar Tomaz Canabrava
Same as the last commit, but for cylinder pressure. Another bug was spotted, where the mean depth line does not move to the correct location after a axis-size-changed - fixing that on next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Shrink temperature axis when partial pressures are shown.Gravatar Tomaz Canabrava
This patch adds shrinking of the Temperature axis when partial pressures are shown. This adds an unwanted side effect however, the axis started showing it's values - and we didn't do that on the gtk version or on the old profile. While this is good for debugging, it's not wanted for the software if it's on release mode. I'll fix that in due time. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Animate transition between show / hide partial pressure graphsGravatar Tomaz Canabrava
When the user checked the option to show or hide the partial presure graph the size of the profile graph was kept the same; usually I do those changes on the objects themselves, on the settingsChanged method, but since the calculation of the size of the profile was done on the ProfileView class for consistency with the other objects, I had to change it there too. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Correctly track parent of print dialogGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Whitespace and dead code cleanupGravatar Dirk Hohndel
The coding style for switch isn't the prettiest, but let's at least keep things consistent. Also, those ugly break statements never got reached, anyway. And there was no need to re-declare and re-generate currentString. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12More variable scope confusionsGravatar Dirk Hohndel
Don't have nested loops with the same loop variable. Really. Even if it is legal C++. And don't declare local variables more than once. This will only cause issues later. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Make sure the about dialog is correctly centeredGravatar Dirk Hohndel
Otherwise, why pass in the parent to begin with? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Don't shadow object members like thisGravatar Dirk Hohndel
If you need to use this->error to distinguish the local variable from the object membe that should be a hint that maybe you didn't pick the best name for the local variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Don't reuse a variable name with a different type inside the same functionGravatar Dirk Hohndel
Since the variable was inside of an inner scope this was technically legal, but it's just too annoying for words. (The diff in the commit doesn't make this obvious, but outside the for loop in the same function there is a divedatapoint *dp, so we had a pointer to divedatapoint and a divedatapoint with the same name...) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12Don't use current_dive instead of the argument to the functionGravatar Dirk Hohndel
I could have gone either way - the other alternative would have been to remove the argument to the function. But since current_dive is a macro and since the semantic of the function make sense with the argument being passed in, it seemed better to just not use current_dive in the function. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Fix variable scope issueGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Fix ATM-vs-bar confusionGravatar Linus Torvalds
SAC should be calculated in relationship to surface pressure, not "1 bar". I also realize that we have a few other cases where we do the same mistake: the partial pressure calculations do things like po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive); which is wrong as well - the partial pressure is also relative to standard atmospheric pressures. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Take the on-canvas position into account for DiveCartesianAxis::valueAt()Gravatar Dirk Hohndel
We did this right for posAtValue(), but not for the inverse. Fixes #438 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Put include guard to every headerGravatar Boris Barbulovski
* ensure include guard to every header * comment endif guard block Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Update #include statement for QStringListModelGravatar Boris Barbulovski
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Migrate MainTab models(QStringListModel)Gravatar Boris Barbulovski
Migrate MainTab models from static xxxCompletioModel::instance() to private MainTab variable members. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Handle cancel in PreferencesDialog::on_chooseFile_clickedGravatar Patrick Majewski
If I click in the Preferences Dialog on the 3 dots to choose a default file to load and cancel the opening FileDialog an empty string is returned and set to the coresponding QLineEdit. The new behavior (and mostly expected) is to update the QLineEdit only if there is a filename returned from QFileDialog. Signed-off-by: Patrick Majewski <dive@patrick-majewski.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11More renamingGravatar Dirk Hohndel
I don't even know what a partial gas might be... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Give the widget for the new profile a better nameGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11New profile: enable switching between dive computersGravatar Dirk Hohndel
This was mostly in place, just needed to be hooked up. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Minor cleanupGravatar Dirk Hohndel
Remove obsolete header and unused variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Use our macro for FP comparisonsGravatar Dirk Hohndel
I think that catches all the ones we missed (thanks clang -Wfloat-equal). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Fix bug in logic expressionGravatar Dirk Hohndel
Yes, the old code made perfect sense when you read it - except the C++ compiler turned it into something quite different from what was intended. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-11Clean up include filesGravatar Dirk Hohndel
They should have a newline at the end. Forward declarations of classes should be 'class'. Function / method definitions don't end on a ';' Remove obsolete QStateMachine forward reference. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Don't repopulate the model if the dive didn't changeGravatar Dirk Hohndel
plotDives takes a list of dives (for future use) but currently only looks at the first dive in this list. With that semantic in mind we can save ourselves some work if we first check if this is the same dive we are already showing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Clean up the setDive functionGravatar Dirk Hohndel
* This should never be called with a NULL dive. * The dc variable was set then never used. * We now have a unique id for each dive, but we can't simply not repopulate the model in setDive as the old comment might make you consider, as otherwise the dataModel will reference already freed data in pInfo. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Set up the dive that was passed in as first diveGravatar Dirk Hohndel
We carefully extracted the first dive passed in with the QList, but then always used current_dive. That's silly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Profile2: Prevent another crash if no dives are presentGravatar Lubomir I. Ivanov
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Do not add the items to the scene twice.Gravatar Tomaz Canabrava
Those items have parent(), which means that when the parent has a scene, they are automatically added and removed from the scene. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Fixed item visibility on emptyState after being on profileState.Gravatar Tomaz Canabrava
Background was not correctly back to it's original position and a few other items kept their visibility when it shouldn't. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Clear the data when the model resets.Gravatar Tomaz Canabrava
This patch does a few things: 1 - reset the model when user closes the dive file 2 - connects the 'rowsAboutToBeRemoved' in a way that the graphics can remove their polygons too 3 - adds a 'clear' virtual method so items that don't follow the rules can clean themseves up. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Don't ignore the return values from readfile and EXIF parserGravatar Dirk Hohndel
If readfile fails it already frees its buffer. If the parsing failed we shouldn't use the data in the structure. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Enable the dive planning under a compile flagGravatar Danilo Cesar Lemes de Paula
Allow subsurface to show the dive planner in case a compile flag is given. qmake CONFIG+=planner Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Improve sanity check for DivePlotDataModel::data()Gravatar Boris Barbulovski
Adds DivePlotDataModel row upper-boundary check (isValid method already checks for negative values). Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10memory leak fix(that I created in some previous commits).Gravatar Boris Barbulovski
Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Close search panel by button clickGravatar Sergey Starosek
Connect Close button (X) to panel's hide() method. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Profile2: Prevent a crash if no dives are presentGravatar Lubomir I. Ivanov
But in general we should not show the profile of a dive that was recently removed from the list - e.g. via File->Close. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-10Use 'struct membuffer' for profile info string generationGravatar Linus Torvalds
The profile info was generated using nasty string concatenation that the membuffers are much better at anyway. And membuffers don't need those arbitrarily sized fixed buffers (500 bytes? Why 500 bytes?). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09mainwindow.cpp improvementsGravatar Boris Barbulovski
* Add missing variable members to the initializer lists. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09maintab.cpp improvements.Gravatar Boris Barbulovski
* Initialize(lazy) MainTab::multiEditEquipmentPlaceholder struct Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09globe.cpp improvementsGravatar Boris Barbulovski
* Add missing variable members to the initializer lists. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09downloadfromdivecomputer.cpp improvementsGravatar Boris Barbulovski
* Add missing variable members to the initializer lists. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-09more diveplanner.cpp improvementsGravatar Boris Barbulovski
* Move variable members construction to the initializer lists. Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>