Commit graph

599 commits

Author SHA1 Message Date
Dirk Hohndel
636477becc Merge branch 'downloaddialog' of github.com:danilocesar/subsurface 2013-09-10 12:07:34 -07:00
Dirk Hohndel
e7fd45c7ef Change ws_info and tank_info types
This is correct C. But debuggers in C++ mode are broken and can't display
the global variables. While I hate having to do this change, I hate not
being able to debug my software because of broken tools even more.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-10 11:44:49 -07:00
Dirk Hohndel
e91ac60f49 Fill ws_info structure and use it when entering weight systems
The code to initialize the weight systems from the last datafile loaded
had not been brought over from the Gtk version.

We now correctly update the data structure when loading file (but not yet
when editing values).

Most likely the same needs to be done for the tanks as well.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-10 11:42:26 -07:00
Danilo Cesar Lemes de Paula
3f8e183008 improve DownloadDialog's error handling
shows an error message when libdivecomputer returns
an error.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-09-10 14:45:25 -03:00
Danilo Cesar Lemes de Paula
59da382613 improve DownloadDialog UI control
* Removes the InterfaceThread
  which is basically an unecessary proxy between the MainThread and
  the DownloadThread.

* Use a state machine to control the DownloadWidget UI logic.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-09-10 14:45:25 -03:00
Tomaz Canabrava
923b4cd9b1 Make the Plus Button on the planner work.
Clicking on the plus button now adds a new stop on the planner.
The depth is always 10m and the time is 10 minutes after the
last stop. can be changed by double clicking or dragging the
balls around the canvas.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 22:57:22 +00:00
Tomaz Canabrava
813722633d Last gas used will be used on new dive planner point.
This patch makes the last gas used on the planner the
default.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 20:45:03 +00:00
Dirk Hohndel
167a55f6f5 Merge branch 'moreDivePlanner' of https://github.com/tcanabrava/subsurface 2013-09-09 07:19:59 -07:00
Tomaz Canabrava
b4a609f46f Signal that the model changed when editing plan specific information.
Signal that the model changed when editing plan specific information,
when you changes the ATM pressure or any other information, the
graphic of the plan will be generated again to mirror your actual dive.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 07:27:46 -03:00
Tomaz Canabrava
545c76992a Plug most of the dive planner - non - model stuff.
Plug most of the dive planner controls that weren't
plugged yet - StartTime, ATMPressure, BottomSAC,
DecoStopSAC, LowGF and highGF are being used by
the calculations now.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 07:18:22 -03:00
Tomaz Canabrava
64864fea9c Enable the CC SetPoint on the planner, also input bug fix.
Enabled the CC SetPoint settings on the table, changing
it will automatically reflect the canvas. Also fixed a bug
that prevented the 'Air' handling on the diveplanner
table to show the list of options using arrow up and down.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 06:48:03 -03:00
Tomaz Canabrava
96d1cc570e Use the same code for command line and gui for file handling.
The Command line execution of Subsurface happened before the
GUI was created, this leaded to various bugs by me(tm) over
time. This patch seems to fix all of those, by reusing the
same code for GUI interaction and CommandLine interaction.

I had to rework how the main.c worked, it used to be C code
calling C++ code, and this is non desirable, since C doesn't
really understand C++.

I Moved all of C-related code to 'subsurfacestartup.c/h' and
created a tiny wrapper to call it, so all of the C code is still
C code, and the new main.cpp calls the mainwindow->loadFiles and
mainWindow->importFiles to get rid of the bugs that happened before.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-09 05:59:03 -03:00
Tomaz Canabrava
c029cb0a07 Fixed a incorrect signal that shouldn't be there.
Fixed a incorrect signal-connection call that should'nt
be there anymore because the TableView now correctly
knows what to do with models.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-03 13:59:20 -03:00
Tomaz Canabrava
46a20e7dd8 Missing Files.
This should have been in the last commit - sorry.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-03 13:57:38 -03:00
Tomaz Canabrava
5666f6573e Code Cleanup: Merged the three TableViews shared code
Merged the shared code for the three table views into
one code, this way less code is needed if we need to
construct another tableview in the future.
I still need to clean some of the models too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-02 16:21:08 -03:00
Tomaz Canabrava
430e7ab132 Added missing CSS file.
Added missing CSS file, this CSS file is used by our tables
to set everything on the ui.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-02 05:57:08 -03:00
Tomaz Canabrava
3fe3426b14 Fixe: Show the profile and info window on opening.
Fixed showing the profile and info window when opening
the program. For some reason ( easy testing of the planner )
the planner was being opened instead of the profile and
info window. now everything's back to normal.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-09-02 05:55:37 -03:00
Dirk Hohndel
0c56a8c1b0 Build fix
I don't quite understand why this was needed - or how this can build for
Tomaz without it...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-30 20:36:15 -07:00
Benjamin
c68296c5bb Corrected spelling of "weight" in the preferences dialog and code
"weight" was spelled as "weigth" in a few places in the code, but
more importantly, it was misspelled in the preferences dialog.
A minor nit-pick, maybe, but it still drew the eye in the dialog
and looked weird.

Signed-off-by: Benjamin Fogel <benjaminfogel@yahoo.co.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-30 20:22:50 -07:00
Dirk Hohndel
db17edda65 Merge branch 'bugfixes' of github.com:danilocesar/subsurface
Fixed one conflict in qt-ui/diveplanner.cpp - please check I got this
right.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-30 20:17:20 -07:00
Tomaz Canabrava
9bc7d8f514 More Code Cleanup
The code now seems to be mostly working. There is unfortunately
a QAction shortcut conflict between the implementation and the
MainWindow. - I'm gonna fix that in the next commit.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 16:43:10 -03:00
Tomaz Canabrava
aef0dd0fa0 More Code Cleanup.
Just a bit of code cleanup so that I don't bloat the software
too much. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 16:33:54 -03:00
Tomaz Canabrava
959bdbbca7 Fix '+' sign for time on the planer, plus code cleanup.
The plus sign for time was in a very strange position,
this puts it back to where it belongs, plus a bit of
code cleanup since the planner was in heavily modifications,
this will be needed quite a bit. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 16:21:55 -03:00
Tomaz Canabrava
72807017ae Make planned points deletion works on the Table too.
Now the planner deletes points by clicking on the
trash icon on the table. The dive planner is almost
finished. <3

next: add a point from the table.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 16:08:55 -03:00
Tomaz Canabrava
d37213a413 Moves deletion logic of divepoints to the Model.
Deletes the logic of divepoints to the model, this
makes automatic updates on the table on deletions.
( remember, to select dive points, ctrl+click on it.
) if you want to delete it, press 'delete', it will
be removed from the graphics part and also from the
table.

Next: delete point by clicking on the table trash-
icon.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 15:53:10 -03:00
Tomaz Canabrava
5e722a93e4 Gas choices working, both directions ( Planner and Table )
The gas choice now works and correctly ( I hope ) calculates
the gas choosen to show on the planner. User can choose the
gas from the list on the visual planner, and also on the table.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 15:06:26 -03:00
Tomaz Canabrava
2d0e877bb2 Added support for changing Depth and Time on the Table.
Added support for changing depth and time on the table.
It now works both ways, one can edit the planner via the
table for a fine tuning. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 13:27:15 -03:00
Tomaz Canabrava
69903903d2 Started the work of Editable Model for the Planner
This commit is the start of the Editable Model work
for the planner, it creates a new delegate and shares
the code for the model that creates the gas types, so
we only need to change in one place to add new gases.

The table is already edition-enabled, but the outcome
is still undone, next commit - put all together.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 07:14:30 -03:00
Tomaz Canabrava
6c56f07959 Code Cleanup - Remove temporaries.
Just code cleanup, removing temporaries.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 06:54:41 -03:00
Tomaz Canabrava
2921f4c825 Code cleanup - Dead Code.
Just removing an #if 0

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-30 06:52:58 -03:00
Danilo Cesar Lemes de Paula
ab649e21ba fix DownloadDialog behavior
The DownloadDialog behavior was broken in a way it allows the user
to make changes on the dialog while the download is happening.

Also, clicking on "Cancel" breaks/hangs the UI sometimes, as libdivingcomputer
doesn't always cancels the download right away. That's a bug that
still needs to be fixed.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-08-29 19:20:34 -03:00
Tomaz Canabrava
bb59202812 Made the TableViews share a bit of code, code cleanup.
Made the tableviews share a bit of code, and code cleanup.
The tableviews for Cylinders, Weigth and Dive Planner Points
now shares the CSS and I also implemented the save / load
methods for the dive planner points, so the functionality
is mostly done on the vieualization side. - since we are
now using three tables maybe it's a better idea to create
one class SubSurfaceTable that knows how to handle saving
/ loading of the columns... TODO for the future. ;)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-28 07:48:46 -03:00
Tomaz Canabrava
cfd17116eb Added a 'remove' icon on the dive planner table.
Added a 'remove' icon on the dive planner table,
this makes the ui more consistent between the other
tables that also manages addition and removal of data.

the delete method is still unimplemented.
next - css.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-28 07:27:59 -03:00
Tomaz Canabrava
65ab236948 Fixed moving a dive point between dive points
Fixed moving a dive point between dive points.
this fixes mostly everything that I have broked
by using a Qt Model instead of a linked list -
but a model is better to make everything updated
and only poke in one place. sharing code++. :)

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 17:15:48 -03:00
Tomaz Canabrava
3323fecea8 Made possible to add a divepoint between two others.
Made possible to add a divepoint between two others,
this also implemented the last patch in the correct way.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 17:02:34 -03:00
Tomaz Canabrava
760c14ac0c Fixed entering a dive stop before another dive stop.
Fixed entering a dive stop before another dive stop,
the correct way is to fix the position of them but
this is easyer - I'll update the correct one in
a couple of patches.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 16:55:30 -03:00
Tomaz Canabrava
9d90034109 Fixed invalid values on the TableView
The values of the dive points on the tableview were
too big, I'm now dividing time by 60 and depth by 1000
to get the correct results.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 16:38:12 -03:00
Tomaz Canabrava
5ad4cfe8e2 Fixed a bug where moving a handler would mess the planner
Fixed a bug where moving a handler would mess the planner
by calculating invalid values to the planner on the model
side.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 16:36:30 -03:00
Tomaz Canabrava
367fc6e1c3 Moved a lot of code to the Model, cleaning the interface.
Moved a lot of code that handled the positioning of the
DiveHandles on the interface to the model. there are a
few bugs left ( regressions ) that I will fix in the
next commits. With this commit an edition of the points
on the widget will trigger a repaint of the planner profile.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 16:34:06 -03:00
Tomaz Canabrava
de2f5d9e60 Moving Handler on Graphics Updates the Model on the Planner
Moving the handler on the graphics updates the model on the planner
Unfortunately, the graphics will move back to it's original
position because of the legacy code used to calculate the
dive plan. Next: fix the legacy code used to calculate the dive plan.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 14:54:07 -03:00
Tomaz Canabrava
bc71f9a916 Moved the creation of the data plan point to the model.
Moved the creation of the data plan point to the model,
this way when the user creates a data point on the
graphical planner, or when the user creates the point
on the QWidget based view, both of them will be updated.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 14:17:39 -03:00
Tomaz Canabrava
024dd80664 First implementation of the Shared Model for the Planner
This implementation of the shared model already shares
some, but not all data between the two views, but it's
already a huge improvement. When the user clicks on the
visual planner, it will update the view on the qt-widget
based view. The editing of the view is still not allowed,
and removing nodes is not allowed too ( yet. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 13:18:21 -03:00
Tomaz Canabrava
9856aaaa86 Started the Model to handle the DivePoints
Started the model to handle the divepoints between the
Qt Widget interface and the QGraphicsView one. good thing
is that we share code. Bad is that a model is harder to
work, but doable. :)

With this finished ( in a couple of commits ) one can
insert a point on the Qt widget or on the graphics view
and it will be 'mirrored' to both interfaces.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 09:14:19 -03:00
Tomaz Canabrava
aceb002a33 Changed the WindowHint of the planner popup to 'Popup'
Changed the Window Hint of the planner popup to 'Popup'
this removes ghost items from the task bar.

Hint By: Danilo Cesar
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 08:49:28 -03:00
Tomaz Canabrava
6cb1f1a250 Code Cleanup: Buttons on Graphical Planner
Removed a bunch of non-used graphics buttons,
since the new widget now contains everything
needed for the creation / cancelation of the
dive plan.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 08:47:45 -03:00
Tomaz Canabrava
0a043528f7 Added a new widget to control the Planner
Added a new widget to control the DivePlanner, now we
have two widgets, a graphics one and a qt sidget based one.
the Technical divers will most likely use the QtWidget one
while the hobbists will most likely use the QGraphicsView
one. there's not a option to choose one, they both will
appear at the same time.

Next step: make the screens to work.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-26 08:43:37 -03:00
Danilo Cesar Lemes de Paula
db44045cfe fixing planner's gas dialog
Before this commit this dialog had a weird behavior in which
when it was shown, the whole screen was still active. In case of a
alt+tab, this dialog is sent to behind the application window, but still
visible in the task bar.

This commit basically changes this behavior to a regular pop-up.

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>
2013-08-25 19:03:43 -03:00
Danilo Cesar Lemes de Paula
1e69731804 use QWebView to show the user manual
Looks like the QTextBrowser can't render the manual correctly.
Also, QWebView provides a better way to find contents on a webpage,
which is an important feature for an user manual (to be implemented).

Signed-off-by: Danilo Cesar Lemes de Paula <danilo.eu@gmail.com>
2013-08-25 19:03:43 -03:00
Dirk Hohndel
2fb2918607 Compile fix
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-08-13 20:29:22 +02:00
Tomaz Canabrava
41ada82a04 Fixed a bug where the auto-completion would not work via commandline.
Fixed a bug where the auto-completion would not work via command
line, I fixed it by reloading the information of dives when a
dive file is open via command line or via UI.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-08-13 11:53:48 -03:00