]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
node disconnect; Qt6.4 compat stuff
authorgg <chown_tee@proton.me>
Tue, 13 Jan 2026 02:26:54 +0000 (21:26 -0500)
committergg <chown_tee@proton.me>
Tue, 13 Jan 2026 02:27:38 +0000 (21:27 -0500)
src/CMakeLists.txt
src/MainWindow.cpp
src/qrcode/utils/QrCodeUtils.cpp
src/utils/nodes.cpp
src/utils/nodes.h

index 1ff01908ee1b8a9941a46e604fef98f37b24a261..170ea479101df401db2e7918585631c982213231 100644 (file)
@@ -305,6 +305,21 @@ if(DEVICE_TREZOR_READY)
 endif()
 
 if (WITH_SCANNER)
+    include(CheckCXXSourceCompiles)
+    set(CMAKE_REQUIRED_LIBRARIES ${ZXING_LIBRARIES})
+
+    check_cxx_source_compiles("
+    #include <ZXing/ReadBarcode.h>
+    int main() {
+        auto fmt = ZXing::ImageFormat::BGRA;
+        return 0;
+    }
+    " HAVE_ZXING_BGRA)
+
+    if (HAVE_ZXING_BGRA)
+        target_compile_definitions(feather PRIVATE HAVE_ZXING_BGRA)
+    endif()
+
     target_link_libraries(feather PRIVATE
             Qt::Multimedia
             Qt::MultimediaWidgets
index d04351caad13c84500671d90cb058047bff4f50c..58e6d05e469a1ec46d7c092dac8fadf3e618c59f 100644 (file)
@@ -250,7 +250,7 @@ void MainWindow::initStatusBar() {
 
                 if (m_actionDisconnectNodeOnPause->isChecked()) {
                      qInfo() << "Disconnecting from node (Pause Sync enabled)";
-                     m_nodes->disconnect();
+                     m_nodes->disconnectCurrentNode();
                      this->onConnectionStatusChanged(Wallet::ConnectionStatus_Disconnected);
                 }
 
index ee3841eb33db6053e814cfab8a2e180d69dbf273..80593f865bcdb7242fb5dc3b0d9d50ddbab78a41 100644 (file)
@@ -10,20 +10,28 @@ Result QrCodeUtils::ReadBarcode(const QImage& img, const ZXing::ReaderOptions& h
             case QImage::Format_ARGB32:
             case QImage::Format_RGB32:
 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+#ifdef HAVE_ZXING_BGRA
                 return ZXing::ImageFormat::BGRA;
+#else
+                return ZXing::ImageFormat::BGRX;
+#endif
 
 #else
                 return ZXing::ImageFormat::XRGB;
 
 #endif
-            case QImage::Format_RGB888: 
+            case QImage::Format_RGB888:
                 return ZXing::ImageFormat::RGB;
 
             case QImage::Format_RGBX8888:
-            case QImage::Format_RGBA8888: 
+            case QImage::Format_RGBA8888:
+#ifdef HAVE_ZXING_BGRA
                 return ZXing::ImageFormat::RGBA;
+#else
+                return ZXing::ImageFormat::RGBX;
+#endif
 
-            case QImage::Format_Grayscale8: 
+            case QImage::Format_Grayscale8:
                 return ZXing::ImageFormat::Lum;
 
             default: 
index bd95bbcc6bf121699dcc6bbf607cbc3f5c95200d..c4e09d5c81603912ab56147cc4acccadc15ec795 100644 (file)
@@ -207,6 +207,21 @@ void Nodes::connectToNode(const FeatherNode &node) {
     if (!node.isValid()) {
         return;
     }
+}
+
+void Nodes::disconnectCurrentNode() {
+    if (!m_wallet) return;
+
+    // Stop any ongoing connection attempt
+    m_connection.isActive = false;
+    m_connection.isConnecting = false;
+
+    // Connect to empty "node" effectively disconnects
+    m_wallet->initAsync("", false, 0);
+
+    this->resetLocalState();
+    this->updateModels();
+}
 
     if (conf()->get(Config::offlineMode).toBool()) {
         return;
index 8bbf8b3a1c2cc7b9da6cd531c5b73e29e61247ca..2cc06b33a364c9d45b57e2d89d2c071a2e9ca92d 100644 (file)
@@ -167,6 +167,7 @@ public:
 public slots:
     void connectToNode();
     void connectToNode(const FeatherNode &node);
+    void disconnectCurrentNode();
     void onWSNodesReceived(QList<FeatherNode>& nodes);
     void onNodeSourceChanged(NodeSource nodeSource);
     void setCustomNodes(const QList<FeatherNode>& nodes);