1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
From 82dccbcff56fc32775dc715cecd7e1fc359d08aa Mon Sep 17 00:00:00 2001
From: Dirk Hohndel <dirk@hohndel.org>
Date: Sun, 25 Jan 2015 14:26:25 -0800
Subject: [PATCH] Make build with Qt4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
---
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 1b37258b2a47..114b275d985d 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
+ us->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 c6679255088c..a4d953ffe947 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -594,19 +594,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<int>() << Qt::CheckStateRole);
+#else
+ dataChanged(index(0, clickedIndex.row()), index(0, clickedIndex.row()));
+#endif
}
void DiveImportedModel::selectAll()
{
memset(checkStates, true, lastIndex - firstIndex);
+#if QT_VERSION >= 0x050000
dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+#else
+ dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1));
+#endif
}
void DiveImportedModel::selectNone()
{
memset(checkStates, false, lastIndex - firstIndex);
+#if QT_VERSION >= 0x050000
dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1), QVector<int>() << Qt::CheckStateRole);
+#else
+ dataChanged(index(0, 0), index(0, lastIndex - firstIndex - 1));
+#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 @@
</item>
<item row="5" column="1">
<widget class="QComboBox" name="rebreathermode">
- <property name="currentText">
- <string/>
+ <property name="currentIndex">
+ <number>0</number>
</property>
<property name="maxVisibleItems">
<number>6</number>
--
1.8.0.rc0.18.gf84667d
|