Compare commits

...

16 Commits

Author SHA1 Message Date
Dirk Hohndel
26349a94ab Initialize device_data_t data
If the user never clicks on the log and dump checkboxes (and that's what
we expect to be the case by default), then the log / dump flags (and
filenames) were never initialized.

I am reasonably certain this will close the following three bugs, that all
show the same symptom: they behave as if libdivecomputer dump was set,
even if it wasn't.

Fixes: #426
Fixes: #431
Fixes: #435

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-02-15 06:30:10 -08:00
Dirk Hohndel
f2ba929839 Used the wrong approach to signing on 10.9
This should work better

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 15:19:58 -08:00
Dirk Hohndel
3e2d757bb1 We need the full version
Clearly the version generation stuff wasn't ported correctly to qmake.
Or something got lost. Just always calling the linux version to get the right
response to the --version option.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 13:28:07 -08:00
Dirk Hohndel
53326b4ec6 Modify signing script for 10.9 / Qt5.2
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 13:22:49 -08:00
Dirk Hohndel
c4e43fda68 Qt5 is unhappy with TRUE/FALSE
So replace them with true/false.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 11:33:10 -08:00
Thiago Macieira
c127a6516d Fix creating the list of Qt translation files under Qt5
We were apparently exploiting a bug in qmake for Qt 4. The $$join
function in Qt 5 is fixed: it returns a single string, not a list with
multiple elements.

Instead, we just iterate over the element list.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:26:41 -08:00
Anton Lundin
74568f0314 In Qt5 reset() is depricated.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:13:38 -08:00
Anton Lundin
21655131c9 Resync included header with upstream
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:12:22 -08:00
Anton Lundin
ba2b6fe3b8 QAbstractItemModel::reset doesn't exist in Qt5
Let the library resolve this one instead.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:11:57 -08:00
Anton Lundin
749bc6023e Make this code Qt5 compatible
The method have bin renamed in Qt5.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:11:41 -08:00
Anton Lundin
42fad46ae3 Make the include Qt5 compatible
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:11:30 -08:00
Anton Lundin
f62f17ea7d Use setSectionResizeMode if we use Qt5
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:11:00 -08:00
Anton Lundin
dfddce5616 Port this code to work with Qt5
This code had parts that where Qt5-compatible, this introduces the last
bits that it needs to be completely compatible.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:10:42 -08:00
Anton Lundin
a1b9d353e8 Add some missing ; in the Qt5 path
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:10:29 -08:00
Anton Lundin
8112f193bd Use the right Qt-module when building with Qt5
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:10:14 -08:00
Anton Lundin
4c98d0e1c7 Fix linking order of libxslt and libxml
libxslt depends on libxml, so we need xslt before xml on the linker-line.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2014-01-25 08:09:48 -08:00
21 changed files with 183 additions and 117 deletions

View File

@ -11,7 +11,7 @@
<key>CFBundleSignature</key>
<string>SBSF</string>
<key>CFBundleExecutable</key>
<string>subsurface</string>
<string>Subsurface</string>
<key>CFBundleIdentifier</key>
<string>org.hohndel.subsurface</string>
<key>CFBundleInfoDictionaryVersion</key>

View File

@ -2,24 +2,51 @@
# Hash is 3A8CE62A483083EDEA5581A61E770EC1FA8BECE8 but it doesn't seem to
# find the key by hash
echo -- copy over the Info.plist files
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtCore.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtCore.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtGui.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtGui.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtNetwork.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtNetwork.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtScript.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtScript.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtSql.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtSql.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtSvg.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtSvg.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtWebKit.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtWebKit.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtMultimedia.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtMultimedia.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtMultimediaWidgets.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtMultimediaWidgets.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtOpenGL.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtOpenGL.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtPositioning.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtPositioning.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtPrintSupport.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtPrintSupport.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtQml.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtQml.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtQuick.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtQuick.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtSensors.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtSensors.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtWebKitWidgets.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtWebKitWidgets.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtWidgets.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtWidgets.framework/Resources/
cp ~/Qt5.2.0/5.2.0/clang_64/lib/QtXml.framework/Contents/Info.plist staging/Subsurface.app/Contents/Frameworks/QtXml.framework/Resources/
echo -- signing staging/Subsurface.app
cd staging
echo -- signing Qt frameworks
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtCore.framework/Versions/4/QtCore
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtDeclarative.framework/Versions/4/QtDeclarative
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtGui.framework/Versions/4/QtGui
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtScript.framework/Versions/4/QtScript
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtSql.framework/Versions/4/QtSql
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtSvg.framework/Versions/4/QtSvg
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebkit
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtXml.framework/Versions/4/QtXml
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app//Contents/Frameworks/QtXmlPatterns.framework/Versions/4/QtXmlPatterns
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtCore.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtGui.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtNetwork.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtScript.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtSql.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtSvg.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtWebKit.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtMultimedia.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtMultimediaWidgets.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtOpenGL.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtPositioning.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtPrintSupport.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtQml.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtQuick.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtSensors.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtWebKitWidgets.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtWidgets.framework/
codesign --verbose --force -s G2PU7Q4ELP staging/Subsurface.app/Contents/Frameworks/QtXml.framework/
echo -- signing plugins
find ./Subsurface.app/Contents/PlugIns -name \*.dylib | xargs codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk
find staging/Subsurface.app/Contents -name \*.dylib | xargs codesign --verbose --force -s G2PU7Q4ELP
echo -- finally sign .app
codesign --keychain /Users/hohndel/Library/Keychains/login.keychain -s Dirk ./Subsurface.app
codesign --verbose --force -s G2PU7Q4ELP -v staging/Subsurface.app/Contents/MacOS/Subsurface
codesign --verbose --force -s G2PU7Q4ELP -v staging/Subsurface.app

View File

@ -60,7 +60,7 @@ void CSVImportDialog::on_buttonBox_accepted()
free(error);
error = NULL;
}
process_dives(TRUE, FALSE);
process_dives(true, false);
mainWindow()->refreshDisplay();
}

View File

@ -319,7 +319,11 @@ void DiveListView::reload(DiveTripModel::Layout layout, bool forceSort)
layout = currentLayout;
else
currentLayout = layout;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
header()->setClickable(true);
#else
header()->setSectionsClickable(true);
#endif
connect(header(), SIGNAL(sectionPressed(int)), this, SLOT(headerClicked(int)), Qt::UniqueConnection);
QSortFilterProxyModel *m = qobject_cast<QSortFilterProxyModel*>(model());
@ -529,7 +533,7 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset)
reload(currentLayout, false);
fixMessyQtModelBehaviour();
restoreSelection();
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
}
void DiveListView::mergeTripAbove()
@ -548,13 +552,13 @@ void DiveListView::removeFromTrip()
struct dive *d;
for_each_dive(i, d) {
if (d->selected)
remove_dive_from_trip(d, FALSE);
remove_dive_from_trip(d, false);
}
rememberSelection();
reload(currentLayout, false);
fixMessyQtModelBehaviour();
restoreSelection();
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
}
void DiveListView::newTripAbove()
@ -573,7 +577,7 @@ void DiveListView::newTripAbove()
trip->expanded = 1;
reload(currentLayout, false);
fixMessyQtModelBehaviour();
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
restoreSelection();
}
@ -616,7 +620,7 @@ void DiveListView::addToTripAbove()
}
}
trip->expanded = 1;
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
reload(currentLayout, false);
restoreSelection();
fixMessyQtModelBehaviour();
@ -637,9 +641,9 @@ void DiveListView::markDiveInvalid()
if (amount_selected == 0) {
mainWindow()->cleanUpEmpty();
}
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
mainWindow()->refreshDisplay();
if(prefs.display_invalid_dives == FALSE) {
if(prefs.display_invalid_dives == false) {
clearSelection();
// select top dive that isn't marked invalid
rememberSelection();
@ -668,7 +672,7 @@ void DiveListView::deleteDive()
if (amount_selected == 0) {
mainWindow()->cleanUpEmpty();
}
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
mainWindow()->refreshDisplay();
if(lastDiveNr != -1){
clearSelection();
@ -766,7 +770,7 @@ void DiveListView::saveSelectedDivesAs()
settings.endGroup();
QByteArray bt = QFile::encodeName(fileName);
save_dives_logic(bt.data(), TRUE);
save_dives_logic(bt.data(), true);
}
void DiveListView::exportSelectedDivesAsUDDF()

View File

@ -1490,7 +1490,7 @@ void DivePlannerPointsModel::createPlan()
cyl->end.mbar = cyl->start.mbar - consumption;
}
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
// Remove and clean the diveplan, so we don't delete
// the dive by mistake.

View File

@ -77,6 +77,7 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget* parent, Qt::WindowFlags f) :
timer->setInterval(200);
connect(timer, SIGNAL(timeout()), this, SLOT(updateProgressBar()));
updateState(INITIAL);
memset(&data, 0, sizeof(data));
}
void DownloadFromDCWidget::runDialog()
@ -348,7 +349,7 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
for (int i = dive_table.nr - 1; i >= previousLast; i--)
delete_single_dive(i);
} else {
process_dives(TRUE, preferDownloaded());
process_dives(true, preferDownloaded());
}
} else {
updateState(CANCELLED);

View File

@ -266,7 +266,7 @@ void GlobeGPS::changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::U
}
centerOn(lon, lat, true);
editingDiveLocation = false;
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
mainWindow()->refreshDisplay();
}

View File

@ -30,7 +30,7 @@
#ifndef __GROUPEDLINEEDIT_H__
#define __GROUPEDLINEEDIT_H__
#include <QtGui/QPlainTextEdit>
#include <QPlainTextEdit>
#include <QStringList>
class GroupedLineEdit : public QPlainTextEdit

View File

@ -358,7 +358,7 @@ void MainTab::clearStats()
if (!d || d->field.mkelvin == 0) \
ui.field->setText(""); \
else \
ui.field->setText(get_temperature_string(d->field, TRUE))
ui.field->setText(get_temperature_string(d->field, true))
bool MainTab::isEditing()
{
@ -461,29 +461,29 @@ void MainTab::updateDiveInfo(int dive)
taglist_get_tagstring(d->tag_list, buf, 1024);
ui.tagWidget->setText(QString(buf));
}
ui.maximumDepthText->setText(get_depth_string(d->maxdepth, TRUE));
ui.averageDepthText->setText(get_depth_string(d->meandepth, TRUE));
ui.maximumDepthText->setText(get_depth_string(d->maxdepth, true));
ui.averageDepthText->setText(get_depth_string(d->meandepth, true));
ui.otuText->setText(QString("%1").arg(d->otu));
ui.waterTemperatureText->setText(get_temperature_string(d->watertemp, TRUE));
ui.airTemperatureText->setText(get_temperature_string(d->airtemp, TRUE));
ui.waterTemperatureText->setText(get_temperature_string(d->watertemp, true));
ui.airTemperatureText->setText(get_temperature_string(d->airtemp, true));
volume_t gases[MAX_CYLINDERS] = {};
get_gas_used(d, gases);
QString volumes = get_volume_string(gases[0], TRUE);
QString volumes = get_volume_string(gases[0], true);
int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS];
per_cylinder_mean_depth(d, select_dc(&d->dc), mean, duration);
volume_t sac;
QString SACs;
if (mean[0] && duration[0]) {
sac.mliter = gases[0].mliter * 1000.0 / (depth_to_mbar(mean[0], d) * duration[0] / 60.0);
SACs = get_volume_string(sac, TRUE).append(tr("/min"));
SACs = get_volume_string(sac, true).append(tr("/min"));
} else {
SACs = QString(tr("unknown"));
}
for(int i=1; i < MAX_CYLINDERS && gases[i].mliter != 0; i++) {
volumes.append("\n" + get_volume_string(gases[i], TRUE));
volumes.append("\n" + get_volume_string(gases[i], true));
if (duration[i]) {
sac.mliter = gases[i].mliter * 1000.0 / (depth_to_mbar(mean[i], d) * duration[i] / 60);
SACs.append("\n" + get_volume_string(sac, TRUE).append(tr("/min")));
SACs.append("\n" + get_volume_string(sac, true).append(tr("/min")));
} else {
SACs.append("\n");
}
@ -509,17 +509,17 @@ void MainTab::updateDiveInfo(int dive)
ui.salinityText->setText(QString("%1g/l").arg(d->salinity/10.0));
else
ui.salinityText->clear();
ui.depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, TRUE));
ui.depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, TRUE));
ui.depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, TRUE));
ui.sacLimits->setMaximum(get_volume_string(stats_selection.max_sac, TRUE).append(tr("/min")));
ui.sacLimits->setMinimum(get_volume_string(stats_selection.min_sac, TRUE).append(tr("/min")));
ui.sacLimits->setAverage(get_volume_string(stats_selection.avg_sac, TRUE).append(tr("/min")));
ui.depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true));
ui.depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, true));
ui.depthLimits->setAverage(get_depth_string(stats_selection.avg_depth, true));
ui.sacLimits->setMaximum(get_volume_string(stats_selection.max_sac, true).append(tr("/min")));
ui.sacLimits->setMinimum(get_volume_string(stats_selection.min_sac, true).append(tr("/min")));
ui.sacLimits->setAverage(get_volume_string(stats_selection.avg_sac, true).append(tr("/min")));
ui.divesAllText->setText(QString::number(stats_selection.selection_size));
temp.mkelvin = stats_selection.max_temp;
ui.tempLimits->setMaximum(get_temperature_string(temp, TRUE));
ui.tempLimits->setMaximum(get_temperature_string(temp, true));
temp.mkelvin = stats_selection.min_temp;
ui.tempLimits->setMinimum(get_temperature_string(temp, TRUE));
ui.tempLimits->setMinimum(get_temperature_string(temp, true));
if (stats_selection.combined_temp && stats_selection.combined_count) {
const char *unit;
get_temp_units(0, &unit);
@ -580,7 +580,7 @@ void MainTab::acceptChanges()
if (mainWindow() && mainWindow()->dive_list()->selectedTrips().count() == 1) {
if (notesBackup[NULL].notes != ui.notes->toPlainText() ||
notesBackup[NULL].location != ui.location->text())
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
} else {
struct dive *curr = current_dive;
//Reset coordinates field, in case it contains garbage.
@ -597,7 +597,7 @@ void MainTab::acceptChanges()
notesBackup[curr].datetime != ui.dateTimeEdit->dateTime().toString() ||
notesBackup[curr].visibility != ui.rating->currentStars() ||
notesBackup[curr].tags != ui.tagWidget->text()) {
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
}
if (notesBackup[curr].location != ui.location->text() ||
notesBackup[curr].coordinates != ui.coordinates->text()) {
@ -609,7 +609,7 @@ void MainTab::acceptChanges()
if (editMode == MANUALLY_ADDED_DIVE) {
DivePlannerPointsModel::instance()->copyCylinders(curr);
} else if (editMode != ADD && cylindersModel->changed) {
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
Q_FOREACH (dive *d, notesBackup.keys()) {
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (notesBackup.keys().count() > 1)
@ -622,7 +622,7 @@ void MainTab::acceptChanges()
}
if (weightModel->changed) {
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
Q_FOREACH (dive *d, notesBackup.keys()) {
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) {
d->weightsystem[i] = multiEditEquipmentPlaceholder.weightsystem[i];
@ -644,7 +644,7 @@ void MainTab::acceptChanges()
current_dive->number = get_dive(dive_table.nr - 2)->number + 1;
DivePlannerPointsModel::instance()->cancelPlan();
mainWindow()->showProfile();
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
}
// each dive that was selected might have had the temperatures in its active divecomputer changed
@ -872,7 +872,7 @@ void MainTab::saveTags()
QString tag;
taglist_clear(mydive->tag_list);
foreach (tag, ui.tagWidget->getBlockStringList())
taglist_add_tag(mydive->tag_list, tag.toAscii().data());
taglist_add_tag(mydive->tag_list, tag.toUtf8().data());
);
}

View File

@ -149,7 +149,7 @@ void MainWindow::on_actionClose_triggered()
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
return;
}
if (unsaved_changes() && (askSaveChanges() == FALSE))
if (unsaved_changes() && (askSaveChanges() == false))
return;
/* free the dives and trips */
@ -162,7 +162,7 @@ void MainWindow::on_actionClose_triggered()
existing_filename = NULL;
cleanUpEmpty();
mark_divelist_changed(FALSE);
mark_divelist_changed(false);
clear_events();
}
@ -255,7 +255,7 @@ void MainWindow::on_actionQuit_triggered()
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
return;
}
if (unsaved_changes() && (askSaveChanges() == FALSE))
if (unsaved_changes() && (askSaveChanges() == false))
return;
writeSettings();
QApplication::quit();
@ -573,7 +573,7 @@ bool MainWindow::askSaveChanges()
#define GET_BOOL(name, field) \
v = s.value(QString(name)); \
if (v.isValid()) \
prefs.field = v.toInt() ? TRUE : FALSE; \
prefs.field = v.toInt() ? true : false; \
else \
prefs.field = default_prefs.field
@ -716,7 +716,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
helpView->deleteLater();
}
if (unsaved_changes() && (askSaveChanges() == FALSE)) {
if (unsaved_changes() && (askSaveChanges() == false)) {
event->ignore();
return;
}
@ -761,9 +761,9 @@ void MainWindow::file_save_as(void)
ui.InfoWidget->acceptChanges();
save_dives(filename.toUtf8().data());
set_filename(filename.toUtf8().data(), TRUE);
set_filename(filename.toUtf8().data(), true);
setTitle(MWTF_FILENAME);
mark_divelist_changed(FALSE);
mark_divelist_changed(false);
}
}
@ -786,7 +786,7 @@ void MainWindow::file_save(void)
current_def_dir.mkpath(current_def_dir.absolutePath());
}
save_dives(existing_filename);
mark_divelist_changed(FALSE);
mark_divelist_changed(false);
}
void MainWindow::showError(QString message)
@ -834,7 +834,7 @@ void MainWindow::importFiles(const QStringList fileNames)
error = NULL;
}
}
process_dives(TRUE, FALSE);
process_dives(true, false);
refreshDisplay();
}
@ -849,7 +849,7 @@ void MainWindow::loadFiles(const QStringList fileNames)
for (int i = 0; i < fileNames.size(); ++i) {
fileNamePtr = QFile::encodeName(fileNames.at(i));
parse_file(fileNamePtr.data(), &error);
set_filename(fileNamePtr.data(), TRUE);
set_filename(fileNamePtr.data(), true);
setTitle(MWTF_FILENAME);
if (error != NULL) {
@ -858,7 +858,7 @@ void MainWindow::loadFiles(const QStringList fileNames)
}
}
process_dives(FALSE, FALSE);
process_dives(false, false);
refreshDisplay();
ui.actionAutoGroup->setChecked(autogroup);
@ -868,7 +868,7 @@ void MainWindow::on_actionImportCSV_triggered()
{
CSVImportDialog *csvImport = new CSVImportDialog();
csvImport->show();
process_dives(TRUE, FALSE);
process_dives(true, false);
refreshDisplay();
}

View File

@ -13,7 +13,9 @@
// -> does not appear to be needed #include "marble_export.h"
#include <QtCore/QAbstractItemModel>
#include <QAbstractItemModel>
class QItemSelectionModel;
namespace Marble
{
@ -70,7 +72,9 @@ class MARBLE_EXPORT GeoDataTreeModel : public QAbstractItemModel
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
void reset() { QAbstractItemModel::reset(); }
void reset();
QItemSelectionModel *selectionModel();
public Q_SLOTS:
@ -82,11 +86,11 @@ public Q_SLOTS:
void setRootDocument( GeoDataDocument *document );
GeoDataDocument* rootDocument();
int addFeature( GeoDataContainer *parent, GeoDataFeature *feature );
int addFeature( GeoDataContainer *parent, GeoDataFeature *feature, int row = -1 );
bool removeFeature( GeoDataContainer *parent, int index );
bool removeFeature( GeoDataFeature *feature );
int removeFeature( const GeoDataFeature *feature );
void updateFeature( GeoDataFeature *feature );

View File

@ -112,23 +112,23 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
break;
case SIZE:
if (cyl->type.size.mliter)
ret = get_volume_string(cyl->type.size, TRUE, cyl->type.workingpressure.mbar);
ret = get_volume_string(cyl->type.size, true, cyl->type.workingpressure.mbar);
break;
case WORKINGPRESS:
if (cyl->type.workingpressure.mbar)
ret = get_pressure_string(cyl->type.workingpressure, TRUE);
ret = get_pressure_string(cyl->type.workingpressure, true);
break;
case START:
if (cyl->start.mbar)
ret = get_pressure_string(cyl->start, TRUE);
ret = get_pressure_string(cyl->start, true);
else if (cyl->sample_start.mbar)
ret = get_pressure_string(cyl->sample_start, TRUE);
ret = get_pressure_string(cyl->sample_start, true);
break;
case END:
if (cyl->end.mbar)
ret = get_pressure_string(cyl->end, TRUE);
ret = get_pressure_string(cyl->end, true);
else if (cyl->sample_end.mbar)
ret = get_pressure_string(cyl->sample_end, TRUE);
ret = get_pressure_string(cyl->sample_end, true);
break;
case O2:
ret = percent_string(cyl->gasmix.o2);
@ -137,7 +137,7 @@ QVariant CylindersModel::data(const QModelIndex& index, int role) const
ret = percent_string(cyl->gasmix.he);
break;
case DEPTH:
ret = get_depth_string(cyl->depth, TRUE);
ret = get_depth_string(cyl->depth, true);
break;
}
break;
@ -211,7 +211,7 @@ bool CylindersModel::setData(const QModelIndex& index, const QVariant& value, in
QModelIndexList matches = tanks->match(tanks->index(0,0), Qt::DisplayRole, cyl->type.description);
cyl->type.size = string_to_volume(vString.toUtf8().data(), cyl->type.workingpressure);
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
if (!matches.isEmpty())
tanks->setData(tanks->index(matches.first().row(), TankInfoModel::ML), cyl->type.size.mliter);
changed = true;
@ -393,7 +393,7 @@ QVariant WeightModel::data(const QModelIndex& index, int role) const
ret = gettextFromC::instance()->tr(ws->description);
break;
case WEIGHT:
ret = get_weight_string(ws->weight, TRUE);
ret = get_weight_string(ws->weight, true);
break;
}
break;
@ -646,7 +646,7 @@ bool WSInfoModel::setData(const QModelIndex& index, const QVariant& value, int r
break;
}
emit dataChanged(index, index);
return TRUE;
return true;
}
void WSInfoModel::clear()
@ -775,7 +775,7 @@ bool TankInfoModel::setData(const QModelIndex& index, const QVariant& value, int
break;
}
emit dataChanged(index, index);
return TRUE;
return true;
}
void TankInfoModel::clear()
@ -1100,7 +1100,7 @@ bool DiveItem::setData(const QModelIndex& index, const QVariant& value, int role
}
dive->number = value.toInt();
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
return true;
}
@ -1381,7 +1381,7 @@ void DiveComputerModel::dropWorkingList()
void DiveComputerModel::keepWorkingList()
{
if (dcList.dcMap != dcWorkingMap)
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
dcList.dcMap = dcWorkingMap;
}
@ -1511,7 +1511,7 @@ void YearlyStatisticsModel::update_yearly_stats()
}
if (stats_by_trip != NULL && stats_by_trip[0].is_trip == TRUE) {
if (stats_by_trip != NULL && stats_by_trip[0].is_trip == true) {
YearStatisticsItem *item = new YearStatisticsItem(stats_by_trip[0]);
for (i = 1; stats_by_trip != NULL && stats_by_trip[i].is_trip; ++i) {
YearStatisticsItem *iChild = new YearStatisticsItem(stats_by_trip[i]);
@ -1558,7 +1558,8 @@ void TablePrintModel::insertRow(int index)
void TablePrintModel::callReset()
{
reset();
beginResetModel();
endResetModel();
}
QVariant TablePrintModel::data(const QModelIndex &index, int role) const

View File

@ -219,9 +219,14 @@ QTableView *PrintLayout::createProfileTable(ProfilePrintModel *model, const int
table->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
table->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
hHeader->setVisible(false);
hHeader->setResizeMode(QHeaderView::Fixed);
vHeader->setVisible(false);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
hHeader->setResizeMode(QHeaderView::Fixed);
vHeader->setResizeMode(QHeaderView::Fixed);
#else
hHeader->setSectionResizeMode(QHeaderView::Fixed);
vHeader->setSectionResizeMode(QHeaderView::Fixed);
#endif
// set the model
table->setModel(model);
@ -284,9 +289,14 @@ void PrintLayout::printTable()
table.setSelectionMode(QAbstractItemView::NoSelection);
table.setFocusPolicy(Qt::NoFocus);
table.horizontalHeader()->setVisible(false);
table.horizontalHeader()->setResizeMode(QHeaderView::Fixed);
table.verticalHeader()->setVisible(false);
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
table.horizontalHeader()->setResizeMode(QHeaderView::Fixed);
table.verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#else
table.horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
table.verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
#endif
table.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// fit table to one page initially

View File

@ -183,8 +183,8 @@ void ProfileGraphicsView::addBookmark()
QPointF scenePos = mapToScene(viewPos);
int seconds = scenePos.x() / gc.maxx * (gc.rightx - gc.leftx) + gc.leftx;
add_event(current_dc, seconds, SAMPLE_EVENT_BOOKMARK, 0, 0, "bookmark");
mark_divelist_changed(TRUE);
plot(current_dive, TRUE);
mark_divelist_changed(true);
plot(current_dive, true);
}
void ProfileGraphicsView::changeGas()
@ -198,8 +198,8 @@ void ProfileGraphicsView::changeGas()
validate_gas(gas.toUtf8().constData(), &o2, &he);
int seconds = scenePos.x() / gc.maxx * (gc.rightx - gc.leftx) + gc.leftx;
add_gas_switch_event(current_dive, current_dc, seconds, get_gasidx(current_dive, o2, he));
mark_divelist_changed(TRUE);
plot(current_dive, TRUE);
mark_divelist_changed(true);
plot(current_dive, true);
}
void ProfileGraphicsView::hideEvents()
@ -220,7 +220,7 @@ void ProfileGraphicsView::hideEvents()
}
}
}
plot(current_dive, TRUE);
plot(current_dive, true);
}
}
@ -229,7 +229,7 @@ void ProfileGraphicsView::unhideEvents()
for (int i = 0; i < evn_used; i++) {
ev_namelist[i].plot_ev = true;
}
plot(current_dive, TRUE);
plot(current_dive, true);
}
void ProfileGraphicsView::removeEvent()
@ -251,8 +251,8 @@ void ProfileGraphicsView::removeEvent()
*ep = event->next;
free(event);
}
mark_divelist_changed(TRUE);
plot(current_dive, TRUE);
mark_divelist_changed(true);
plot(current_dive, true);
}
}
@ -348,7 +348,7 @@ void ProfileGraphicsView::clear()
void ProfileGraphicsView::refresh()
{
clear();
plot(current_dive, TRUE);
plot(current_dive, true);
}
void ProfileGraphicsView::setPrintMode(bool mode, bool grayscale)
@ -715,7 +715,7 @@ void ProfileGraphicsView::plot_cylinder_pressure_text()
{
int i;
int mbar, cyl;
int seen_cyl[MAX_CYLINDERS] = { FALSE, };
int seen_cyl[MAX_CYLINDERS] = { false, };
int last_pressure[MAX_CYLINDERS] = { 0, };
int last_time[MAX_CYLINDERS] = { 0, };
struct plot_data *entry;
@ -738,7 +738,7 @@ void ProfileGraphicsView::plot_cylinder_pressure_text()
plot_gas_value(mbar, entry->sec, LEFT, TOP,
get_o2(&dive->cylinder[cyl].gasmix),
get_he(&dive->cylinder[cyl].gasmix));
seen_cyl[cyl] = TRUE;
seen_cyl[cyl] = true;
}
}
last_pressure[cyl] = mbar;
@ -882,8 +882,8 @@ void ProfileGraphicsView::plot_cylinder_pressure()
{
int i;
int last_index = -1;
int lift_pen = FALSE;
int first_plot = TRUE;
int lift_pen = false;
int first_plot = true;
if (!get_cylinder_pressure_range(&gc))
return;
@ -895,10 +895,10 @@ void ProfileGraphicsView::plot_cylinder_pressure()
mbar = GET_PRESSURE(entry);
if (entry->cylinderindex != last_index) {
lift_pen = TRUE;
lift_pen = true;
}
if (!mbar) {
lift_pen = TRUE;
lift_pen = true;
continue;
}
@ -917,10 +917,10 @@ void ProfileGraphicsView::plot_cylinder_pressure()
item->setPen(pen);
scene()->addItem(item);
} else {
first_plot = FALSE;
first_plot = false;
from = QPointF(SCALEGC(entry->sec, mbar));
}
lift_pen = FALSE;
lift_pen = false;
} else {
to = QPointF(SCALEGC(entry->sec, mbar));
QGraphicsLineItem *item = new QGraphicsLineItem(from.x(), from.y(), to.x(), to.y());

View File

@ -100,7 +100,7 @@ private:
class EventItem : public QGraphicsPixmapItem
{
public:
explicit EventItem(struct event *ev, QGraphicsItem* parent = 0, bool grayscale = FALSE);
explicit EventItem(struct event *ev, QGraphicsItem* parent = 0, bool grayscale = false);
struct event* ev;
private:
@ -131,10 +131,10 @@ public:
enum Mode{DIVE, PLAN};
ProfileGraphicsView(QWidget* parent = 0);
void plot(struct dive *d, bool forceRedraw = FALSE);
void plot(struct dive *d, bool forceRedraw = false);
bool eventFilter(QObject* obj, QEvent* event);
void clear();
void setPrintMode(bool mode, bool grayscale = FALSE);
void setPrintMode(bool mode, bool grayscale = false);
protected:
void resizeEvent(QResizeEvent *event);

View File

@ -142,7 +142,7 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton* button)
// DANGER, DANGER - this could get our dive_table unsorted...
shift_times(amount);
sort_table(&dive_table);
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
mainWindow()->dive_list()->rememberSelection();
mainWindow()->refreshDisplay();
mainWindow()->dive_list()->restoreSelection();

View File

@ -22,6 +22,10 @@
# include <unistd.h> // for dup(2)
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
# include <QUrlQuery>
#endif
struct dive_table gps_location_table;
static bool merge_locations_into_dives(void);
@ -30,8 +34,8 @@ static bool is_automatic_fix(struct dive *gpsfix)
if (gpsfix && gpsfix->location &&
(!strcmp(gpsfix->location, "automatic fix") ||
!strcmp(gpsfix->location, "Auto-created dive")))
return TRUE;
return FALSE;
return true;
return false;
}
#define SAME_GROUP 6 * 3600 // six hours
@ -332,7 +336,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton* button)
/* now merge the data in the gps_location table into the dive_table */
if (merge_locations_into_dives()) {
mark_divelist_changed(TRUE);
mark_divelist_changed(true);
}
/* store last entered uid in config */
@ -363,7 +367,13 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton* button)
void SubsurfaceWebServices::startDownload()
{
QUrl url("http://api.hohndel.org/api/dive/get/");
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
url.addQueryItem("login", ui.userID->text().toUpper());
#else
QUrlQuery query;
query.addQueryItem("login", ui.userID->text().toUpper());
url.setQuery(query);
#endif
QNetworkRequest request;
request.setUrl(url);
@ -674,7 +684,7 @@ void DivelogsDeWebServices::startDownload()
body.addQueryItem("user", ui.userID->text());
body.addQueryItem("pass", ui.password->text());
reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1())
reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1());
#endif
connect(reply, SIGNAL(finished()), this, SLOT(listDownloadFinished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
@ -720,7 +730,7 @@ void DivelogsDeWebServices::listDownloadFinished()
body.addQueryItem("pass", ui.password->text());
body.addQueryItem("ids", diveList.idList);
reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1())
reply = manager()->post(request, body.query(QUrl::FullyEncoded).toLatin1());
#endif
connect(reply, SIGNAL(readyRead()), this, SLOT(saveToZipFile()));
@ -847,7 +857,7 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton* button)
mainWindow()->showError(error);
free(error);
}
process_dives(TRUE, FALSE);
process_dives(true, false);
mainWindow()->refreshDisplay();
/* store last entered user/pass in config */

View File

@ -111,7 +111,7 @@ link_pkgconfig {
QMAKE_CFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
QMAKE_CXXFLAGS *= $$XML2_CFLAGS $$XSLT_CFLAGS
LIBS *= $$XML2_LIBS $$XSLT_LIBS
LIBS *= $$XSLT_LIBS $$XML2_LIBS
#
# Find other pkg-config-based projects

View File

@ -13,7 +13,7 @@ exists(.git/HEAD): {
PRODVERSION_STRING = $$system("sh scripts/get-version win $$FULL_VERSION || $${VERSION}.0.0")
VERSION_STRING = $$system("sh scripts/get-version linux $$FULL_VERSION || $${VERSION}")
version_h.depends = $$VERSION_SCRIPT $$PWD/.git/$$system("$$SET_GIT_DIR=$$PWD/.git git rev-parse --symbolic-full-name HEAD")
version_h.commands = echo \\$${LITERAL_HASH}define VERSION_STRING \\\"`GIT_DIR=$$PWD/.git $$VERSION_SCRIPT $$VER_OS`\\\" > ${QMAKE_FILE_OUT}
version_h.commands = echo \\$${LITERAL_HASH}define VERSION_STRING \\\"`GIT_DIR=$$PWD/.git $$VERSION_SCRIPT linux`\\\" > ${QMAKE_FILE_OUT}
version_h.input = GIT_HEAD
version_h.output = $$VERSION_FILE
version_h.variable_out = GENERATED_FILES

View File

@ -2,13 +2,17 @@ marbledir.files = $$MARBLEDIR
doc.files = $$DOC_FILES
translation.files = $$replace(TRANSLATIONS, .ts, .qm)
exists($$[QT_INSTALL_TRANSLATIONS]) {
qt_translation_dir = $$[QT_INSTALL_TRANSLATIONS]/
qt_translation_dir = $$[QT_INSTALL_TRANSLATIONS]
} else: exists(/usr/share/qt4/translations) {
# On some cross-compilation environments, the translations are either missing or not
# where they're expected to be. In such cases, try copying from the system.
qt_translation_dir = /usr/share/qt4/translations
}
qttranslation.files = $$join(QTTRANSLATIONS," "$$qt_translation_dir/,$$qt_translation_dir/)
# Prepend the Qt translation dir so we can actually find the files
qttranslation.files =
for(translation, QTTRANSLATIONS): \
qttranslation.files += $${qt_translation_dir}/$$translation
nltab = $$escape_expand(\\n\\t)

View File

@ -1,6 +1,11 @@
include(subsurface-configure.pri)
QT = core gui network webkit svg
QT = core gui network svg
lessThan(QT_MAJOR_VERSION, 5) {
QT += webkit
} else {
QT += webkitwidgets
}
INCLUDEPATH += qt-ui $$PWD
mac: TARGET = Subsurface