@@ -54,3 +54,8 @@ r
|
||||
s
|
||||
n
|
||||
q
|
||||
b FileSystem::readContactsOldFormat
|
||||
r
|
||||
n
|
||||
c
|
||||
q
|
||||
|
||||
@@ -26,7 +26,7 @@ SilentDragonLite does automatic note and utxo management, which means it doesn't
|
||||
## Compiling from source
|
||||
* SilentDragonLite is written in C++ 14, and can be compiled with g++/clang++/visual c++.
|
||||
* It also depends on Qt5, which you can get from [here](https://www.qt.io/download).
|
||||
* You'll need Rust v1.37 +
|
||||
* You'll need Rust v1.41 +
|
||||
|
||||
## Building on Linux
|
||||
|
||||
|
||||
@@ -33,12 +33,9 @@
|
||||
<file>res/add_contact.png</file>
|
||||
<file>res/notification.png</file>
|
||||
<file>res/rahmen-message.png</file>
|
||||
<file>res/upload.png</file>
|
||||
<file>res/upload.svg</file>
|
||||
<file>res/message-icon.svg</file>
|
||||
<file>res/lock.svg</file>
|
||||
<file>res/lock.png</file>
|
||||
<file>res/lock_green.png</file>
|
||||
<file>res/lock_orange.png</file>
|
||||
<file>res/unlocked.png</file>
|
||||
<file>res/getAddrWhite.png</file>
|
||||
<file>res/send-white.png</file>
|
||||
@@ -48,6 +45,8 @@
|
||||
<file>res/sendBlack.png</file>
|
||||
<file>res/requestBlack.png</file>
|
||||
<file>res/addContactBlack.png</file>
|
||||
<file>res/unknownBlack.png</file>
|
||||
<file>res/unknownWhite.png</file>
|
||||
|
||||
</qresource>
|
||||
<qresource prefix="/img">
|
||||
@@ -65,6 +64,7 @@
|
||||
<file>res/silentdragonlite_it.qm</file>
|
||||
<file>res/silentdragonlite_hr.qm</file>
|
||||
<file>res/silentdragonlite_fa.qm</file>
|
||||
<file>res/silentdragonlite_id.qm</file>
|
||||
</qresource>
|
||||
<qresource prefix="/css">
|
||||
<file>res/css/blue.css</file>
|
||||
|
||||
6
lib/Cargo.lock
generated
@@ -1177,7 +1177,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=fb07cae93c706cce929beef98690109e5f2d7592)",
|
||||
"silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=d196ad938a22810c0b6b4164e6bf8f1db0409763)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1640,7 +1640,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "silentdragonlitelib"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=fb07cae93c706cce929beef98690109e5f2d7592#fb07cae93c706cce929beef98690109e5f2d7592"
|
||||
source = "git+https://github.com/DenioD/silentdragonlite-cli?rev=d196ad938a22810c0b6b4164e6bf8f1db0409763#d196ad938a22810c0b6b4164e6bf8f1db0409763"
|
||||
dependencies = [
|
||||
"base58 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bellman 0.1.0 (git+https://github.com/MyHush/librustzcash.git?rev=1a0204113d487cdaaf183c2967010e5214ff9e37)",
|
||||
@@ -2631,7 +2631,7 @@ dependencies = [
|
||||
"checksum serde_yaml 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)" = "691b17f19fc1ec9d94ec0b5864859290dff279dbd7b03f017afda54eb36c3c35"
|
||||
"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0"
|
||||
"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=fb07cae93c706cce929beef98690109e5f2d7592)" = "<none>"
|
||||
"checksum silentdragonlitelib 0.1.0 (git+https://github.com/DenioD/silentdragonlite-cli?rev=d196ad938a22810c0b6b4164e6bf8f1db0409763)" = "<none>"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6"
|
||||
"checksum socket2 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e8b74de517221a2cb01a53349cf54182acdc31a074727d3079068448c0676d85"
|
||||
|
||||
@@ -11,4 +11,4 @@ crate-type = ["staticlib"]
|
||||
[dependencies]
|
||||
libc = "0.2.58"
|
||||
lazy_static = "1.4.0"
|
||||
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "fb07cae93c706cce929beef98690109e5f2d7592" }
|
||||
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "d196ad938a22810c0b6b4164e6bf8f1db0409763" }
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
break FileEncryption::encrypt
|
||||
break FileSystem::readContactsOldFormat
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 12 KiB |
BIN
res/lock_orange.png
Normal file
|
After Width: | Height: | Size: 929 B |
BIN
res/silentdragonlite_id.qm
Normal file
2002
res/silentdragonlite_id.ts
Normal file
BIN
res/unknownBlack.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
res/unknownWhite.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
res/unkownBlack.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Svg Vector Icons : http://www.onlinewebfonts.com/icon -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg fill="#EB4F38" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
|
||||
<metadata> Svg Vector Icons : http://www.onlinewebfonts.com/icon </metadata>
|
||||
<g><g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"><path d="M4631.2,5015.7c-634.2-57.5-1212.8-212.7-1755.1-475.2c-546.1-264.4-894.8-513.5-1339.3-959.9c-446.4-446.4-676.4-766.4-948.4-1322.1c-231.8-469.4-367.9-914-454.1-1465.8c-46-308.5-46-1032.7,1.9-1341.2c90.1-586.3,239.5-1057.6,488.6-1548.1c254.8-496.3,494.3-822,912-1239.7c438.8-440.7,764.5-674.4,1302.9-938.9c343-168.6,567.1-252.9,915.9-344.9c1452.4-383.2,2981.4-76.6,4209.5,839.2c233.8,176.3,756.8,699.3,933.1,933.1C9909.8-1493,10170.4,202.7,9610.9,1779.6c-168.6,475.2-484.8,1032.7-812.4,1437c-187.8,231.8-609.3,640-837.3,810.5C7286.8,4532.9,6530,4849,5685,4979.3C5491.5,5008.1,4817,5033,4631.2,5015.7z M5483.8,4622.9C7206.3,4450.5,8697,3264.5,9273.7,1605.2C9540,836.9,9593.7-44.5,9419.3-855c-176.3-818.1-615.1-1615.2-1224.3-2222.6c-714.7-716.6-1619-1159.2-2630.7-1293.3c-293.2-38.3-845-38.3-1138.1,0C2906.7-4171.6,1600-3240.4,933.2-1880.1c-320,651.4-461.8,1272.2-461.8,2013.8c0,730,139.9,1331.6,461.8,1990.8C1370.1,3015.4,2102,3747.3,2993,4184.2C3788.1,4571.2,4583.3,4713,5483.8,4622.9z"/><path d="M4589,2237.5c-431.1-103.5-768.3-486.7-814.3-927.4c-13.4-136,9.6-197.3,92-231.8c107.3-44.1,208.8,40.2,208.8,172.4c0,151.4,107.3,373.6,243.3,502c208.8,197.3,513.5,258.7,791.3,162.9c180.1-63.2,385.1-268.2,452.2-452.2c24.9-63.2,34.5-172.4,42.2-406.2l7.7-321.9H4431.9H3249.7l-46-47.9l-47.9-46v-1439v-1438.9l47.9-46l46-47.9h1592.2h1592.2l46,47.9l47.9,46v1438.9v1439l-47.9,46c-44.1,46-55.6,47.9-302.7,47.9h-258.7l-9.6,341c-7.7,287.4-15.3,358.3-49.8,457.9c-97.7,272.1-298.9,498.2-548,618.9C5068,2270.1,4832.3,2296.9,4589,2237.5z M6221.5-797.5v-1226.2H4841.9H3462.4v1226.2V428.8h1379.5h1379.5V-797.5z"/><path d="M4688.6,97.3c-36.4-11.5-111.1-65.2-162.9-118.8c-136-134.1-174.4-279.7-120.7-454.1c26.8-92,145.6-231.8,226.1-264.4l57.5-23v-402.4c0-398.5,0-400.4,47.9-446.4c61.3-63.2,149.4-63.2,210.8,0c47.9,46,47.9,47.9,47.9,446.4V-763l57.5,23c80.5,32.6,199.3,172.4,226.1,264.4c53.6,174.4,15.3,320-120.7,454.1C5023.9,114.5,4866.8,152.9,4688.6,97.3z M4947.3-232.3c95.8-93.9,28.7-258.7-105.4-258.7c-36.4,0-76.6,17.3-105.4,47.9c-30.7,28.7-47.9,69-47.9,105.4c0,36.4,17.2,76.6,47.9,105.4c28.7,30.7,69,47.9,105.4,47.9S4918.6-201.6,4947.3-232.3z"/></g></g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 2.7 KiB |
BIN
res/upload.png
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 218.8 283.5" style="enable-background:new 0 0 218.8 283.5;" xml:space="preserve">
|
||||
<g>
|
||||
<path d="M109.4,0L0,109.4h62.5v93.8h93.8v-93.8h62.5L109.4,0z M0,234.4v31.3h218.8v-31.3H0z M0,234.4"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 476 B |
@@ -122,6 +122,7 @@ HEADERS += \
|
||||
FORMS += \
|
||||
src/contactrequest.ui \
|
||||
src/encryption.ui \
|
||||
src/hushrequest.ui \
|
||||
src/mainwindow.ui \
|
||||
src/migration.ui \
|
||||
src/newseed.ui \
|
||||
@@ -158,6 +159,7 @@ TRANSLATIONS = res/silentdragonlite_es.ts \
|
||||
res/silentdragonlite_hr.ts \
|
||||
res/silentdragonlite_sr.ts \
|
||||
res/silentdragonlite_fa.ts \
|
||||
res/silentdragonlite_id.ts \
|
||||
res/silentdragonlite_tr.ts
|
||||
|
||||
include(singleapplication/singleapplication.pri)
|
||||
|
||||
@@ -7,43 +7,43 @@
|
||||
Chat::Chat() {}
|
||||
|
||||
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QTextEdit(parent) {
|
||||
QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay);
|
||||
QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplayChat);
|
||||
}
|
||||
|
||||
void ChatMemoEdit::updateDisplay() {
|
||||
void ChatMemoEdit::updateDisplayChat() {
|
||||
QString txt = this->toPlainText();
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlen));
|
||||
if (lenDisplayLabelchat)
|
||||
lenDisplayLabelchat->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlenchat));
|
||||
|
||||
if (txt.toUtf8().size() <= maxlen) {
|
||||
if (txt.toUtf8().size() <= maxlenchat) {
|
||||
// Everything is fine
|
||||
if (sendChatButton)
|
||||
sendChatButton->setEnabled(true);
|
||||
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setStyleSheet("");
|
||||
if (lenDisplayLabelchat)
|
||||
lenDisplayLabelchat->setStyleSheet("");
|
||||
}
|
||||
else {
|
||||
// Overweight
|
||||
if (sendChatButton)
|
||||
sendChatButton->setEnabled(false);
|
||||
|
||||
if (lenDisplayLabel)
|
||||
lenDisplayLabel->setStyleSheet("color: red;");
|
||||
if (lenDisplayLabelchat)
|
||||
lenDisplayLabelchat->setStyleSheet("color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
void ChatMemoEdit::setMaxLen(int len) {
|
||||
this->maxlen = len;
|
||||
updateDisplay();
|
||||
void ChatMemoEdit::setMaxLenChat(int len) {
|
||||
this->maxlenchat = len;
|
||||
updateDisplayChat();
|
||||
}
|
||||
|
||||
void ChatMemoEdit::SetSendChatButton(QPushButton* button) {
|
||||
this->sendChatButton = button;
|
||||
}
|
||||
|
||||
void ChatMemoEdit::setLenDisplayLabel(QLabel* label) {
|
||||
this->lenDisplayLabel = label;
|
||||
void ChatMemoEdit::setLenDisplayLabelChat(QLabel* label) {
|
||||
this->lenDisplayLabelchat = label;
|
||||
}
|
||||
|
||||
void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
||||
@@ -55,7 +55,6 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
||||
{
|
||||
for (auto &c : DataStore::getChatDataStore()->getAllMemos())
|
||||
{
|
||||
//////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid
|
||||
|
||||
if (
|
||||
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
|
||||
@@ -67,7 +66,8 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
||||
|
||||
Items->setData(OUTGOING, Qt::UserRole + 1);
|
||||
chat->appendRow(Items);
|
||||
ui->listChat->setModel(chat);
|
||||
ui->listChat->setModel(chat);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
@@ -86,6 +86,8 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
||||
Items1->setData(INCOMING, Qt::UserRole + 1);
|
||||
chat->appendRow(Items1);
|
||||
ui->listChat->setModel(chat);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -93,5 +95,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
||||
ui->listChat->setModel(chat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "ChatDataStore.h"
|
||||
#include "addressbook.h"
|
||||
#include "chatmodel.h"
|
||||
|
||||
|
||||
ChatDataStore* ChatDataStore::getInstance()
|
||||
{
|
||||
@@ -53,15 +55,14 @@ std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
|
||||
{
|
||||
std::map<QString, ChatItem> filteredItems;
|
||||
|
||||
for(auto &c: this->data)
|
||||
for(auto &c: this->data)
|
||||
{
|
||||
if (
|
||||
(c.second.isOutgoing() == false) &&
|
||||
(c.second.getType() == "Cont") &&
|
||||
(c.second.getContact() == "")
|
||||
|
||||
|
||||
(c.second.isContact() == false)
|
||||
)
|
||||
|
||||
{
|
||||
filteredItems[c.first] = c.second;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "FileSystem.h"
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#include "FileSystem.h"
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include "../Crypto/passwd.h"
|
||||
#include "addressbook.h"
|
||||
|
||||
FileSystem::FileSystem()
|
||||
{
|
||||
@@ -80,7 +83,7 @@ void FileSystem::writeContactsOldFormat(QString file, QList<ContactItem> contact
|
||||
c.push_back(item.getAvatar());
|
||||
_contacts.push_back(c);
|
||||
}
|
||||
out << QString("v1") << _contacts;
|
||||
out << QString("v2") << _contacts;
|
||||
_file.close();
|
||||
}
|
||||
|
||||
@@ -93,19 +96,68 @@ QList<ContactItem> FileSystem::readContactsOldFormat(QString file)
|
||||
contacts.clear();
|
||||
_file.open(QIODevice::ReadOnly);
|
||||
QDataStream in(&_file); // read the data serialized from the file
|
||||
QString version;
|
||||
in >> version;
|
||||
qDebug() << "Read " << version << " Hush contacts from disk...";
|
||||
qDebug() << "Detected old addressbook format";
|
||||
QList<QList<QString>> stuff;
|
||||
in >> stuff;
|
||||
//qDebug() << "Stuff: " << stuff;
|
||||
for (int i=0; i < stuff.size(); i++)
|
||||
if(in.status() == QDataStream::ReadCorruptData)
|
||||
{
|
||||
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]);
|
||||
contacts.push_back(contact);
|
||||
qDebug() << "Error reading contacts! ---> Your hush contacts from disk maybe corrupted";
|
||||
QFile::rename(file, file + QString(".corrupted"));
|
||||
QMessageBox::critical(
|
||||
nullptr,
|
||||
QObject::tr("Error reading contacts!"),
|
||||
QObject::tr("Your hush contacts from disk maybe corrupted"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
QString version;
|
||||
in >> version;
|
||||
if(version == "v1")
|
||||
{
|
||||
qDebug() << "Detected old addressbook format";
|
||||
// Convert old addressbook format v1 to v2
|
||||
QList<QPair<QString,QString>> stuff;
|
||||
in >> stuff;
|
||||
qDebug() << "Stuff: " << stuff;
|
||||
for (int i=0; i < stuff.size(); i++)
|
||||
{
|
||||
ContactItem contact = ContactItem(stuff[i].first, stuff[i].second);
|
||||
contacts.push_back(contact);
|
||||
qDebug() << "contact=" << contact.toQTString();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Read " << version << " Hush contacts from disk...";
|
||||
QList<QList<QString>> stuff;
|
||||
in >> stuff;
|
||||
qDebug() << "Dataarray size: " << stuff.size();
|
||||
if(stuff.size() == 0)
|
||||
return contacts;
|
||||
|
||||
for (int i= 0; i < stuff.size(); i++)
|
||||
{
|
||||
qDebug() << stuff[i].size();
|
||||
ContactItem contact;
|
||||
if(stuff[i].size() == 4)
|
||||
{
|
||||
contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]);
|
||||
}
|
||||
|
||||
qDebug() << contact.toQTString();
|
||||
contacts.push_back(contact);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
qDebug() << "Hush contacts readed from disk...";
|
||||
}
|
||||
|
||||
_file.close();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// GPLv3
|
||||
#ifndef FILESYSTEM_H
|
||||
#define FILESYSTEM_H
|
||||
|
||||
@@ -13,7 +15,7 @@ class FileSystem
|
||||
static bool instanced;
|
||||
static FileSystem* instance;
|
||||
FileSystem();
|
||||
|
||||
|
||||
public:
|
||||
static FileSystem* getInstance();
|
||||
QList<ContactItem> readContacts(QString file);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
ChatItem::ChatItem() {}
|
||||
|
||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
|
||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact)
|
||||
{
|
||||
_timestamp = timestamp;
|
||||
_address = address;
|
||||
@@ -17,9 +17,11 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
|
||||
_txid = txid;
|
||||
_confirmations = confirmations;
|
||||
_outgoing = false;
|
||||
_notarize = notarize;
|
||||
_iscontact = iscontact;
|
||||
}
|
||||
|
||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing)
|
||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact)
|
||||
{
|
||||
_timestamp = timestamp;
|
||||
_address = address;
|
||||
@@ -31,6 +33,9 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
|
||||
_txid = txid;
|
||||
_confirmations = confirmations;
|
||||
_outgoing = outgoing;
|
||||
_notarize = notarize;
|
||||
_iscontact = iscontact;
|
||||
|
||||
}
|
||||
|
||||
long ChatItem::getTimestamp()
|
||||
@@ -81,6 +86,16 @@ bool ChatItem::isOutgoing()
|
||||
return _outgoing;
|
||||
}
|
||||
|
||||
bool ChatItem::isNotarized()
|
||||
{
|
||||
return _notarize;
|
||||
}
|
||||
|
||||
bool ChatItem::isContact()
|
||||
{
|
||||
return _iscontact;
|
||||
}
|
||||
|
||||
void ChatItem::setTimestamp(long timestamp)
|
||||
{
|
||||
_timestamp = timestamp;
|
||||
@@ -128,6 +143,15 @@ void ChatItem::toggleOutgo()
|
||||
{
|
||||
_outgoing = true;
|
||||
}
|
||||
void ChatItem::notarized()
|
||||
{
|
||||
_notarize = false;
|
||||
}
|
||||
|
||||
void ChatItem::contact(bool iscontact)
|
||||
{
|
||||
_iscontact = iscontact;
|
||||
}
|
||||
|
||||
|
||||
QString ChatItem::toChatLine()
|
||||
@@ -136,14 +160,25 @@ QString ChatItem::toChatLine()
|
||||
QString lock;
|
||||
myDateTime.setTime_t(_timestamp);
|
||||
|
||||
if (_confirmations == 0){
|
||||
if (_notarize == true)
|
||||
|
||||
{
|
||||
|
||||
lock = "<b> <img src=':/icons/res/lock_orange.png'><b>";
|
||||
|
||||
}else{
|
||||
|
||||
lock = "<b> <img src=':/icons/res/unlocked.png'><b>";
|
||||
}else{
|
||||
}
|
||||
if ((_confirmations > 0) && (_notarize == false))
|
||||
|
||||
{
|
||||
|
||||
lock = "<b> <img src=':/icons/res/lock_green.png'><b>";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
qDebug()<<_notarize;
|
||||
QString line = QString("<small>") + myDateTime.toString("dd.MM.yyyy hh:mm");
|
||||
line += QString(lock) + QString("</small>");
|
||||
line += QString("<p>") + _memo.toHtmlEscaped() + QString("</p>");
|
||||
|
||||
@@ -20,11 +20,13 @@ class ChatItem
|
||||
QString _txid;
|
||||
int _confirmations;
|
||||
bool _outgoing = false;
|
||||
bool _notarize = false;
|
||||
bool _iscontact = false;
|
||||
|
||||
public:
|
||||
ChatItem();
|
||||
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations);
|
||||
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing);
|
||||
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact);
|
||||
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact);
|
||||
long getTimestamp();
|
||||
QString getAddress();
|
||||
QString getContact();
|
||||
@@ -35,6 +37,9 @@ class ChatItem
|
||||
QString getTxid();
|
||||
int getConfirmations();
|
||||
bool isOutgoing();
|
||||
bool isdouble();
|
||||
bool isNotarized();
|
||||
bool isContact();
|
||||
void setTimestamp(long timestamp);
|
||||
void setAddress(QString address);
|
||||
void setContact(QString contact);
|
||||
@@ -45,6 +50,8 @@ class ChatItem
|
||||
void setTxid(QString txid);
|
||||
void setConfirmations(int confirmations);
|
||||
void toggleOutgo();
|
||||
void notarized();
|
||||
void contact(bool iscontact);
|
||||
QString toChatLine();
|
||||
json toJson();
|
||||
~ChatItem();
|
||||
|
||||
@@ -1,14 +1,33 @@
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// GPLv3
|
||||
#include "ContactItem.h"
|
||||
#include "chatmodel.h"
|
||||
#include "Model/ChatItem.h"
|
||||
#include "controller.h"
|
||||
|
||||
ContactItem::ContactItem() {}
|
||||
|
||||
ContactItem::ContactItem(QString name, QString partnerAddress)
|
||||
{
|
||||
_name = name;
|
||||
_partnerAddress = partnerAddress;
|
||||
}
|
||||
|
||||
ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid)
|
||||
{
|
||||
_name = name;
|
||||
_myAddress = myAddress;
|
||||
_partnerAddress = partnerAddress;
|
||||
_cid = cid;
|
||||
}
|
||||
|
||||
ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar)
|
||||
{
|
||||
_name = name;
|
||||
_myAddress = myAddress;
|
||||
_partnerAddress = partnerAddress;
|
||||
_cid = cid;
|
||||
_avatar = avatar;
|
||||
_avatar = avatar;
|
||||
}
|
||||
|
||||
QString ContactItem::getName() const
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// GPLv3
|
||||
#ifndef CONTACTITEM_H
|
||||
#define CONTACTITEM_H
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include "mainwindow.h"
|
||||
using json = nlohmann::json;
|
||||
|
||||
class ContactItem
|
||||
{
|
||||
private:
|
||||
QString _myAddress;
|
||||
QString _partnerAddress;
|
||||
QString _name;
|
||||
QString _cid;
|
||||
QString _avatar;
|
||||
|
||||
QString _myAddress = "";
|
||||
QString _partnerAddress = "";
|
||||
QString _name = "";
|
||||
QString _cid = "";
|
||||
QString _avatar = ":/icons/res/sdlogo.png";
|
||||
|
||||
public:
|
||||
ContactItem();
|
||||
ContactItem(QString name, QString partnerAddress);
|
||||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid);
|
||||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar);
|
||||
QString getName() const;
|
||||
QString getMyAddress() const;
|
||||
|
||||
@@ -80,7 +80,7 @@ QString ContactRequest::toString()
|
||||
return "sender: " + _senderAddress + " receiver: " + _receiverAddress + " memo: " + _memo + " cid: " + _cid + " label: " + _label + " avatar: " + _avatar;
|
||||
}
|
||||
|
||||
ContactRequest::~ContactRequest()
|
||||
void ContactRequest::clear()
|
||||
{
|
||||
_senderAddress = "";
|
||||
_receiverAddress = "";
|
||||
@@ -88,4 +88,9 @@ ContactRequest::~ContactRequest()
|
||||
_cid = "";
|
||||
_label = "";
|
||||
_avatar = "";
|
||||
}
|
||||
|
||||
ContactRequest::~ContactRequest()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@@ -33,6 +33,7 @@ class ContactRequest
|
||||
void setLabel(QString label);
|
||||
void setAvatar(QString avatar);
|
||||
QString toString();
|
||||
void clear();
|
||||
~ContactRequest();
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@ void AddressBookModel::loadData()
|
||||
QSettings().value(
|
||||
"addresstablegeometry"
|
||||
).toByteArray()
|
||||
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
void AddressBookModel::addNewLabel(QString label, QString addr, QString myAddr, QString cid, QString avatar)
|
||||
@@ -414,12 +417,7 @@ void AddressBook::readFromStorage()
|
||||
allLabels = FileSystem::getInstance()->readContacts(AddressBook::writeableFile());
|
||||
|
||||
// test to see if the contact items in datastore are correctly dumped to json
|
||||
for(ContactItem item: allLabels)
|
||||
{
|
||||
DataStore::getContactDataStore()->setData(item.getCid(), item);
|
||||
}
|
||||
DataStore::getContactDataStore()->dump();
|
||||
AddressBook::writeToStorage();
|
||||
}
|
||||
|
||||
void AddressBook::writeToStorage()
|
||||
|
||||
@@ -23,6 +23,7 @@ public:
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@@ -32,7 +33,8 @@ private:
|
||||
QTableView* parent;
|
||||
//QList<QPair<QString, QString>> labels;
|
||||
QList<ContactItem> labels;
|
||||
QStringList headers;
|
||||
QStringList headers;
|
||||
|
||||
};
|
||||
|
||||
class AddressBook {
|
||||
@@ -63,6 +65,10 @@ public:
|
||||
|
||||
QString get_avatar_name();
|
||||
void set_avatar_name(QString avatar_name);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +82,7 @@ private:
|
||||
|
||||
QString writeableFile();
|
||||
QList<ContactItem> allLabels;
|
||||
|
||||
|
||||
static AddressBook* instance;
|
||||
};
|
||||
|
||||
@@ -65,31 +65,11 @@
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
<activeon>:/icons/res/sdlogo.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -105,11 +85,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -133,6 +113,26 @@
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Garflied</string>
|
||||
@@ -185,11 +185,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SDLogo</string>
|
||||
<string>Stag</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/sdlogo2.png</activeon>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "ui_mainwindow.h"
|
||||
#include "ui_requestContactDialog.h"
|
||||
#include "addressbook.h"
|
||||
#include "ui_memodialog.h"
|
||||
#include "ui_contactrequest.h"
|
||||
#include <QtWidgets>
|
||||
#include <QUuid>
|
||||
@@ -54,7 +53,6 @@ void ChatModel::clear()
|
||||
void ChatModel::addMessage(ChatItem item)
|
||||
{
|
||||
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
|
||||
// qDebug() << "inserting chatitem with id: " << key;
|
||||
this->chatItems[key] = item;
|
||||
}
|
||||
|
||||
@@ -74,8 +72,26 @@ void ChatModel::showMessages()
|
||||
|
||||
}
|
||||
|
||||
void ChatModel::addAddressbylabel(QString address, QString label)
|
||||
{
|
||||
this->AddressbyLabelMap[address] = label;
|
||||
}
|
||||
|
||||
|
||||
QString ChatModel::Addressbylabel(QString address)
|
||||
{
|
||||
for(auto& pair : this->AddressbyLabelMap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(this->AddressbyLabelMap.count(address) > 0)
|
||||
{
|
||||
return this->AddressbyLabelMap[address];
|
||||
}
|
||||
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
void MainWindow::renderContactRequest(){
|
||||
|
||||
Ui_requestDialog requestContact;
|
||||
@@ -83,27 +99,53 @@ void MainWindow::renderContactRequest(){
|
||||
requestContact.setupUi(&dialog);
|
||||
Settings::saveRestore(&dialog);
|
||||
|
||||
QString icon;
|
||||
auto theme = Settings::getInstance()->get_theme_name();
|
||||
if (theme == "dark" || theme == "midnight") {
|
||||
icon = ":/icons/res/unknownWhite.png";
|
||||
}else{
|
||||
icon = ":/icons/res/unknownBlack.png";
|
||||
}
|
||||
|
||||
QPixmap unknownWhite(icon);
|
||||
QIcon addnewAddrIcon(unknownWhite);
|
||||
|
||||
|
||||
|
||||
|
||||
QStandardItemModel* contactRequest = new QStandardItemModel();
|
||||
|
||||
for (auto &c : DataStore::getChatDataStore()->getAllNewContactRequests())
|
||||
|
||||
|
||||
|
||||
{
|
||||
|
||||
QStandardItem* Items = new QStandardItem(c.second.getAddress());
|
||||
QStandardItem* Items = new QStandardItem(QString("Unknown Sender"));
|
||||
contactRequest->appendRow(Items);
|
||||
requestContact.requestContact->setModel(contactRequest);
|
||||
|
||||
Items->setData(QIcon(addnewAddrIcon),Qt::DecorationRole);
|
||||
requestContact.requestContact->setIconSize(QSize(40,50));
|
||||
requestContact.requestContact->setUniformItemSizes(true);
|
||||
requestContact.requestContact->show();
|
||||
requestContact.zaddrnew->setVisible(false);
|
||||
requestContact.zaddrnew->setText(c.second.getAddress());
|
||||
|
||||
}
|
||||
|
||||
QStandardItemModel* contactRequestOld = new QStandardItemModel();
|
||||
|
||||
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
for (auto &c : DataStore::getChatDataStore()->getAllOldContactRequests())
|
||||
{
|
||||
if (p.getPartnerAddress() == c.second.getRequestZaddr())
|
||||
{
|
||||
QStandardItem* Items = new QStandardItem(c.second.getAddress());
|
||||
QStandardItem* Items = new QStandardItem(p.getName());
|
||||
contactRequestOld->appendRow(Items);
|
||||
requestContact.requestContactOld->setModel(contactRequestOld);
|
||||
requestContact.zaddrold->setVisible(false);
|
||||
requestContact.zaddrold->setText(c.second.getAddress());
|
||||
requestContact.requestContactOld->show();
|
||||
}else{}
|
||||
}
|
||||
@@ -116,7 +158,7 @@ void MainWindow::renderContactRequest(){
|
||||
QString label_contact = index.data(Qt::DisplayRole).toString();
|
||||
QStandardItemModel* contactMemo = new QStandardItemModel();
|
||||
|
||||
if ((c.second.isOutgoing() == false) && (label_contact == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
||||
if ((c.second.isOutgoing() == false) && (requestContact.zaddrnew->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
||||
|
||||
{
|
||||
|
||||
@@ -139,11 +181,11 @@ void MainWindow::renderContactRequest(){
|
||||
QObject::connect(requestContact.requestContactOld, &QTableView::clicked, [&] () {
|
||||
|
||||
for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems()){
|
||||
QModelIndex index = requestContact.requestContactOld->currentIndex();
|
||||
QString label_contactold = index.data(Qt::DisplayRole).toString();
|
||||
/* QModelIndex index = requestContact.requestContactOld->currentIndex();
|
||||
QString label_contactold = index.data(Qt::DisplayRole).toString();*/
|
||||
QStandardItemModel* contactMemo = new QStandardItemModel();
|
||||
|
||||
if ((c.second.isOutgoing() == false) && (label_contactold == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
||||
if ((c.second.isOutgoing() == false) && (requestContact.zaddrold->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
||||
|
||||
{
|
||||
|
||||
@@ -220,6 +262,11 @@ void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
||||
this->requestZaddrMap[tx] = requestZaddr;
|
||||
}
|
||||
|
||||
void ChatModel::addconfirmations(QString tx, int confirmation)
|
||||
{
|
||||
this->confirmationsMap[tx] = confirmation;
|
||||
}
|
||||
|
||||
QString ChatModel::getCidByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->cidMap)
|
||||
@@ -235,6 +282,21 @@ QString ChatModel::getCidByTx(QString tx)
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
QString ChatModel::getConfirmationByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->confirmationsMap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(this->confirmationsMap.count(tx) > 0)
|
||||
{
|
||||
return this->confirmationsMap[tx];
|
||||
}
|
||||
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
QString ChatModel::getrequestZaddrByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->requestZaddrMap)
|
||||
@@ -260,6 +322,11 @@ void ChatModel::killrequestZaddrCache()
|
||||
this->requestZaddrMap.clear();
|
||||
}
|
||||
|
||||
void ChatModel::killConfirmationCache()
|
||||
{
|
||||
this->confirmationsMap.clear();
|
||||
}
|
||||
|
||||
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
|
||||
{
|
||||
|
||||
@@ -334,14 +401,12 @@ void MainWindow::sendChat() {
|
||||
|
||||
// Create a Tx from the values on the send tab. Note that this Tx object
|
||||
// might not be valid yet.
|
||||
|
||||
// Memos can only be used with zAddrs. So check that first
|
||||
// for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
|
||||
|
||||
QString Name = ui->contactNameMemo->text();
|
||||
int sizename = Name.size();
|
||||
qDebug()<< sizename;
|
||||
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
|
||||
|
||||
// auto addr = "";
|
||||
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
|
||||
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
|
||||
QMessageBox::Ok, this);
|
||||
@@ -350,6 +415,20 @@ void MainWindow::sendChat() {
|
||||
return;
|
||||
}
|
||||
|
||||
int max = 512;
|
||||
QString chattext = ui->memoTxtChat->toPlainText();
|
||||
int size = chattext.size();
|
||||
|
||||
if (size > max){
|
||||
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
|
||||
tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
|
||||
QMessageBox::Ok, this);
|
||||
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
Tx tx = createTxFromChatPage();
|
||||
|
||||
QString error = doSendChatTxValidations(tx);
|
||||
@@ -384,10 +463,11 @@ void MainWindow::sendChat() {
|
||||
}
|
||||
|
||||
connD->status->setText(tr("Please wait..."));
|
||||
connD->statusDetail->setText(tr("Your Message will be send"));
|
||||
connD->statusDetail->setText(tr("Your Message will be sent"));
|
||||
|
||||
d->show();
|
||||
ui->memoTxtChat->clear();
|
||||
|
||||
|
||||
// And send the Tx
|
||||
rpc->executeTransaction(tx,
|
||||
@@ -396,6 +476,7 @@ void MainWindow::sendChat() {
|
||||
|
||||
connD->status->setText(tr("Done!"));
|
||||
connD->statusDetail->setText(txid);
|
||||
|
||||
|
||||
QTimer::singleShot(1000, [=]() {
|
||||
d->accept();
|
||||
@@ -406,7 +487,7 @@ void MainWindow::sendChat() {
|
||||
});
|
||||
|
||||
// Force a UI update so we get the unconfirmed Tx
|
||||
// rpc->refresh(true);
|
||||
rpc->refresh(true);
|
||||
ui->memoTxtChat->clear();
|
||||
|
||||
},
|
||||
@@ -425,6 +506,8 @@ void MainWindow::sendChat() {
|
||||
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
||||
}
|
||||
);
|
||||
|
||||
// rpc->refresh(true);
|
||||
}
|
||||
|
||||
QString MainWindow::doSendChatTxValidations(Tx tx) {
|
||||
@@ -450,7 +533,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
|
||||
auto available = rpc->getModel()->getAvailableBalance();
|
||||
|
||||
if (available < total) {
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 3 confirmations before they can be spent")
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||
}
|
||||
|
||||
@@ -499,7 +582,7 @@ void::MainWindow::addContact()
|
||||
});
|
||||
|
||||
QObject::connect(request.sendRequestButton, &QPushButton::clicked, this, &MainWindow::saveandsendContact);
|
||||
QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
|
||||
// QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
|
||||
|
||||
dialog.exec();
|
||||
|
||||
@@ -510,95 +593,7 @@ void::MainWindow::addContact()
|
||||
void MainWindow::saveandsendContact()
|
||||
{
|
||||
this->ContactRequest();
|
||||
QString addr = contactRequest.getReceiverAddress();
|
||||
QString newLabel = contactRequest.getLabel();
|
||||
QString myAddr = contactRequest.getSenderAddress();
|
||||
QString cid = contactRequest.getCid();
|
||||
QString avatar = contactRequest.getAvatar();
|
||||
|
||||
if (addr.isEmpty() || newLabel.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address or Label Error"),
|
||||
QObject::tr("Address or Label cannot be empty"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test if address is valid.
|
||||
if (!Settings::isValidAddress(addr))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address Format Error"),
|
||||
QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
///////Todo: Test if label allready exist!
|
||||
|
||||
////// Success, so show it
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
QMessageBox::information(
|
||||
this,
|
||||
QObject::tr("Added Contact"),
|
||||
QObject::tr("successfully added your new contact").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::saveContact()
|
||||
{
|
||||
|
||||
QString addr = contactRequest.getReceiverAddress();
|
||||
QString newLabel = contactRequest.getLabel();
|
||||
QString myAddr = contactRequest.getSenderAddress();
|
||||
QString cid = contactRequest.getCid();
|
||||
QString avatar = contactRequest.getAvatar();
|
||||
|
||||
if (addr.isEmpty() || newLabel.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address or Label Error"),
|
||||
QObject::tr("Address or Label cannot be empty"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test if address is valid.
|
||||
if (!Settings::isValidAddress(addr))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address Format Error"),
|
||||
QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
///////Todo: Test if label allready exist!
|
||||
|
||||
////// Success, so show it
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
QMessageBox::information(
|
||||
this,
|
||||
QObject::tr("Added Contact"),
|
||||
QObject::tr("successfully added your new contact").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Create a Tx for a contact Request
|
||||
@@ -646,6 +641,22 @@ void MainWindow::ContactRequest() {
|
||||
return;
|
||||
}
|
||||
|
||||
int max = 512;
|
||||
QString chattext = contactRequest.getMemo();;
|
||||
int size = chattext.size();
|
||||
|
||||
if (size > max){
|
||||
|
||||
// auto addr = "";
|
||||
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||
QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
|
||||
tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
|
||||
QMessageBox::Ok, this);
|
||||
|
||||
msg.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
Tx tx = createTxForSafeContactRequest();
|
||||
|
||||
QString error = doSendRequestTxValidations(tx);
|
||||
@@ -680,7 +691,7 @@ void MainWindow::ContactRequest() {
|
||||
}
|
||||
|
||||
connD->status->setText(tr("Please wait..."));
|
||||
connD->statusDetail->setText(tr("Your Contact will be send"));
|
||||
connD->statusDetail->setText(tr("Your contact request will be sent"));
|
||||
|
||||
d->show();
|
||||
ui->memoTxtChat->clear();
|
||||
@@ -700,7 +711,46 @@ void MainWindow::ContactRequest() {
|
||||
delete d;
|
||||
|
||||
});
|
||||
|
||||
QString addr = contactRequest.getReceiverAddress();
|
||||
QString newLabel = contactRequest.getLabel();
|
||||
QString myAddr = contactRequest.getSenderAddress();
|
||||
QString cid = contactRequest.getCid();
|
||||
QString avatar = contactRequest.getAvatar();
|
||||
|
||||
if (addr.isEmpty() || newLabel.isEmpty())
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address or Label Error"),
|
||||
QObject::tr("Address or Label cannot be empty"),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Test if address is valid.
|
||||
if (!Settings::isValidAddress(addr))
|
||||
{
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
QObject::tr("Address Format Error"),
|
||||
QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
///////Todo: Test if label allready exist!
|
||||
|
||||
////// Success, so show it
|
||||
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
|
||||
QMessageBox::information(
|
||||
this,
|
||||
QObject::tr("Added Contact"),
|
||||
QObject::tr("successfully added your new contact").arg(newLabel),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
// Force a UI update so we get the unconfirmed Tx
|
||||
// rpc->refresh(true);
|
||||
ui->memoTxtChat->clear();
|
||||
@@ -749,9 +799,11 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) {
|
||||
auto available = rpc->getModel()->getAvailableBalance();
|
||||
|
||||
if (available < total) {
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Chat/Helper/ChatDelegator.h"
|
||||
#include "Chat/Helper/ChatIDGenerator.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
@@ -32,7 +33,9 @@ class ChatModel
|
||||
MainWindow* main;
|
||||
std::map<QString, QString> cidMap;
|
||||
std::map<QString, QString> requestZaddrMap;
|
||||
std::map<QString, QString> confirmationsMap;
|
||||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||
std::map<QString, QString> AddressbyLabelMap;
|
||||
|
||||
public:
|
||||
ChatModel() {};
|
||||
@@ -45,16 +48,21 @@ class ChatModel
|
||||
void triggerRequest();
|
||||
void showMessages();
|
||||
void clear();
|
||||
void addAddressbylabel(QString addr, QString label);
|
||||
void addMessage(ChatItem item);
|
||||
void addMessage(QString timestamp, ChatItem item);
|
||||
void addCid(QString tx, QString cid);
|
||||
void addrequestZaddr(QString tx, QString requestZaddr);
|
||||
void addconfirmations(QString tx, int confirmation);
|
||||
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
||||
QString getCidByTx(QString tx);
|
||||
QString getrequestZaddrByTx(QString tx);
|
||||
QString getConfirmationByTx(QString tx);
|
||||
QString Addressbylabel(QString addr);
|
||||
void killCidCache();
|
||||
void killConfirmationCache();
|
||||
void killrequestZaddrCache();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,11 +5,18 @@
|
||||
#include "addressbook.h"
|
||||
#include "mainwindow.h"
|
||||
#include "chatmodel.h"
|
||||
#include "requestdialog.h"
|
||||
#include "ui_requestdialog.h"
|
||||
#include "ui_hushrequest.h"
|
||||
#include "settings.h"
|
||||
#include "controller.h"
|
||||
|
||||
|
||||
|
||||
void ContactModel::renderContactList(QListView* view)
|
||||
{
|
||||
QStandardItemModel* contact = new QStandardItemModel();
|
||||
|
||||
|
||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
|
||||
@@ -18,14 +25,119 @@ void ContactModel::renderContactList(QListView* view)
|
||||
|
||||
QStandardItem* Items1 = new QStandardItem(c.getName());
|
||||
Items1->setData(QIcon(avatar),Qt::DecorationRole);
|
||||
|
||||
contact->appendRow(Items1);
|
||||
view->setModel(contact);
|
||||
view->setIconSize(QSize(60,70));
|
||||
view->setUniformItemSizes(true);
|
||||
view->setDragDropMode(QAbstractItemView::DropOnly);
|
||||
view->show();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::showRequesthush() {
|
||||
|
||||
Ui_hushrequest req;
|
||||
QDialog d(this);
|
||||
req.setupUi(&d);
|
||||
Settings::saveRestore(&d);
|
||||
|
||||
QString label = ui->contactNameMemo->text();
|
||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
|
||||
if (p.getName() == label)
|
||||
|
||||
{
|
||||
|
||||
QString addr = p.getPartnerAddress();
|
||||
QString myzaddr = p.getMyAddress();
|
||||
|
||||
req.txtFrom->setText(addr);
|
||||
req.lblAddressInfo->setText(myzaddr);
|
||||
// Amount textbox
|
||||
req.txtAmount->setValidator(this->getAmountValidator());
|
||||
QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) {
|
||||
CAmount amount = CAmount::fromDecimalString(text);
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
}
|
||||
});
|
||||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
|
||||
if (Settings::getInstance()->get_currency_name() == "USD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalUSDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalEURString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCNYString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalRUBString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCADString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalSGDString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalCHFString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalINRString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalGBPString());
|
||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||
req.txtAmountUSD->setText(amount.toDecimalBTCString());
|
||||
}
|
||||
req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok));
|
||||
req.txtMemo->setLenDisplayLabel(req.lblMemoLen);
|
||||
req.txtMemo->setMaxLen(400);
|
||||
|
||||
req.txtFrom->setFocus();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (d.exec() == QDialog::Accepted) {
|
||||
// Construct a hush Payment URI with the data and pay it immediately.
|
||||
CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
|
||||
QString memoURI = "hush:" + req.lblAddressInfo->text()
|
||||
+ "?amt=" + amount.toDecimalString()
|
||||
+ "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText());
|
||||
|
||||
QString sendURI = "hush:" + AddressBook::addressFromAddressLabel(req.txtFrom->text())
|
||||
+ "?amt=0.0001"
|
||||
+ "&memo=" + QUrl::toPercentEncoding(memoURI);
|
||||
|
||||
// If the disclosed address in the memo doesn't have a balance, it will automatically fallback to the default
|
||||
// sapling address
|
||||
this->payhushURI(sendURI, req.lblAddressInfo->text());
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,13 +5,17 @@
|
||||
|
||||
#include "Model/ContactItem.h"
|
||||
#include <QListWidget>
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
class ContactModel
|
||||
|
||||
{
|
||||
public:
|
||||
|
||||
ContactModel() {}
|
||||
void renderContactList(QListView* view);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>777</width>
|
||||
<width>780</width>
|
||||
<height>427</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -38,31 +38,11 @@
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
<activeon>:/icons/res/sdlogo.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -78,11 +58,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -96,6 +76,16 @@
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Sharpee</string>
|
||||
@@ -106,6 +96,26 @@
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Garfield</string>
|
||||
@@ -156,16 +166,6 @@
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/sdlogo2.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
@@ -233,7 +233,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="3">
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Insert a memo for your request</span></p></body></html></string>
|
||||
@@ -318,36 +318,11 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QPushButton" name="onlyAdd">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>152</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Only add this contact</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="3" colspan="2">
|
||||
<widget class="QPushButton" name="sendRequestButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>188</width>
|
||||
<width>300</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
@@ -358,7 +333,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Contact & send request</string>
|
||||
<string>Add Contact and send request</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
|
||||
@@ -237,12 +237,15 @@ void Controller::getInfoThenRefresh(bool force)
|
||||
zrpc->fetchInfo([=] (const json& reply) {
|
||||
prevCallSucceeded = true;
|
||||
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
||||
int longestchain = reply["longestchain"].get<json::number_integer_t>();
|
||||
int notarized = reply["notarized"].get<json::number_integer_t>();
|
||||
bool doUpdate = force || (model->getLatestBlock() != curBlock);
|
||||
int difficulty = reply["difficulty"].get<json::number_integer_t>();
|
||||
int blocks_until_halving= 340000 - curBlock;
|
||||
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
|
||||
bool doUpdate = force || (model->getLatestBlock() != curBlock);
|
||||
int longestchain = reply["longestchain"].get<json::number_integer_t>();
|
||||
int notarized = reply["notarized"].get<json::number_integer_t>();
|
||||
|
||||
|
||||
|
||||
model->setLatestBlock(curBlock);
|
||||
if (
|
||||
Settings::getInstance()->get_currency_name() == "EUR" ||
|
||||
@@ -258,7 +261,11 @@ void Controller::getInfoThenRefresh(bool force)
|
||||
);
|
||||
ui->longestchain->setText(
|
||||
"Block: " + QLocale(QLocale::German).toString(longestchain)
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
ui->difficulty->setText(
|
||||
QLocale(QLocale::German).toString(difficulty)
|
||||
);
|
||||
@@ -540,8 +547,12 @@ void Controller::getInfoThenRefresh(bool force)
|
||||
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
|
||||
refreshTransactions();
|
||||
}
|
||||
|
||||
int lag = longestchain - notarized ;
|
||||
this->setLag(lag);
|
||||
}, [=](QString err) {
|
||||
// hushd has probably disappeared.
|
||||
|
||||
this->noConnection();
|
||||
|
||||
// Prevent multiple dialog boxes, because these are called async
|
||||
@@ -552,7 +563,7 @@ void Controller::getInfoThenRefresh(bool force)
|
||||
QMessageBox::critical(
|
||||
main,
|
||||
QObject::tr("Connection Error"),
|
||||
QObject::tr("There was an error connecting to hushd. The error was") + ": \n\n"+ err,
|
||||
QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n"+ err,
|
||||
QMessageBox::StandardButton::Ok
|
||||
);
|
||||
shown = false;
|
||||
@@ -562,6 +573,20 @@ void Controller::getInfoThenRefresh(bool force)
|
||||
});
|
||||
}
|
||||
|
||||
int Controller::getLag()
|
||||
{
|
||||
|
||||
return _lag;
|
||||
|
||||
}
|
||||
|
||||
void Controller::setLag(int lag)
|
||||
{
|
||||
|
||||
_lag = lag;
|
||||
|
||||
}
|
||||
|
||||
void Controller::refreshAddresses()
|
||||
{
|
||||
if (!zrpc->haveConnection())
|
||||
@@ -871,12 +896,33 @@ void Controller::refreshTransactions() {
|
||||
CAmount amount = CAmount::fromqint64(-1* o["value"].get<json::number_unsigned_t>());
|
||||
|
||||
// Check for Memos
|
||||
|
||||
if (confirmations == 0) {
|
||||
chatModel->addconfirmations(txid, confirmations);
|
||||
}
|
||||
|
||||
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
||||
DataStore::getChatDataStore()->clear();
|
||||
chatModel->killConfirmationCache();
|
||||
this->refresh(true);
|
||||
}
|
||||
|
||||
QString memo;
|
||||
if (!o["memo"].is_null()) {
|
||||
memo = QString::fromStdString(o["memo"]);
|
||||
|
||||
QString cid;
|
||||
bool isNotarized;
|
||||
|
||||
if (confirmations > getLag())
|
||||
{
|
||||
isNotarized = true;
|
||||
}else{
|
||||
|
||||
isNotarized = false;
|
||||
}
|
||||
|
||||
qDebug()<<"Conf : " << confirmations;
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
datetime,
|
||||
@@ -888,15 +934,17 @@ void Controller::refreshTransactions() {
|
||||
cid,
|
||||
txid,
|
||||
confirmations,
|
||||
true
|
||||
true,
|
||||
isNotarized,
|
||||
false
|
||||
);
|
||||
// qDebug()<<"Memo : " <<memo;
|
||||
// qDebug()<<"Confirmation :" << confirmations;
|
||||
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||
total_amount = total_amount + amount;
|
||||
}
|
||||
@@ -944,6 +992,28 @@ void Controller::refreshTransactions() {
|
||||
QString cid;
|
||||
int position;
|
||||
QString requestZaddr;
|
||||
bool isContact;
|
||||
|
||||
|
||||
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
|
||||
if (p.getPartnerAddress() == requestZaddr)
|
||||
{
|
||||
|
||||
chatModel->addAddressbylabel(address, requestZaddr);
|
||||
} else{}
|
||||
|
||||
|
||||
if (chatModel->Addressbylabel(address) != QString("0xdeadbeef")){
|
||||
|
||||
isContact = true;
|
||||
|
||||
}else{
|
||||
|
||||
isContact = false;
|
||||
|
||||
}
|
||||
|
||||
if (!it["memo"].is_null()) {
|
||||
|
||||
@@ -958,7 +1028,8 @@ void Controller::refreshTransactions() {
|
||||
chatModel->addCid(txid, cid);
|
||||
chatModel->addrequestZaddr(txid, requestZaddr);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){
|
||||
|
||||
@@ -973,8 +1044,20 @@ void Controller::refreshTransactions() {
|
||||
requestZaddr = chatModel->getrequestZaddrByTx(txid);
|
||||
}else{
|
||||
requestZaddr = "";
|
||||
}
|
||||
}
|
||||
|
||||
position = it["position"].get<json::number_integer_t>();
|
||||
|
||||
bool isNotarized;
|
||||
|
||||
if (confirmations > getLag())
|
||||
{
|
||||
isNotarized = true;
|
||||
}else{
|
||||
|
||||
isNotarized = false;
|
||||
}
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
datetime,
|
||||
address,
|
||||
@@ -985,16 +1068,17 @@ void Controller::refreshTransactions() {
|
||||
cid,
|
||||
txid,
|
||||
confirmations,
|
||||
false
|
||||
false,
|
||||
isNotarized,
|
||||
isContact
|
||||
);
|
||||
// qDebug()<< "Position : " << position;
|
||||
// qDebug()<<"Confirmation :" << confirmations;
|
||||
|
||||
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
qDebug()<<"get Lag" << getLag();
|
||||
|
||||
// Calculate the total unspent amount that's pending. This will need to be
|
||||
// shown in the UI so the user can keep track of pending funds
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright 2019-2020 The Hush developers
|
||||
// GPLv3
|
||||
|
||||
#ifndef RPCCLIENT_H
|
||||
#define RPCCLIENT_H
|
||||
|
||||
@@ -37,7 +40,10 @@ public:
|
||||
Connection* getConnection() { return zrpc->getConnection(); }
|
||||
void setConnection(Connection* c);
|
||||
void refresh(bool force = false);
|
||||
void refreshAddresses();
|
||||
void refreshAddresses();
|
||||
int getLag();
|
||||
void setLag(int lag);
|
||||
int _lag;
|
||||
|
||||
void checkForUpdate(bool silent = true);
|
||||
void refreshZECPrice();
|
||||
|
||||
156
src/hushrequest.ui
Normal file
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>hushrequest</class>
|
||||
<widget class="QDialog" name="hushrequest">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>663</width>
|
||||
<height>529</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblPixmap">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblHeader">
|
||||
<property name="text">
|
||||
<string>Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblAddress">
|
||||
<property name="text">
|
||||
<string>Request From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>541</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="txtFrom">
|
||||
<property name="text">
|
||||
<string>zaddr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblAmount">
|
||||
<property name="text">
|
||||
<string>Amount in </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLineEdit" name="txtAmount">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="txtAmountUSD">
|
||||
<property name="text">
|
||||
<string>Amount USD</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Memo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="lblMemoLen">
|
||||
<property name="text">
|
||||
<string notr="true">0 / 512</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="MemoEdit" name="txtMemo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>My Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="lblAddressInfo">
|
||||
<property name="text">
|
||||
<string>The recipient will see this address in the "to" field when they pay your request.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MemoEdit</class>
|
||||
<extends>QPlainTextEdit</extends>
|
||||
<header>memoedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -59,7 +59,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
theme_name = "default";
|
||||
theme_name = "dark";
|
||||
}
|
||||
|
||||
this->slot_change_theme(theme_name);
|
||||
@@ -1208,6 +1208,7 @@ void MainWindow::setupTransactionsTab() {
|
||||
ui->listChat->setMinimumSize(200,350);
|
||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
||||
ui->listChat->show();
|
||||
|
||||
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
// Table right click
|
||||
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
|
||||
@@ -1337,9 +1338,6 @@ void MainWindow::setupchatTab() {
|
||||
ui->memoTxtChat->setTextColor("Black");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
|
||||
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
|
||||
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);
|
||||
@@ -1354,18 +1352,67 @@ void MainWindow::setupchatTab() {
|
||||
|
||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
if (label_contact == p.getName()) {
|
||||
// ui->ContactZaddr->setText(p.getPartnerAddress());
|
||||
// ui->MyZaddr->setText(p.getMyAddress());
|
||||
ui->contactNameMemo->setText(p.getName());
|
||||
ui->memoTxtChat->clear();
|
||||
|
||||
rpc->refresh(true);
|
||||
// updateChat();
|
||||
ui->contactNameMemo->setText(p.getName());
|
||||
rpc->refresh(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
QMenu* contextMenu;
|
||||
QAction* requestAction;
|
||||
QAction* editAction;
|
||||
QAction* HushAction;
|
||||
QAction* requestHushAction;
|
||||
QAction* subatomicAction;
|
||||
contextMenu = new QMenu(ui->listContactWidget);
|
||||
requestAction = new QAction("Send a contact request - coming soon",contextMenu);
|
||||
editAction = new QAction("Delete this contact",contextMenu);
|
||||
HushAction = new QAction("Send a friend some Hush - coming soon",contextMenu);
|
||||
requestHushAction = new QAction("Request some Hush - coming soon",contextMenu);
|
||||
subatomicAction = new QAction("Make a subatomic swap with a friend- coming soon",contextMenu);
|
||||
ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
ui->listContactWidget->addAction(requestAction);
|
||||
ui->listContactWidget->addAction(editAction);
|
||||
ui->listContactWidget->addAction(HushAction);
|
||||
ui->listContactWidget->addAction(requestHushAction);
|
||||
ui->listContactWidget->addAction(subatomicAction);
|
||||
QObject::connect(requestHushAction, &QAction::triggered, [=]() {
|
||||
QModelIndex index = ui->listContactWidget->currentIndex();
|
||||
QString label_contact = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
if (label_contact == p.getName()) {
|
||||
ui->contactNameMemo->setText(p.getName());
|
||||
rpc->refresh(true);
|
||||
|
||||
}
|
||||
|
||||
MainWindow::showRequesthush();
|
||||
});
|
||||
|
||||
QObject::connect(editAction, &QAction::triggered, [=]() {
|
||||
QModelIndex index = ui->listContactWidget->currentIndex();
|
||||
QString label_contact = index.data(Qt::DisplayRole).toString();
|
||||
|
||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||
if (label_contact == p.getName()) {
|
||||
|
||||
QString label1 = p.getName();
|
||||
QString addr = p.getPartnerAddress();
|
||||
QString myzaddr = p.getMyAddress();
|
||||
QString cid = p.getCid();
|
||||
QString avatar = p.getAvatar();
|
||||
|
||||
|
||||
AddressBook::getInstance()->removeAddressLabel(label1, addr, myzaddr, cid,avatar);
|
||||
rpc->refreshContacts(
|
||||
ui->listContactWidget);
|
||||
rpc->refresh(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
|
||||
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
|
||||
}
|
||||
|
||||
|
||||
@@ -1374,13 +1421,11 @@ void MainWindow::updateChat()
|
||||
{
|
||||
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
|
||||
rpc->refresh(true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::updateContacts()
|
||||
{
|
||||
//rpc->refreshContacts(ui->listContactWidget);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::addNewZaddr(bool sapling) {
|
||||
@@ -1778,7 +1823,7 @@ void MainWindow::slot_change_theme(const QString& theme_name)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
saved_theme_name = "default";
|
||||
saved_theme_name = "dark";
|
||||
}
|
||||
|
||||
QFile qFile(":/css/res/css/" + saved_theme_name +".css");
|
||||
|
||||
@@ -60,8 +60,9 @@ public:
|
||||
void stopWebsocket();
|
||||
void saveContact();
|
||||
void saveandsendContact();
|
||||
void setMaxLen(int len);
|
||||
void updateDisplay();
|
||||
void showRequesthush();
|
||||
// void setmaxlenChat(int len);
|
||||
// void updateDisplay();
|
||||
|
||||
|
||||
void balancesReady();
|
||||
@@ -199,14 +200,14 @@ class ChatMemoEdit : public QTextEdit
|
||||
public:
|
||||
ChatMemoEdit(QWidget* parent);
|
||||
|
||||
void setMaxLen(int len);
|
||||
void setLenDisplayLabel(QLabel* label);
|
||||
void setMaxLenChat(int len);
|
||||
void setLenDisplayLabelChat(QLabel* label);
|
||||
void SetSendChatButton(QPushButton* button);
|
||||
void updateDisplay();
|
||||
void updateDisplayChat();
|
||||
|
||||
private:
|
||||
int maxlen = 512;
|
||||
QLabel* lenDisplayLabel = nullptr;
|
||||
int maxlenchat = 512;
|
||||
QLabel* lenDisplayLabelchat = nullptr;
|
||||
QPushButton* sendChatButton = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -1378,7 +1378,10 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>false</bool>
|
||||
@@ -1386,6 +1389,9 @@
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectItems</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_39">
|
||||
<property name="geometry">
|
||||
@@ -1419,10 +1425,16 @@
|
||||
<set>QTextEdit::AutoNone</set>
|
||||
</property>
|
||||
<property name="lineWrapMode">
|
||||
<enum>QTextEdit::FixedColumnWidth</enum>
|
||||
<enum>QTextEdit::FixedPixelWidth</enum>
|
||||
</property>
|
||||
<property name="lineWrapColumnOrWidth">
|
||||
<number>80</number>
|
||||
<number>600</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextEditorInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="contactNameMemo">
|
||||
@@ -1505,6 +1517,9 @@
|
||||
<height>521</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>The locks shows you the status of the message. Red lock = unconfirmed, green lock = min. 1 confirmations, orange lock = message is notarized</string>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAsNeeded</enum>
|
||||
</property>
|
||||
@@ -1515,7 +1530,7 @@
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::AllEditTriggers</set>
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<customwidget>
|
||||
<class>MemoEdit</class>
|
||||
<extends>QPlainTextEdit</extends>
|
||||
<header>memoedit.h</header>
|
||||
<header location="global">memoedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>812</width>
|
||||
<width>850</width>
|
||||
<height>495</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -27,7 +27,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" colspan="2">
|
||||
<item row="0" column="2" colspan="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html></string>
|
||||
@@ -97,12 +97,12 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" rowspan="6" colspan="2">
|
||||
<item row="3" column="0" rowspan="8">
|
||||
<widget class="QListView" name="requestContactOld">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>192</height>
|
||||
<height>190</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
@@ -119,14 +119,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<item row="3" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Request from :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" colspan="3">
|
||||
<item row="4" column="4" colspan="3">
|
||||
<widget class="QLineEdit" name="requestZaddr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -142,14 +149,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>My Zaddr :</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="4" colspan="3">
|
||||
<item row="5" column="4" colspan="3">
|
||||
<widget class="QLineEdit" name="requestMyAddr">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -165,24 +172,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<item row="6" column="1" colspan="3">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Give a Nickname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="4" colspan="2">
|
||||
<item row="6" column="4" colspan="2">
|
||||
<widget class="QLineEdit" name="requestLabel"/>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="3">
|
||||
<item row="7" column="1" colspan="4">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2" colspan="2">
|
||||
<item row="8" column="1" rowspan="2" colspan="3">
|
||||
<widget class="QComboBox" name="comboBoxAvatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -198,31 +205,11 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stag</string>
|
||||
<string>SDLogo</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
<activeon>:/icons/res/sdlogo.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -238,11 +225,11 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
<string>Denio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
<activeon>:/icons/res/Denio.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
@@ -266,6 +253,26 @@
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Elsa</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/res/Elsa.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Yoda</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/Yoda.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Garfield</string>
|
||||
@@ -318,17 +325,17 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SDLogo</string>
|
||||
<string>Stag</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<activeon>:/icons/res/sdlogo2.png</activeon>
|
||||
<activeon>:/icons/res/Stag.png</activeon>
|
||||
</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="5" rowspan="2">
|
||||
<item row="8" column="5" rowspan="2">
|
||||
<widget class="QPushButton" name="cancel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -353,7 +360,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="6" rowspan="2">
|
||||
<item row="8" column="6" rowspan="2">
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@@ -369,17 +376,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="3" colspan="2">
|
||||
<widget class="QLabel" name="requestCID">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="zaddrold">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="3">
|
||||
<widget class="QLabel" name="zaddrnew">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="5">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="10" column="2">
|
||||
<widget class="QLabel" name="requestCID">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html></string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -14,9 +14,124 @@
|
||||
<string>Payment Request</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblAddress">
|
||||
<property name="text">
|
||||
<string>Request From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="3">
|
||||
<widget class="QLabel" name="lblAddressInfo">
|
||||
<property name="text">
|
||||
<string>The recipient will see this address in the "to" field when they pay your request.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="MemoEdit" name="txtMemo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblPixmap">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1" colspan="3">
|
||||
<widget class="AddressCombo" name="cmbMyAddress"/>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLabel" name="lblSaplingWarning">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Memo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="3">
|
||||
<widget class="QLabel" name="lblMemoLen">
|
||||
<property name="text">
|
||||
<string notr="true">0 / 512</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="txtAmountUSD">
|
||||
<property name="text">
|
||||
<string>Amount USD</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="0" colspan="4">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -41,65 +156,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="21" column="0" colspan="4">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="lblAddress">
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QLabel" name="lblHeader">
|
||||
<property name="text">
|
||||
<string>Request From</string>
|
||||
<string>Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>My Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" colspan="3">
|
||||
<widget class="QLabel" name="lblSaplingWarning">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: red;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="lblAmount">
|
||||
<property name="text">
|
||||
<string>Amount in </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="2" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -119,20 +182,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="15" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>My Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="MemoEdit" name="txtMemo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<item row="24" column="2" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -146,83 +209,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="3">
|
||||
<widget class="Line" name="line_2">
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="lblAmount">
|
||||
<property name="text">
|
||||
<string>Amount in </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="3">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="3">
|
||||
<widget class="QLabel" name="lblAddressInfo">
|
||||
<property name="text">
|
||||
<string>The recipient will see this address in the "to" field when they pay your request.</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="3">
|
||||
<widget class="QLabel" name="lblMemoLen">
|
||||
<property name="text">
|
||||
<string notr="true">0 / 512</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="txtAmountUSD">
|
||||
<property name="text">
|
||||
<string>Amount USD</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Memo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblPixmap">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QLabel" name="lblHeader">
|
||||
<property name="text">
|
||||
<string>Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -937,7 +937,7 @@ QString MainWindow::doSendTxValidations(Tx tx) {
|
||||
auto available = rpc->getModel()->getAvailableBalance();
|
||||
|
||||
if (available < total) {
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
|
||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||
}
|
||||
|
||||
|
||||