Doing this on Arch Linux with gcc 4.8.0 helped find one real bug.
The rest are simply changes to make static functions externally visible
(as they are kept around to eventually become helpers used by Qt) which
for now avoids the warnings.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Apparently only older Linux toolchains didn't bother to throw up with the
remainders of Gtk related code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clean up the formatting.
Distinguish between headings and value labels.
Tidy up text appearance (remove trailing ':')
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
- rip all Gtk code from qt-gui.cpp
- don't compile Gtk specific files
- don't link against Gtk libraries
- don't compile modules we don't use at all (yet)
- use #if USE_GTK_UI on the remaining files to disable Gtk related parts
- disable the non-functional Cochran support while I'm at it
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Auto-detect on first start and keep in settings afterwards. So if the user
resizes them, Subsurface remembers the correct sizes.
Signed-off-by: Dirk Hohndel <dirk@hohndel.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>
This code seems rather crude to me. I'm sure this could be done better.
This also makes the column alignment work again.
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>
The constructor letf the currentWeightsytem variable uninitialized.
Instead of creating the memory leak by malloc-ing the newWeightsystem in
the on_addWeight_clicked() function use a local variable instead and pass
its address around.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
My first attempt to create a Qt dialog and to hook it up with the program.
Unsurprisingly this doesn't quite work as expected (i.e., the values I
enter aren't populated in the model), but it's a start...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rename splitters and remove seemingly redundant empty splitter.
Use save/restoreState to save splitter sizes using QSettings.
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Use QSettings to provide persistent storage of settings. For example, we
store and restore the size of the MainWindow.
We use the organisation name hohndel.org and keep subsurface as the
application name.
A section is specified for things to do with the MainWindow; other
sections could be added e.g. for preferred units?
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.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>
Thanks to commit bdbfdcdfa0fb ('Ask Qt 4 to use the UTF-8 codec as the
"codec for C strings"') we no longer need the explicit UTF-8 conversion
when creating QStrings from char *.
Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Qt 5 does this by default, so it's not necessary there (in fact,
setCodecForCStrings was removed, so you catch any mistakes).
Now all QString methods taking a const char* or QByteArray
(constructor, append(), operator+=, operator<, etc.) will interpret
that char array as UTF-8. Conversely, the QByteArray methods taking a
QString will generate UTF-8 too. This includes the badly named
QString::fromAscii() and QString::toAscii().
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Just use the dive struct directly.
Suggested-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The DiveItem constructor had 13 variables. By passing it the full
dive we reduce that to 2.
[Dirk Hohndel: changed to use "struct dive *" instead of just "dive *"]
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We have these data structures for a reason. They provide context
about the units used and prevent mistakes. And of course they
are used everywhere else so we should use them here, too.
This also tries to display some more data and make things look
a bit more like the Gtk version when it comes to alignment and
formatting.
My guess is this will make Qt developers' eyes bleed. My apologies.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise, we won't link to winsock or set the subsystem correctly.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Functionality is unchanged, except we now have a nice process_dives
function that deals with all the logic and that gets called from
report_dives from the Gtk code.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>