mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove all the no longer necessary code that aborts read of first V2 file
This was a poorly implemented hack when we executed the reverse geo lookup in the main thread and opening a V2 file could take a very long time. We need to do the "Welcome" message quite differently. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bd11988f74
commit
ccc9d80015
9 changed files with 4 additions and 75 deletions
3
dive.h
3
dive.h
|
@ -49,9 +49,6 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
extern int last_xml_version;
|
||||
extern bool abort_read_of_old_file;
|
||||
extern bool v2_question_shown;
|
||||
extern bool imported_via_xslt;
|
||||
|
||||
enum dive_comp_type {OC, CCR, PSCR, FREEDIVE, NUM_DC_TYPE}; // Flags (Open-circuit and Closed-circuit-rebreather) for setting dive computer type
|
||||
enum cylinderuse {OC_GAS, DILUENT, OXYGEN, NUM_GAS_USE}; // The different uses for cylinders
|
||||
|
|
9
file.c
9
file.c
|
@ -1168,16 +1168,7 @@ int parse_manual_file(const char *filename, int sepidx, int units, int dateforma
|
|||
if (try_to_xslt_open_csv(filename, &mem, "manualCSV"))
|
||||
return -1;
|
||||
|
||||
// right now input files created by XSLT processing report being v2 XML which makes
|
||||
// the parse function abort until the dialog about importing v2 files has been shown.
|
||||
// Until the XSLT has been updated we just override this check
|
||||
//
|
||||
// FIXME
|
||||
//
|
||||
bool remember = v2_question_shown;
|
||||
v2_question_shown = true;
|
||||
ret = parse_xml_buffer(filename, mem.buffer, mem.size, &dive_table, (const char **)params);
|
||||
v2_question_shown = remember;
|
||||
|
||||
free(mem.buffer);
|
||||
return ret;
|
||||
|
|
13
parse-xml.c
13
parse-xml.c
|
@ -22,9 +22,6 @@
|
|||
int verbose, quit;
|
||||
int metric = 1;
|
||||
int last_xml_version = -1;
|
||||
bool abort_read_of_old_file = false;
|
||||
bool v2_question_shown = false;
|
||||
bool imported_via_xslt = false;
|
||||
|
||||
static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params);
|
||||
|
||||
|
@ -1718,14 +1715,6 @@ static bool entry(const char *name, char *buf)
|
|||
if (!strncmp(name, "version.program", sizeof("version.program") - 1) ||
|
||||
!strncmp(name, "version.divelog", sizeof("version.divelog") - 1)) {
|
||||
last_xml_version = atoi(buf);
|
||||
if (last_xml_version < 3 && !v2_question_shown && !imported_via_xslt) {
|
||||
// let's ask the user what they want to do about reverse geo coding
|
||||
// and warn them that opening older XML files can take a while
|
||||
// since C code shouldn't call the UI we set a global flag and bail
|
||||
// from reading the file for now
|
||||
abort_read_of_old_file = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (in_userid) {
|
||||
try_to_fill_userid(name, buf);
|
||||
|
@ -1996,7 +1985,6 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
|
|||
}
|
||||
dive_end();
|
||||
xmlFreeDoc(doc);
|
||||
imported_via_xslt = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3213,7 +3201,6 @@ static xmlDoc *test_xslt_transforms(xmlDoc *doc, const char **params)
|
|||
}
|
||||
free((void *)attribute);
|
||||
}
|
||||
imported_via_xslt = true;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
xslt = get_stylesheet(info->file);
|
||||
if (xslt == NULL) {
|
||||
|
|
|
@ -574,7 +574,6 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy)
|
|||
|
||||
void DiveLogImportDialog::on_buttonBox_accepted()
|
||||
{
|
||||
imported_via_xslt = true;
|
||||
QStringList r = resultModel->result();
|
||||
if (ui->knownImports->currentText() != "Manual import") {
|
||||
for (int i = 0; i < fileNames.size(); ++i) {
|
||||
|
@ -594,7 +593,6 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
ui->CSVUnits->currentIndex(),
|
||||
delta.toUtf8().data()
|
||||
) < 0) {
|
||||
imported_via_xslt = false;
|
||||
return;
|
||||
}
|
||||
// Seabear CSV stores NDL and TTS in Minutes, not seconds
|
||||
|
@ -670,7 +668,6 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
|||
}
|
||||
process_dives(true, false);
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
imported_via_xslt = false;
|
||||
}
|
||||
|
||||
TagDragDelegate::TagDragDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
||||
|
|
|
@ -237,11 +237,6 @@ void MainTab::enableGeoLookupEdition()
|
|||
{
|
||||
ui.waitingSpinner->stop();
|
||||
ui.addDiveSite->show();
|
||||
// if we showed an informational text about loading the files, hide it, but don't
|
||||
// hide the message area if it contains other warnings
|
||||
if (MainWindow::instance()->getNotificationWidget()->getNotificationText() ==
|
||||
tr("Please Wait, Importing your files..."))
|
||||
MainWindow::instance()->getNotificationWidget()->hideNotification();
|
||||
}
|
||||
|
||||
void MainTab::disableGeoLookupEdition()
|
||||
|
|
|
@ -1495,24 +1495,6 @@ void MainWindow::importTxtFiles(const QStringList fileNames)
|
|||
refreshDisplay();
|
||||
}
|
||||
|
||||
void MainWindow::showV2Dialog()
|
||||
{
|
||||
// here we need to ask the user if / how they want to do the reverse geo coding
|
||||
//
|
||||
// since the reverse geo coding now happens in its own thread the warning isn't needed
|
||||
// anymore, but I'll leave this function / the logic to call it around because we are likely
|
||||
// too have to add questions about how the user wants to do the reverse geo coding...
|
||||
//
|
||||
#if 0
|
||||
QMessageBox d(QMessageBox::Information,
|
||||
tr("Welcom to Subsurface %1").arg(subsurface_version()),
|
||||
tr("Importing data files from earlier versions of Subsurface can take a significant amount of time"),
|
||||
QMessageBox::Ok,
|
||||
this);
|
||||
d.exec();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::loadFiles(const QStringList fileNames)
|
||||
{
|
||||
bool showWarning = false;
|
||||
|
@ -1537,14 +1519,6 @@ void MainWindow::loadFiles(const QStringList fileNames)
|
|||
getNotificationWidget()->showNotification(warning , KMessageWidget::Information);
|
||||
}
|
||||
} else {
|
||||
if (!v2_question_shown && abort_read_of_old_file) {
|
||||
v2_question_shown = true;
|
||||
abort_read_of_old_file = false;
|
||||
showV2Dialog();
|
||||
getNotificationWidget()->showNotification(tr("Please Wait, Importing your files..."), KMessageWidget::Information);
|
||||
i--; // so we re-try this file
|
||||
continue;
|
||||
}
|
||||
failedParses.append(fileNames.at(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,6 @@ public:
|
|||
void printPlan();
|
||||
void checkSurvey(QSettings *s);
|
||||
void setApplicationState(const QByteArray& state);
|
||||
void showV2Dialog();
|
||||
QUndoStack *undoStack;
|
||||
NotificationWidget *getNotificationWidget();
|
||||
void enableDisableCloudActions();
|
||||
|
|
|
@ -6,8 +6,7 @@ void TestParse::testParseCSV()
|
|||
{
|
||||
// some basic file parsing tests
|
||||
//
|
||||
// even with the V2 question not shown, CSV import should work
|
||||
v2_question_shown = false;
|
||||
// CSV import should work
|
||||
verbose = 1;
|
||||
QCOMPARE(parse_manual_file(SUBSURFACE_SOURCE "/dives/test41.csv",
|
||||
0, // tab separator
|
||||
|
@ -21,25 +20,16 @@ void TestParse::testParseCSV()
|
|||
|
||||
void TestParse::testParseV2NoQuestion()
|
||||
{
|
||||
// but parsing of a V2 file should fail
|
||||
v2_question_shown = false;
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test40.xml"), -1);
|
||||
// parsing of a V2 file should work
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test40.xml"), 0);
|
||||
}
|
||||
|
||||
void TestParse::testParseV3()
|
||||
{
|
||||
// while parsing of a V3 files should succeed
|
||||
v2_question_shown = false;
|
||||
// parsing of a V3 files should succeed
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test42.xml"), 0);
|
||||
}
|
||||
|
||||
void TestParse::testParseV2YesQuestion()
|
||||
{
|
||||
// once we claim to have shown the V2 question, parsing the V2 file should work as well
|
||||
v2_question_shown = true;
|
||||
QCOMPARE(parse_file(SUBSURFACE_SOURCE "/dives/test40.xml"), 0);
|
||||
}
|
||||
|
||||
void TestParse::testParseCompareOutput()
|
||||
{
|
||||
QCOMPARE(save_dives("./testout.ssrf"), 0);
|
||||
|
|
|
@ -8,7 +8,6 @@ class TestParse : public QObject{
|
|||
private slots:
|
||||
void testParseCSV();
|
||||
void testParseV2NoQuestion();
|
||||
void testParseV2YesQuestion();
|
||||
void testParseV3();
|
||||
void testParseCompareOutput();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue