Commit graph

112 commits

Author SHA1 Message Date
Tomaz Canabrava
9511ee0294 Do not allow the drop target to erase an old column
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:56 -08:00
Tomaz Canabrava
a96e0e1ec1 Fix moving columns
Qt has a very bad habit of getting the inner widget instead of the outer
one.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:50 -08:00
Tomaz Canabrava
6746b73d85 Remove data if it was correctly moved to the upper model
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:42 -08:00
Tomaz Canabrava
1ba08e2fec Make it possible to move from top to bottom
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:40 -08:00
Tomaz Canabrava
59fc5cecb7 Add the code to actually make it possible to move columns
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:38 -08:00
Tomaz Canabrava
fd41ff4ab9 Start to make it possible to move columns around
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:37 -08:00
Tomaz Canabrava
325f47c8d8 Add missing returns
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:35 -08:00
Tomaz Canabrava
8a230f9145 Remove drag operations from the 'From' widget
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:30 -08:00
Tomaz Canabrava
e3fbfe5498 Remove pesky QDebug that snook in
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:28 -08:00
Tomaz Canabrava
555fd979cb Port the code that actually parses the CSV to the new system
Change the QWidget based approach to the Model based approach, using the
result QStringList for finding if we have the depth or the time of some
specific column.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:19 -08:00
Tomaz Canabrava
f48065ac3c Do not accept drops from outside of subsurface
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:16 -08:00
Tomaz Canabrava
909be75113 Re-add the string to the avaliable models if drag cancelled
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:12 -08:00
Tomaz Canabrava
9042abc68c Set data done, drag & drop works
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:10 -08:00
Tomaz Canabrava
7d53299831 Implement most of the drag operation
Only thing missing is the Drop.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:08 -08:00
Tomaz Canabrava
4e7bd86e07 Fix constructor
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:04 -08:00
Tomaz Canabrava
af13ba7d44 Add setData() to the ColumnResult model
This way the drop target will work when implemented.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:38:00 -08:00
Tomaz Canabrava
74596cc193 Add the data() method
Now we can correctly visualize the file data, and changing
the separator will update on the fly.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:57 -08:00
Tomaz Canabrava
58e21a6160 Add the setColumnValues() method
This method populates the model with a few lines of the CSV data to help
the user to define what each column is.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:48 -08:00
Tomaz Canabrava
79e81d70ec Implement LoadFileContents
This will get the first 10 lines of data, try to separate
them using the separator specified, and then try to make
things display correctly on the table.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:46 -08:00
Tomaz Canabrava
ba30e938b3 Another skeleton: LoadFileContents
Also, do not pass QStringLists by pointer, uneeded.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:44 -08:00
Tomaz Canabrava
f1b90813cf Set the model on the table view, one more skeleton
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:42 -08:00
Tomaz Canabrava
858fe5588a Add skeleton code for the model that will have the result of columns
This model will show some columns and the user will
need to provide the correct information for each of them

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:40 -08:00
Tomaz Canabrava
aa33ae9526 Add skeleton code for the table view that will accepts drops
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:37 -08:00
Tomaz Canabrava
cedf339e1e Show the pixmap being dragged
This way we know that we got the correct drag thingy.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:35 -08:00
Tomaz Canabrava
b7e27e3141 Re-add the string removed upon drop operation
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:27 -08:00
Tomaz Canabrava
6149004f47 Remove the string from the model while dragging
We are not correctly readding it yet - be patient.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:23 -08:00
Tomaz Canabrava
81f2ee5892 More DragDrop skeletons
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:37:20 -08:00
Tomaz Canabrava
0a1908137b Start to drag the correct values
This piece of code starts a drag and moves around data, it does nothing
with it yet.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:35:12 -08:00
Tomaz Canabrava
2034508c07 Add class skeleton that will handle the drag starts
This class will handle the drag 'n drop "drag" part.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:35:03 -08:00
Tomaz Canabrava
d2a4cd9965 Display the list of column names on the ListView
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:34:56 -08:00
Tomaz Canabrava
7bc93d4242 Add data, row count and the string list that populate the model
I know that there is a QStringListModel, but that doesn't
have add and remove methods, and thus I cannot use it. ;)

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:34:54 -08:00
Tomaz Canabrava
3d8e2d0643 Skeleton code for the model that has the columns information
Just the skeleton, then start doing stuff.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:34:51 -08:00
Tomaz Canabrava
48775c530e Clean a lot of code for a new and improved CSV import dialog
This mostly cleans out stuff that is going to be uneeded.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06 19:34:45 -08:00
Miika Turkia
d70a6f23ed Change the XSLT to use the duration format instead of "logic"
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-31 08:35:36 -08:00
Miika Turkia
3416278da4 Allow unit selection on known CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-30 07:35:23 -08:00
Miika Turkia
1e04aec7fd Preconfigured import of Subsurface CSV log file
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-26 08:43:43 -08:00
Miika Turkia
83fd196c4a Automatically increment column number on CSV import
This increments the column number automatically when doing manual CSV
import. Counter is decreased when un-checking checkboxes, but that is
all the logic there currently is.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-25 10:38:23 -08:00
Miika Turkia
071cea15c0 Glue between GUI and XSLT for additions in CSV import
This code sets the parameters properly to support the new fields in
manual CSV import.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-12-20 11:30:52 -08:00
Miika Turkia
1b74947bf5 Allow user to select date format on manual CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-11-25 13:19:49 -08:00
Miika Turkia
4bc9b7748b Parse meta information from Seaber log
This will parse date information from Seabear log file and skips the
"header" data to allow parsing of the CSV content.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-10-28 07:25:45 -07:00
Anton Lundin
dd924a21ed Add quirks for Seabear CSV settings for pressure
This adds the settings quirk workaround for the pressure import from the
Seabear CSV file.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 12:40:41 -07:00
Anton Lundin
89d74888b3 Add support for importing pressure from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 12:40:25 -07:00
Anton Lundin
c7df6df8cd Fix bug in Seabear Quirks
By mistake i used memcpy to "fix" the samples, but the sample list was
overlapping so i needed to use memmove.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-10 07:39:20 -07:00
Anton Lundin
f940ebcf74 Add quirk for Seabear CSV settings
The Seabear software stores its settings as two csv-rows in the same
file as its samples. These settings got read as two bogus samples in the
beginning of the dive.

This kills those off and repairs the temperature damage they done.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 14:22:48 -07:00
Anton Lundin
ffb441aa84 Add quirk for Seabear CSV NDL/TTS in minutes
In the Seabear CSV the NDL and TTS fields are in minutes, not seconds as
their time field. This is an ugly quirk but it gets the job done.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:06 -07:00
Anton Lundin
6cd0928487 Add support for importing TTS from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:00 -07:00
Anton Lundin
d5991800ee Add support for importing NDL from CSV files
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:22:00 -07:00
Anton Lundin
b1d7ba9f63 Initial stab at Seabear CSV imports
This adds a preconfigured import setting for Seabear CSV files.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-07-09 13:18:58 -07:00
Dirk Hohndel
155eac11d2 Ctrl-W and -Q support for GPS, divelogs.de, divecomputer and CVS import
Getting closer to consistent behavior.

See #489

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-04-25 10:47:44 -07:00
Linus Torvalds
609715ab69 Convert other users of showError() to the new world order
The "report_error()" interface is a lot simpler, although some of the
C++ code uses QStrings which make them a bit annoying, especially for
the varargs model.  Still, even with the explicit conversion to UTF8 and
"char *", the report_error() model is much nicer.

This also just makes refreshDisplay() do the error reporting in the UI
automatically, so a number of error paths don't even have to worry.  And
the multi-line model of error reporting means that it all automatically
does the right thing, and reports errors for each file rather than just
for the last file that failed to open.

So this removes closer to a hundred lines of cruft, while being a
simpler interface and doing better error reporting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-14 12:36:06 -07:00
Dirk Hohndel
7c535452f9 Whitespace cleanup
Minor change to the perl postprocessing script and resulting changes to
the affected source files.

This deals with two issues:
- "foreach"-like structures were not always treated correctly
- some longer calculations that ended on "+ constant" were reformatted in
  a rather unatractive manner

In one source file (divelist.c) I ended up adding braces to the sources...
trying to cascade the indentation further down without having the block
there seemed a lot more trouble than it's worth.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-03-03 13:29:22 -08:00
Dirk Hohndel
76e6420f6b Massive automated whitespace cleanup
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>
2014-02-27 20:09:57 -08:00
Miika Turkia
cb5ab4bc8e Add unit support for CSV import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 06:33:33 -08:00
Boris Barbulovski
c86822c2f4 Replace mainWindow() with MainWindow::instance()
C++ style of accessing single instance class object.

Signed-off-by: Boris Barbulovski <bbarbulovski@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-12 11:42:59 -08:00
Miika Turkia
47ad50d6de C++ code to call parsing functions for manual CSV
This code sets up the C++ part for importing manually kept CSV log.
That includes setting up the field separator selection and calling
C-code for parsing the log file.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 06:52:06 -08:00
Miika Turkia
e9f3d652e8 Treat Sensus CSV import specially on GUI
As Sensus import needs a specific XSLT and user specified parameters are
not used nor needed, tune the GUI accordingly (disable options and add
Sensus in the list of known imports).

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-17 05:57:45 +07:00
Anton Lundin
7e9582631d Convert to TRUE/FALSE to stdbools true/false
I had problems with this one on Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 15:52:31 +07:00
Rodrigo Severo
349f3e9cde More CSV import fixes
Pre-configured imports in Import Dive Log File for CSV files should also
be cleared when the field separator is changed by the user.

Promoted DiveLogImportDialog::unknownImports to slot as per Canabrava's
suggestion and Hohndel's request.

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-15 05:56:34 +07:00
Rodrigo Severo
3a3d61ba53 Pre-configured CSV imports should also set the field separator
Pre-configured imports in Import Dive Log File for CSV files should also
set the pre-defined field separator.

[Dirk Hohndel: cleaned up hideous whitespace]

Signed-off-by:Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:18:28 +07:00
Rodrigo Severo
2da8146b46 Include support for semicolon separated CSV files
Oceanic's Geo's companion software, OceanLog, when exporting as txt produces log files with the dives samples as semicolon separated CSV files.

Signed-off-by: Rodrigo Severo <rodrigo@fabricadeideias.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-14 21:08:31 +07:00
Miika Turkia
88fdf1b138 Show import dialog only when needed for CSV config
We do not need any import dialog when importing normal XML based
divelogs. With this they are imported directly after file selection
dialog. However, when CSV files are detected in the import list, the
configuration dialog is displayed and applied for them. (CSV files are
detected by file extension.)

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-08 05:54:20 +08:00
Miika Turkia
b052b790df Refactoring import to DiveLogImportDialog
Changing the import stuff to DiveLogImport. Now we should have one
import function/dialog for importing divelogs instead of multiple menu
entries.

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-03 10:30:08 -08:00
Renamed from qt-ui/csvimportdialog.cpp (Browse further)