From 272d07665b5f47b8396aac56f29ab4b7a9cd8902 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 3 Dec 2011 15:10:23 +1000 Subject: [PATCH] Fix minor profile/import selectionbugs --- daily.cpp | 2 ++ mainwindow.cpp | 30 ++++++++++++++++-------------- newprofile.cpp | 2 +- preferencesdialog.cpp | 6 +++--- preferencesdialog.ui | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/daily.cpp b/daily.cpp index abb5bce6..dc69926c 100644 --- a/daily.cpp +++ b/daily.cpp @@ -1415,6 +1415,7 @@ void Daily::on_weightSpinBox_valueChanged(double arg1) if ((height>0) && (kg>0)) { double bmi=kg/(height * height); ui->BMI->display(bmi); + ui->BMI->setVisible(true); //ui->BMI->setDigitCount(5); //ui->BMI->setSmallDecimalPoint(true); } @@ -1427,6 +1428,7 @@ void Daily::on_ouncesSpinBox_valueChanged(int arg1) if ((height>0) && (kg>0)) { double bmi=kg/(height * height); ui->BMI->display(bmi); + ui->BMI->setVisible(true); //ui->BMI->setDigitCount(5); //ui->BMI->setSmallDecimalPoint(true); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 6d472f6d..0c9fd9c9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -264,6 +264,8 @@ void MainWindow::on_action_Import_Data_triggered() if (res==2) return; } + QStringList importFrom=importLocations; + if (asknew) { QFileDialog w; w.setFileMode(QFileDialog::DirectoryOnly); @@ -282,32 +284,27 @@ void MainWindow::on_action_Import_Data_triggered() } for (int i=0;isetValue(0); qprogress->show(); qstatus->setText(tr("Importing Data")); int c=PROFILE.Import(dir); - if (!c) { - mainwin->Notify("Import Problem\n\nCouldn't Find any Machine Data at this location:\n"+dir); - if (newdir==dir) addnew=false; // Don't bother asking to add it. - } qDebug() << "Finished Importing data" << c; if (c) { + if (!importLocations.contains(dir)) + goodlocations.push_back(dir); successful=true; } qstatus->setText(""); @@ -318,7 +315,10 @@ void MainWindow::on_action_Import_Data_triggered() PROFILE.Save(); if (daily) daily->ReloadGraphs(); if (overview) overview->ReloadGraphs(); - if (addnew && (QMessageBox::question(this,"Remember this Location?","Would you like to remember this import location for next time?\n"+newdir,QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes)) { + if ((goodlocations.size()>0) && (QMessageBox::question(this,"Remember this Location?","Would you like to remember this import location for next time?\n"+newdir,QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes)) { + for (int i=0;iNotify("Import Problem\n\nCouldn't find any new Machine Data at the locations given"); } } QMenu * MainWindow::CreateMenu(QString title) diff --git a/newprofile.cpp b/newprofile.cpp index 418b56a8..33c267e9 100644 --- a/newprofile.cpp +++ b/newprofile.cpp @@ -163,7 +163,7 @@ void NewProfile::on_nextButton_clicked() if (prof["Units"].toString()!=ui->heightCombo->currentText()) { prof["Units"]=ui->heightCombo->currentText(); - mainwin->getDaily()->UnitsChanged(); + if (mainwin && mainwin->getDaily()) mainwin->getDaily()->UnitsChanged(); } double v=0; if (ui->heightCombo->currentIndex()==1) { diff --git a/preferencesdialog.cpp b/preferencesdialog.cpp index ad908309..3363a5bb 100644 --- a/preferencesdialog.cpp +++ b/preferencesdialog.cpp @@ -70,8 +70,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : ui->startedUsingMask->calendarWidget()->setWeekdayTextFormat(Qt::Saturday, format); ui->startedUsingMask->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format); - - //ui->leakProfile->setColumnWidth(1,ui->leakProfile->width()/2); { @@ -220,7 +218,9 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) : ui->oximetryGroupBox->setChecked((*profile)["EnableOximetry"].toBool()); ui->oximetrySync->setChecked((*profile)["SyncOximetry"].toBool()); - ui->oximetryType->setCurrentIndex(ui->oximetryType->findText((*profile)["OximeterType"].toString(),Qt::MatchExactly)); + int ot=ui->oximetryType->findText((*profile)["OximeterType"].toString(),Qt::MatchExactly); + if (ot<0) ot=0; + ui->oximetryType->setCurrentIndex(ot); ui->eventTable->setColumnWidth(0,40); ui->eventTable->setColumnWidth(1,55); diff --git a/preferencesdialog.ui b/preferencesdialog.ui index 6059ed68..89e68fd0 100644 --- a/preferencesdialog.ui +++ b/preferencesdialog.ui @@ -38,7 +38,7 @@ - 0 + 4