Commit graph

286 commits

Author SHA1 Message Date
Amit Chaudhuri
f07614fb2f Reformat statistics tab in MainTab tab widget
Rename various labels and text into clear pairs and reflect changes into
.cpp file.

To avoid clashes with names on other tabs use '..All..' to emphasise
that this page deals with an aggregate across the selected dives.

Re-format the statistics tab.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-06 06:11:02 -07:00
Dirk Hohndel
e960a5b558 Add most settings to the QSettings code
This is missing the char * based settings (as I have no idea how to do
those) plus the map provider. Everything else should work.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-05 21:11:08 -07:00
Tomaz Canabrava
8e35868b9b Fixed some bad drawings
Removed the lines of the graphs that doesn't supposed to have lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 19:30:54 -03:00
Tomaz Canabrava
be0f2e0e8d Enabled some Render Hints for Antialiasing
Enabled some Render Hints for Antialiasing and
smooth transformations.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 09:55:56 -07:00
Dirk Hohndel
1238fde17c Merge branch 'PlotsV2' of https://github.com/tcanabrava/subsurface into Qt
Minor conflicts based on my cleanup of Tomaz' earlier commits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-05 09:50:11 -07:00
Tomaz Canabrava
c72609046a Finished the port of the plot_profile code.
There are a few regressions, mostly because the text
is not being plotted yet and the background of some
of the curves are not being applied.
This is because QGrapdien is based on the coordinates
of the items that I wanna paint, but I'v setted a
QGradient that's global and doesn't take this into
consideration.

all curves are being plotted. in Small resolutions
they plot bad. but it's just a matter of redrawing
in the correct resolution.

the Line widths are being hardcoded now, on the cairo
version they weren't, this will need a bit of porting
too.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-05 13:42:33 -03:00
Tomaz Canabrava
adcae4d913 Added the code to plot the actual Graph.
This version already plots the dive-graph, with the
gradient and all that jazz. One thing that will be
easily spotted is that the size of the line is very
thick - easily changed, I'm just using the default.
As soon as everything is plotted correctly I'll
fix the lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:55:46 -07:00
Tomaz Canabrava
f269f86496 Plot of the Mean Deph
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:55:16 -07:00
Tomaz Canabrava
19048b98e5 Start plotting something.
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.

Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:55:12 -07:00
Tomaz Canabrava
fa82ba6079 Moved the plot from the cairo version to the Qt version
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:51:33 -07:00
Tomaz Canabrava
ec4d4566ad Converted the Colors.h code to Qt
The colors on colors.h were done to fill a special
struct by Subsurface - I removed that structure and
replaced the code that generated the map of colors
to a QMap. I know that this changes are not very
'welcomed', but C++ has issues on creating & initializing
complex static members, this was the best way that I could
think of.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:51:29 -07:00
Tomaz Canabrava
8353d57164 Started the code for the Profile Plotting
This small patch adds a new class - ProfileGraphicsView
it's a QGraphicsView based class that will holds all
graphics-items for the plotting.

The setup is simple, just call ui->ListView->plot( dive )  ( that's
already a ProfileGraphicsView and magic will happen.

Since Im using a QGraphicsView , the size of the canvas doesn't
matter and I'm fixing it at 0,0,100,100. when a resize is done,
the resizeEvent will be called, fitting the scene's rectangle on
the view.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-04 19:49:52 -07:00
Tomaz Canabrava
926224122e Added the code to plot the actual Graph.
This version already plots the dive-graph, with the
gradient and all that jazz. One thing that will be
easily spotted is that the size of the line is very
thick - easily changed, I'm just using the default.
As soon as everything is plotted correctly I'll
fix the lines.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 20:18:16 -03:00
Tomaz Canabrava
09597cd2d8 Plot of the Mean Deph
The mean depth now is plotted correctly.
I wanted to do more stuff on this commit, but since
it required that a few things on profile.c got moved
to profile.h, commited to not have a huge blob for review.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:36:40 -03:00
Tomaz Canabrava
1b1ea35fac Start plotting something.
The first plotting method was removed from profile.c
to profilegraphics.cpp and some conversion ( almost 1 to 1 )
was made so that the code could work.

Since the code is big - this commit has just a part of it
working - it plots the grid. but already works for testing
the resizing of the window and Zooming ( unimplemented )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 19:20:49 -03:00
Tomaz Canabrava
c74dc11167 Moved the plot from the cairo version to the Qt version
Started working on the Qt version of the Plot, initially
nothing is printed - but this is not a bad thing,
the program doesn't explodes too. :)

some work had to be done about the 'bool/gboolean' stuff
so I removed all gbooleans in the code that I'v encountered.

A new file was created ( profile.h ) so I could put the
signatures of helper methods that cairo used to call.

till now the code computes the max limits.
Next patch the first drawing will be made.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 18:43:42 -03:00
Tomaz Canabrava
a58412cb31 Converted the Colors.h code to Qt
The colors on colors.h were done to fill a special
struct by Subsurface - I removed that structure and
replaced the code that generated the map of colors
to a QMap. I know that this changes are not very
'welcomed', but C++ has issues on creating & initializing
complex static members, this was the best way that I could
think of.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 16:41:49 -03:00
Tomaz Canabrava
243016633d Started the code for the Profile Plotting
This small patch adds a new class - ProfileGraphicsView
it's a QGraphicsView based class that will holds all
graphics-items for the plotting.

The setup is simple, just call ui->ListView->plot( dive )  ( that's
already a ProfileGraphicsView and magic will happen.

Since Im using a QGraphicsView , the size of the canvas doesn't
matter and I'm fixing it at 0,0,100,100. when a resize is done,
the resizeEvent will be called, fitting the scene's rectangle on
the view.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-04 16:12:43 -03:00
Dirk Hohndel
fcd6903621 Small changes to the selection logic
Now it correctly uses the existing helper functions and keeps our idea of
the selection consistent.

There is a small behavioral change compared to the Gtk code. Range
selections no longer have the last dive clicked on as selected_dive but
instead the dive with the highest index that was selected. I don't think
that is a major issue for anyone.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 20:58:44 -07:00
Tomaz Canabrava
7add8594a7 Added code to select / desselect a range of items
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-05-03 21:49:40 -03:00
Dirk Hohndel
c385e7aae8 Make Ctrl-q work as Quit
It's annoying to always have to close the window with the mouse.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 16:30:36 -07:00
Dirk Hohndel
ce5fc7d0ec Select the first dive
This works regardless whether the first dive is in a trip or not.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 12:53:33 -07:00
Dirk Hohndel
0a19a964e0 Temporarily expand all dives so the automatic width calculation works
Suggested-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-03 12:49:58 -07:00
Amit Chaudhuri
8577410fcd Reformat dive info page in tab widget
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>
2013-05-03 11:47:06 -07:00
Dirk Hohndel
8677721e85 Remove the majority of the Gtk related code
- 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>
2013-05-03 11:37:09 -07:00
Dirk Hohndel
a6b89b3254 Don't hard-code column width.
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>
2013-05-02 22:06:01 -07:00
Dirk Hohndel
ff2ce39970 Merge branch 'tomaz-css' into Qt
Tomaz' code does a much better job of shading the dive list!

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 17:02:55 -07:00
Tomaz Canabrava
696c9ccacd Added code to Select a dive, fixed minor annoyances.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 16:56:48 -07:00
Tomaz Canabrava
82b1b04920 Test the CSS for styling the TableView
This is a test and I shouldn't be taken seriously.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 16:56:13 -07:00
Dirk Hohndel
021ef8ad09 Alternate background colors for dive list
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>
2013-05-02 14:52:26 -07:00
Dirk Hohndel
c4e2c322a3 Set better column widths in the dive list
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>
2013-05-02 14:49:56 -07:00
Dirk Hohndel
f9c97ff97d Show cylinder and gas used in the Qt dive list
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 10:48:09 -07:00
Dirk Hohndel
e6ec626c97 Show trip date (with number of dives) in dive/trip list
That was easy :-)

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-02 09:33:51 -07:00
Dirk Hohndel
6b7797140b Minor style updates
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 22:00:08 -07:00
Tomaz Canabrava
e5ad47e459 Merge branch 'Qt' into RenderStarsOnTable 2013-05-01 23:54:38 -03:00
Tomaz Canabrava
764a863082 Added Support for the Trips and Dives on the DiveList model.
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>
2013-05-01 23:51:34 -03:00
Dirk Hohndel
00d8531382 Fix a couple of small problems in add weightsystem
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>
2013-05-01 16:23:20 -07:00
Dirk Hohndel
f45618f0c7 Create Add Weightsystem dialog
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>
2013-05-01 16:02:34 -07:00
Dirk Hohndel
482bea84c2 Don't add cylinders and weightsystems past the MAX
We actually should disable the 'Add' button, I guess.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 14:49:17 -07:00
Dirk Hohndel
04e59a0e1c Hook up adding a weightsystem
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 14:43:07 -07:00
Dirk Hohndel
5c2ce0ac20 Add data and add functions for WeightModel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 10:11:46 -07:00
Dirk Hohndel
730e055e5a Use the existing current_dive macro in Qt code
Replicating this with the currentDive member seems to make no sense.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-05-01 10:10:16 -07:00
Dirk Hohndel
0794f03b5e Merge branch 'RenderStarsOnTable' of https://github.com/tcanabrava/subsurface into Qt 2013-04-28 13:10:20 -07:00
Amit Chaudhuri
4c665be05f Save and retore splitter dimensions.
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>
2013-04-28 10:17:53 -07:00
Tomaz Canabrava
0be521bb25 Fixed loading the stars when opening with file as argv. minor cleanup
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-28 08:45:22 -03:00
Dirk Hohndel
4179885da7 Merge branch 'RenderStarsOnTable' of https://github.com/tcanabrava/subsurface into Qt 2013-04-27 20:53:25 -07:00
Dirk Hohndel
4bb0cd8cef Minor coding style cleanups - and use core logic function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-27 20:47:47 -07:00
Amit Chaudhuri
89f02c42aa Add support for remembering settings
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>
2013-04-27 20:44:36 -07:00
Tomaz Canabrava
2f4d6bbe53 Added support for showing the Stars on the DiveTable
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>
2013-04-27 12:27:27 -03:00
Dirk Hohndel
1d0d42f861 Remove the explicit UTF-8 conversions
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>
2013-04-25 21:10:05 -07:00
Tomaz Canabrava
b20b57b29f Make dirk happy by enabling sort in the model.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-25 20:44:06 -03:00
Dirk Hohndel
98027be1c1 Minor cleanup of constructors and one accessor for DiveItem
Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-25 08:39:40 -07:00
Henrik Brautaset Aronsen
8a884d2cf7 Remove useless members of DiveItem
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>
2013-04-25 07:13:19 -07:00
Henrik Brautaset Aronsen
5d4d40df91 Simplify DiveItem
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>
2013-04-25 06:39:02 -07:00
Dirk Hohndel
fde0f49df8 Use Subsurface's data structures for DiveItem
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>
2013-04-24 23:21:57 -07:00
Dirk Hohndel
02d822924c Merge branch 'useStarWidgets' of git://github.com/tcanabrava/subsurface into Qt 2013-04-24 16:18:08 -07:00
Dirk Hohndel
ce235bd581 Correctly format depth and time
We really need those leading 0s.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:03:14 -07:00
Dirk Hohndel
e156b00f05 Fix column headings for divelist
This looks better and is consistent with the Gtk version.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 16:02:41 -07:00
Tomaz Canabrava
639dbe95f8 Fix the order of the DiveInformation tab bar.
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:59:52 -03:00
Tomaz Canabrava
607c08bb25 Remove the use of this->
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:57:50 -03:00
Tomaz Canabrava
634abb8bb2 Use the star widget in it's right place
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-24 19:57:10 -03:00
Amit Chaudhuri
edab566105 Amend divetrip model to use int units
Amend the DiveItem class to avoid float in favour of int. Add getters
which return display friendly QStrings reflecting user preferences for
(e.g.) depth.

Modify DiveTripModel to support controlled alignment by column; right
align for depth and duration.

Fix problems with utf8 encoding on rating stars, degree symbols and
O2 subscript.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-24 13:06:42 -07:00
Dirk Hohndel
26f7e82b62 Merge branch 'StarWidgetResource' of git://github.com/tcanabrava/subsurface into Qt 2013-04-23 14:05:43 -07:00
Tomaz Canabrava
0ac67c4256 Use the star from the resource file instead of hardcoding it's patch
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-23 17:32:30 -03:00
Dirk Hohndel
315c0b505c Set the window icon in Qt
And even use the resource file to allow me to use an alias for it in the
actual code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-23 09:55:08 -07:00
Tomaz Canabrava
9ffb707d9d Initial version of the Star Picker Widget.
A very simple to use widget:
StarWidget *stars = new StarWidget( windowParent);
stars->setMaximumStars(10);
stars->setCurrentStars( rand()%10);
stars->show();
connect(stars, SIGNAL(valueChanged(int)), someObj, SLOT(starsChangedValue(int)));

It currently uses a 'star.svg' file on the same folder as the binary.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 16:09:21 -07:00
Tomaz Canabrava
a0280ae7d2 Move model related code from MainWindow and adjustments.
Moves the DiveTrip model related code to models.h

The DiveTripModel was implemented in three parts:

 DiveTripModel.h
 DiveTripModel.cpp
 MainWindow.cpp (the code to populate the model)

This patch changes the DiveTripModel from it's original
implementation to the file models.h, wich should store
all models (Dirk requested the Qt developers to not create
2 files per class, but instead to use a file for functionality,
and data-models are one functionality.)

Besides that, this code cleans up a bit the style:
removed operator<< for .push_back, const references where they apply,
moved the internal DiveItem class to the .cpp since it should be visible
only to the DiveTripModel class, and redesigned the current interface of
the model to be identical of the GTK one (used the UTF8-star and 2
subscribed, for instance).

Amit (the creator of the original code) should comment here if it's ok
with my changes.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-22 09:42:13 -07:00
Dirk Hohndel
26076610e5 Use helper function to get dive date string
Correct order of arguments in the DiveItem constructor call.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18 13:23:46 -07:00
Amit Chaudhuri
1a15462073 Use get_dive to populate divelistview with dives
Add dives from dive_table to the model/view using the functions provided
to extract the dives.

We do not yet handle trips.

Formatting of date/time, depth and duration need attention.

Relies on earlier patch to delay Qt ui construction.

We should look at the signals we publish to link to other widgets etc..

[Dirk Hohndel: use for_each_dive -- clean up some white space]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-18 12:38:52 -07:00
Amit Chaudhuri
073be111f4 Delay Qt ui construction
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>
2013-04-18 12:31:15 -07:00
Tomaz Canabrava
115ee47bfc Added the code that will load and populate the Tank Info
Added the code that will load and populate the Tank Info
ComboBox that`s used by the user to select the Cylinder
description.

Code curerntly implements more than the GTK version since
the GTK version of it was a plain-list, this one is a
table based model that can be used in ListViews ( like
we use now in the ComboBox ) but also in TableViews
( if there`s a need in the future to see everything
that`s catalogued in the Tank Info struct. )

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-15 17:34:44 -07:00
Dirk Hohndel
983e5f6356 Merge branch 'fixCppStyleToC' of https://github.com/tcanabrava/subsurface into Qt 2013-04-14 07:02:06 -07:00
Dirk Hohndel
d8e11439ad Undoing the last Qtr_ hack
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>
2013-04-14 06:58:56 -07:00
Tomaz Canabrava
f913eacbd9 Fixed the C++ code Style to conform the C style that was previously agreed upon.
Removed the use of operator<<() in a bunch of lines to do direct calls
this way the code will not scare non-c++ hearted people. :)
s

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
2013-04-14 10:56:51 -03:00
Dirk Hohndel
fc0e307f00 Add common.h file
Oops

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-14 06:21:32 -07:00
Dirk Hohndel
f5c958ad73 Add Qtr_ macros that uses gettext in a tr() compatible manner
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>
2013-04-13 20:44:02 -07:00
Tomaz Canabrava
92397a2bad Started the real code on the Qt Interface.
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>
2013-04-13 14:08:16 -07:00
Amit Chaudhuri
76f71b4ca0 Add dive list view to main window
Add files for dive list model/view implementation. Replace TableView
with the custom list view.  Amendments to makefile to match.

Note: we don't yet handle trips and may want to add additional columns
to describe the dive.

A single, dummy dive is added to show how this works (get root; item is
child of root). Purely to illustrate - needs proper integration etc.

Amend member names for dive list view components

Various naming changes to conform to coding style. Required changes to
members (remove prefix) and methods (avoid clash with members).

Clean up indentation (swap spaces for tabs). Code for model/view was
written with a different editor which had different settings :-/

[Dirk Hohndel: minor whitespace cleanup]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-12 12:54:08 -07:00
Alberto Mardegan
ec8c2b9368 MainWindow: remove useless include
This was accidentally reintroduced by a previous commit, and was causing
a moc warning.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
2013-04-10 19:00:20 +04:00
Amit Chaudhuri
6e02e9d5b7 Add logic to switch views
Rename the 3 main widgets in the Qt mainwindow.

Wire view menu options to the setVisible methods of same.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 07:35:07 -07:00
Henrik Brautaset Aronsen
55106a7583 Avoid C++ style streams
As Thiago wrote: qDebug("actionNew") also works.  The current policy is to avoid
C++ style source code as much as possible.

Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-10 07:31:14 -07:00
Amit Chaudhuri
1182c98997 Add stub slots for all menu items
Naming of QActions was inconsistent wrt abbreviations - fixed.

Add stub slots for each action relying on connect by name.

Add qDebug() message to allow people to check that menu items fire
slots; not really necessary but may provide some reassurance as we build
familiarity with Qt.

Some changes to display text for menu items (e.g. Tree becomes View
All).

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 22:49:13 -07:00
Alberto Mardegan
99153de715 Makefile: detect which files need moc and uic
Add some magic rules to detect which files need to be processed by the
moc or uic tools, as well as a way to manually specify exceptions.

Signed-off-by: Alberto Mardegan <mardy@users.sourceforge.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 19:54:41 -07:00
Amit Chaudhuri
a94e09ad5c Add a slot to mainwindow but amend to use Q_SLOTS
For some reason, 'private slots:' causes a build error but private
Q_SLOTS: works.

The error was that 'slots' did not name a type and it appeared to be
insensitive to whether the Makefile rule for .moc was in its current
place or preceeded the rule for .cpp.

Add a slot using the connectByName idiom e.g. actionNew connects to slot
on_actionNew_triggered(). Use qDebug to show this fires if the menu
option is selected.

Above to demonstrate how to begin to link menu to code paths.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-09 06:50:42 -07:00
Amit Chaudhuri
e865aed478 Change tab widget names.
Names for individual tab widgets were not specific and caused warnings
from UIC. Rename the individual widgets to reflect purpose.

[Dirk Hohndel: removed some of the hunks that appeared to be unintentional
               changes not mentioned in the commit log]

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-04-08 12:58:06 -07:00
Tomaz Canabrava
ba712c3b54 Start creating the Qt UI
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>
2013-04-07 15:59:33 -07:00