I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Another futile attempt to cleanup the code and make coding style and
whitespace consistent. I tried to add a file that describes the key points
of our coding style. I have no illusions that this will help the least
bit...
This commit should ONLY change whitespace
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is the same code that Dirk used on the Mac to fix the
bad-behavior of Cylinder Selection, this time applyed to
Weigthsystem selection.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch uses the class created by the previous patch
to get rid of the CSS and be really desktop native. it
fixes a lot of stuff in non-blue-styles and throws
a lot of code away. <3
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The css was done by me in the first days of subsurface for Qt, and it
was a code that I was never proud of. Mostly because I tougth at the
time that it was better to write it into CSS than to create a new class
just to take care of the size of the default cell height on a tree view.
Now I see that it was a biased approach since it created issues on
dark color schemes and it also didn't make a 'native' experience on
Gnome or OSX, only on KDE.
This fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is an ugly hack as it partially breaks the ability to abort a selection
(so if you click outside of the combobox, the last value you hovered over is
selected). But this seems much better than not being able to select a different
tank at all.
Fixes#275
(and by 'Fixes' I mean "hacks to sort of make work"... but the trac automation
is rather inflexible in which words it understands...)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
What happened before was that the AirTypes model was only being updated
when the user requested to change the air by clicking directly
on the Air, in the planner ( but not on the Air Table. ).
This fixes it by calling 'repopulate' whenever the cylinder model
changes ( by adding, removing and changing something.)
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now the gases for which we have cylinders are offered in the gas selection
list and correctly recognized and added for the plan.
Still tons of work to be done to make this work the way it is designed,
but we are getting closer.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This Patch fixes the tab behavior on the QComboBox
delegate. For a QComboBox, tab was being treated as
'cancel' action on edit, but since it will send a
editingFinished() signal, and the Qt::Key_Return
will also send a editingFinished() signal, I couldn't
use that method and had to do a little hack around it.
The code is mostly clean and works.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I just went thru all of subsurface code removing
some whitespaces issues and trying to make the
code prettyer, I also removed a few QString issues.d
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
"Weight" was misspelled "weigth" in several places in the code
and comments.
Signed-off-by: Benjamin Fogel <nystire@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds a couple of classes and some other modifications
in PrintLayout that handle the printing of tables under a profile.
models.h : ProfilePrintModel
The class uses a 'struct *dive' to output all required data
for a certain dive at specific rows and columns. It also handles
font formatting and text alignment.
modeldelagatates.h : ProfilePrintDelegate
The class is used only for drawing a custom grid for profile tables.
PrintLayout::createProfileTable()
The function is used to create and setup the profile table object
PrintLayout::printProfileDives()
The function now has correct padding of dive profiles on a page
and also the printing of actual tables below them.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Gtk+ style on the Gnome shell is somewhat broken on Qt for
some reason. This hack pokes the system, checks if it's running
gnome-shell, and if the current style is gtk+ ( I couldn't just
check for gtk+ since it worked on XFCE and other Gtk based enviro
ments. so a double check is needed. ) then I changed the Pallete
of the affected widgets by hand.
not a pretty hack but worked.
[Dirk Hohndel: redid the patch to be simpler and more consistent]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch fixes the cylinders and weigth edition
by keypress. I don`t know when I broke this and linus found,
most probably when I added the code for showing the
cylinder size and working press while moving the mouse
around the list - sorry guys.
So, now this *seems* fixed, tested for a fairly good
amount of time and everything seemed ok.
I was unable to reproduce the behavior that linus got
on two value overlapped on each other, tougth.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Since the cylinders and weigths have other data attached
to it, like size and working pressure, one could mess the
other data and want it to revert to the cylinder / weigth
defaults, but for that the user had to choose another
item, then go back to the previous one, so the cache would
be clean.
This patch fixes that by reverting the values to the
it fixes linus bug n2, where he had invalid data
on the other fields and had to go back and forth for it
to be fixed.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, the ComboBox is a beast, and when used on a Delegate
it's very hard to get things right, wich is a pitty, because
I overly like qt. So:
1 - Combobox needs to show the popup when user press ↓ and ↑ keys
2 - Combobox needs to select when user press enter, not twice.
3 - Combobox neesds to select when user selects from the mouse, not
pressing enter after.
4 - Combobox needs to not mess with stuff when moving around.
Everything that I listed there works on a non-delegate combobox,
but for some reason, a delegate missed those, so I reimplemented
all. not nice, but now we have a code that will work, I hope.
*fingers crossed*
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.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>
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>
"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 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>
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>
This is a follow up commit to the previous one that
enabled cancel for cylinders, everything in the commit
log for the cylinders also applyes here.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Made the default 'Cancel' action correctly cancel
the cylinder edition. This is needed only because
we bypassed the default behavior on Qt that took
care of this, because we wanted to have more control
on how the view would update the items accordingly
with wich one of the cylinders were selected
on the edition pane - the pressure and size of the
cylinders needed to have it's data set, but the Qt
Model/View system *thinks* that cancel-edition is
simply 'do not commit the edition data, then.' wich
would not work with us, because we passed the strange
data already. So, I created a backup data that serves
us very well. When the user cancels, this backup data
is added back on the cylinder, making everything as
it was before.
[Dirk Hohndel: removed the inadvertendly added boost header]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't set the cylinders and weight types if they are
the same than before, this fixes a bad thing that happened
when playing with the values. it could blank out the values
carefully chosen by you.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, I used the Qt Event Filter strategy to bypass the normal role
of user interaction, the Qt ComboBox needed 2 keypresses to close
and edit. so I grabbed the first one and send together a second one.
Há.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch fixes the combobox behavior on the inline edit
to what it was ( well, similar to ) the GTK version,
up and arrow keys will walk you to the list of choices,
and it will update the other data as soon as you walks over it
one drawback is that you cant ( for now, since I do have a
very big headache at the moment ) cancel, since the cancel
will just forgets the item and do not call 'setData' on the
model, but we already called it while walking on the list.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Adds spport for key_up and key_down in the combobox
delegates, now when you press key_up or down, it will
show the list of choices instead of going one-by-one
in the lineedit.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
So, I changed a lot of code to reduce boilerplate on models in the
future. Currently we do not have a lot of models, but this can increase
quite rapdly. There's a second TreeModel in the works, the Yearly
Statistics, this patch will save around 250 LOC for this new model,
and more and more models will give us a greater saving.
Iwll do that for the table models in the future too - I did the tree
models now because they are the most complex case and I didn't wanted
to create a second tree model without this.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Better handling of default sizes on the Cylinder and weight widgets,
the weigth widget didn't had a CSS applied so it looked odd compared
to the cylinder one, also the default behavior for the combobox delegate
didn't worked very well with the css applied, being too small.
this patch fixes that.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This patch creates a ComboBoxDelegate where the other specific delegates
should inherit from. this adds a little code cleanup for the current
version, and will help as soon as more delegates got added to the code.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
We now detect if a weight / cylinder with this description exists and if
not add it on the fly. We also remember the additional values (weight and
size / workingpressure) for new entries and take the values for these
fields into account when autocompleting.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is very much analogous to the way cylinders are implemented.
That means that just like with cylinders, if the user enters a new type
and hits 'tab' before hitting 'enter', Subsurface will crash.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With this we should have tank editing mostly done.
See #122
(it's not quite fixed, we need the equivalent code for weight systems)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
this is more a 'Well, this is how we do it' than an actuall
good commit. I'm probably using the wrong conversion paradigm
( none ) to convert the data from psi / bar and such, it
changes the model with wrong data.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
I had to immprove the TankInfoModel with two new methods,
insertRows and setData, because the delegate used this
model to show what kind of Tanks we are offering.
Since the user can enter a new type of Tank, it's important
to add this tank to all lists using the delegates.
I Also added two new methods on the delegate itself,
to correctly shows the data, and set the data on the
model. This also will help dirk with a working example
on how to edit things while using a delegate.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Now when you edit 'Type', a drop-down list will appear
and will enable you to choose from it's contents.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This was written with massive hand-holding by Tomaz - actually, this was
mostly proposed via IRC by Tomaz and then implemented by me...
Right now because of the list-of-lists nature of the model we have the
small issue that every trip starts with a dark background dive, even if
the trip itself has a dark background.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now the list and dives will work in the same way that the GTK
version does. The code got changed heavly because the old one
was just looking at the dives and didn't worked like a tree.
small adaptations on the list view and model delegates because
of the changes done on this model.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
For the stars on the dive table I had to rework a bit my
StarRating widget, because it used a pixmap for each widget
that were created. Not it uses only 2 pixmaps: the active
and inactive ones.
A new file was created named modeldelegates(h, cpp) that
should hold all delegates of the models. For the GTK / C
folks, a 'Delegate' ia s way to bypass the default behavior
of the view that's displaying the data.
I also added the code to display the stars if no delegate
is set ( good for debugging. )
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>