Browse Source

Merge branch 'duke' of https://github.com/MyHush/SilentDragon into duke

pull/140/head
Duke Leto 4 years ago
parent
commit
69b24d6127
  1. 55
      .gitignore
  2. 23
      application.qrc
  3. BIN
      res/silentdragon_de.qm
  4. 407
      res/silentdragon_de.ts
  5. BIN
      res/silentdragon_es.qm
  6. 405
      res/silentdragon_es.ts
  7. BIN
      res/silentdragon_fi.qm
  8. 590
      res/silentdragon_fi.ts
  9. BIN
      res/silentdragon_fr.qm
  10. 405
      res/silentdragon_fr.ts
  11. BIN
      res/silentdragon_hr.qm
  12. 1889
      res/silentdragon_hr.ts
  13. BIN
      res/silentdragon_it.qm
  14. 405
      res/silentdragon_it.ts
  15. BIN
      res/silentdragon_nl.qm
  16. 2197
      res/silentdragon_nl.ts
  17. BIN
      res/silentdragon_pt.qm
  18. 405
      res/silentdragon_pt.ts
  19. BIN
      res/silentdragon_ru.qm
  20. 429
      res/silentdragon_ru.ts
  21. BIN
      res/silentdragon_sr.qm
  22. 1889
      res/silentdragon_sr.ts
  23. 1247
      res/silentdragon_template.ts
  24. BIN
      res/silentdragon_tr.qm
  25. 405
      res/silentdragon_tr.ts
  26. BIN
      res/silentdragon_uk.qm
  27. 421
      res/silentdragon_uk.ts
  28. BIN
      res/silentdragon_zh.qm
  29. 405
      res/silentdragon_zh.ts
  30. BIN
      res/zec_qt_wallet_fi.qm
  31. BIN
      res/zec_qt_wallet_fr.qm
  32. BIN
      res/zec_qt_wallet_hr.qm
  33. 23
      silentdragon.pro
  34. 18
      src/connection.cpp
  35. 2
      src/main.cpp
  36. 4
      src/mainwindow.cpp
  37. 4
      src/scripts/dotranslations.sh
  38. 1
      src/scripts/mkmacdmg.sh
  39. 2
      src/sendtab.cpp
  40. 45
      src/settings.cpp
  41. 2
      src/txtablemodel.cpp
  42. 16
      src/websockets.cpp

55
.gitignore

@ -1,37 +1,40 @@
artifacts/
*.autosave
bin/
debug/
release/
x64/
artifacts/
docs/website/public
.vscode/
.DS_Store
hushd
IDEWorkspaceChecks.plist
komodo-cli
komodod
*.mak
Makefile
Makefile.*
.qmake.stash
qrc_application.cpp
release/
res/libsodium.a
res/libsodium/libsodium*
res/libsodium.a
src/ui_*.h
*.autosave
src/precompiled.h.cpp
.qmake.stash
res/libsodium/libsodium*
silentdragon
silentdragon
zec-qt-wallet-mingw*
zec-qt-wallet.vcxproj*
zecwallet.vcxproj*
zec-qt-wallet.sln
silentdragon.pro.user
Makefile
Makefile.*
qrc_application.cpp
*.sln
src/precompiled.h.cpp
src/ui_*.h
*.sw?
*.tar.gz
.vscode/
workspace.code-workspace
x64/
*.xcsettings
zec-qt-wallet-mingw*
zec-qt-wallet_plugin_import.cpp
zecwallet_plugin_import.cpp
zec-qt-wallet_resource*
zec-qt-wallet.sln
zec-qt-wallet.vcxproj*
zecwallet_plugin_import.cpp
zecwallet_resource*
workspace.code-workspace
zecwallet.vcxproj*
*.zip
*.tar.gz
*.xcsettings
.DS_Store
*.mak
komodod
hushd
IDEWorkspaceChecks.plist
*.sln

23
application.qrc

@ -13,16 +13,19 @@
<file>res/logobig.gif</file>
</qresource>
<qresource prefix="/translations">
<file>res/zec_qt_wallet_de.qm</file>
<file>res/zec_qt_wallet_es.qm</file>
<file>res/zec_qt_wallet_fi.qm</file>
<file>res/zec_qt_wallet_fr.qm</file>
<file>res/zec_qt_wallet_pt.qm</file>
<file>res/zec_qt_wallet_it.qm</file>
<file>res/zec_qt_wallet_zh.qm</file>
<file>res/zec_qt_wallet_ru.qm</file>
<file>res/zec_qt_wallet_tr.qm</file>
<file>res/zec_qt_wallet_uk.qm</file>
<file>res/silentdragon_de.qm</file>
<file>res/silentdragon_es.qm</file>
<file>res/silentdragon_fi.qm</file>
<file>res/silentdragon_fr.qm</file>
<file>res/silentdragon_hr.qm</file>
<file>res/silentdragon_it.qm</file>
<file>res/silentdragon_nl.qm</file>
<file>res/silentdragon_pt.qm</file>
<file>res/silentdragon_ru.qm</file>
<file>res/silentdragon_sr.qm</file>
<file>res/silentdragon_tr.qm</file>
<file>res/silentdragon_uk.qm</file>
<file>res/silentdragon_zh.qm</file>
</qresource>
<qresource prefix="/css">
<file>res/css/blue.css</file>

BIN
res/zec_qt_wallet_de.qm → res/silentdragon_de.qm

Binary file not shown.

407
res/zec_qt_wallet_de.ts → res/silentdragon_de.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_es.qm → res/silentdragon_es.qm

Binary file not shown.

405
res/zec_qt_wallet_es.ts → res/silentdragon_es.ts

File diff suppressed because it is too large

BIN
res/silentdragon_fi.qm

Binary file not shown.

590
res/zec_qt_wallet_fi.ts → res/silentdragon_fi.ts

File diff suppressed because it is too large

BIN
res/silentdragon_fr.qm

Binary file not shown.

405
res/zec_qt_wallet_fr.ts → res/silentdragon_fr.ts

File diff suppressed because it is too large

BIN
res/silentdragon_hr.qm

Binary file not shown.

1889
res/silentdragon_hr.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_it.qm → res/silentdragon_it.qm

Binary file not shown.

405
res/zec_qt_wallet_it.ts → res/silentdragon_it.ts

File diff suppressed because it is too large

BIN
res/silentdragon_nl.qm

Binary file not shown.

2197
res/silentdragon_nl.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_pt.qm → res/silentdragon_pt.qm

Binary file not shown.

405
res/zec_qt_wallet_pt.ts → res/silentdragon_pt.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_ru.qm → res/silentdragon_ru.qm

Binary file not shown.

429
res/zec_qt_wallet_ru.ts → res/silentdragon_ru.ts

File diff suppressed because it is too large

BIN
res/silentdragon_sr.qm

Binary file not shown.

1889
res/silentdragon_sr.ts

File diff suppressed because it is too large

1247
res/zec_qt_wallet_template.ts → res/silentdragon_template.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_tr.qm → res/silentdragon_tr.qm

Binary file not shown.

405
res/zec_qt_wallet_tr.ts → res/silentdragon_tr.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_uk.qm → res/silentdragon_uk.qm

Binary file not shown.

421
res/zec_qt_wallet_uk.ts → res/silentdragon_uk.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_zh.qm → res/silentdragon_zh.qm

Binary file not shown.

405
res/zec_qt_wallet_zh.ts → res/silentdragon_zh.ts

File diff suppressed because it is too large

BIN
res/zec_qt_wallet_fi.qm

Binary file not shown.

BIN
res/zec_qt_wallet_fr.qm

Binary file not shown.

BIN
res/zec_qt_wallet_hr.qm

Binary file not shown.

23
silentdragon.pro

@ -106,16 +106,19 @@ FORMS += \
src/requestdialog.ui
TRANSLATIONS = res/zec_qt_wallet_es.ts \
res/zec_qt_wallet_fi.ts \
res/zec_qt_wallet_fr.ts \
res/zec_qt_wallet_de.ts \
res/zec_qt_wallet_pt.ts \
res/zec_qt_wallet_it.ts \
res/zec_qt_wallet_zh.ts \
res/zec_qt_wallet_tr.ts \
res/zec_qt_wallet_ru.ts \
res/zec_qt_wallet_uk.ts
TRANSLATIONS = res/silentdragon_de.ts \
res/silentdragon_es.ts \
res/silentdragon_fi.ts \
res/silentdragon_fr.ts \
res/silentdragon_hr.ts \
res/silentdragon_it.ts \
res/silentdragon_nl.ts \
res/silentdragon_pt.ts \
res/silentdragon_ru.ts \
res/silentdragon_sr.ts \
res/silentdragon_tr.ts \
res/silentdragon_uk.ts \
res/silentdragon_zh.ts
include(singleapplication/singleapplication.pri)
DEFINES += QAPPLICATION_CLASS=QApplication

18
src/connection.cpp

@ -215,13 +215,13 @@ void ConnectionLoader::createZcashConf() {
}
void ConnectionLoader::downloadParams(std::function<void(void)> cb) {
void ConnectionLoader::downloadParams(std::function<void(void)> cb) {
main->logger->write("Adding params to download queue");
// Add all the files to the download queue
downloadQueue = new QQueue<QUrl>();
client = new QNetworkAccessManager(main);
//TODO: we never execute this
//Currently we fallback to this in rare edgecases, it's not normally executed
downloadQueue->enqueue(QUrl("https://z.cash/downloads/sapling-output.params"));
downloadQueue->enqueue(QUrl("https://z.cash/downloads/sapling-spend.params"));
@ -590,8 +590,6 @@ bool ConnectionLoader::verifyParams() {
QDir paramsDir(zcashParamsDir());
// TODO: better error reporting if only 1 file exists or is missing
// TODO: do a basic size check, to filter out partial downloads and corrupt
// files from full HD's and other weird stuff
qDebug() << "Verifying sapling param files exist";
@ -611,9 +609,15 @@ bool ConnectionLoader::verifyParams() {
return true;
}
// this is to support hushd inside a .dmg file, where the binaries are not at the root directory, but they are executed from the root dir of the .dmg
if( QFile( QDir("..").filePath("Contents/MacOS/sapling-output.params") ).exists() && QFile( QDir("..").filePath("Contents/MacOS/hush3/sapling-spend.params") ).exists() ) {
qDebug() << "Found params in ../Contents/MacOS";
// this is to support SD on mac in /Applications1
if( QFile( QDir("/Applications").filePath("silentdragon.app/Contents/MacOS/sapling-output.params") ).exists() && QFile( QDir("/Applications").filePath("./silentdragon.app/Contents/MacOS/sapling-spend.params") ).exists() ) {
qDebug() << "Found params in /Applications/silentdragon.app/Contents/MacOS";
return true;
}
// this is to support SD on mac inside a DMG
if( QFile( QDir("./").filePath("silentdragon.app/Contents/MacOS/sapling-output.params") ).exists() && QFile( QDir("./").filePath("./silentdragon.app/Contents/MacOS/sapling-spend.params") ).exists() ) {
qDebug() << "Found params in ./silentdragon.app/Contents/MacOS";
return true;
}

2
src/main.cpp

@ -180,7 +180,7 @@ public:
qDebug() << "Loading locale " << locale;
QTranslator translator;
translator.load(QString(":/translations/res/zec_qt_wallet_") + locale);
translator.load(QString(":/translations/res/silentdragon_") + locale);
a.installTranslator(&translator);
QIcon icon(":/icons/res/icon.ico");

4
src/mainwindow.cpp

@ -442,7 +442,7 @@ void MainWindow::setupSettingsModal() {
void MainWindow::addressBook() {
// Check to see if there is a target.
QRegExp re("Address[0-9]+", Qt::CaseInsensitive);
QRegularExpression re("Address[0-9]+", QRegularExpression::CaseInsensitiveOption);
for (auto target: ui->sendToWidgets->findChildren<QLineEdit *>(re)) {
if (target->hasFocus()) {
AddressBook::open(this, target);
@ -926,6 +926,7 @@ void MainWindow::setupTransactionsTab() {
if (!memo.isEmpty()) {
QMessageBox mb(QMessageBox::Information, tr("Memo"), memo, QMessageBox::Ok, this);
mb.setTextFormat(Qt::PlainText);
mb.setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
mb.exec();
}
@ -981,6 +982,7 @@ void MainWindow::setupTransactionsTab() {
if (!memo.isEmpty()) {
menu.addAction(tr("View Memo"), [=] () {
QMessageBox mb(QMessageBox::Information, tr("Memo"), memo, QMessageBox::Ok, this);
mb.setTextFormat(Qt::PlainText);
mb.setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
mb.exec();
});

4
src/scripts/dotranslations.sh

@ -11,7 +11,7 @@ $QT_STATIC/bin/lrelease silentdragon.pro
# Then update the qt base translations. First, get all languages
ls res/*.qm | awk -F '[_.]' '{print $4}' | while read -r language ; do
if [ -f $QT_STATIC/translations/qtbase_$language.qm ]; then
$QT_STATIC/bin/lconvert -o res/zec_$language.qm $QT_STATIC/translations/qtbase_$language.qm res/zec_qt_wallet_$language.qm
mv res/zec_$language.qm res/zec_qt_wallet_$language.qm
$QT_STATIC/bin/lconvert -o res/zec_$language.qm $QT_STATIC/translations/qtbase_$language.qm res/silentdragon_$language.qm
mv res/zec_$language.qm res/silentdragon_$language.qm
fi
done

1
src/scripts/mkmacdmg.sh

@ -106,7 +106,6 @@ echo "[OK]"
# xcrun stapler staple macOS-zecwallet-v0.8.0.dmg
echo -n "Building dmg..........."
<<<<<<< HEAD
mv silentdragon.app silentdragon.app
create-dmg --volname "silentdragon-v$APP_VERSION" --volicon "res/logo.icns" --window-pos 200 120 --icon "silentdragon.app" 200 190 --app-drop-link 600 185 --hide-extension "silentdragon.app" --window-size 800 400 --hdiutil-quiet --background res/dmgbg.png artifacts/macOS-silentdragon-v$APP_VERSION.dmg silentdragon.app >/dev/null 2>&1

2
src/sendtab.cpp

@ -132,7 +132,7 @@ void MainWindow::updateLabelsAutoComplete() {
labelCompleter->setCaseSensitivity(Qt::CaseInsensitive);
// Then, find all the address fields and update the completer.
QRegExp re("Address[0-9]+", Qt::CaseInsensitive);
QRegularExpression re("Address[0-9]+", QRegularExpression::CaseInsensitiveOption);
for (auto target: ui->sendToWidgets->findChildren<QLineEdit *>(re)) {
target->setCompleter(labelCompleter);
}

45
src/settings.cpp

@ -34,9 +34,11 @@ void Settings::setAllowFetchPrices(bool allow) {
Explorer Settings::getExplorer() {
// Load from the QT Settings.
QSettings s;
//TODO: make it easy for people to use other explorers like komodod.com
QString explorer = "https://explorer.myhush.org";
auto txExplorerUrl = s.value("explorer/txExplorerUrl").toString();
auto addressExplorerUrl = s.value("explorer/addressExplorerUrl").toString();
auto txExplorerUrl = s.value("explorer/txExplorerUrl", explorer + "/tx/").toString();
auto addressExplorerUrl = s.value("explorer/addressExplorerUrl", explorer + "/address/").toString();
auto testnetTxExplorerUrl = s.value("explorer/testnetTxExplorerUrl").toString();
auto testnetAddressExplorerUrl = s.value("explorer/testnetAddressExplorerUrl").toString();
@ -364,27 +366,24 @@ PaymentURI Settings::parseURI(QString uri) {
ans.error = "Could not understand address";
return ans;
}
uri = uri.right(uri.length() - ans.addr.length());
if (!uri.isEmpty()) {
uri = uri.right(uri.length() - 1); // Eat the "?"
QStringList args = uri.split("&");
for (QString arg: args) {
QStringList kv = arg.split("=");
if (kv.length() != 2) {
ans.error = "No value argument was seen";
return ans;
}
if (kv[0].toLower() == "amt" || kv[0].toLower() == "amount") {
ans.amt = kv[1];
} else if (kv[0].toLower() == "memo" || kv[0].toLower() == "message" || kv[0].toLower() == "msg") {
ans.memo = QUrl::fromPercentEncoding(kv[1].toUtf8());
} else {
// Ignore unknown fields, since some developers use it to pass extra data.
}
}
uri = uri.right(uri.length() - ans.addr.length()-1); // swallow '?'
QUrlQuery query(uri);
// parse out amt / amount
if (query.hasQueryItem("amt")) {
ans.amt = query.queryItemValue("amt");
} else if (query.hasQueryItem("amount")) {
ans.amt = query.queryItemValue("amount");
}
// parse out memo / msg / message
if (query.hasQueryItem("memo")) {
ans.memo = query.queryItemValue("memo");
} else if (query.hasQueryItem("msg")) {
ans.memo = query.queryItemValue("msg");
} else if (query.hasQueryItem("message")) {
ans.memo = query.queryItemValue("message");
}
return ans;

2
src/txtablemodel.cpp

@ -143,7 +143,7 @@ void TxTableModel::updateAllData() {
return Settings::paymentURIPretty(Settings::parseURI(dat.memo));
} else {
return modeldata->at(index.row()).type +
(dat.memo.isEmpty() ? "" : " tx memo: \"" + dat.memo + "\"");
(dat.memo.isEmpty() ? "" : " tx memo: \"" + dat.memo.toHtmlEscaped() + "\"");
}
}
case 1: {

16
src/websockets.cpp

@ -211,14 +211,18 @@ void WormholeClient::onConnected()
qDebug() << "Created QTimer";
QObject::connect(timer, &QTimer::timeout, [=]() {
qDebug() << "Timer timeout!";
if (!shuttingDown && m_webSocket && m_webSocket->isValid()) {
auto payload = QJsonDocument(QJsonObject { {"ping", "ping"} }).toJson();
qint64 bytes = m_webSocket->sendTextMessage(payload);
qDebug() << "Sent ping, " << bytes << " bytes";
try {
if (!shuttingDown && m_webSocket && m_webSocket->isValid()) {
auto payload = QJsonDocument(QJsonObject { {"ping", "ping"} }).toJson();
qint64 bytes = m_webSocket->sendTextMessage(payload);
qDebug() << "Sent ping, " << bytes << " bytes";
}
} catch (...) {
qDebug() << "Websocket is invalid, no ping sent!";
}
});
unsigned int interval = 4*60*1000;
timer->start(interval); // 4 minutes
unsigned int interval = 1*60*1000; // 1 minute
timer->start(interval);
qDebug() << "Started timer with interval=" << interval;
} else {
qDebug() << "Invalid websocket object onConnected!";

Loading…
Cancel
Save