m_clients;
+ bool m_debug;
+};
+
+class WormholeClient : public QObject {
+ Q_OBJECT
+
+private Q_SLOTS:
+ void onConnected();
+ void onTextMessageReceived(QString message);
+ void closed();
+
+public:
+ WormholeClient(MainWindow* parent, QString wormholeCode);
+ ~WormholeClient();
+
+ void connect();
+ void retryConnect();
+
+private:
+ MainWindow* parent = nullptr;
+ QWebSocket* m_webSocket = nullptr;
+
+ QTimer* timer = nullptr;
+
+ QString code;
+ int retryCount = 0;
+ bool shuttingDown = false;
+};
+
+enum NonceType {
+ LOCAL = 1,
+ REMOTE
+};
+
+enum AppConnectionType {
+ DIRECT = 1,
+ INTERNET
+};
+
+class AppDataServer {
+public:
+ static AppDataServer* getInstance() {
+ if (instance == nullptr) {
+ instance = new AppDataServer();
+ }
+ return instance;
+ }
+
+ void connectAppDialog(MainWindow* parent);
+ void updateConnectedUI();
+ void updateUIWithNewQRCode(MainWindow* mainwindow);
+
+ void processSendTx(QJsonObject sendTx, MainWindow* mainwindow, QWebSocket* pClient);
+ void processMessage(QString message, MainWindow* mainWindow, QWebSocket* pClient, AppConnectionType connType);
+ void processGetInfo(QJsonObject jobj, MainWindow* mainWindow, QWebSocket* pClient);
+ void processDecryptedMessage(QString message, MainWindow* mainWindow, QWebSocket* pClient);
+ void processGetTransactions(MainWindow* mainWindow, QWebSocket* pClient);
+
+ QString decryptMessage(QJsonDocument msg, QString secretHex, QString lastRemoteNonceHex);
+ QString encryptOutgoing(QString msg);
+
+ QString getWormholeCode(QString secretHex);
+ QString getSecretHex();
+ void saveNewSecret(QString secretHex);
+
+ void registerNewTempSecret(QString tmpSecretHex, bool allowInternet, MainWindow* main);
+
+ QString getNonceHex(NonceType nt);
+ void saveNonceHex(NonceType nt, QString noncehex);
+
+ bool getAllowInternetConnection();
+ void setAllowInternetConnection(bool allow);
+
+ void saveLastSeenTime();
+ QDateTime getLastSeenTime();
+
+ void setConnectedName(QString name);
+ QString getConnectedName();
+ bool isAppConnected();
+
+ QString connDesc(AppConnectionType t);
+
+ void saveLastConnectedOver(AppConnectionType type);
+ AppConnectionType getLastConnectionType();
+
+private:
+ AppDataServer() = default;
+
+ static AppDataServer* instance;
+ Ui_MobileAppConnector* ui;
+
+ QString tempSecret;
+ WormholeClient* tempWormholeClient = nullptr;
+};
+
+class AppDataModel {
+public:
+ static AppDataModel* getInstance() {
+ if (instance == NULL)
+ instance = new AppDataModel();
+
+ return instance;
+ }
+
+ double getTBalance() { return balTransparent; }
+ double getZBalance() { return balShielded; }
+ double getTotalBalance() { return balTotal; }
+
+ void setBalances(double transparent, double shielded) {
+ balTransparent = transparent;
+ balShielded = shielded;
+ balTotal = balTransparent + balShielded;
+ }
+
+private:
+ AppDataModel() = default; // Private, for singleton
+
+ double balTransparent;
+ double balShielded;
+ double balTotal;
+
+ QString saplingAddress;
+
+ static AppDataModel* instance;
+};
+
+
+
+#endif // WEBSOCKETS_H
\ No newline at end of file
diff --git a/wsclient.html b/wsclient.html
new file mode 100644
index 0000000..e6d22cd
--- /dev/null
+++ b/wsclient.html
@@ -0,0 +1,102 @@
+
+
+ WebSocket Echo Client
+
+
+ WebSocket Echo Client
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/zec-qt-wallet.pro b/zec-qt-wallet.pro
index 1d9c835..d1db8c6 100644
--- a/zec-qt-wallet.pro
+++ b/zec-qt-wallet.pro
@@ -10,7 +10,8 @@ CONFIG += precompile_header
PRECOMPILED_HEADER = src/precompiled.h
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+QT += widgets
+QT += websockets
TARGET = zec-qt-wallet
@@ -45,13 +46,15 @@ SOURCES += \
src/sendtab.cpp \
src/senttxstore.cpp \
src/txtablemodel.cpp \
- src/turnstile.cpp \
+ src/turnstile.cpp \
src/qrcodelabel.cpp \
src/connection.cpp \
src/fillediconlabel.cpp \
src/addressbook.cpp \
src/logger.cpp \
src/addresscombo.cpp \
+ src/websockets.cpp \
+ src/mobileappconnector.cpp \
src/recurring.cpp
HEADERS += \
@@ -66,13 +69,15 @@ HEADERS += \
src/settings.h \
src/txtablemodel.h \
src/senttxstore.h \
- src/turnstile.h \
+ src/turnstile.h \
src/qrcodelabel.h \
src/connection.h \
src/fillediconlabel.h \
src/addressbook.h \
src/logger.h \
src/addresscombo.h \
+ src/websockets.h \
+ src/mobileappconnector.h \
src/recurring.h
FORMS += \
@@ -87,6 +92,8 @@ FORMS += \
src/connection.ui \
src/zboard.ui \
src/addressbook.ui \
+ src/mobileappconnector.ui \
+ src/createzcashconfdialog.ui \
src/recurringdialog.ui \
src/newrecurring.ui
@@ -94,14 +101,32 @@ FORMS += \
TRANSLATIONS = res/zec_qt_wallet_es.ts \
res/zec_qt_wallet_fr.ts \
res/zec_qt_wallet_de.ts \
- res/zec_qt_wallet_pt.ts
+ res/zec_qt_wallet_pt.ts \
+ res/zec_qt_wallet_it.ts
win32: RC_ICONS = res/icon.ico
ICON = res/logo.icns
+libsodium.target = $$PWD/res/libsodium.a
+libsodium.commands = res/libsodium/buildlibsodium.sh
+
+QMAKE_EXTRA_TARGETS += libsodium
+QMAKE_CLEAN += res/libsodium.a
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
+win32:CONFIG(release, debug|release): LIBS += -L$$PWD/res/ -llibsodium
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/res/ -llibsodiumd
+else:unix: LIBS += -L$$PWD/res/ -lsodium
+
+INCLUDEPATH += $$PWD/res
+DEPENDPATH += $$PWD/res
+
+win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/res/liblibsodium.a
+else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/res/liblibsodium.a
+else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/res/libsodium.lib
+else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/res/libsodiumd.lib
+else:unix: PRE_TARGETDEPS += $$PWD/res/libsodium.a