Partial fix for database upgrade loop.

Resmed loader still needs to return -1 on error.

Also fixed a crasher in MainWindow::finishCPAPImport.
This commit is contained in:
sawinglogz 2020-05-06 13:40:59 -04:00
parent ad15655ffb
commit d9386a993b
4 changed files with 10 additions and 8 deletions

View File

@ -566,11 +566,12 @@ void Profile::DataFormatError(Machine *m)
// Note: I deliberately haven't added a Profile help for this // Note: I deliberately haven't added a Profile help for this
if (backups) { if (backups) {
MachineLoader * loader = lookupLoader(m); MachineLoader * loader = lookupLoader(m);
/* int c = */ int c = mainwin->importCPAP(ImportPath(m->getBackupPath(), loader),
mainwin->importCPAP(ImportPath(m->getBackupPath(), loader), QObject::tr("Rebuilding from %1 Backup").arg(m->brand()));
QObject::tr("Rebuilding from %1 Backup").arg(m->brand())); if (c >= 0) {
// if ( c > 0 ) // Make sure the updated version gets saved, even if there were no sessions to import.
// m->info.version = loader->Version(); mainwin->finishCPAPImport();
}
} else { } else {
if (!p_profile->session->backupCardData()) { if (!p_profile->session->backupCardData()) {
// Automatic backups not available for Intellipap users yet, so don't taunt them.. // Automatic backups not available for Intellipap users yet, so don't taunt them..

View File

@ -72,7 +72,7 @@ void initializeLogger()
s_LoggerRunning.lock(); // wait until the thread begins running s_LoggerRunning.lock(); // wait until the thread begins running
s_LoggerRunning.unlock(); // we no longer need the lock s_LoggerRunning.unlock(); // we no longer need the lock
} }
qInstallMessageHandler(MyOutputHandler); qInstallMessageHandler(MyOutputHandler); // NOTE: comment this line out when debugging a crash, otherwise the deferred output will mislead you.
if (b) { if (b) {
qDebug() << "Started logging thread"; qDebug() << "Started logging thread";
} else { } else {

View File

@ -743,7 +743,8 @@ void MainWindow::finishCPAPImport()
GenerateStatistics(); GenerateStatistics();
profileSelector->updateProfileList(); profileSelector->updateProfileList();
welcome->refreshPage(); if (welcome)
welcome->refreshPage();
if (overview) { overview->ReloadGraphs(); } if (overview) { overview->ReloadGraphs(); }
if (daily) { if (daily) {

View File

@ -164,6 +164,7 @@ class MainWindow : public QMainWindow
void setStatsHTML(QString html); void setStatsHTML(QString html);
int importCPAP(ImportPath import, const QString &message); int importCPAP(ImportPath import, const QString &message);
void finishCPAPImport();
void startImportDialog() { on_action_Import_Data_triggered(); } void startImportDialog() { on_action_Import_Data_triggered(); }
@ -365,7 +366,6 @@ class MainWindow : public QMainWindow
private: private:
QString getMainWindowTitle(); QString getMainWindowTitle();
void importCPAPBackups(); void importCPAPBackups();
void finishCPAPImport();
QList<ImportPath> detectCPAPCards(); QList<ImportPath> detectCPAPCards();
QList<ImportPath> selectCPAPDataCards(const QString & prompt); QList<ImportPath> selectCPAPDataCards(const QString & prompt);
void importCPAPDataCards(const QList<ImportPath> & datacards); void importCPAPDataCards(const QList<ImportPath> & datacards);