diff --git a/CMakeLists.txt b/CMakeLists.txt index bac09ae8d..daa38ca08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ option(NO_PRINTING "disable the printing support" OFF) option(NO_USERMANUAL "don't include a viewer for the user manual" OFF) #Options regarding enabling parts of subsurface -option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON) +option(BTSUPPORT "enable support for QtBluetooth" ON) option(FTDISUPPORT "enable support for libftdi based serial" OFF) # Options regarding What should we build on subsurface @@ -505,9 +505,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)") install(CODE "execute_process(COMMAND cp ${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") - # this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH - string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE}) - install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})") + # this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently + install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})") # the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)") # and another hack to get the QML Components in the right place diff --git a/cmake/Modules/MacOSXBundleInfo.plist.in b/cmake/Modules/MacOSXBundleInfo.plist.in index 684ad7908..e6e7daaf6 100644 --- a/cmake/Modules/MacOSXBundleInfo.plist.in +++ b/cmake/Modules/MacOSXBundleInfo.plist.in @@ -34,5 +34,9 @@ ${MACOSX_BUNDLE_COPYRIGHT} NSHighResolutionCapable + NSSupportsAutomaticGraphicsSwitching + + NSBluetoothAlwaysUsageDescription + Subsurface needs access to your Bluetooth peripherals in order to download dive information directly from BLE enabled dive computers. diff --git a/core/color.h b/core/color.h index 37281045e..c98b64174 100644 --- a/core/color.h +++ b/core/color.h @@ -7,65 +7,67 @@ #include +#define MAKEQCOLOR(r,g,b,a) QColor::fromRgbF((float)(r), (float)(b), (float)(g), (float)(a)) + // Greens -#define CAMARONE1 QColor::fromRgbF(0.0, 0.4, 0.0, 1) -#define FUNGREEN1 QColor::fromRgbF(0.0, 0.4, 0.2, 1) -#define FUNGREEN1_HIGH_TRANS QColor::fromRgbF(0.0, 0.4, 0.2, 0.25) -#define KILLARNEY1 QColor::fromRgbF(0.2, 0.4, 0.2, 1) -#define APPLE1 QColor::fromRgbF(0.2, 0.6, 0.2, 1) -#define APPLE1_MED_TRANS QColor::fromRgbF(0.2, 0.6, 0.2, 0.5) -#define APPLE1_HIGH_TRANS QColor::fromRgbF(0.2, 0.6, 0.2, 0.25) -#define LIMENADE1 QColor::fromRgbF(0.4, 0.8, 0.0, 1) -#define ATLANTIS1 QColor::fromRgbF(0.4, 0.8, 0.2, 1) -#define ATLANTIS2 QColor::fromRgbF(0.6, 0.8, 0.2, 1) -#define RIOGRANDE1 QColor::fromRgbF(0.8, 0.8, 0.0, 1) -#define EARLSGREEN1 QColor::fromRgbF(0.8, 0.8, 0.2, 1) -#define FORESTGREEN1 QColor::fromRgbF(0.1, 0.5, 0.1, 1) -#define NITROX_GREEN QColor::fromRgbF(0, 0.54, 0.375, 1) +#define CAMARONE1 MAKEQCOLOR(0.0, 0.4, 0.0, 1) +#define FUNGREEN1 MAKEQCOLOR(0.0, 0.4, 0.2, 1) +#define FUNGREEN1_HIGH_TRANS MAKEQCOLOR(0.0, 0.4, 0.2, 0.25) +#define KILLARNEY1 MAKEQCOLOR(0.2, 0.4, 0.2, 1) +#define APPLE1 MAKEQCOLOR(0.2, 0.6, 0.2, 1) +#define APPLE1_MED_TRANS MAKEQCOLOR(0.2, 0.6, 0.2, 0.5) +#define APPLE1_HIGH_TRANS MAKEQCOLOR(0.2, 0.6, 0.2, 0.25) +#define LIMENADE1 MAKEQCOLOR(0.4, 0.8, 0.0, 1) +#define ATLANTIS1 MAKEQCOLOR(0.4, 0.8, 0.2, 1) +#define ATLANTIS2 MAKEQCOLOR(0.6, 0.8, 0.2, 1) +#define RIOGRANDE1 MAKEQCOLOR(0.8, 0.8, 0.0, 1) +#define EARLSGREEN1 MAKEQCOLOR(0.8, 0.8, 0.2, 1) +#define FORESTGREEN1 MAKEQCOLOR(0.1, 0.5, 0.1, 1) +#define NITROX_GREEN MAKEQCOLOR(0, 0.54, 0.375, 1) // Reds -#define PERSIANRED1 QColor::fromRgbF(0.8, 0.2, 0.2, 1) -#define TUSCANY1 QColor::fromRgbF(0.8, 0.4, 0.2, 1) -#define PIRATEGOLD1 QColor::fromRgbF(0.8, 0.5, 0.0, 1) -#define PIRATEGOLD1_MED_TRANS QColor::fromRgbF(0.8, 0.5, 0.0, 0.75) -#define HOKEYPOKEY1 QColor::fromRgbF(0.8, 0.6, 0.2, 1) -#define CINNABAR1 QColor::fromRgbF(0.9, 0.3, 0.2, 1) -#define REDORANGE1 QColor::fromRgbF(1.0, 0.2, 0.2, 1) -#define REDORANGE1_HIGH_TRANS QColor::fromRgbF(1.0, 0.2, 0.2, 0.25) -#define REDORANGE1_MED_TRANS QColor::fromRgbF(1.0, 0.2, 0.2, 0.5) -#define RED1_MED_TRANS QColor::fromRgbF(1.0, 0.0, 0.0, 0.5) -#define RED1 QColor::fromRgbF(1.0, 0.0, 0.0, 1) +#define PERSIANRED1 MAKEQCOLOR(0.8, 0.2, 0.2, 1) +#define TUSCANY1 MAKEQCOLOR(0.8, 0.4, 0.2, 1) +#define PIRATEGOLD1 MAKEQCOLOR(0.8, 0.5, 0.0, 1) +#define PIRATEGOLD1_MED_TRANS MAKEQCOLOR(0.8, 0.5, 0.0, 0.75) +#define HOKEYPOKEY1 MAKEQCOLOR(0.8, 0.6, 0.2, 1) +#define CINNABAR1 MAKEQCOLOR(0.9, 0.3, 0.2, 1) +#define REDORANGE1 MAKEQCOLOR(1.0, 0.2, 0.2, 1) +#define REDORANGE1_HIGH_TRANS MAKEQCOLOR(1.0, 0.2, 0.2, 0.25) +#define REDORANGE1_MED_TRANS MAKEQCOLOR(1.0, 0.2, 0.2, 0.5) +#define RED1_MED_TRANS MAKEQCOLOR(1.0, 0.0, 0.0, 0.5) +#define RED1 MAKEQCOLOR(1.0, 0.0, 0.0, 1) // Monochromes -#define BLACK1 QColor::fromRgbF(0.0, 0.0, 0.0, 1) -#define BLACK1_LOW_TRANS QColor::fromRgbF(0.0, 0.0, 0.0, 0.75) -#define BLACK1_HIGH_TRANS QColor::fromRgbF(0.0, 0.0, 0.0, 0.25) -#define TUNDORA1_MED_TRANS QColor::fromRgbF(0.3, 0.3, 0.3, 0.5) -#define MED_GRAY_HIGH_TRANS QColor::fromRgbF(0.5, 0.5, 0.5, 0.25) -#define MERCURY1_MED_TRANS QColor::fromRgbF(0.9, 0.9, 0.9, 0.5) -#define CONCRETE1_LOWER_TRANS QColor::fromRgbF(0.95, 0.95, 0.95, 0.9) -#define WHITE1_MED_TRANS QColor::fromRgbF(1.0, 1.0, 1.0, 0.5) -#define WHITE1 QColor::fromRgbF(1.0, 1.0, 1.0, 1) +#define BLACK1 MAKEQCOLOR(0.0, 0.0, 0.0, 1) +#define BLACK1_LOW_TRANS MAKEQCOLOR(0.0, 0.0, 0.0, 0.75) +#define BLACK1_HIGH_TRANS MAKEQCOLOR(0.0, 0.0, 0.0, 0.25) +#define TUNDORA1_MED_TRANS MAKEQCOLOR(0.3, 0.3, 0.3, 0.5) +#define MED_GRAY_HIGH_TRANS MAKEQCOLOR(0.5, 0.5, 0.5, 0.25) +#define MERCURY1_MED_TRANS MAKEQCOLOR(0.9, 0.9, 0.9, 0.5) +#define CONCRETE1_LOWER_TRANS MAKEQCOLOR(0.95, 0.95, 0.95, 0.9) +#define WHITE1_MED_TRANS MAKEQCOLOR(1.0, 1.0, 1.0, 0.5) +#define WHITE1 MAKEQCOLOR(1.0, 1.0, 1.0, 1) // Blues -#define GOVERNORBAY2 QColor::fromRgbF(0.2, 0.2, 0.7, 1) -#define GOVERNORBAY1_MED_TRANS QColor::fromRgbF(0.2, 0.2, 0.8, 0.5) -#define ROYALBLUE2 QColor::fromRgbF(0.2, 0.2, 0.9, 1) -#define ROYALBLUE2_LOW_TRANS QColor::fromRgbF(0.2, 0.2, 0.9, 0.75) -#define AIR_BLUE QColor::fromRgbF(0.25, 0.75, 1.0, 1) -#define AIR_BLUE_TRANS QColor::fromRgbF(0.25, 0.75, 1.0, 0.5) +#define GOVERNORBAY2 MAKEQCOLOR(0.2, 0.2, 0.7, 1) +#define GOVERNORBAY1_MED_TRANS MAKEQCOLOR(0.2, 0.2, 0.8, 0.5) +#define ROYALBLUE2 MAKEQCOLOR(0.2, 0.2, 0.9, 1) +#define ROYALBLUE2_LOW_TRANS MAKEQCOLOR(0.2, 0.2, 0.9, 0.75) +#define AIR_BLUE MAKEQCOLOR(0.25, 0.75, 1.0, 1) +#define AIR_BLUE_TRANS MAKEQCOLOR(0.25, 0.75, 1.0, 0.5) // Yellows / BROWNS -#define SPRINGWOOD1 QColor::fromRgbF(0.95, 0.95, 0.9, 1) -#define SPRINGWOOD1_MED_TRANS QColor::fromRgbF(0.95, 0.95, 0.9, 0.5) -#define BROOM1_LOWER_TRANS QColor::fromRgbF(1.0, 1.0, 0.1, 0.9) -#define PEANUT QColor::fromRgbF(0.5, 0.2, 0.1, 1.0) -#define PEANUT_MED_TRANS QColor::fromRgbF(0.5, 0.2, 0.1, 0.5) -#define NITROX_YELLOW QColor::fromRgbF(0.98, 0.89, 0.07, 1.0) +#define SPRINGWOOD1 MAKEQCOLOR(0.95, 0.95, 0.9, 1) +#define SPRINGWOOD1_MED_TRANS MAKEQCOLOR(0.95, 0.95, 0.9, 0.5) +#define BROOM1_LOWER_TRANS MAKEQCOLOR(1.0, 1.0, 0.1, 0.9) +#define PEANUT MAKEQCOLOR(0.5, 0.2, 0.1, 1.0) +#define PEANUT_MED_TRANS MAKEQCOLOR(0.5, 0.2, 0.1, 0.5) +#define NITROX_YELLOW MAKEQCOLOR(0.98, 0.89, 0.07, 1.0) // Magentas -#define MEDIUMREDVIOLET1_HIGHER_TRANS QColor::fromRgbF(0.7, 0.2, 0.7, 0.1) -#define MAGENTA QColor::fromRgbF(1.0, 0.0, 1.0, 1.0) +#define MEDIUMREDVIOLET1_HIGHER_TRANS MAKEQCOLOR(0.7, 0.2, 0.7, 0.1) +#define MAGENTA MAKEQCOLOR(1.0, 0.0, 1.0, 1.0) #define SAC_COLORS_START_IDX SAC_1 #define SAC_COLORS 9 diff --git a/desktop-widgets/about.cpp b/desktop-widgets/about.cpp index faece6656..503bb5e69 100644 --- a/desktop-widgets/about.cpp +++ b/desktop-widgets/about.cpp @@ -19,9 +19,9 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget *parent) : QDialog(parent, QFlag(0)) "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger, and others, 2011-2022" "").arg(versionString)); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 4eef0dfe9..e54e78e20 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -18,7 +18,7 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) : ui->setupUi(this); // Quit button callbacks - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), this, SLOT(reject())); connect(ui->quit, SIGNAL(clicked()), this, SLOT(reject())); diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 391960c12..befe03bdd 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -37,9 +37,9 @@ DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent), { ui->setupUi(this); showExplanation(); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close())); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); /* the names are not the actual values exported to the json files,The font-family property should hold several @@ -246,7 +246,7 @@ void DiveLogExportDialog::on_buttonBox_accepted() qPrefDisplay::set_lastDir(fileInfo.dir().path()); // the non XSLT exports are called directly above, the XSLT based ons are called here if (!stylesheet.isEmpty()) { - QFuture future = exportUsingStyleSheet(filename, ui->exportSelected->isChecked(), + QFuture future = exportUsingStyleSheet(filename, ui->exportSelected->isChecked(), ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8(), ui->anonymize->isChecked()); MainWindow::instance()->getNotificationWidget()->showNotification(tr("Please wait, exporting..."), KMessageWidget::Information); MainWindow::instance()->getNotificationWidget()->setFuture(future); diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp index bb6c7650c..d10b9d5f7 100644 --- a/desktop-widgets/divelogimportdialog.cpp +++ b/desktop-widgets/divelogimportdialog.cpp @@ -380,9 +380,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia loadFileContents(-1, INITIAL); /* manually import CSV file */ - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(ui->CSVSeparator, SIGNAL(currentIndexChanged(int)), this, SLOT(loadFileContentsSeperatorSelected(int))); diff --git a/desktop-widgets/divesiteimportdialog.cpp b/desktop-widgets/divesiteimportdialog.cpp index f440d6edb..c16918809 100644 --- a/desktop-widgets/divesiteimportdialog.cpp +++ b/desktop-widgets/divesiteimportdialog.cpp @@ -16,8 +16,8 @@ DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent), importedSource(source) { - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); divesiteImportedModel = new DivesiteImportedModel(this); diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 6b6e9f5f1..c11260905 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -31,8 +31,8 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent) : QDialog(parent, QF { diveImportedModel = new DiveImportedModel(this); vendorModel.setStringList(vendorList); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); int startingWidth = defaultModelFont().pointSize(); diff --git a/desktop-widgets/kmessagewidget.cpp b/desktop-widgets/kmessagewidget.cpp index f293e7527..c64635220 100644 --- a/desktop-widgets/kmessagewidget.cpp +++ b/desktop-widgets/kmessagewidget.cpp @@ -250,9 +250,9 @@ KMessageWidget::MessageType KMessageWidget::messageType() const static QColor darkShade(QColor c) { - qreal contrast = 0.7; // taken from kcolorscheme for the dark shade + double contrast = 0.7; // taken from kcolorscheme for the dark shade - qreal darkAmount; + double darkAmount; if (c.lightnessF() < 0.006) { /* too dark */ darkAmount = 0.02 + 0.40 * contrast; } else if (c.lightnessF() > 0.93) { /* too bright */ @@ -261,9 +261,9 @@ static QColor darkShade(QColor c) darkAmount = (-c.lightnessF()) * (0.55 + contrast * 0.35); } - qreal v = c.lightnessF() + darkAmount; + double v = c.lightnessF() + darkAmount; v = v > 0.0 ? (v < 1.0 ? v : 1.0) : 0.0; - c.setHsvF(c.hslHueF(), c.hslSaturationF(), v); + c.setHsvF(c.hslHueF(), c.hslSaturationF(), (float)v); return c; } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 2ece1975f..1a695eb7a 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -210,8 +210,8 @@ MainWindow::MainWindow() : QMainWindow(), updateManager = new UpdateManager(this); undoAction = Command::undoAction(this); redoAction = Command::redoAction(this); - undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); - redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); + undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z)); + redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z)); ui.menu_Edit->addActions({ undoAction, redoAction }); #ifndef NO_PRINTING @@ -570,8 +570,8 @@ void MainWindow::enableShortcuts() redoAction->setEnabled(true); ui.actionPreviousDC->setShortcut(Qt::Key_Left); ui.actionNextDC->setShortcut(Qt::Key_Right); - ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); - ui.paste->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); + ui.copy->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C)); + ui.paste->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V)); } void MainWindow::showProfile() @@ -724,9 +724,9 @@ void MainWindow::on_actionYearlyStatistics_triggered() l->addWidget(view); d.resize(lrint(width() * .8), height() / 2); d.move(lrint(width() * .1), height() / 4); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), &d); connect(close, SIGNAL(activated()), &d, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), &d); connect(quit, SIGNAL(activated()), this, SLOT(close())); d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint); diff --git a/desktop-widgets/notificationwidget.cpp b/desktop-widgets/notificationwidget.cpp index 7c156ee5c..878685955 100644 --- a/desktop-widgets/notificationwidget.cpp +++ b/desktop-widgets/notificationwidget.cpp @@ -31,7 +31,7 @@ QString NotificationWidget::getNotificationText() return text(); } -void NotificationWidget::setFuture(const QFuture &future) +void NotificationWidget::setFuture(const QFuture &future) { future_watcher.setFuture(future); } diff --git a/desktop-widgets/notificationwidget.h b/desktop-widgets/notificationwidget.h index 93fc62605..82dbd5df1 100644 --- a/desktop-widgets/notificationwidget.h +++ b/desktop-widgets/notificationwidget.h @@ -16,7 +16,7 @@ class NotificationWidget : public KMessageWidget { public: explicit NotificationWidget(QWidget *parent = 0); - void setFuture(const QFuture &future); + void setFuture(const QFuture &future); void showNotification(QString message, KMessageWidget::MessageType type); void hideNotification(); QString getNotificationText(); @@ -25,7 +25,7 @@ public slots: void showError(QString message); private: - QFutureWatcher future_watcher; + QFutureWatcher future_watcher; private slots: diff --git a/desktop-widgets/qtwaitingspinner.cpp b/desktop-widgets/qtwaitingspinner.cpp index 14e8669b0..bfe024b92 100644 --- a/desktop-widgets/qtwaitingspinner.cpp +++ b/desktop-widgets/qtwaitingspinner.cpp @@ -272,7 +272,7 @@ QColor QtWaitingSpinner::currentLineColor(int countDistance, int totalNrOfLines, int distanceThreshold = static_cast(ceil((totalNrOfLines - 1) * trailFadePerc / 100.0)); if (countDistance > distanceThreshold) { - color.setAlphaF(minAlphaF); + color.setAlphaF((float)minAlphaF); } else { qreal alphaDiff = color.alphaF() - minAlphaF; qreal gradient = alphaDiff / static_cast(distanceThreshold + 1); @@ -280,7 +280,7 @@ QColor QtWaitingSpinner::currentLineColor(int countDistance, int totalNrOfLines, // If alpha is out of bounds, clip it. resultAlpha = std::min(1.0, std::max(0.0, resultAlpha)); - color.setAlphaF(resultAlpha); + color.setAlphaF((float)resultAlpha); } return color; } diff --git a/desktop-widgets/shifttimes.ui b/desktop-widgets/shifttimes.ui index 3c03b7d57..6439eab95 100644 --- a/desktop-widgets/shifttimes.ui +++ b/desktop-widgets/shifttimes.ui @@ -198,17 +198,5 @@ - - timeEdit - timeChanged(const QTime) - ShiftTimesDialog - changeTime() - - - backwards - toggled(bool) - ShiftTimesDialog - changeTime() - diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index ddfb331fc..ff6d27655 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -45,9 +45,9 @@ RenumberDialog::RenumberDialog(bool selectedOnlyIn, QWidget *parent) : QDialog(p { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); if (selectedOnly && amount_selected == 1) @@ -72,9 +72,9 @@ SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDia { ui.setupUi(this); connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, &QShortcut::activated, this, &QDialog::close); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, &QShortcut::activated, MainWindow::instance(), &QWidget::close); } @@ -116,9 +116,9 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent), connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), this, SLOT(changeTime())); connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(changeTime())); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } @@ -271,9 +271,9 @@ void ShiftImageTimesDialog::backwardsChanged(bool) URLDialog::URLDialog(QWidget *parent) : QDialog(parent) { ui.setupUi(this); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } @@ -317,9 +317,9 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar UI_FROM_COMPONENT(number); UI_FROM_COMPONENT(when); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index 34efd098e..b66202dbb 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -259,9 +259,9 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent) : WebServices(pare ui.password->setText(qPrefCloudStorage::divelogde_pass()); ui.saveUidLocal->hide(); hideUpload(); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/tripselectiondialog.cpp b/desktop-widgets/tripselectiondialog.cpp index 5b336b1b8..e7e87c724 100644 --- a/desktop-widgets/tripselectiondialog.cpp +++ b/desktop-widgets/tripselectiondialog.cpp @@ -10,9 +10,9 @@ TripSelectionDialog::TripSelectionDialog(QWidget *parent) : QDialog(parent) ui.setupUi(this); connect(ui.trips, &QListWidget::itemSelectionChanged, this, &TripSelectionDialog::selectionChanged); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, &QShortcut::activated, this, &QDialog::close); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, &QShortcut::activated, parent, &QWidget::close); // We could use a model, but it seems barely worth the hassle. diff --git a/packaging/android/variables.sh b/packaging/android/variables.sh index f2c940a77..9a46d403d 100644 --- a/packaging/android/variables.sh +++ b/packaging/android/variables.sh @@ -11,4 +11,4 @@ ANDROID_PLATFORMS=android-29 ANDROID_NDK=ndk/${NDK_VERSION} # OpenSSL also has an entry in get-dep-lib.sh line 103 # that needs to be updated as well. -OPENSSL_VERSION=1.1.1h +OPENSSL_VERSION=1.1.1m diff --git a/packaging/macosx/Info.plist.in b/packaging/macosx/Info.plist.in deleted file mode 100644 index 9d2e6d43f..000000000 --- a/packaging/macosx/Info.plist.in +++ /dev/null @@ -1,23 +0,0 @@ - - - - - NSPrincipalClass - NSApplication - CFBundleIconFile - Subsurface.icns - CFBundleName - Subsurface - CFBundlePackageType - APPL - CFBundleExecutable - subsurface - CFBundleIdentifier - org.hohndel.subsurface - CFBundleInfoDictionaryVersion - 6.0 - CFBundleVersion - @SHORT_VERSION@ - NSSupportsAutomaticGraphicsSwitching - - diff --git a/profile-widget/divepercentageitem.cpp b/profile-widget/divepercentageitem.cpp index fb40553e5..2dec81baa 100644 --- a/profile-widget/divepercentageitem.cpp +++ b/profile-widget/divepercentageitem.cpp @@ -6,8 +6,8 @@ #include -DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, double dpr) : - hAxis(hAxis), vAxis(vAxis), dpr(dpr) +DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis) : + hAxis(hAxis), vAxis(vAxis) { } @@ -52,29 +52,30 @@ static std::array calcLinesPerTissue(int size) return res; } +#define SETHSVF(h, s, v) setHsvF((float)(h), (float)(s), (float)(v)) static QRgb colorScale(double value, int inert) { QColor color; double scaledValue = value / (AMB_PERCENTAGE * inert) * 1000.0; if (scaledValue < 0.8) // grade from cyan to blue to purple - color.setHsvF(0.5 + 0.25 * scaledValue / 0.8, 1.0, 1.0); + color.SETHSVF(0.5 + 0.25 * scaledValue / 0.8, 1.0, 1.0); else if (scaledValue < 1.0) // grade from magenta to black - color.setHsvF(0.75, 1.0, (1.0 - scaledValue) / 0.2); + color.SETHSVF(0.75, 1.0, (1.0 - scaledValue) / 0.2); else if (value < AMB_PERCENTAGE) // grade from black to bright green - color.setHsvF(0.333, 1.0, (value - AMB_PERCENTAGE * inert / 1000.0) / (AMB_PERCENTAGE - AMB_PERCENTAGE * inert / 1000.0)); + color.SETHSVF(0.333, 1.0, (value - AMB_PERCENTAGE * inert / 1000.0) / (AMB_PERCENTAGE - AMB_PERCENTAGE * inert / 1000.0)); else if (value < 65) // grade from bright green (0% M) to yellow-green (30% M) - color.setHsvF(0.333 - 0.133 * (value - AMB_PERCENTAGE) / (65.0 - AMB_PERCENTAGE), 1.0, 1.0); + color.SETHSVF(0.333 - 0.133 * (value - AMB_PERCENTAGE) / (65.0 - AMB_PERCENTAGE), 1.0, 1.0); else if (value < 85) // grade from yellow-green (30% M) to orange (70% M) - color.setHsvF(0.2 - 0.1 * (value - 65.0) / 20.0, 1.0, 1.0); + color.SETHSVF(0.2 - 0.1 * (value - 65.0) / 20.0, 1.0, 1.0); else if (value < 100) // grade from orange (70% M) to red (100% M) - color.setHsvF(0.1 * (100.0 - value) / 15.0, 1.0, 1.0); + color.SETHSVF(0.1 * (100.0 - value) / 15.0, 1.0, 1.0); else if (value < 120) // M value exceeded - grade from red to white - color.setHsvF(0.0, 1 - (value - 100.0) / 20.0, 1.0); + color.SETHSVF(0.0, 1 - (value - 100.0) / 20.0, 1.0); else // white - color.setHsvF(0.0, 0.0, 1.0); + color.SETHSVF(0.0, 0.0, 1.0); return color.rgba(); } - +#undef SETHSVF void DivePercentageItem::replot(const dive *d, const struct divecomputer *dc, const plot_info &pi) { auto [minX, maxX] = hAxis.screenMinMax(); diff --git a/profile-widget/divepercentageitem.h b/profile-widget/divepercentageitem.h index 08d7f0bdc..27657c009 100644 --- a/profile-widget/divepercentageitem.h +++ b/profile-widget/divepercentageitem.h @@ -10,12 +10,11 @@ class DiveCartesianAxis; class DivePercentageItem : public QGraphicsPixmapItem { public: - DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, double dpr); + DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis); void replot(const dive *d, const divecomputer *dc, const plot_info &pi); private: const DiveCartesianAxis &hAxis; const DiveCartesianAxis &vAxis; - double dpr; }; #endif diff --git a/profile-widget/divepixmapcache.cpp b/profile-widget/divepixmapcache.cpp index 4f487a41b..e1dadb4d4 100644 --- a/profile-widget/divepixmapcache.cpp +++ b/profile-widget/divepixmapcache.cpp @@ -49,7 +49,7 @@ DivePixmaps::DivePixmaps(int dpr) : dpr(dpr) // The transparen pixmap is a very obscure feature to enable tooltips without showing a pixmap. // See code in diveeventitem.cpp. This should probably be replaced by a different mechanism. QPixmap transparentPixmap(lrint(4 * dprf), lrint(20 * dprf)); - transparentPixmap.fill(QColor::fromRgbF(1.0, 1.0, 1.0, 0.01)); + transparentPixmap.fill(QColor::fromRgbF(1.0f, 1.0f, 1.0f, 0.01f)); } static std::vector> cache; diff --git a/profile-widget/profilescene.cpp b/profile-widget/profilescene.cpp index 5b063fea4..db568e15c 100644 --- a/profile-widget/profilescene.cpp +++ b/profile-widget/profilescene.cpp @@ -144,7 +144,7 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) : heartBeatItem(createItem(*heartBeatAxis, [](const plot_data &item) { return (double)item.heartbeat; }, 1, dpr)), - percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis, dpr)), + percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis)), tankItem(new TankItem(*timeAxis, dpr)), pixmaps(getDivePixmaps(dpr)) { diff --git a/scripts/build.sh b/scripts/build.sh index aa53269b1..e5ab34f2f 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -348,7 +348,8 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then pushd openssl mkdir -p build cd build - ../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" darwin64-x86_64-cc + if [ $(arch) == "arm64" ] ; then OS_ARCH=darwin64-arm64-cc ; else OS_ARCH=darwin64-x86_64-cc; fi + ../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" $OS_ARCH make depend # all the tests fail because the assume that openssl is already installed. Odd? Still thinks work make -j4 -k @@ -436,6 +437,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then ./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp pushd libmtp + patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch echo 'N' | NOCONFIGURE="1" bash ./autogen.sh mkdir -p build cd build diff --git a/scripts/get-dep-lib.sh b/scripts/get-dep-lib.sh index 420815a94..45e19c75b 100755 --- a/scripts/get-dep-lib.sh +++ b/scripts/get-dep-lib.sh @@ -6,8 +6,8 @@ CURRENT_LIBZ="v1.2.11" CURRENT_LIBZIP="rel-1-5-1" CURRENT_LIBGIT2="v1.0.1" CURRENT_LIBCURL="curl-7_54_1" -CURRENT_LIBUSB="v1.0.21" -CURRENT_OPENSSL="OpenSSL_1_1_1h" +CURRENT_LIBUSB="v1.0.25" +CURRENT_OPENSSL="OpenSSL_1_1_1m" CURRENT_LIBSSH2="libssh2-1.8.0" CURRENT_XSLT="v1.1.34" CURRENT_SQLITE="3190200" @@ -103,7 +103,7 @@ fi # FIX FOR ANDROID, if [ "$PLATFORM" == "singleAndroid" ] ; then - CURRENT_OPENSSL="OpenSSL_1_1_1h" + CURRENT_OPENSSL="OpenSSL_1_1_1m" # If changing the openSSL version here, make sure to change it in packaging/android/variables.sh also. fi # no curl and old libs (never version breaks) diff --git a/scripts/libmtp.patch b/scripts/libmtp.patch new file mode 100644 index 000000000..a3bac339f --- /dev/null +++ b/scripts/libmtp.patch @@ -0,0 +1,13 @@ +diff --git a/libmtp.pc.in b/libmtp.pc.in +index 93c7bbf..ff817e1 100644 +--- a/libmtp.pc.in ++++ b/libmtp.pc.in +@@ -10,6 +10,6 @@ Description: libmtp is a library for accessing Media Transfer Protocol devices + Version: @VERSION@ + Requires.private: @LIBUSB_REQUIRES@ + Conflicts: +-Libs: -L${libdir} -lmtp ++Libs: -L${libdir} -lmtp @OSFLAGS@ + Libs.private: @LIBS@ +-Cflags: -I${includedir} @OSFLAGS@ ++Cflags: -I${includedir} diff --git a/stats/regressionitem.cpp b/stats/regressionitem.cpp index 9f176c6ae..3377ec419 100644 --- a/stats/regressionitem.cpp +++ b/stats/regressionitem.cpp @@ -87,7 +87,7 @@ void RegressionItem::updatePosition() img->fill(Qt::transparent); if (confidence) { QColor col(regressionItemColor); - col.setAlphaF(reg.r2); + col.setAlphaF((float)reg.r2); painter->setPen(Qt::NoPen); painter->setBrush(QBrush(col)); painter->drawPolygon(poly); diff --git a/stats/statsvariables.cpp b/stats/statsvariables.cpp index 8855b003f..2d32345e8 100644 --- a/stats/statsvariables.cpp +++ b/stats/statsvariables.cpp @@ -113,7 +113,7 @@ template<> int invalid_value() } template<> double invalid_value() { - return std::numeric_limits::quiet_NaN(); + return NaN; } template<> QString invalid_value() { @@ -121,7 +121,6 @@ template<> QString invalid_value() } template<> StatsQuartiles invalid_value() { - double NaN = std::numeric_limits::quiet_NaN(); return { std::vector(), NaN, NaN, NaN, NaN, NaN }; }