aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-07-02Silence some warningsGravatar Dirk Hohndel
One of them actually looks like it was a bug... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-07-02Merge branch 'nitpicks' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-07-02Make the increase time button to work.Gravatar Tomaz Canabrava
Makes the increase time button to work, it will increase the minimum time, not the correct time of the dive. the total time is calculated by the deco, and does not come from this, unless the deco is smaller than the minimum time. This patch also fixes the problem where a button would only click once - I was holding the first clicked button as the 'mouse grabber', bad tomaz. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Make the 'increase depth' button to work.Gravatar Tomaz Canabrava
Make the increase depth button to work, it also adds a 'safety' stop at 150m, I know that this is deep, and maybe we need to adjust this to a better safety stop. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Removed user-entered lines on the plan, keeping only deco.Gravatar Tomaz Canabrava
Removed the user-entered lines on the plan, keeping only deco, This way the graph looks way prettier and we don't loose any functionality. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the color of the DepthString based on it's deepnessGravatar Tomaz Canabrava
Change the color of the DepthString based on it's deepness on the profile planner. The new color of the profileString ( the string that follows the mouse stating how deep you are) is now interpolated from SAMPLE_SHALLOW and SAMPLE_DEEP - but since those two colors were the same and I had to change it so that could work, I want somebody to check if my choose of colors were ok. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Use the same profile colors on the planer for the Time and DepthGravatar Tomaz Canabrava
Use the same profile colors on the planner for the Time and Depth rulers. this needed a new method on the rulers - setColor, that will call the setPen method and make everything behave properly. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Fixed positioning of the dive Handlers.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Correct collors for the DivePlanner background.Gravatar Tomaz Canabrava
Use the correct colors for the Background on the Dive Plan, same as on the Profile. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added the last 'tick' to the rulersGravatar Tomaz Canabrava
The last tick to the rulers were missing, this was making them to look odd, this make the rulers better looking, but it caused the other-non-ported-yet-to-percent stuff to behave in a not so good way, most visible one is the handlers, gonna update them next. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Change the rules so they work with percentages.Gravatar Tomaz Canabrava
Changed the ruler so that they work with percentages, also added a new method to the rules to set the size of the ticks. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added a method and a simple stub to position things using percentage.Gravatar Tomaz Canabrava
Added a method and a simple stub to position things on the canvas using percentage - this way I have a proper control on where I want to put things on screen and it will make simpler for future changes, even if the amount of code written is a bit bigger. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Shared background for profile and planner.Gravatar Tomaz Canabrava
Share the background for profile and planner. Those are not the same class, but they should behave somwheat the same. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-07-02Added 2 new files to handle the common stuff for graphics.Gravatar Tomaz Canabrava
Added 2 new files, graphicsview-common.h/cpp, that should have the common stuff shared between the dive profile viewer and the dive planner. the amount of duplicated code would be huge if we go the road of two different classes for each one, but since the planner took a more 'Qtish' way of behavior, in comparisson to the profile - that's most a Cairo-To-Qt literal translation, we cant easily merge the code without a complete ( and unwanted ) reestruturation of the profile code, thus, this new files will serve as a bridge between them. Initially I put there only the colors - since that's wat most easilyy shareable. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-29Profile: add white outline to all textGravatar Lubomir I. Ivanov
Goal: no blending between profile text and graph lines Qt doesn't seem to provide an easy-to-go solution in terms of styling the z-order of the pen and brush layers of a QAbstractGraphicsShapeItem (or alternatively pen offset), which is needed if for example one likes the pen not to cover the text fill. Calling QGraphicsSimpleTextItem->setPen() on small text can cover bigger portions of the text, as the pen ends on top of the fill and given the pen stroke path ends up scaling exactly at the fill path border but not on the outside, for example. Since we don't get quick control over that (and to avoid the issue in a naive way), we set the text as bold and the white outline lands over the "bold-ed" area of glyphs. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-28Profile: move the bounding box below plot dataGravatar Lubomir I. Ivanov
In certain conditions a number such as '51' could end up being partially hidden under the white bounding box in such a way that the digit '1' is barely visible. Putting the bounding box bellow all plot data solves the issue. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-28A couple of dialog modality considerationsGravatar Lubomir I. Ivanov
While most dialogs can be open and the main application window can still be accessed, certain should possibly be modal in these terms. This patch proposes the download from webservice and DC dialogs to lock the main application window until they are closed, with the consideration of preventing eventual unexpected behavior in the divelist if both dialogs are active at the same time. To solve that QtDialog::exec() is used instead of QtWidget::show(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-28Close child windows and dialogs with main windowGravatar Lubomir I. Ivanov
Most child windows should be closed with the main application window otherwise if left open and if making specific modifictions could potentially cause a SIGSEGV. To solve that we mark all custom windows/dialogs with the Qt::WA_QuitOnClose attribute on instance creation. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Make planner prettier. but still ugly.Gravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Removed memleak created by the diveplan calculationsGravatar Tomaz Canabrava
Removed a small memleak created by the diveplan calculations. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Added the Ok / Cancel buttons on the dive planner canvas.Gravatar Tomaz Canabrava
Added the ok / cancel buttons on the dive planner canvas. I still need to hook the esc button to cancel it too, but since I removed the 'floating dialog' option and merged it into the mainwindow, it's necessary. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Moved the DivePlanner to the MainWindow.Gravatar Tomaz Canabrava
Now, activating the dive planner will hide the profile and show the planner on the same place. we still need a way to 'cancel' or 'accept' the profile created. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Somewhat saner behavior for rescaling the planner time axisGravatar Dirk Hohndel
We always resize if the dive is longer than the current scale allows, but we don't shrink it overly aggressively and we never shrink it below the initial size. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Correctly prevent time travel in plannerGravatar Dirk Hohndel
Prior to this change the visual feedback (the handle that is drawn when the user moves the mouse while pressing the left mouse button) would not move to an illegal position (one that is impossible without time travel), but it the user moved the mouse to such an illegal position and then released the mouse button, we still added that illegal position to the plan. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Show empty labels in the Stats tabGravatar Lubomir I. Ivanov
Remove a couple of TextLabel text entries from maintab.ui which can be seen right after program start and if no dives are present. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Coordinate some mark_divelist_changed() callsGravatar Lubomir I. Ivanov
1) Make a call mark_divelist_changed(TRUE) when the user adds new cylinder or weight entries. 2) Call mark_divelist_changed(FALSE) in MainWindow::on_actionClose_triggered() so that each time after a file is closed or a new one is created it does not ask immediately the user for a save confirmation for the blank file/divelist. 3) Call mark_divelist_changed(TRUE) once a dive's geo location has changed in GlobeGPS::changeDiveGeoPosition(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Better positioning of the plus sign icons in the Equip. tabGravatar Lubomir I. Ivanov
There are a couple of problems with said icons: - When the Equip. tab is first seen, no relative event is monitored so that the correct position is updated and the icons are positioned. To solve that we connect the signal MainTab::currentChanged(int) and call MainTab::equipmentPlusUpdate(). - When the info-profile QSplitter resizes with a snap towards/from the edges of the main window, no resize handler is called such as MainTab::resizeEvent(). A solution is to monitor the resize of the info-profile splitter with MainWindow::on_infoProfileSplitter_splitterMoved() and again call MainTab::equipmentPlusUpdate() Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Remove unused codeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Remove incorrect logic for first line in plannerGravatar Dirk Hohndel
This greatly simplifies the code. Similar to (but not based on) code submitted by Robert Helling. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Removes circle in planGravatar Robert Helling
Remove circle in plan by starting the first line at the first point rather than the last. In addition marks all entered points as entered and not just the first and sets line color accordingly. Makes plan_add_segment return the added data point. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Merge branch 'divePlanner4' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-06-26Fixes most of the issues with the dive planner.Gravatar Tomaz Canabrava
Fixes most of the issues with the dive planner, The lines are removed when the drag starts, and it's repopulated after. The time ruler updates itself with the biggest time in the dive (I'll add later the code to keep a minimum of 60 minutes, and increase by 15 to 15 minutes, but for now this will work ), Removed the code to do line manipulation while we are moving handlers around ( because it could trigger ruler-expansion, that woul'd move everything, and that's not nice. This showed that something bogus is going on with the decompression algorithm - I don't know if it's on the data or on the algorithm itself, but it's creating a ring with the lines on the canvas I painted all decompression-algorithm based lines red so it's easier to spot where the hell things got wrong. midnight, sleepy. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-27Update main window title depending of current file stateGravatar Lubomir I. Ivanov
If a file has been opened from the command line or via the File menu the main window title becomes "Subsurface: filename.ext". Title also updates if 'File->Save As' is called. "Subsurface" only is displayed when no active file is present or post 'File->New' or 'File->Close'. To make this work a new public method is added - MainWindow::setTitle() and also an enum type MainWindowTitleFormat, which should allow more complicated formatting, such as showing the selected dives or the total number of dives (e.g. MWTF_FILENAME_N_DIVES). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Reorder the 'View->View ..' listGravatar Lubomir I. Ivanov
Use Ctrl+1 for 'View All', while all the singular views follow with Ctrl+2..5. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Enable 'View->View Globe'Gravatar Lubomir I. Ivanov
For viewing the Globe section (pane) we need to collapse both the 'list' and the 'main' splitters. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Add action to 'File->New'Gravatar Lubomir I. Ivanov
File->New in the GTK version performed the same as File->Close. Creating a new file may also ask the user if the current file has to be saved. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-27Add the 'Import files' functionalityGravatar Lubomir I. Ivanov
Similar to File->Open but for multiple files and without calling on_actionClose_triggered(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-26Remove the bogus time/depth, and fix the positioning of the Handler after ↵Gravatar Tomaz Canabrava
updateTicks. Remove the bogus time/depth that was duplicated in the Handler - dirk didn't realized that I already created the same data that he put on it later, but mine was double and his his was int, I choosed his implementation since he knows a bit more than I do about subsurface internals. Besides that, I worked a bit on the logic that called update ticks, because it was calling it for every mouseMoveEvent, it created sooooo many ticks that it made the app unusable ( and slow. ) Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-24Enable downloads from the UEMIS ZurichGravatar Dirk Hohndel
This behaves somewhat differently from the Gtk version - still needs more investigation. But at least now it's hooked in. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-24Add an 'About' dialog for the Qt UIGravatar Lubomir I. Ivanov
The dialog is similar to the one in the GTK version Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Perform deco calculation for planGravatar Dirk Hohndel
This uses a bunch of default values that we eventually need to get from the UI, but it's a first step towards a working dive planner. This exhibits some graphical artifacts when running, but other than that appears to be mostly correct. Things go far worse if I enable the changing of the scale once the deco makes the dive longer than the displayed time window. Things quickly spiral out of control. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Start hooking in the deco calculationsGravatar Dirk Hohndel
I expanded the DiveHandler to include the actual time / depth of each node on the graph - this way things will stay consistent if we need to rescale the graph. One thing that this makes obvious is that the whole design for the planner so far assumes metric data. We need to make sure this works well with feet instead of meters as well (and that it uses the information in the units settings). With this change we actually create a dive based on the plan input and add the deco stops (if needed) to it - but we don't do anything with the results of those calculations, yet. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Print the rounded values for time and depth in plannerGravatar Dirk Hohndel
This looks much more natural than truncating the values. Now the displayed numbers correspond to the "snap" behavior of the handles. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Fix updateTicksGravatar Tomaz Canabrava
This is the correct way to add the ticks (and gets rid of two warnings). Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-23Clean up coding styleGravatar Dirk Hohndel
Just to keep me sane. The code still shows compile time warnings which are the areas where we need to complete things to actually do the deco calculations, etc. But now seemed a good time to merge it into master as hopefully more people can contribute. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-06-22Merge branch 'divePlannerTry3' of github.com:tcanabrava/subsurfaceGravatar Dirk Hohndel
2013-06-21Added the skeleton implementation of the increaseTime and depthGravatar Tomaz Canabrava
Added the skeleton implementation of the increaseTime and increaseDepth methods - they will increase the time / depth by 10 units ( feets / minutes ) each time they are clicked. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-21Added a new class to handle the pseudo-buttons on the canvas.Gravatar Tomaz Canabrava
Added a new class, named Button, that has a clicked() signal, and can be connected to the view to emulate buttons. While I know that Qt supports widgets on canvas - I think it's too nineties to have such square controls on something that can have rounded borders. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-21Make the plot and handle movement stick to an 'Grid'Gravatar Tomaz Canabrava
Make the plot and the handle stick to a grid, the grid is defined by the integers in the rulers, so a time of 10,2 is converted to 10, and will put the point at 10. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-06-21Depth doesn't suppose to show broken numbers.Gravatar Tomaz Canabrava
This patch makes the depth to show only integers, as dirk asked. I'v also added a 'm' at the end, I know that this will need to be taken from the settings but i feel lazy today =p Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>