To use ++, we need to declare the variable as int. But then we need to
cast to the enum type.
This is using C-style casts because this is still C-like code.
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Qt ui will need to read the dive_table to populate widgets with
dives. Gtk functionality in init_ui is required to parse the dives.
Split init_ui to allow parsing to proceed and complete before Qt ui
mainwindow constructor is called.
Play with qDebug()'s printf style (Thiago!)
Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Qtr_ hack isn't needed as in commit 720fc15b2dcd ("Introduce
QApplication") had already made sure that we are using gettext.
I didn't revert the two commits as I wanted to keep the added header
comments and fix the tooling in the Makefile as well.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This should wrap gettext nicely and replace the "_()" macros we use in C
code.
Also added comments to the top of all the new files.
Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1 - Open File already open files, it tries to not break the Gtk version,
but some methods on the GTK version still need to be called inside Qt
because the code is too tight-coupled.
2 - Close file already close files, same comments for the open file dialog
applies here.
3 - The code for adding new cylinders in the cylinder dialog is done,
already works and it's integrated with the system. There's a need to
implement the edit and delete now, but it will be easyer since I'm
starting to not get lost on the code.
4 - Some functions that were used to convert unities have been moved to
convert.h ( can be changed later, put there because it's easyer to
find something that converts in a convert.h =p ) because they were
static functions that operated in the GTK version but I need those
functions in the Qt version too.
[Dirk Hohndel: lots and lots of whitespace and coding style changes]
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Most of the warnings are IMHO false positives:
e.g.: an enum variable is initialized in a switch statement that has a case for
each possible enum value - yet gcc 4.8 warns that it could be used
uninitialized;
or: two variables are initialized together in the code - second one of them
is previously initialized to -1 at declaration time, both are initialized
in an if (second one == -1) clause - so they are guaranteed to both be
initialized...
I did not "fix" those as the code is actually correct.
But there are three spots where it catches things that could indeed go wrong
(with odd input data in one of them).
This commit also adds a check to only call g_type_init() for older versions of
glib as in newer ones it is deprecated.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is based on several commits from Tomaz - mingled together and mildly
extended by Dirk (mostly Makefile hacking).
All Qt UI related stuff should eventually move into the qt-ui directory.
So the Makefile rules for moc and uic have been adjusted accordingly.
The MainWindow class has been moved into its own file in qt-ui (but just
with a placeholder, the existing class has simply been ifdef'ed out in
qt-gui.cpp for the moment).
We still have a couple of Qt things in qt-gui.cpp in the main directory...
all this needs to move into the qt-ui directory and be built with separate
.h files. Right now we have the one-off Makefile rule to create the
qt-gui.moc file from the qt-gui.cpp file.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This is just an empty window with a File menu and a few items.
It shows how to hook up functions to menu actions.
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Remove the boolean parameter from parse_file; the code is more readable
by having an explicit call to set_filename() where necessary, rather
than a boolean parameter.
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
The previous rules were conflicting, and the naming of the moc-generated
file to be included in .cpp files was deviating from what's most used in
Qt: the usual way is to
#include "file.moc"
and not
#include "file.moc.cpp"
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Instantiate a QApplication and let Qt handle the event loop.
Add a QTranslator subclass to translate the UI via gettext.
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Rename gtk-gui.c to qt-gui.cpp, and make the necessary changes so that
the project still builds.
Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>