From 6c59f4c0fa925d1254668390f32229da93b44c75 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 28 Jan 2015 14:42:12 -0800 Subject: [PATCH] Make build with Qt4 Signed-off-by: Dirk Hohndel Conflicts: qt-ui/downloadfromdivecomputer.cpp --- qt-ui/divelogimportdialog.cpp | 30 ++++++++++++++++++++++++++++++ qt-ui/downloadfromdivecomputer.cpp | 12 ++++++++++++ qt-ui/plannerSettings.ui | 4 ++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp index 5cda9036eb94..57648e081050 100644 --- a/qt-ui/divelogimportdialog.cpp +++ b/qt-ui/divelogimportdialog.cpp @@ -375,14 +375,22 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) seabear = true; firstLine = "Sample time;Sample depth;Sample NDL;Sample TTS;Sample stopdepth;Sample temperature;Sample pressure"; blockSignals(true); +#if QT_VERSION >= 0x050000 ui->knownImports->setCurrentText("Seabear CSV"); +#else + ui->knownImports->setCurrentIndex(4); +#endif blockSignals(false); } else if (firstLine.contains("Tauchgangs-Nr.:")) { xp5 = true; //"Abgelaufene Tauchzeit (Std:Min.)\tTiefe\tStickstoff Balkenanzeige\tSauerstoff Balkenanzeige\tAufstiegsgeschwindigkeit\tRestluftzeit\tRestliche Tauchzeit\tDekompressionszeit (Std:Min)\tDekostopp-Tiefe\tTemperatur\tPO2\tPressluftflasche\tLesen des Druckes\tStatus der Verbindung\tTauchstatus"; firstLine = "Sample time\tSample depth\t\t\t\t\t\t\t\tSample temperature\t"; blockSignals(true); +#if QT_VERSION >= 0x050000 ui->knownImports->setCurrentText("XP5"); +#else + ui->knownImports->setCurrentIndex(2); +#endif blockSignals(false); } @@ -390,7 +398,11 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) if (triggeredBy == KNOWNTYPES && value == 1) { firstLine = "Sample time\tSample depth\t\t\t\t\tSample pO₂\t\t\t\t\t\t\t\t\tSample temperature\t\tSample CNS\tSample stopdepth"; blockSignals(true); +#if QT_VERSION >= 0x050000 ui->CSVSeparator->setCurrentText(tr("Tab")); +#else + ui->CSVSeparator->setCurrentIndex(0); +#endif blockSignals(false); } @@ -409,7 +421,16 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) separator = ";"; if (ui->CSVSeparator->currentText() != separator) { blockSignals(true); +#if QT_VERSION >= 0x050000 ui->CSVSeparator->setCurrentText(separator); +#else + if (separator == "Tab") + ui->CSVSeparator->setCurrentIndex(0); + else if (separator == ",") + ui->CSVSeparator->setCurrentIndex(1); + else + ui->CSVSeparator->setCurrentIndex(2); +#endif blockSignals(false); currColumns = firstLine.split(separator); } @@ -460,7 +481,16 @@ void DiveLogImportDialog::loadFileContents(int value, whatChanged triggeredBy) if (ui->CSVSeparator->currentText() != separator || separator == "Tab") { ui->CSVSeparator->blockSignals(true); +#if QT_VERSION >= 0x050000 ui->CSVSeparator->setCurrentText(separator); +#else + if (separator == "Tab") + ui->CSVSeparator->setCurrentIndex(0); + else if (separator == ",") + ui->CSVSeparator->setCurrentIndex(1); + else + ui->CSVSeparator->setCurrentIndex(2); +#endif ui->CSVSeparator->blockSignals(false); if (separator == "Tab") separator = "\t"; diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp index cd3dd90d0cc2..e5ddab840b03 100644 --- a/qt-ui/downloadfromdivecomputer.cpp +++ b/qt-ui/downloadfromdivecomputer.cpp @@ -600,19 +600,31 @@ QVariant DiveImportedModel::data(const QModelIndex &index, int role) const void DiveImportedModel::changeSelected(QModelIndex clickedIndex) { checkStates[clickedIndex.row()] = !checkStates[clickedIndex.row()]; +#if QT_VERSION >= 0x050000 dataChanged(index(0, clickedIndex.row()), index(0, clickedIndex.row()), QVector() << Qt::CheckStateRole); +#else + dataChanged(index(0, clickedIndex.row()), index(0, clickedIndex.row())); +#endif } void DiveImportedModel::selectAll() { memset(checkStates, true, lastIndex - firstIndex + 1); +#if QT_VERSION >= 0x050000 dataChanged(index(0, 0), index(0, lastIndex - firstIndex), QVector() << Qt::CheckStateRole); +#else + dataChanged(index(0, 0), index(0, lastIndex - firstIndex)); +#endif } void DiveImportedModel::selectNone() { memset(checkStates, false, lastIndex - firstIndex + 1); +#if QT_VERSION >= 0x050000 dataChanged(index(0, 0), index(0, lastIndex - firstIndex), QVector() << Qt::CheckStateRole); +#else + dataChanged(index(0, 0), index(0, lastIndex - firstIndex )); +#endif } Qt::ItemFlags DiveImportedModel::flags(const QModelIndex &index) const diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui index af03fd1fbfb9..aaf99750e26f 100644 --- a/qt-ui/plannerSettings.ui +++ b/qt-ui/plannerSettings.ui @@ -338,8 +338,8 @@ - - + + 0 6 -- 1.8.0.rc0.18.gf84667d