diff --git a/.github/workflows/cpp-ci-serial-programs.yml b/.github/workflows/cpp-ci-serial-programs.yml index 075c9ea6e..796271668 100644 --- a/.github/workflows/cpp-ci-serial-programs.yml +++ b/.github/workflows/cpp-ci-serial-programs.yml @@ -10,13 +10,13 @@ jobs: fail-fast: false matrix: os: [windows-2022, macos-13, ubuntu-24.04] - qt_version: ['5.12.12', '6.7.2'] + qt_version: ['5.12.12', '6.8.1'] include: - qt_version: '5.12.12' qt_version_major: '5' qt_modules: '' - - qt_version: '6.7.2' + - qt_version: '6.8.1' qt_version_major: '6' qt_modules: 'qtmultimedia qtserialport' @@ -37,7 +37,7 @@ jobs: if: startsWith(matrix.os, 'mac') run: | brew install opencv - - uses: jurplel/install-qt-action@v3 + - uses: jurplel/install-qt-action@v4 with: version: ${{ matrix.qt_version }} modules: ${{ matrix.qt_modules }} diff --git a/Common/Qt/Options/BooleanCheckBoxWidget.cpp b/Common/Qt/Options/BooleanCheckBoxWidget.cpp index b8848ca91..7a1aa4b87 100644 --- a/Common/Qt/Options/BooleanCheckBoxWidget.cpp +++ b/Common/Qt/Options/BooleanCheckBoxWidget.cpp @@ -38,12 +38,21 @@ BooleanCheckBoxCellWidget::BooleanCheckBoxCellWidget(QWidget& parent, BooleanChe m_box = new QCheckBox(this); m_box->setChecked(m_value); layout->addWidget(m_box); +#if QT_VERSION < 0x060700 connect( m_box, &QCheckBox::stateChanged, this, [this](int){ m_value = m_box->isChecked(); } ); +#else + connect( + m_box, &QCheckBox::checkStateChanged, + this, [this](Qt::CheckState){ + m_value = m_box->isChecked(); + } + ); +#endif value.add_listener(*this); } void BooleanCheckBoxCellWidget::update_value(){ @@ -81,12 +90,21 @@ BooleanCheckBoxOptionWidget::BooleanCheckBoxOptionWidget(QWidget& parent, Boolea m_box = new QCheckBox(this); m_box->setChecked(m_value); layout->addWidget(m_box, 1); +#if QT_VERSION < 0x060700 connect( m_box, &QCheckBox::stateChanged, this, [this](int){ m_value = m_box->isChecked(); } ); +#else + connect( + m_box, &QCheckBox::checkStateChanged, + this, [this](int){ + m_value = m_box->isChecked(); + } + ); +#endif value.add_listener(*this); } void BooleanCheckBoxOptionWidget::update_value(){ diff --git a/Common/Qt/TimeQt.cpp b/Common/Qt/TimeQt.cpp index 6afbf762d..d39be44de 100644 --- a/Common/Qt/TimeQt.cpp +++ b/Common/Qt/TimeQt.cpp @@ -5,6 +5,7 @@ */ #include +#include #include "Common/Cpp/Exceptions.h" #include "Common/Cpp/PrettyPrint.h" #include "TimeQt.h" @@ -45,7 +46,7 @@ std::string to_utc_time_str(WallClock time){ #endif int64_t secs_since_epoch = std::chrono::duration_cast(time.time_since_epoch()).count(); - QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(secs_since_epoch, Qt::UTC); + QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(secs_since_epoch, QTimeZone::utc()); QDate qdate = qdatetime.date(); QTime qtime = qdatetime.time(); std::string str; @@ -142,7 +143,7 @@ WallClock parse_utc_time_str(const std::string& str){ throw ParseException("Invalid time."); } - QDateTime qdatetime(qdate, qtime, Qt::UTC); + QDateTime qdatetime(qdate, qtime, QTimeZone::utc()); int64_t secs_since_epoch = qdatetime.toSecsSinceEpoch(); return WallClock{} + std::chrono::seconds(secs_since_epoch); @@ -153,12 +154,12 @@ WallClock parse_utc_time_str(const std::string& str){ int64_t to_seconds_since_epoch(const DateTime& date){ QDate qdate(date.year, date.month, date.day); QTime qtime(date.hour, date.minute, date.second); - QDateTime qdatetime(qdate, qtime, Qt::UTC); + QDateTime qdatetime(qdate, qtime, QTimeZone::utc()); int64_t secs_since_epoch = qdatetime.toSecsSinceEpoch(); return secs_since_epoch; } DateTime from_seconds_since_epoch(int64_t seconds_since_epoch){ - QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(seconds_since_epoch, Qt::UTC); + QDateTime qdatetime = QDateTime::fromSecsSinceEpoch(seconds_since_epoch, QTimeZone::utc()); QDate qdate = qdatetime.date(); QTime qtime = qdatetime.time(); return DateTime{ diff --git a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp index 227aed699..78fb16a8e 100644 --- a/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp +++ b/SerialPrograms/Source/CommonFramework/GlobalSettingsPanel.cpp @@ -70,7 +70,8 @@ void PreloadSettings::load(const JsonValue& json){ const std::string* dev_token = obj->get_string("DEVELOPER_TOKEN"); if (dev_token){ QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); - hash.addData(dev_token->c_str(), (int)dev_token->size()); + QByteArrayView dataView(dev_token->data(), dev_token->size()); + hash.addData(dataView); DEVELOPER_MODE = TOKENS.find(hash.result().toHex().toStdString()) != TOKENS.end(); } diff --git a/SerialPrograms/Source/NintendoSwitch/Framework/UI/NintendoSwitch_CommandRow.cpp b/SerialPrograms/Source/NintendoSwitch/Framework/UI/NintendoSwitch_CommandRow.cpp index b0a205546..fc8016f0f 100644 --- a/SerialPrograms/Source/NintendoSwitch/Framework/UI/NintendoSwitch_CommandRow.cpp +++ b/SerialPrograms/Source/NintendoSwitch/Framework/UI/NintendoSwitch_CommandRow.cpp @@ -81,6 +81,7 @@ CommandRow::CommandRow( m_overlay_boxes, &QCheckBox::clicked, this, [this](bool checked){ m_session.set_enabled_boxes(checked); } ); +#if QT_VERSION < 0x060700 connect( m_overlay_text, &QCheckBox::stateChanged, this, [this](bool checked){ m_session.set_enabled_text(checked); } @@ -93,6 +94,20 @@ CommandRow::CommandRow( m_overlay_stats, &QCheckBox::stateChanged, this, [this](bool checked){ m_session.set_enabled_stats(checked); } ); +#else + connect( + m_overlay_text, &QCheckBox::checkStateChanged, + this, [this](Qt::CheckState state){ m_session.set_enabled_text(state == Qt::Checked); } + ); + connect( + m_overlay_log, &QCheckBox::checkStateChanged, + this, [this](Qt::CheckState state){ m_session.set_enabled_log(state == Qt::Checked); } + ); + connect( + m_overlay_stats, &QCheckBox::checkStateChanged, + this, [this](Qt::CheckState state){ m_session.set_enabled_stats(state == Qt::Checked); } + ); +#endif connect( m_load_profile_button, &QPushButton::clicked, this, [this](bool) { emit load_profile(); }