Commit graph

119 commits

Author SHA1 Message Date
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
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
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
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
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