mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
f1b90813cf
commit
ba30e938b3
3 changed files with 14 additions and 5 deletions
|
@ -9,6 +9,8 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = {
|
const DiveLogImportDialog::CSVAppConfig DiveLogImportDialog::CSVApps[CSVAPPS] = {
|
||||||
// time, depth, temperature, po2, cns, ndl, tts, stopdepth, pressure
|
// 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),
|
selector(true),
|
||||||
ui(new Ui::DiveLogImportDialog)
|
ui(new Ui::DiveLogImportDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
fileNames = *fn;
|
fileNames = fn;
|
||||||
column = 0;
|
column = 0;
|
||||||
|
|
||||||
/* Add indexes of XSLTs requiring special handling to the list */
|
/* 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);
|
ColumnNameResult *result = new ColumnNameResult(this);
|
||||||
ui->tableView->setModel(result);
|
ui->tableView->setModel(result);
|
||||||
|
|
||||||
|
loadFileContents();
|
||||||
|
|
||||||
/* manually import CSV file */
|
/* manually import CSV file */
|
||||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
||||||
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
||||||
|
@ -208,6 +212,11 @@ DiveLogImportDialog::~DiveLogImportDialog()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiveLogImportDialog::loadFileContents() {
|
||||||
|
QFile f(fileNames.first());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() - 1 : -1)
|
#define VALUE_IF_CHECKED(x) (ui->x->isEnabled() ? ui->x->value() - 1 : -1)
|
||||||
void DiveLogImportDialog::on_buttonBox_accepted()
|
void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
{
|
{
|
||||||
|
|
|
@ -73,7 +73,7 @@ class DiveLogImportDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DiveLogImportDialog(QStringList *fn, QWidget *parent = 0);
|
explicit DiveLogImportDialog(QStringList fn, QWidget *parent = 0);
|
||||||
~DiveLogImportDialog();
|
~DiveLogImportDialog();
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -81,7 +81,7 @@ slots:
|
||||||
void on_buttonBox_accepted();
|
void on_buttonBox_accepted();
|
||||||
void on_knownImports_currentIndexChanged(int index);
|
void on_knownImports_currentIndexChanged(int index);
|
||||||
void unknownImports();
|
void unknownImports();
|
||||||
|
void loadFileContents();
|
||||||
private:
|
private:
|
||||||
bool selector;
|
bool selector;
|
||||||
QStringList fileNames;
|
QStringList fileNames;
|
||||||
|
|
|
@ -1361,7 +1361,7 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csvFiles.size()) {
|
if (csvFiles.size()) {
|
||||||
DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(&csvFiles, this);
|
DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(csvFiles, this);
|
||||||
diveLogImport->show();
|
diveLogImport->show();
|
||||||
process_dives(true, false);
|
process_dives(true, false);
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
|
|
Loading…
Add table
Reference in a new issue