]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
Qt5 compat
authorgg <chown_tee@proton.me>
Thu, 15 Jan 2026 10:38:56 +0000 (05:38 -0500)
committergg <chown_tee@proton.me>
Thu, 15 Jan 2026 11:57:50 +0000 (06:57 -0500)
src/CoinsWidget.cpp
src/MainWindow.cpp
src/SendWidget.cpp
src/WindowManager.cpp
src/components.cpp
src/components.h
src/dialog/HistoryExportDialog.cpp
src/libwalletqt/PassphraseHelper.h
src/main.cpp
src/model/CoinsModel.h

index edee303bc263bc74e8a524f9bec5f2bcc904509e..8259c22e4570a792cdbf9e92fe33e6e79d249cf0 100644 (file)
@@ -275,10 +275,16 @@ void CoinsWidget::onSweepOutputs() {
     bool churn = dialog.churn();
     int outputs = dialog.outputs();
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     QtFuture::connect(m_wallet, &Wallet::preTransactionChecksComplete)
             .then([this, keyImages, address, churn, outputs](int feeLevel){
                 m_wallet->sweepOutputs(keyImages, address, churn, outputs, feeLevel);
             });
+#else
+    QObject::connect(m_wallet, &Wallet::preTransactionChecksComplete, [this, keyImages, address, churn, outputs](int feeLevel){
+        m_wallet->sweepOutputs(keyImages, address, churn, outputs, feeLevel);
+    });
+#endif
 
     m_wallet->preTransactionChecks(dialog.feeLevel());
 }
index a1323e7ec015d0b09138aec245eb2beaa001d9a5..b0db7d49c3c23717268e33d692f2f8a1690768fb 100644 (file)
@@ -1188,19 +1188,19 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
             }
             catch (const tools::error::daemon_busy &e) {
                 message.description = QString("Node was unable to respond. Failed request: %1").arg(QString::fromStdString(e.request()));
-                message.helpItems = {"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
+                message.helpItems = QStringList{"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
             }
             catch (const tools::error::no_connection_to_daemon &e) {
                 message.description = QString("Connection to node lost. Failed request: %1").arg(QString::fromStdString(e.request()));
-                message.helpItems = {"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
+                message.helpItems = QStringList{"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
             }
             catch (const tools::error::wallet_rpc_error &e) {
                 message.description = QString("RPC error: %1").arg(QString::fromStdString(e.to_string()));
-                message.helpItems = {"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
+                message.helpItems = QStringList{"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
             }
             catch (const tools::error::get_outs_error &e) {
                 message.description = "Failed to get enough decoy outputs from node";
-                message.helpItems = {"Your transaction has too many inputs. Try sending a lower amount."};
+                message.helpItems = QStringList{"Your transaction has too many inputs. Try sending a lower amount."};
             }
             catch (const tools::error::not_enough_unlocked_money &e) {
                 QString error;
@@ -1211,19 +1211,19 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
                     error = QString("Spendable balance insufficient to pay for transaction.\n\nSpendable balance: %1\nTransaction needs: %2").arg(WalletManager::displayAmount(e.available()), WalletManager::displayAmount(e.tx_amount() + e.fee()));
                 }
                 message.description = error;
-                message.helpItems = {"Wait for more balance to unlock.", "Click 'Help' to learn more about how balance works."};
+                message.helpItems = QStringList{"Wait for more balance to unlock.", "Click 'Help' to learn more about how balance works."};
                 message.doc = "balance";
             }
             catch (const tools::error::not_enough_money &e) {
                 message.description = QString("Not enough money to transfer\n\nTotal balance: %1\nTransaction amount: %2").arg(WalletManager::displayAmount(e.available()), WalletManager::displayAmount(e.tx_amount()));
-                message.helpItems = {"If you are trying to send your entire balance, click 'Max'."};
+                message.helpItems = QStringList{"If you are trying to send your entire balance, click 'Max'."};
                 message.doc = "balance";
             }
             catch (const tools::error::tx_not_possible &e) {
                 message.description = QString("Not enough money to transfer. Transaction amount + fee exceeds available balance.\n\n"
                                               "Spendable balance: %1\n"
                                               "Transaction needs: %2").arg(WalletManager::displayAmount(e.available()), WalletManager::displayAmount(e.tx_amount() + e.fee()));
-                message.helpItems = {"If you're trying to send your entire balance, click 'Max'."};
+                message.helpItems = QStringList{"If you're trying to send your entire balance, click 'Max'."};
                 message.doc = "balance";
             }
             catch (const tools::error::not_enough_outs_to_mix &e) {
@@ -1231,7 +1231,7 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
             }
             catch (const tools::error::tx_not_constructed&) {
                 message.description = "Transaction was not constructed";
-                message.helpItems = {"You have found a bug. Please contact the developers."};
+                message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                 message.doc = "report_an_issue";
             }
             catch (const tools::error::tx_rejected &e) {
@@ -1240,26 +1240,26 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
             }
             catch (const tools::error::tx_sum_overflow &e) {
                 message.description = "Transaction tries to spend an unrealistic amount of XMR";
-                message.helpItems = {"You have found a bug. Please contact the developers."};
+                message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                 message.doc = "report_an_issue";
             }
             catch (const tools::error::zero_amount&) {
                 message.description = "Destination amount is zero";
-                message.helpItems = {"You have found a bug. Please contact the developers."};
+                message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                 message.doc = "report_an_issue";
             }
             catch (const tools::error::zero_destination&) {
                 message.description = "Transaction has no destination";
-                message.helpItems = {"You have found a bug. Please contact the developers."};
+                message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                 message.doc = "report_an_issue";
             }
             catch (const tools::error::tx_too_big &e) {
                 message.description = "Transaction too big";
-                message.helpItems = {"Try sending a smaller amount."};
+                message.helpItems = QStringList{"Try sending a smaller amount."};
             }
             catch (const tools::error::transfer_error &e) {
                 message.description = QString("Unknown transfer error: %1").arg(QString::fromStdString(e.what()));
-                message.helpItems = {"You have found a bug. Please contact the developers."};
+                message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                 message.doc = "report_an_issue";
             }
             catch (const tools::error::wallet_internal_error &e) {
@@ -1281,12 +1281,12 @@ void MainWindow::onTransactionCreated(PendingTransaction *tx, const QVector<QStr
                 }
                 if (msg.contains("Failed to get height") || msg.contains("Failed to get earliest fork height")) {
                     message.description = QString("RPC error: %1").arg(QString::fromStdString(e.to_string()));
-                    message.helpItems = {"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
+                    message.helpItems = QStringList{"Try sending the transaction again.", "If this keeps happening, connect to a different node."};
                     bug = false;
                 }
 
                 if (bug) {
-                    message.helpItems = {"You have found a bug. Please contact the developers."};
+                    message.helpItems = QStringList{"You have found a bug. Please contact the developers."};
                     message.doc = "report_an_issue";
                 }
             }
index e0ce2dea4c55f593c5852ba275398cf01ac7db0b..3b99c8746081a5e04f42f41c17e74e01974e2784 100644 (file)
@@ -190,10 +190,17 @@ void SendWidget::sendClicked() {
             amounts.push_back(output.amount);
         }
 
+    #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
         QtFuture::connect(m_wallet, &Wallet::preTransactionChecksComplete)
                 .then([this, addresses, amounts, description, subtractFeeFromAmount](int feeLevel){
                     m_wallet->createTransactionMultiDest(addresses, amounts, description, feeLevel, subtractFeeFromAmount);
                 });
+    #else
+        // Qt 5 Fallback
+        connect(m_wallet, &Wallet::preTransactionChecksComplete, this, [this, addresses, amounts, description, subtractFeeFromAmount](int feeLevel){
+            m_wallet->createTransactionMultiDest(addresses, amounts, description, feeLevel, subtractFeeFromAmount);
+        });
+    #endif
 
         m_wallet->preTransactionChecks(ui->combo_feePriority->currentIndex());
 
@@ -249,10 +256,17 @@ void SendWidget::sendClicked() {
         #endif
     }
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     QtFuture::connect(m_wallet, &Wallet::preTransactionChecksComplete)
-            .then([this, recipient, amount, description, sendAll, subtractFeeFromAmount](int feeLevel){
-                m_wallet->createTransaction(recipient, amount, description, sendAll, feeLevel, subtractFeeFromAmount);
-            });
+        .then([this, recipient, amount, description, sendAll, subtractFeeFromAmount](int feeLevel){
+            m_wallet->createTransaction(recipient, amount, description, sendAll, feeLevel, subtractFeeFromAmount);
+        });
+#else
+    // Qt 5 Fallback
+    connect(m_wallet, &Wallet::preTransactionChecksComplete, this, [this, recipient, amount, description, sendAll, subtractFeeFromAmount](int feeLevel){
+        m_wallet->createTransaction(recipient, amount, description, sendAll, feeLevel, subtractFeeFromAmount);
+    });
+#endif
 
     m_wallet->preTransactionChecks(ui->combo_feePriority->currentIndex());
 }
index 2417e61fad371a72882028f1f05153cb17e0179c..0b95825dcfa7645b0beb1d17dd05c515bf915439 100644 (file)
@@ -520,12 +520,12 @@ void WindowManager::handleDeviceError(const QString &error, Utils::Message &msg)
     // Ledger
     if (error.contains("No device found")) {
         msg.description = "No Ledger device found.";
-        msg.helpItems = {"Make sure the Monero app is open on the device.", "If the problem persists, try restarting Feather."};
+        msg.helpItems = QStringList{"Make sure the Monero app is open on the device.", "If the problem persists, try restarting Feather."};
         msg.doc = "create_wallet_hardware_device";
     }
     else if (error.contains("Unable to open device")) {
         msg.description = "Unable to open device.";
-        msg.helpItems = {"The device might be in use by a different application."};
+        msg.helpItems = QStringList{"The device might be in use by a different application."};
 #if defined(Q_OS_LINUX)
         msg.helpItems.append("On Linux you may need to follow the instructions in the link below before the device can be opened:\n"
                          "https://support.ledger.com/hc/en-us/articles/115005165269-Fix-connection-issues");
@@ -536,15 +536,15 @@ void WindowManager::handleDeviceError(const QString &error, Utils::Message &msg)
     // Trezor
     else if (error.contains("Unable to claim libusb device")) {
         msg.description = "Unable to claim Trezor device";
-        msg.helpItems = {"Please make sure the device is not used by another program, like Trezor Suite or trezord, and try again."};
+        msg.helpItems = QStringList{"Please make sure the device is not used by another program, like Trezor Suite or trezord, and try again."};
     }
     else if (error.contains("Cannot get a device address")) {
         msg.description = "Cannot get a device address";
-        msg.helpItems = {"Reattach the Trezor device and try again"};
+        msg.helpItems = QStringList{"Reattach the Trezor device and try again"};
     }
     else if (error.contains("Could not connect to the device Trezor") || error.contains("Device connect failed")) {
         msg.description = "Could not connect to the Trezor device";
-        msg.helpItems = {"Make sure the device is connected to your computer and unlocked."};
+        msg.helpItems = QStringList{"Make sure the device is connected to your computer and unlocked."};
 #if defined(Q_OS_LINUX)
         msg.helpItems.append("On Linux you may need to follow the instructions in the link below before the device can be opened:\n"
                          "https://wiki.trezor.io/Udev_rules");
@@ -552,17 +552,17 @@ void WindowManager::handleDeviceError(const QString &error, Utils::Message &msg)
 #endif
     }
     else if (error.contains("Failed to acquire device")) {
-        msg.helpItems = {"Make sure Trezor Suite and trezord are closed."};
+        msg.helpItems = QStringList{"Make sure Trezor Suite and trezord are closed."};
     }
     else if (error.contains("SW_CLIENT_NOT_SUPPORTED")) {
-        msg.helpItems = {"Upgrade your Ledger device firmware to the latest version using Ledger Live.\n"
+        msg.helpItems = QStringList{"Upgrade your Ledger device firmware to the latest version using Ledger Live.\n"
                      "Then upgrade the Monero app for the Ledger device to the latest version."};
     }
     else if (error.contains("Wrong Device Status")) {
-        msg.helpItems = {"The device may need to be unlocked."};
+        msg.helpItems = QStringList{"The device may need to be unlocked."};
     }
     else if (error.contains("Wrong Channel")) {
-        msg.helpItems = {"Restart the hardware device and try again."};
+        msg.helpItems = QStringList{"Restart the hardware device and try again."};
     }
     else {
         msg.doc = "report_an_issue";
index 439494316f38c4eeaae83c71eaefe3c0457edd49..8c6b98787b7034022a8ebed36630b6b0972137c0 100644 (file)
@@ -52,7 +52,11 @@ void HelpLabel::mouseReleaseEvent(QMouseEvent *event)
     Utils::showInfo(this, m_text, m_informativeText, {}, m_doc);
 }
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 void HelpLabel::enterEvent(QEnterEvent *event)
+#else
+void HelpLabel::enterEvent(QEvent *event)
+#endif
 {
    font.setUnderline(true);
    setFont(font);
index 4d7b8a82118b892c0bb3cfad0006db435c5f2586..57ec4d687aa15b3633b63fbc5e0f9e20b11365bf 100644 (file)
@@ -50,7 +50,11 @@ public:
 
 protected:
     void mouseReleaseEvent(QMouseEvent *event) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
     void enterEvent(QEnterEvent *event) override;
+#else
+    void enterEvent(QEvent *event) override;
+#endif
     void leaveEvent(QEvent *event) override;
 
 private:
index 766f4fc34d41e9d6207e60b4f6551bb844f709cc..5a63e7f9209e32830f09dad9ac7e8fa311ab04cc 100644 (file)
@@ -39,7 +39,8 @@ HistoryExportDialog::HistoryExportDialog(Wallet *wallet, QWidget *parent)
         ui->date_max->setDate(QDate::currentDate());
     });
 
-    connect(ui->spin_days, &QSpinBox::valueChanged, [this] {
+    // Works on Qt 5 and Qt 6
+    connect(ui->spin_days, QOverload<int>::of(&QSpinBox::valueChanged), [this] {
         ui->date_min->setDate(QDate::currentDate().addDays(-ui->spin_days->value() + 1));
         ui->date_max->setDate(QDate::currentDate());
     });
index d9b8b45068115e1722c88cad0680313077437b48..ff964baf3c581af086e86bd97d0e9ccc8cd1ebf8 100644 (file)
@@ -7,6 +7,7 @@
 #include <QMutex>
 #include <QPointer>
 #include <QWaitCondition>
+#include <optional>  // For Qt5 compatibility
 
 /**
  * Implements component responsible for showing entry prompt to the user,
index 4b57478ec969c358c89f17ed5658eb7e225f8c4e..79306493dfb608f8eafd86153b40d1dec9c3901e 100644 (file)
@@ -214,14 +214,14 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
 
     if (!quiet && !conf()->get(Config::disableLogging).toBool()) {
         QList<QPair<QString, QString>> info;
-        info.emplace_back("Feather", FEATHER_VERSION);
-        info.emplace_back("Monero", MONERO_VERSION);
-        info.emplace_back("Qt", QT_VERSION_STR);
-        info.emplace_back("Tor", TOR_VERSION);
-        info.emplace_back("SSL", QSslSocket::sslLibraryVersionString());
-        info.emplace_back("Mode", stagenet ? "Stagenet" : (testnet ? "Testnet" : "Mainnet"));
-        info.emplace_back("Network", conf()->get(Config::syncPaused).toBool() ? "PAUSED" : "ACTIVE");
-        info.emplace_back("Config dir", configDir);
+        info.push_back({"Feather", FEATHER_VERSION});
+        info.push_back({"Monero", MONERO_VERSION});
+        info.push_back({"Qt", QT_VERSION_STR});
+        info.push_back({"Tor", TOR_VERSION});
+        info.push_back({"SSL", QSslSocket::sslLibraryVersionString()});
+        info.push_back({"Mode", stagenet ? "Stagenet" : (testnet ? "Testnet" : "Mainnet")});
+        info.push_back({"Network", conf()->get(Config::syncPaused).toBool() ? "PAUSED" : "ACTIVE"});
+        info.push_back({"Config dir", configDir});
 
         for (const auto &k: info) {
             qWarning().nospace().noquote() << QString("%1: %2").arg(k.first, k.second);
index 827724b49333c89e4096831f765afba99de5bc8f..57bcb23e27a1694a397ace1165c39f84f3403dd7 100644 (file)
@@ -5,6 +5,7 @@
 #define FEATHER_COINSMODEL_H
 
 #include <QAbstractTableModel>
+#include <QSet>  // For Qt5 compatibility
 
 class Coins;
 class CoinsInfo;