summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-06 16:11:27 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-06 19:37:44 -0800
commitba30e938b3580bc04eda860b67e757aa3ecae305 (patch)
tree030624f48a2460f0b68bac7dc8287692e25817a4 /qt-ui
parentf1b90813cf2a76cd2f13344af8b240af46ed683f (diff)
downloadsubsurface-ba30e938b3580bc04eda860b67e757aa3ecae305.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divelogimportdialog.cpp13
-rw-r--r--qt-ui/divelogimportdialog.h4
-rw-r--r--qt-ui/mainwindow.cpp2
3 files changed, 14 insertions, 5 deletions
diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index 5f9d36543..41144b81c 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -9,6 +9,8 @@
#include <QMouseEvent>
#include <QDrag>
#include <QMimeData>
+#include <QFile>
+
const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = {
// time, depth, temperature, po2, cns, ndl, tts, stopdepth, pressure
{ "", },
@@ -172,12 +174,12 @@ void ColumnNameResult::setColumnValues(QList<QStringList> columns)
}
-DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDialog(parent),
+DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDialog(parent),
selector(true),
ui(new Ui::DiveLogImportDialog)
{
ui->setupUi(this);
- fileNames = *fn;
+ fileNames = fn;
column = 0;
/* Add indexes of XSLTs requiring special handling to the list */
@@ -196,6 +198,8 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList *fn, QWidget *parent) : QDi
ColumnNameResult *result = new ColumnNameResult(this);
ui->tableView->setModel(result);
+ loadFileContents();
+
/* manually import CSV file */
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close()));
@@ -208,6 +212,11 @@ DiveLogImportDialog::~DiveLogImportDialog()
delete ui;
}
+void DiveLogImportDialog::loadFileContents() {
+ QFile f(fileNames.first());
+
+}
+
#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() - 1 : -1)
void DiveLogImportDialog::on_buttonBox_accepted()
{
diff --git a/qt-ui/divelogimportdialog.h b/qt-ui/divelogimportdialog.h
index 06052f58b..bca7ecc36 100644
--- a/qt-ui/divelogimportdialog.h
+++ b/qt-ui/divelogimportdialog.h
@@ -73,7 +73,7 @@ class DiveLogImportDialog : public QDialog {
Q_OBJECT
public:
- explicit DiveLogImportDialog(QStringList *fn, QWidget *parent = 0);
+ explicit DiveLogImportDialog(QStringList fn, QWidget *parent = 0);
~DiveLogImportDialog();
private
@@ -81,7 +81,7 @@ slots:
void on_buttonBox_accepted();
void on_knownImports_currentIndexChanged(int index);
void unknownImports();
-
+ void loadFileContents();
private:
bool selector;
QStringList fileNames;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 2ae9b74f9..9186b7a0a 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -1361,7 +1361,7 @@ void MainWindow::on_actionImportDiveLog_triggered()
}
if (csvFiles.size()) {
- DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(&csvFiles, this);
+ DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(csvFiles, this);
diveLogImport->show();
process_dives(true, false);
refreshDisplay();