Ok on the planner now correctly creates a dive,
a few remarks, tougth:
1 - the number of the added dive is always 0
( but I may be testing it wrong )
2 - the information pane is working only when
the mouse is clicked, this is a regression and
it will be fixed. ;)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
The dive plan was bein created on the Profile, this
While this worked out, it created a bit of spaggethi
code, so now the model will take control of *everything*
on the planner.
I tested it quite a bit and doesn't seems to have appeared
a regression, wich is good.
Now that a dive plan is bein created, I can just save it. :)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Plug the cancel action on the dive planner ( before that, only by
hitting the 'ESC' button things worked, so now you can also click
on the Cancel box that's on the right of the planner profile window.
Also, the beginning of the 'ok' code is also at place.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Position the X and Y labels of the rulers, this way
it's a bit more clear the deepness and the length
of the trip. It's still not the best approach, but
I'm getting close.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
When updating the weight system model we have to remove the old ones and
then correctly count the new ones.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
* 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>
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>
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>
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>
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>
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>
Fixes QString Usage. to return a Empty QString, one should
return a QString() and not a QString(""), and to check if
the string is empty, one should check for string.isEmpty()
instead of "string != "" ", because the latter will create
a new QString, then call the != operator, less function calls,
better code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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>
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>
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>
"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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>