Fix minor profile/import selectionbugs

This commit is contained in:
Mark Watkins 2011-12-03 15:10:23 +10:00
parent d206e98008
commit 272d07665b
5 changed files with 23 additions and 19 deletions

View File

@ -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);
}

View File

@ -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;i<w.selectedFiles().size();i++) {
QString newdir=w.selectedFiles().at(i);
if (!importLocations.contains(newdir)) {
importLocations.append(newdir);
if (!importFrom.contains(newdir)) {
importFrom.append(newdir);
addnew=true;
}
}
/*newdir=QFileDialog::getExistingDirectory(this,"Select a folder to import","",QFileDialog::ShowDirsOnly);
if (newdir.isEmpty()) {
// inform the user or just abort?
return;
} */
}
int successful=false;
for (int i=0;i<importLocations.size();i++) {
QString dir=importLocations[i];
QStringList goodlocations;
for (int i=0;i<importFrom.size();i++) {
QString dir=importFrom[i];
if (!dir.isEmpty()) {
qprogress->setValue(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;i<goodlocations.size();i++) {
importLocations.push_back(goodlocations[i]);
}
QString filename=PROFILE.Get("{DataFolder}/ImportLocations.txt");
QFile file(filename);
file.open(QFile::WriteOnly);
@ -329,6 +329,8 @@ void MainWindow::on_action_Import_Data_triggered()
}
file.close();
}
} else {
mainwin->Notify("Import Problem\n\nCouldn't find any new Machine Data at the locations given");
}
}
QMenu * MainWindow::CreateMenu(QString title)

View File

@ -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) {

View File

@ -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);

View File

@ -38,7 +38,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<widget class="QWidget" name="importTab">
<attribute name="title">