diff options
| author | saturneric <[email protected]> | 2026-10-24 11:00:19 +0200 |
|---|---|---|
| committer | saturneric <[email protected]> | 2026-10-24 11:00:19 +0200 |
| commit | 93739079935dafb0df3810c5103ace6061eb1cc3 (patch) | |
| tree | 0f7dcbc99f8699b057adcd0e3dc354429179daa9 | |
| parent | build(cmake): drop Qt5 build mode and require Qt 6.5 (diff) | |
| download | modules-93739079935dafb0df3810c5103ace6061eb1cc3.tar.gz modules-93739079935dafb0df3810c5103ace6061eb1cc3.zip | |
refactor: remove Qt5 leftovers from modules
- drop the pre-6.4 fallback for QFormLayout::setRowVisible
- use QList instead of QVector
| -rw-r--r-- | src/m_email/EMailPageView.cpp | 12 | ||||
| -rw-r--r-- | src/m_im/ImToken.cpp | 14 | ||||
| -rw-r--r-- | src/m_pgp_inspect/PGPInspectDialog.cpp | 6 | ||||
| -rw-r--r-- | src/m_pgp_inspect/PGPInspectDialog.h | 4 | ||||
| -rw-r--r-- | src/m_pgp_inspect/PGPInspectModel.cpp | 6 | ||||
| -rw-r--r-- | src/m_pgp_inspect/PGPInspectModel.h | 14 |
6 files changed, 22 insertions, 34 deletions
diff --git a/src/m_email/EMailPageView.cpp b/src/m_email/EMailPageView.cpp index 221522f..c26dad4 100644 --- a/src/m_email/EMailPageView.cpp +++ b/src/m_email/EMailPageView.cpp @@ -1242,20 +1242,8 @@ void EMailPageView::resizeEvent(QResizeEvent* event) { void EMailPageView::set_cc_bcc_visible(bool visible) { if (header_form_ == nullptr) return; -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) header_form_->setRowVisible(cc_edit_, visible); header_form_->setRowVisible(bcc_edit_, visible); -#else - // Older Qt has no setRowVisible; hiding both cells collapses the row. - const auto set_row_visible = [this, visible](QWidget* field) { - if (auto* label = header_form_->labelForField(field)) { - label->setVisible(visible); - } - field->setVisible(visible); - }; - set_row_visible(cc_edit_); - set_row_visible(bcc_edit_); -#endif if (cc_bcc_toggle_ != nullptr && cc_bcc_toggle_->isChecked() != visible) { QSignalBlocker blocker(cc_bcc_toggle_); diff --git a/src/m_im/ImToken.cpp b/src/m_im/ImToken.cpp index 2e03f12..031a286 100644 --- a/src/m_im/ImToken.cpp +++ b/src/m_im/ImToken.cpp @@ -33,8 +33,8 @@ #include <QCryptographicHash> #include <QDebug> #include <QHash> +#include <QList> #include <QMutex> -#include <QVector> #include <algorithm> #include <array> #include <atomic> @@ -125,7 +125,7 @@ auto Base58Encode(const QByteArray& in) -> QString { const auto body = in.size() - zeroes; // log(256)/log(58) rounded up, then five characters to the limb. - QVector<quint32> limbs; + QList<quint32> limbs; limbs.reserve((body * 138 / 100 / 5) + 1); const auto absorb = [&limbs](quint64 chunk, quint64 base) { @@ -209,7 +209,7 @@ auto Base58Decode(const QString& in, bool& ok) -> QByteArray { const auto body = in.size() - zeroes; // log(58)/log(256) rounded up, then four bytes to the limb. - QVector<quint32> limbs; + QList<quint32> limbs; limbs.reserve((body * 733 / 1000 / 4) + 1); const auto absorb = [&limbs](quint64 chunk, quint64 base) { @@ -561,8 +561,8 @@ auto Keystream(const std::array<unsigned char, 32>& master, } // Keyed Fisher-Yates permutation P of [0, m) driven by 4 bytes per step. -auto BuildPermutation(const QByteArray& material, int m) -> QVector<int> { - QVector<int> p(m); +auto BuildPermutation(const QByteArray& material, int m) -> QList<int> { + QList<int> p(m); for (int i = 0; i < m; ++i) p[i] = i; int off = 0; for (int i = m - 1; i > 0; --i) { @@ -674,7 +674,7 @@ auto Encode(const QByteArray& pgp, const QString& phrase) -> QString { t[i] = static_cast<char>(inner[i] ^ xor_ks[i]); } - const QVector<int> p = BuildPermutation(perm_material, m); + const QList<int> p = BuildPermutation(perm_material, m); QByteArray cipher(m, Qt::Uninitialized); for (int i = 0; i < m; ++i) cipher[i] = t[p[i]]; @@ -710,7 +710,7 @@ auto Decode(const QString& text, const QString& phrase) -> DecodeResult { const QByteArray perm_material = stream.mid(kPrefixLen, 4 * m); const QByteArray xor_ks = stream.mid(kPrefixLen + 4 * m, m); - const QVector<int> p = BuildPermutation(perm_material, m); + const QList<int> p = BuildPermutation(perm_material, m); QByteArray t(m, Qt::Uninitialized); for (int i = 0; i < m; ++i) t[p[i]] = cipher[i]; diff --git a/src/m_pgp_inspect/PGPInspectDialog.cpp b/src/m_pgp_inspect/PGPInspectDialog.cpp index 79ef097..27d83fb 100644 --- a/src/m_pgp_inspect/PGPInspectDialog.cpp +++ b/src/m_pgp_inspect/PGPInspectDialog.cpp @@ -148,7 +148,7 @@ void PGPInspectDialog::render_document() { // The block's own facts are rows like any other, so the search box reaches // the armor headers and the CRC verdict too. - QVector<PGPInspectField> facts; + QList<PGPInspectField> facts; if (block.has_armor) { facts.push_back({GTrC::tr("Armor Type"), block.armor.block_type}); facts.push_back({GTrC::tr("CRC24"), block.armor.crc24}); @@ -192,7 +192,7 @@ void PGPInspectDialog::render_document() { } void PGPInspectDialog::add_packets(QTreeWidgetItem* parent, - const QVector<PGPInspectPacket>& packets) { + const QList<PGPInspectPacket>& packets) { int index = 1; for (const auto& packet : packets) { auto* item = new QTreeWidgetItem(parent); @@ -215,7 +215,7 @@ void PGPInspectDialog::add_packets(QTreeWidgetItem* parent, } void PGPInspectDialog::add_fields(QTreeWidgetItem* parent, - const QVector<PGPInspectField>& fields) { + const QList<PGPInspectField>& fields) { for (const auto& field : fields) { auto* row = new QTreeWidgetItem(parent); row->setText(kLabelColumn, field.label); diff --git a/src/m_pgp_inspect/PGPInspectDialog.h b/src/m_pgp_inspect/PGPInspectDialog.h index 93e4224..7746dea 100644 --- a/src/m_pgp_inspect/PGPInspectDialog.h +++ b/src/m_pgp_inspect/PGPInspectDialog.h @@ -72,9 +72,9 @@ class PGPInspectDialog : public QDialog, public gf::ui::DialogWidget { void create_widgets(); void render_document(); void add_packets(QTreeWidgetItem* parent, - const QVector<PGPInspectPacket>& packets); + const QList<PGPInspectPacket>& packets); void add_fields(QTreeWidgetItem* parent, - const QVector<PGPInspectField>& fields); + const QList<PGPInspectField>& fields); PGPInspectDocument document_; qint64 size_ = 0; diff --git a/src/m_pgp_inspect/PGPInspectModel.cpp b/src/m_pgp_inspect/PGPInspectModel.cpp index c9ab6db..221b106 100644 --- a/src/m_pgp_inspect/PGPInspectModel.cpp +++ b/src/m_pgp_inspect/PGPInspectModel.cpp @@ -38,8 +38,8 @@ namespace { -auto ParseFields(const QJsonValue& value) -> QVector<PGPInspectField> { - QVector<PGPInspectField> fields; +auto ParseFields(const QJsonValue& value) -> QList<PGPInspectField> { + QList<PGPInspectField> fields; for (const auto& entry : value.toArray()) { const auto object = entry.toObject(); // A row with neither half says nothing; dropping it keeps the detail @@ -102,7 +102,7 @@ auto ParseBlock(const QJsonObject& object) -> PGPInspectBlock { return block; } -auto CountPackets(const QVector<PGPInspectPacket>& packets) -> int { +auto CountPackets(const QList<PGPInspectPacket>& packets) -> int { int count = 0; for (const auto& packet : packets) { count += 1 + CountPackets(packet.children); diff --git a/src/m_pgp_inspect/PGPInspectModel.h b/src/m_pgp_inspect/PGPInspectModel.h index 0a081aa..bac0e81 100644 --- a/src/m_pgp_inspect/PGPInspectModel.h +++ b/src/m_pgp_inspect/PGPInspectModel.h @@ -29,9 +29,9 @@ #pragma once #include <QByteArray> +#include <QList> #include <QString> #include <QStringList> -#include <QVector> /** * @file PGPInspectModel.h @@ -64,8 +64,8 @@ struct PGPInspectPacket { QString length_type; /// The body's own version octet; -1 for the types that carry none. int version = -1; - QVector<PGPInspectField> fields; - QVector<PGPInspectPacket> children; + QList<PGPInspectField> fields; + QList<PGPInspectPacket> children; /// Why this packet could not be decoded, empty when it could. QString error; @@ -75,7 +75,7 @@ struct PGPInspectPacket { /// The armor envelope of a block. struct PGPInspectArmor { QString block_type; - QVector<PGPInspectField> headers; + QList<PGPInspectField> headers; /// "ok", "mismatch" or "absent". QString crc24; }; @@ -89,8 +89,8 @@ struct PGPInspectBlock { PGPInspectArmor armor; bool has_cleartext = false; qint64 cleartext_text_size = 0; - QVector<PGPInspectField> cleartext_headers; - QVector<PGPInspectPacket> packets; + QList<PGPInspectField> cleartext_headers; + QList<PGPInspectPacket> packets; QString error; }; @@ -100,7 +100,7 @@ struct PGPInspectDocument { bool valid = false; QString format; qint64 size = 0; - QVector<PGPInspectBlock> blocks; + QList<PGPInspectBlock> blocks; QStringList errors; QString parse_error; |
