aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divelogimportdialog.cpp
AgeCommit message (Collapse)Author
2015-01-07CSV import: make predefined imports work againGravatar Dirk Hohndel
We need to reparse the file when the known type changes and want to make sure that we only try to guess the separator and the columns if the user hasn't told us otherwise. For the predefined imports this then looks up the correct columns and places the correct headings there - and then allows the user to modify them if needed. This has been lightly tested, there may be dragons. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV import: first steps to enable the preset types againGravatar Dirk Hohndel
With the new infrastructure colum numbers are 0 based, so the indices had to change. This commit also adds the column names for sample based formats (and ends up re-indenting parts of that code). This doesn't make things work, yet, but it's a step in the right direction. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV input UI: if we detect columns, set type to "manual" for nowGravatar Dirk Hohndel
We still need to re-implement the other presets. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV import UI: Minor update to stringsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CVS import UI: mark the column names in blue as wellGravatar Dirk Hohndel
And make the bubbles slightly larger. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CVS import UI: mark the drop row in blueGravatar Dirk Hohndel
That way it is distinct from the rest. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CVS import UI: better message if some columns were matchedGravatar Dirk Hohndel
If we automatically matched the columns this might already be correct. So the standard text is confusing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV Import UI: Prettifications, hide headers, code cleanup.Gravatar Tomaz Canabrava
Just a few cleanups. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07Fix moving columns around when one of the columns is emptyGravatar Tomaz Canabrava
I used to compare strings, but since there can be more than one empty column, this was a very sad choice, now I'm comparing indexes. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07Draw a nice rounded rect around the avaliable column namesGravatar Tomaz Canabrava
This drawns a nice rounded rect around the avaliable column names, using antialiasing. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07Give the items a bit more spacing / enable the delegateGravatar Tomaz Canabrava
Enable the new delegate on the view, and give the items a bit more spacing, so we can draw things around them. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07Add delegate skeleton for the drag columnsGravatar Tomaz Canabrava
This new class is the responsible to draw the columns that can be dragged from the top bar to the bottom one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CVS import UI: use my own match functionGravatar Dirk Hohndel
This makes the code simpler and allows us to do a much better job matching the column names. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV import UI: First step towards recognizing column headersGravatar Dirk Hohndel
This doesn't do a good job of matching the titles, but it works for some of them. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-07CSV import dialog: try to guess the separator based on the fileGravatar Dirk Hohndel
This is taking a very simplistic approach. It picks the predominant potential separator. If there is no clear winner, it uses the UI default and makes the user pick (and either way, this can always be overwritten by the user). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Adjust capitalization to our styleGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add missing divemaster field to the manual importGravatar Dirk Hohndel
No idea why I didn't notice earlier that this was missing. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Fix crash when importing CSV that requires change of separatorGravatar Dirk Hohndel
The dialog defaults to tab; if a file is indeed comma separated and one switches to that, data() could be called on a higher index before the model is re-populated. I'm a bit surprised why index.isValid() doesn't catch this, but the manual check appears to work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Do not allow the drop target to erase an old columnGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Fix moving columnsGravatar Tomaz Canabrava
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-06Remove data if it was correctly moved to the upper modelGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Make it possible to move from top to bottomGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add the code to actually make it possible to move columnsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Start to make it possible to move columns aroundGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add missing returnsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Remove drag operations from the 'From' widgetGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Remove pesky QDebug that snook inGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Port the code that actually parses the CSV to the new systemGravatar Tomaz Canabrava
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-06Do not accept drops from outside of subsurfaceGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Re-add the string to the avaliable models if drag cancelledGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Set data done, drag & drop worksGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Implement most of the drag operationGravatar Tomaz Canabrava
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-06Fix constructorGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add setData() to the ColumnResult modelGravatar Tomaz Canabrava
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-06Add the data() methodGravatar Tomaz Canabrava
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-06Add the setColumnValues() methodGravatar Tomaz Canabrava
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-06Implement LoadFileContentsGravatar Tomaz Canabrava
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-06Another skeleton: LoadFileContentsGravatar Tomaz Canabrava
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-06Set the model on the table view, one more skeletonGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add skeleton code for the model that will have the result of columnsGravatar Tomaz Canabrava
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-06Add skeleton code for the table view that will accepts dropsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Show the pixmap being draggedGravatar Tomaz Canabrava
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-06Re-add the string removed upon drop operationGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Remove the string from the model while draggingGravatar Tomaz Canabrava
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-06More DragDrop skeletonsGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Start to drag the correct valuesGravatar Tomaz Canabrava
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-06Add class skeleton that will handle the drag startsGravatar Tomaz Canabrava
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-06Display the list of column names on the ListViewGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-01-06Add data, row count and the string list that populate the modelGravatar Tomaz Canabrava
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-06Skeleton code for the model that has the columns informationGravatar Tomaz Canabrava
Just the skeleton, then start doing stuff. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>