@@ -12,6 +12,10 @@
|
|||||||
<qresource prefix="/img">
|
<qresource prefix="/img">
|
||||||
<file>res/hushdlogo.gif</file>
|
<file>res/hushdlogo.gif</file>
|
||||||
<file>res/logobig.gif</file>
|
<file>res/logobig.gif</file>
|
||||||
|
<file>res/silentdragonlite-animated.gif</file>
|
||||||
|
<file>res/silentdragonlite-animated-dark.gif</file>
|
||||||
|
<file>res/silentdragonlite-animated-startup.gif</file>
|
||||||
|
<file>res/silentdragonlite-animated-startup-dark.gif</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/translations">
|
<qresource prefix="/translations">
|
||||||
<file>res/silentdragonlite_de.qm</file>
|
<file>res/silentdragonlite_de.qm</file>
|
||||||
@@ -27,6 +31,7 @@
|
|||||||
<file>res/css/dark.css</file>
|
<file>res/css/dark.css</file>
|
||||||
<file>res/css/default.css</file>
|
<file>res/css/default.css</file>
|
||||||
<file>res/css/light.css</file>
|
<file>res/css/light.css</file>
|
||||||
|
<file>res/css/midnight.css</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/images/blue">
|
<qresource prefix="/images/blue">
|
||||||
<file>res/images/blue/unchecked.png</file>
|
<file>res/images/blue/unchecked.png</file>
|
||||||
|
|||||||
139
res/css/midnight.css
Normal file
139
res/css/midnight.css
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
Theme: Midnight Qt
|
||||||
|
Version: 1.0.2
|
||||||
|
Reference: https://doc.qt.io/qt-5/stylesheet-reference.html
|
||||||
|
|
||||||
|
Author: Charles Sharpe
|
||||||
|
Date: Apr. 23, 2020
|
||||||
|
Website: https://www.csharpe.me
|
||||||
|
License: https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow
|
||||||
|
{
|
||||||
|
background-color: #111;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton {
|
||||||
|
padding: 10px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton:hover {
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit, QRadioButton::indicator::unchecked, QCheckBox::indicator::unchecked {
|
||||||
|
background: #222;
|
||||||
|
border: 1px solid #333;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit:focus {
|
||||||
|
border: 1px solid #9d8400;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget QLabel {
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget QCheckBox {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabWidget QTabBar::tab {
|
||||||
|
min-height: 15px;
|
||||||
|
padding: 15px 25px;
|
||||||
|
border: 1px ridge #222;
|
||||||
|
left: 1px; /* Fix 1px alignment */
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabWidget QTabBar::tab:selected {
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111);
|
||||||
|
color:#fff;
|
||||||
|
border: 1px ridge #222;
|
||||||
|
border-bottom: 0px; /* Overwrites border-bottom */
|
||||||
|
}
|
||||||
|
|
||||||
|
QTabWidget QTabBar::tab:hover {
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #555, stop: 1 #111);
|
||||||
|
}
|
||||||
|
|
||||||
|
QHeaderView { /* Table Header */
|
||||||
|
background-color:#111;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHeaderView::section { /* Table Header Sections */
|
||||||
|
qproperty-alignment:center;
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111);
|
||||||
|
color:#fff;
|
||||||
|
min-height:25px;
|
||||||
|
font-weight:bold;
|
||||||
|
font-size:12px;
|
||||||
|
outline:0;
|
||||||
|
border:1px ridge #222;
|
||||||
|
padding: 2px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHeaderView::section:last {
|
||||||
|
border-right: 0px ridge #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
QScrollArea {
|
||||||
|
background:transparent;
|
||||||
|
border:0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView { /* Table - has to be selected as a class otherwise it throws off QCalendarWidget */
|
||||||
|
background:#111;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView::item { /* Table Item */
|
||||||
|
background-color:#111;
|
||||||
|
border:1px solid #222;
|
||||||
|
font-size:12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView::item:selected { /* Table Item Selected */
|
||||||
|
background-color:#fff;
|
||||||
|
color:#000;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar {
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar::item {
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #222, stop: 1 #111);
|
||||||
|
color: #fff;
|
||||||
|
padding: 5px 7px;
|
||||||
|
margin: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenuBar::item:selected {
|
||||||
|
background-color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 0.25, stop: 0 #333, stop: 1 #111);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu {
|
||||||
|
border:1px solid #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::item {
|
||||||
|
padding: 7px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::item:selected {
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMenu::separator {
|
||||||
|
height: 1px;
|
||||||
|
margin: 3px 7px 3px 7px; /* space at ends of separator */
|
||||||
|
background: #222;
|
||||||
|
}
|
||||||
BIN
res/silentdragonlite-animated-dark.gif
Normal file
BIN
res/silentdragonlite-animated-dark.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 KiB |
BIN
res/silentdragonlite-animated-startup-dark.gif
Normal file
BIN
res/silentdragonlite-animated-startup-dark.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
BIN
res/silentdragonlite-animated-startup.gif
Normal file
BIN
res/silentdragonlite-animated-startup.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1015 KiB |
BIN
res/silentdragonlite-animated.gif
Normal file
BIN
res/silentdragonlite-animated.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 406 KiB |
@@ -142,16 +142,15 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
bool sapling = true;
|
bool sapling = true;
|
||||||
rpc->createNewZaddr(sapling, [=] (json reply) {
|
rpc->createNewZaddr(sapling, [=] (json reply) {
|
||||||
QString myAddr = QString::fromStdString(reply.get<json::array_t>()[0]);
|
QString myAddr = QString::fromStdString(reply.get<json::array_t>()[0]);
|
||||||
// QString myAddr = "zs1flslqurcnummsw37mfxkhx6d7uwpevlc78cdjyqrgng7357t8f3stm9fneeqtuupfnrt7f933a9";
|
|
||||||
QString message = QString("New Chat Address for your partner: ") + myAddr;
|
QString message = QString("New Chat Address for your partner: ") + myAddr;
|
||||||
|
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
||||||
|
|
||||||
parent->ui->listReceiveAddresses->insertItem(0, myAddr);
|
parent->ui->listReceiveAddresses->insertItem(0, myAddr);
|
||||||
parent->ui->listReceiveAddresses->setCurrentIndex(0);
|
parent->ui->listReceiveAddresses->setCurrentIndex(0);
|
||||||
// ab.addr_chat->setText(myAddr);
|
|
||||||
qDebug() << "new generated myAddr" << myAddr;
|
qDebug() << "new generated myAddr" << myAddr;
|
||||||
//
|
ab.cid->setText(cid);
|
||||||
ab.addr_chat->setText(myAddr);
|
ab.addr_chat->setText(myAddr);
|
||||||
// AddressBook::getInstance()->addAddressLabel(newLabel, ab.addr->text(), myAddr, cid);
|
|
||||||
});
|
});
|
||||||
model.updateUi(); //todo fix updating gui after adding
|
model.updateUi(); //todo fix updating gui after adding
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
@@ -168,8 +167,6 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
|
|||||||
auto addr = ab.addr->text().trimmed();
|
auto addr = ab.addr->text().trimmed();
|
||||||
auto myAddr = ab.addr_chat->text().trimmed();
|
auto myAddr = ab.addr_chat->text().trimmed();
|
||||||
QString newLabel = ab.label->text();
|
QString newLabel = ab.label->text();
|
||||||
// QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
|
|
||||||
|
|
||||||
QString cid = ab.cid->text();
|
QString cid = ab.cid->text();
|
||||||
|
|
||||||
if (addr.isEmpty() || newLabel.isEmpty())
|
if (addr.isEmpty() || newLabel.isEmpty())
|
||||||
|
|||||||
@@ -27,9 +27,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Nickname</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLineEdit" name="addr"/>
|
<widget class="QLineEdit" name="addr"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="label">
|
||||||
|
<property name="maxLength">
|
||||||
|
<number>40</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -41,20 +55,13 @@
|
|||||||
<widget class="QLineEdit" name="addr_chat"/>
|
<widget class="QLineEdit" name="addr_chat"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Label</string>
|
<string><html><head/><body><p>Conversation ID (editable):</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLineEdit" name="label">
|
|
||||||
<property name="maxLength">
|
|
||||||
<number>40</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLineEdit" name="cid"/>
|
<widget class="QLineEdit" name="cid"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ void ChatModel::clear()
|
|||||||
void ChatModel::addMessage(ChatItem item)
|
void ChatModel::addMessage(ChatItem item)
|
||||||
{
|
{
|
||||||
QString key = this->generateChatItemID(item);
|
QString key = this->generateChatItemID(item);
|
||||||
qDebug() << "inserting chatitem with id: " << key;
|
// qDebug() << "inserting chatitem with id: " << key;
|
||||||
this->chatItems[key] = item;
|
this->chatItems[key] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,20 +129,34 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view)
|
|||||||
|
|
||||||
if ((ui->MyZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)){
|
if ((ui->MyZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)){
|
||||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels()){
|
for(auto &p : AddressBook::getInstance()->getAllAddressLabels()){
|
||||||
if (p.getCid() == c.second.getCid()){
|
|
||||||
line += QString("<") + "verified" + QString("> :\n");}
|
if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid()))
|
||||||
}
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// line+= QString("[") + "Warning. Not verified!" + QString("]");
|
||||||
|
|
||||||
|
|
||||||
line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
|
line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
|
||||||
line += QString("<") + QString("incoming") + QString("> :\n");
|
line += QString("<") + QString("incoming") + QString("> :\n");
|
||||||
line += QString(c.second.getMemo()) + QString("\n");
|
line += QString(c.second.getMemo()) + QString("\n");
|
||||||
view->addItem(line);
|
view->addItem(line);
|
||||||
line ="";
|
line ="";
|
||||||
}else{}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChatModel::addCid(QString tx, QString cid)
|
void ChatModel::addCid(QString tx, QString cid)
|
||||||
{
|
{
|
||||||
this->cidMap[tx] = cid;
|
this->cidMap[tx] = cid;
|
||||||
@@ -152,7 +166,7 @@ QString ChatModel::getCidByTx(QString tx)
|
|||||||
{
|
{
|
||||||
for(auto& pair : this->cidMap)
|
for(auto& pair : this->cidMap)
|
||||||
{
|
{
|
||||||
qDebug() << "TXID=" << pair.first << " CID=" << pair.second;
|
// qDebug() << "TXID=" << pair.first << " CID=" << pair.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->cidMap.count(tx) > 0)
|
if(this->cidMap.count(tx) > 0)
|
||||||
@@ -233,7 +247,7 @@ Tx MainWindow::createTxFromChatPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::sendChatButton() {
|
void MainWindow::sendChatButton() {
|
||||||
////////////////////////////Todo: Check if its a zaddr//////////
|
////////////////////////////Todo: Check if a Contact is selected//////////
|
||||||
|
|
||||||
// Create a Tx from the values on the send tab. Note that this Tx object
|
// Create a Tx from the values on the send tab. Note that this Tx object
|
||||||
// might not be valid yet.
|
// might not be valid yet.
|
||||||
@@ -241,17 +255,17 @@ void MainWindow::sendChatButton() {
|
|||||||
// Memos can only be used with zAddrs. So check that first
|
// Memos can only be used with zAddrs. So check that first
|
||||||
// for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
// for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
|
|
||||||
// if (ui->ContactZaddr->text().trimmed() == c.getName()) {
|
if (ui->ContactZaddr->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
|
||||||
|
|
||||||
// auto addr = "";
|
// auto addr = "";
|
||||||
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
|
||||||
// QMessageBox msg(QMessageBox::Critical, tr("Memos can only be used with z-addresses"),
|
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
|
||||||
// tr("The memo field can only be used with a z-address.\n") + addr->text() + tr("\ndoesn't look like a z-address"),
|
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
|
||||||
// QMessageBox::Ok, this);
|
QMessageBox::Ok, this);
|
||||||
|
|
||||||
// msg.exec();
|
msg.exec();
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
Tx tx = createTxFromChatPage();
|
Tx tx = createTxFromChatPage();
|
||||||
|
|
||||||
@@ -273,8 +287,18 @@ void MainWindow::sendChatButton() {
|
|||||||
auto d = new QDialog(this);
|
auto d = new QDialog(this);
|
||||||
auto connD = new Ui_ConnectionDialog();
|
auto connD = new Ui_ConnectionDialog();
|
||||||
connD->setupUi(d);
|
connD->setupUi(d);
|
||||||
QPixmap logo(":/img/res/logobig.gif");
|
QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated.gif");;
|
||||||
connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
QMovie *movie2 = new QMovie(":/img/res/silentdragonlite-animated-dark.gif");;
|
||||||
|
auto theme = Settings::getInstance()->get_theme_name();
|
||||||
|
if (theme == "dark" || theme == "midnight") {
|
||||||
|
movie2->setScaledSize(QSize(512,512));
|
||||||
|
connD->topIcon->setMovie(movie2);
|
||||||
|
movie2->start();
|
||||||
|
} else {
|
||||||
|
movie1->setScaledSize(QSize(512,512));
|
||||||
|
connD->topIcon->setMovie(movie1);
|
||||||
|
movie1->start();
|
||||||
|
}
|
||||||
|
|
||||||
connD->status->setText(tr("Please wait..."));
|
connD->status->setText(tr("Please wait..."));
|
||||||
connD->statusDetail->setText(tr("Your Message will be send"));
|
connD->statusDetail->setText(tr("Your Message will be send"));
|
||||||
|
|||||||
@@ -10,40 +10,52 @@
|
|||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc)
|
ConnectionLoader::ConnectionLoader(MainWindow* main, Controller* rpc)
|
||||||
{
|
{
|
||||||
this->main = main;
|
this->main = main;
|
||||||
this->rpc = rpc;
|
this->rpc = rpc;
|
||||||
|
|
||||||
d = new QDialog(main);
|
d = new QDialog(main);
|
||||||
connD = new Ui_ConnectionDialog();
|
connD = new Ui_ConnectionDialog();
|
||||||
connD->setupUi(d);
|
connD->setupUi(d);
|
||||||
QPixmap logo(":/img/res/logobig.gif");
|
|
||||||
connD->topIcon->setBasePixmap(
|
auto theme = Settings::getInstance()->get_theme_name();
|
||||||
logo.scaled(
|
qDebug() << theme << "theme has loaded";
|
||||||
256,
|
auto size = QSize(512,512);
|
||||||
256,
|
|
||||||
Qt::KeepAspectRatio,
|
if (theme == "dark" || theme == "midnight") {
|
||||||
Qt::SmoothTransformation
|
QMovie *movie2 = new QMovie(":/img/res/silentdragonlite-animated-startup-dark.gif");;
|
||||||
)
|
movie2->setScaledSize(size);
|
||||||
);
|
qDebug() << "Animation dark loaded";
|
||||||
|
connD->topIcon->setMovie(movie2);
|
||||||
|
movie2->start();
|
||||||
|
} else {
|
||||||
|
QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated-startup.gif");;
|
||||||
|
movie1->setScaledSize(size);
|
||||||
|
qDebug() << "Animation light loaded";
|
||||||
|
connD->topIcon->setMovie(movie1);
|
||||||
|
movie1->start();
|
||||||
|
}
|
||||||
|
main->logger->write("Set animation");
|
||||||
|
qDebug() << "Set animation";
|
||||||
isSyncing = new QAtomicInteger<bool>();
|
isSyncing = new QAtomicInteger<bool>();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionLoader::~ConnectionLoader()
|
ConnectionLoader::~ConnectionLoader()
|
||||||
{
|
{
|
||||||
delete isSyncing;
|
delete isSyncing;
|
||||||
delete connD;
|
delete connD;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::loadConnection()
|
void ConnectionLoader::loadConnection()
|
||||||
{
|
{
|
||||||
QTimer::singleShot(1, [=]() { this->doAutoConnect(); });
|
QTimer::singleShot(1, [=]() { this->doAutoConnect(); });
|
||||||
if (!Settings::getInstance()->isHeadless())
|
if (!Settings::getInstance()->isHeadless())
|
||||||
d->exec();
|
d->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::doAutoConnect()
|
void ConnectionLoader::doAutoConnect()
|
||||||
{
|
{
|
||||||
qDebug() << "Doing autoconnect";
|
qDebug() << "Doing autoconnect";
|
||||||
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
auto config = std::shared_ptr<ConnectionConfig>(new ConnectionConfig());
|
||||||
@@ -54,29 +66,29 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
|
main->logger->write(QObject::tr("Attempting to initialize library with ") + config->server);
|
||||||
|
|
||||||
// Check to see if there's an existing wallet
|
// Check to see if there's an existing wallet
|
||||||
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str()))
|
if (litelib_wallet_exists(Settings::getDefaultChainName().toStdString().c_str()))
|
||||||
{
|
{
|
||||||
main->logger->write(QObject::tr("Using existing wallet."));
|
main->logger->write(QObject::tr("Using existing wallet."));
|
||||||
char* resp = litelib_initialize_existing(
|
char* resp = litelib_initialize_existing(
|
||||||
config->dangerous,
|
config->dangerous,
|
||||||
config->server.toStdString().c_str()
|
config->server.toStdString().c_str()
|
||||||
);
|
);
|
||||||
QString response = litelib_process_response(resp);
|
QString response = litelib_process_response(resp);
|
||||||
|
|
||||||
if (response.toUpper().trimmed() != "OK")
|
if (response.toUpper().trimmed() != "OK")
|
||||||
{
|
{
|
||||||
showError(response);
|
showError(response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
main->logger->write(QObject::tr("Create/restore wallet."));
|
main->logger->write(QObject::tr("Create/restore wallet."));
|
||||||
createOrRestore(config->dangerous, config->server);
|
createOrRestore(config->dangerous, config->server);
|
||||||
d->show();
|
d->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto connection = makeConnection(config);
|
auto connection = makeConnection(config);
|
||||||
auto me = this;
|
auto me = this;
|
||||||
|
|
||||||
@@ -97,14 +109,14 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
// When sync is done, set the connection
|
// When sync is done, set the connection
|
||||||
this->doRPCSetConnection(connection);
|
this->doRPCSetConnection(connection);
|
||||||
});
|
});
|
||||||
|
|
||||||
// While it is syncing, we'll show the status updates while it is alive.
|
// While it is syncing, we'll show the status updates while it is alive.
|
||||||
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
|
QObject::connect(syncTimer, &QTimer::timeout, [=]() {
|
||||||
// Check the sync status
|
// Check the sync status
|
||||||
if (isSyncing != nullptr && isSyncing->load()) {
|
if (isSyncing != nullptr && isSyncing->load()) {
|
||||||
// Get the sync status
|
// Get the sync status
|
||||||
connection->doRPC("syncstatus", "", [=](json reply) {
|
connection->doRPC("syncstatus", "", [=](json reply) {
|
||||||
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end())
|
if (isSyncing != nullptr && reply.find("synced_blocks") != reply.end())
|
||||||
{
|
{
|
||||||
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
|
qint64 synced = reply["synced_blocks"].get<json::number_unsigned_t>();
|
||||||
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
|
qint64 total = reply["total_blocks"].get<json::number_unsigned_t>();
|
||||||
@@ -117,8 +129,8 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
qDebug() << "Sync error" << err;
|
qDebug() << "Sync error" << err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
syncTimer->setInterval(1* 1000);
|
syncTimer->setInterval(1* 1000);
|
||||||
syncTimer->start();
|
syncTimer->start();
|
||||||
|
|
||||||
@@ -127,16 +139,16 @@ void ConnectionLoader::doAutoConnect()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::createOrRestore(bool dangerous, QString server)
|
void ConnectionLoader::createOrRestore(bool dangerous, QString server)
|
||||||
{
|
{
|
||||||
// Close the startup dialog, since we'll be showing the wizard
|
// Close the startup dialog, since we'll be showing the wizard
|
||||||
d->hide();
|
d->hide();
|
||||||
// Create a wizard
|
// Create a wizard
|
||||||
FirstTimeWizard wizard(dangerous, server);
|
FirstTimeWizard wizard(dangerous, server);
|
||||||
wizard.exec();
|
wizard.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionLoader::doRPCSetConnection(Connection* conn)
|
void ConnectionLoader::doRPCSetConnection(Connection* conn)
|
||||||
{
|
{
|
||||||
qDebug() << "Connectionloader finished, setting connection";
|
qDebug() << "Connectionloader finished, setting connection";
|
||||||
rpc->setConnection(conn);
|
rpc->setConnection(conn);
|
||||||
@@ -144,26 +156,26 @@ void ConnectionLoader::doRPCSetConnection(Connection* conn)
|
|||||||
QTimer::singleShot(1, [=]() { delete this; });
|
QTimer::singleShot(1, [=]() { delete this; });
|
||||||
}
|
}
|
||||||
|
|
||||||
Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config)
|
Connection* ConnectionLoader::makeConnection(std::shared_ptr<ConnectionConfig> config)
|
||||||
{
|
{
|
||||||
return new Connection(main, config);
|
return new Connection(main, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the UI with the status
|
// Update the UI with the status
|
||||||
void ConnectionLoader::showInformation(QString info, QString detail)
|
void ConnectionLoader::showInformation(QString info, QString detail)
|
||||||
{
|
{
|
||||||
connD->status->setText(info);
|
connD->status->setText(info);
|
||||||
connD->statusDetail->setText(detail);
|
connD->statusDetail->setText(detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show error will close the loading dialog and show an error.
|
* Show error will close the loading dialog and show an error.
|
||||||
*/
|
*/
|
||||||
void ConnectionLoader::showError(QString explanation)
|
void ConnectionLoader::showError(QString explanation)
|
||||||
{
|
{
|
||||||
rpc->noConnection();
|
rpc->noConnection();
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
main,
|
main,
|
||||||
QObject::tr("Connection Error"),
|
QObject::tr("Connection Error"),
|
||||||
explanation,
|
explanation,
|
||||||
QMessageBox::Ok
|
QMessageBox::Ok
|
||||||
@@ -171,7 +183,7 @@ void ConnectionLoader::showError(QString explanation)
|
|||||||
d->close();
|
d->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString litelib_process_response(char* resp)
|
QString litelib_process_response(char* resp)
|
||||||
{
|
{
|
||||||
char* resp_copy = new char[strlen(resp) + 1];
|
char* resp_copy = new char[strlen(resp) + 1];
|
||||||
//a safer version of strcpy
|
//a safer version of strcpy
|
||||||
@@ -185,15 +197,15 @@ QString litelib_process_response(char* resp)
|
|||||||
|
|
||||||
/***********************************************************************************
|
/***********************************************************************************
|
||||||
* Connection, Executor and Callback Class
|
* Connection, Executor and Callback Class
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
void Executor::run()
|
void Executor::run()
|
||||||
{
|
{
|
||||||
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
char* resp = litelib_execute(this->cmd.toStdString().c_str(), this->args.toStdString().c_str());
|
||||||
QString reply = litelib_process_response(resp);
|
QString reply = litelib_process_response(resp);
|
||||||
//qDebug() << "RPC Reply=" << reply;
|
//qDebug() << "RPC Reply=" << reply;
|
||||||
auto parsed = json::parse(
|
auto parsed = json::parse(
|
||||||
reply.toStdString().c_str(),
|
reply.toStdString().c_str(),
|
||||||
nullptr,
|
nullptr,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
if (parsed.is_discarded() || parsed.is_null())
|
if (parsed.is_discarded() || parsed.is_null())
|
||||||
@@ -204,14 +216,14 @@ void Executor::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Callback::processRPCCallback(json resp)
|
void Callback::processRPCCallback(json resp)
|
||||||
{
|
{
|
||||||
this->cb(resp);
|
this->cb(resp);
|
||||||
// Destroy self
|
// Destroy self
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Callback::processError(QString resp)
|
void Callback::processError(QString resp)
|
||||||
{
|
{
|
||||||
this->errCb(resp);
|
this->errCb(resp);
|
||||||
// Destroy self
|
// Destroy self
|
||||||
@@ -226,7 +238,7 @@ Connection::Connection(MainWindow* m, std::shared_ptr<ConnectionConfig> conf)
|
|||||||
qRegisterMetaType<json>("json");
|
qRegisterMetaType<json>("json");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPC(const QString cmd, const QString args, const std::function<void(json)>& cb, const std::function<void(QString)>& errCb)
|
void Connection::doRPC(const QString cmd, const QString args, const std::function<void(json)>& cb, const std::function<void(QString)>& errCb)
|
||||||
{
|
{
|
||||||
if (shutdownInProgress)
|
if (shutdownInProgress)
|
||||||
// Ignoring RPC because shutdown in progress
|
// Ignoring RPC because shutdown in progress
|
||||||
@@ -242,26 +254,26 @@ void Connection::doRPC(const QString cmd, const QString args, const std::functio
|
|||||||
|
|
||||||
QObject::connect(runner, &Executor::responseReady, c, &Callback::processRPCCallback);
|
QObject::connect(runner, &Executor::responseReady, c, &Callback::processRPCCallback);
|
||||||
QObject::connect(runner, &Executor::handleError, c, &Callback::processError);
|
QObject::connect(runner, &Executor::handleError, c, &Callback::processError);
|
||||||
QThreadPool::globalInstance()->start(runner);
|
QThreadPool::globalInstance()->start(runner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
void Connection::doRPCWithDefaultErrorHandling(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
||||||
{
|
{
|
||||||
doRPC(cmd, args, cb, [=] (QString err) {
|
doRPC(cmd, args, cb, [=] (QString err) {
|
||||||
this->showTxError(err);
|
this->showTxError(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
void Connection::doRPCIgnoreError(const QString cmd, const QString args, const std::function<void(json)>& cb)
|
||||||
{
|
{
|
||||||
doRPC(cmd, args, cb, [=] (auto) {
|
doRPC(cmd, args, cb, [=] (auto) {
|
||||||
// Ignored error handling
|
// Ignored error handling
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::showTxError(const QString& error)
|
void Connection::showTxError(const QString& error)
|
||||||
{
|
{
|
||||||
if (error.isNull())
|
if (error.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Prevent multiple dialog boxes from showing, because they're all called async
|
// Prevent multiple dialog boxes from showing, because they're all called async
|
||||||
@@ -271,8 +283,8 @@ void Connection::showTxError(const QString& error)
|
|||||||
|
|
||||||
shown = true;
|
shown = true;
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
main,
|
main,
|
||||||
QObject::tr("Transaction Error"),
|
QObject::tr("Transaction Error"),
|
||||||
QObject::tr("There was an error sending the transaction. The error was:") + "\n\n" + error,
|
QObject::tr("There was an error sending the transaction. The error was:") + "\n\n" + error,
|
||||||
QMessageBox::StandardButton::Ok
|
QMessageBox::StandardButton::Ok
|
||||||
);
|
);
|
||||||
@@ -281,8 +293,8 @@ void Connection::showTxError(const QString& error)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prevent all future calls from going through
|
* Prevent all future calls from going through
|
||||||
*/
|
*/
|
||||||
void Connection::shutdown()
|
void Connection::shutdown()
|
||||||
{
|
{
|
||||||
shutdownInProgress = true;
|
shutdownInProgress = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>513</width>
|
<width>512</width>
|
||||||
<height>201</height>
|
<height>513</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="FilledIconLabel" name="topIcon">
|
<widget class="QLabel" name="topIcon">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="status">
|
<widget class="QLabel" name="status">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Starting Up</string>
|
<string>The Dragon Awakens...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@@ -84,13 +84,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>FilledIconLabel</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>fillediconlabel.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -966,7 +966,7 @@ void Controller::refreshTransactions() {
|
|||||||
cid, // we have to set the cid here, its included in the headermemo
|
cid, // we have to set the cid here, its included in the headermemo
|
||||||
txid
|
txid
|
||||||
);
|
);
|
||||||
qDebug()<< "Message CID: " << cid;
|
// qDebug()<< "Message CID: " << cid;
|
||||||
chatModel->addMessage(item);
|
chatModel->addMessage(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1006,7 +1006,6 @@ void Controller::refreshChat(QListWidget *listWidget)
|
|||||||
|
|
||||||
void Controller::refreshContacts(QListWidget *listWidget)
|
void Controller::refreshContacts(QListWidget *listWidget)
|
||||||
{
|
{
|
||||||
qDebug() << "Called Controller::refreshContacts(QListWidget *listWidget)";
|
|
||||||
contactModel->renderContactList(listWidget);
|
contactModel->renderContactList(listWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1571,7 +1570,7 @@ void Controller::shutdownhushd()
|
|||||||
QDialog d(main);
|
QDialog d(main);
|
||||||
Ui_ConnectionDialog connD;
|
Ui_ConnectionDialog connD;
|
||||||
connD.setupUi(&d);
|
connD.setupUi(&d);
|
||||||
connD.topIcon->setBasePixmap(QIcon(":/icons/res/icon.ico").pixmap(256, 256));
|
connD.topIcon->setPixmap(QIcon(":/icons/res/icon.ico").pixmap(256, 256));
|
||||||
connD.status->setText(QObject::tr("Please wait for SilentDragonLite to exit"));
|
connD.status->setText(QObject::tr("Please wait for SilentDragonLite to exit"));
|
||||||
connD.statusDetail->setText(QObject::tr("Waiting for hushd to exit"));
|
connD.statusDetail->setText(QObject::tr("Waiting for hushd to exit"));
|
||||||
bool finished = false;
|
bool finished = false;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->checkBox->setChecked(true);
|
||||||
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
|
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
|
||||||
|
|
||||||
// Status Bar
|
// Status Bar
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
<normaloff>:/icons/res/icon.ico</normaloff>:/icons/res/icon.ico</iconset>
|
<normaloff>:/icons/res/icon.ico</normaloff>:/icons/res/icon.ico</iconset>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item>
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
@@ -389,7 +389,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1226</width>
|
<width>1226</width>
|
||||||
<height>504</height>
|
<height>488</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="sendToLayout">
|
<layout class="QVBoxLayout" name="sendToLayout">
|
||||||
@@ -1332,17 +1332,17 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>80</y>
|
<y>40</y>
|
||||||
<width>341</width>
|
<width>341</width>
|
||||||
<height>561</height>
|
<height>551</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_39">
|
<widget class="QLabel" name="label_39">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>6</x>
|
<x>0</x>
|
||||||
<y>40</y>
|
<y>0</y>
|
||||||
<width>311</width>
|
<width>311</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1351,25 +1351,12 @@
|
|||||||
<string><html><head/><body><p align="center">Hushchat Contactlist</p></body></html></string>
|
<string><html><head/><body><p align="center">Hushchat Contactlist</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="label_40">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>400</x>
|
|
||||||
<y>410</y>
|
|
||||||
<width>331</width>
|
|
||||||
<height>17</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Memo</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="MemoEdit" name="memoTxtChat">
|
<widget class="MemoEdit" name="memoTxtChat">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>340</x>
|
||||||
<y>510</y>
|
<y>410</y>
|
||||||
<width>901</width>
|
<width>921</width>
|
||||||
<height>128</height>
|
<height>128</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -1377,8 +1364,8 @@
|
|||||||
<widget class="QLabel" name="memoSizeChat">
|
<widget class="QLabel" name="memoSizeChat">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>1180</x>
|
<x>1200</x>
|
||||||
<y>460</y>
|
<y>540</y>
|
||||||
<width>47</width>
|
<width>47</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1393,9 +1380,9 @@
|
|||||||
<widget class="QLabel" name="contactNameMemo">
|
<widget class="QLabel" name="contactNameMemo">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>720</x>
|
<x>450</x>
|
||||||
<y>50</y>
|
<y>20</y>
|
||||||
<width>481</width>
|
<width>161</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -1410,7 +1397,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>340</x>
|
||||||
<y>80</y>
|
<y>40</y>
|
||||||
<width>921</width>
|
<width>921</width>
|
||||||
<height>371</height>
|
<height>371</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1432,7 +1419,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>1130</x>
|
<x>1130</x>
|
||||||
<y>650</y>
|
<y>590</y>
|
||||||
<width>114</width>
|
<width>114</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1453,21 +1440,21 @@
|
|||||||
<widget class="QLabel" name="label_42">
|
<widget class="QLabel" name="label_42">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>350</x>
|
||||||
<y>460</y>
|
<y>550</y>
|
||||||
<width>67</width>
|
<width>81</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p>Send to :</p></body></html></string>
|
<string>Send To :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="ContactName">
|
<widget class="QLabel" name="ContactName">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>340</x>
|
<x>350</x>
|
||||||
<y>490</y>
|
<y>580</y>
|
||||||
<width>81</width>
|
<width>81</width>
|
||||||
<height>17</height>
|
<height>17</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1480,7 +1467,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>460</y>
|
<y>550</y>
|
||||||
<width>691</width>
|
<width>691</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1492,8 +1479,8 @@
|
|||||||
<widget class="QPushButton" name="safeContactRequest">
|
<widget class="QPushButton" name="safeContactRequest">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>943</x>
|
<x>50</x>
|
||||||
<y>20</y>
|
<y>600</y>
|
||||||
<width>211</width>
|
<width>211</width>
|
||||||
<height>25</height>
|
<height>25</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1515,7 +1502,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>420</x>
|
<x>420</x>
|
||||||
<y>490</y>
|
<y>580</y>
|
||||||
<width>691</width>
|
<width>691</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1527,8 +1514,8 @@
|
|||||||
<widget class="QLabel" name="contactCid">
|
<widget class="QLabel" name="contactCid">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>870</x>
|
<x>720</x>
|
||||||
<y>90</y>
|
<y>20</y>
|
||||||
<width>331</width>
|
<width>331</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -1537,6 +1524,45 @@
|
|||||||
<string><html><head/><body><p align="center"><br/></p></body></html></string>
|
<string><html><head/><body><p align="center"><br/></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="contactNameMemo_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>590</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>131</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">Conversation ID:</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>980</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>271</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Render only authenticated messages</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="contactNameMemo_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>111</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">Contact Name:</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
181
src/sendtab.cpp
181
src/sendtab.cpp
@@ -13,7 +13,7 @@ using json = nlohmann::json;
|
|||||||
|
|
||||||
void MainWindow::setupSendTab() {
|
void MainWindow::setupSendTab() {
|
||||||
// Create the validator for send to/amount fields
|
// Create the validator for send to/amount fields
|
||||||
amtValidator = new QRegExpValidator(QRegExp("[0-9]{0,8}\\.?[0-9]{0,8}"));
|
amtValidator = new QRegExpValidator(QRegExp("[0-9]{0,8}\\.?[0-9]{0,8}"));
|
||||||
|
|
||||||
ui->Amount1->setValidator(amtValidator);
|
ui->Amount1->setValidator(amtValidator);
|
||||||
|
|
||||||
@@ -39,10 +39,10 @@ void MainWindow::setupSendTab() {
|
|||||||
this->memoButtonClicked(1);
|
this->memoButtonClicked(1);
|
||||||
});
|
});
|
||||||
setMemoEnabled(1, false);
|
setMemoEnabled(1, false);
|
||||||
|
|
||||||
// This is the damnest thing ever. If we do AddressBook::readFromStorage() directly, the whole file
|
// This is the damnest thing ever. If we do AddressBook::readFromStorage() directly, the whole file
|
||||||
// doesn't get read. It needs to run in a timer after everything has finished to be able to read
|
// doesn't get read. It needs to run in a timer after everything has finished to be able to read
|
||||||
// the file properly.
|
// the file properly.
|
||||||
QTimer::singleShot(2000, [=]() { updateLabelsAutoComplete(); });
|
QTimer::singleShot(2000, [=]() { updateLabelsAutoComplete(); });
|
||||||
|
|
||||||
// The first address book button
|
// The first address book button
|
||||||
@@ -84,7 +84,7 @@ void MainWindow::setupSendTab() {
|
|||||||
ui->lblMinerFeeUSD->setText(fee.toDecimalAUDString());
|
ui->lblMinerFeeUSD->setText(fee.toDecimalAUDString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ui->minerFeeAmt->setText(Settings::getMinerFee().toDecimalString());
|
ui->minerFeeAmt->setText(Settings::getMinerFee().toDecimalString());
|
||||||
|
|
||||||
// Set up focus enter to set fees
|
// Set up focus enter to set fees
|
||||||
QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) {
|
QObject::connect(ui->tabWidget, &QTabWidget::currentChanged, [=] (int pos) {
|
||||||
@@ -123,13 +123,13 @@ void MainWindow::setupSendTab() {
|
|||||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||||
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalAUDString();
|
QString feeUSD = CAmount::fromDecimalString(txt).toDecimalAUDString();
|
||||||
ui->lblMinerFeeUSD->setText(feeUSD);
|
ui->lblMinerFeeUSD->setText(feeUSD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//Fees validator
|
//Fees validator
|
||||||
feesValidator = new QRegExpValidator(QRegExp("[0-9]{0,8}\\.?[0-9]{0,8}"));
|
feesValidator = new QRegExpValidator(QRegExp("[0-9]{0,8}\\.?[0-9]{0,8}"));
|
||||||
ui->minerFeeAmt->setValidator(feesValidator);
|
ui->minerFeeAmt->setValidator(feesValidator);
|
||||||
|
|
||||||
// Font for the first Memo label
|
// Font for the first Memo label
|
||||||
@@ -140,7 +140,7 @@ void MainWindow::setupSendTab() {
|
|||||||
// Recurring button
|
// Recurring button
|
||||||
QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) {
|
QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
ui->btnRecurSchedule->setEnabled(true);
|
ui->btnRecurSchedule->setEnabled(true);
|
||||||
|
|
||||||
// If this is the first time the button is checked, open the edit schedule dialog
|
// If this is the first time the button is checked, open the edit schedule dialog
|
||||||
if (sendTxRecurringInfo == nullptr) {
|
if (sendTxRecurringInfo == nullptr) {
|
||||||
@@ -172,23 +172,23 @@ void MainWindow::disableRecurring() {
|
|||||||
void MainWindow::editSchedule() {
|
void MainWindow::editSchedule() {
|
||||||
// Only on testnet for now
|
// Only on testnet for now
|
||||||
if (!Settings::getInstance()->isTestnet()) {
|
if (!Settings::getInstance()->isTestnet()) {
|
||||||
QMessageBox::critical(this, "Not Supported yet",
|
QMessageBox::critical(this, "Not Supported yet",
|
||||||
"Recurring payments are only supported on Testnet for now.", QMessageBox::Ok);
|
"Recurring payments are only supported on Testnet for now.", QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check to see that recurring payments are not selected when there are 2 or more addresses
|
// Check to see that recurring payments are not selected when there are 2 or more addresses
|
||||||
if (ui->sendToWidgets->children().size()-1 > 2) {
|
if (ui->sendToWidgets->children().size()-1 > 2) {
|
||||||
QMessageBox::critical(this, tr("Cannot support multiple addresses"),
|
QMessageBox::critical(this, tr("Cannot support multiple addresses"),
|
||||||
tr("Recurring payments doesn't currently support multiple addresses"), QMessageBox::Ok);
|
tr("Recurring payments doesn't currently support multiple addresses"), QMessageBox::Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the edit schedule dialog
|
// Open the edit schedule dialog
|
||||||
auto recurringInfo = Recurring::getInstance()->getNewRecurringFromTx(this, this,
|
auto recurringInfo = Recurring::getInstance()->getNewRecurringFromTx(this, this,
|
||||||
createTxFromSendPage(), this->sendTxRecurringInfo);
|
createTxFromSendPage(), this->sendTxRecurringInfo);
|
||||||
if (recurringInfo == nullptr) {
|
if (recurringInfo == nullptr) {
|
||||||
// User pressed cancel.
|
// User pressed cancel.
|
||||||
// If there is no existing recurring info, uncheck the recurring box
|
// If there is no existing recurring info, uncheck the recurring box
|
||||||
if (sendTxRecurringInfo == nullptr) {
|
if (sendTxRecurringInfo == nullptr) {
|
||||||
ui->chkRecurring->setCheckState(Qt::Unchecked);
|
ui->chkRecurring->setCheckState(Qt::Unchecked);
|
||||||
@@ -205,11 +205,11 @@ void MainWindow::editSchedule() {
|
|||||||
void MainWindow::updateLabelsAutoComplete() {
|
void MainWindow::updateLabelsAutoComplete() {
|
||||||
QList<QString> list;
|
QList<QString> list;
|
||||||
auto labels = AddressBook::getInstance()->getAllAddressLabels();
|
auto labels = AddressBook::getInstance()->getAllAddressLabels();
|
||||||
|
|
||||||
std::transform(labels.begin(), labels.end(), std::back_inserter(list), [=] (auto la) -> QString {
|
std::transform(labels.begin(), labels.end(), std::back_inserter(list), [=] (auto la) -> QString {
|
||||||
return la.getName() % "/" % la.getPartnerAddress();
|
return la.getName() % "/" % la.getPartnerAddress();
|
||||||
});
|
});
|
||||||
|
|
||||||
delete labelCompleter;
|
delete labelCompleter;
|
||||||
labelCompleter = new QCompleter(list, this);
|
labelCompleter = new QCompleter(list, this);
|
||||||
labelCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
labelCompleter->setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
@@ -221,7 +221,7 @@ void MainWindow::updateLabelsAutoComplete() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::addAddressSection() {
|
void MainWindow::addAddressSection() {
|
||||||
int itemNumber = ui->sendToWidgets->children().size() - 1;
|
int itemNumber = ui->sendToWidgets->children().size() - 1;
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ void MainWindow::addAddressSection() {
|
|||||||
horizontalLayout_12->addWidget(label_4);
|
horizontalLayout_12->addWidget(label_4);
|
||||||
|
|
||||||
auto Address1 = new QLineEdit(verticalGroupBox);
|
auto Address1 = new QLineEdit(verticalGroupBox);
|
||||||
Address1->setObjectName(QString("Address") % QString::number(itemNumber));
|
Address1->setObjectName(QString("Address") % QString::number(itemNumber));
|
||||||
Address1->setPlaceholderText(tr("Address"));
|
Address1->setPlaceholderText(tr("Address"));
|
||||||
QObject::connect(Address1, &QLineEdit::textChanged, [=] (auto text) {
|
QObject::connect(Address1, &QLineEdit::textChanged, [=] (auto text) {
|
||||||
this->addressChanged(itemNumber, text);
|
this->addressChanged(itemNumber, text);
|
||||||
@@ -261,16 +261,16 @@ void MainWindow::addAddressSection() {
|
|||||||
|
|
||||||
auto horizontalLayout_13 = new QHBoxLayout();
|
auto horizontalLayout_13 = new QHBoxLayout();
|
||||||
horizontalLayout_13->setSpacing(6);
|
horizontalLayout_13->setSpacing(6);
|
||||||
|
|
||||||
auto label_6 = new QLabel(verticalGroupBox);
|
auto label_6 = new QLabel(verticalGroupBox);
|
||||||
label_6->setText(tr("Amount"));
|
label_6->setText(tr("Amount"));
|
||||||
horizontalLayout_13->addWidget(label_6);
|
horizontalLayout_13->addWidget(label_6);
|
||||||
|
|
||||||
auto Amount1 = new QLineEdit(verticalGroupBox);
|
auto Amount1 = new QLineEdit(verticalGroupBox);
|
||||||
Amount1->setPlaceholderText(tr("Amount"));
|
Amount1->setPlaceholderText(tr("Amount"));
|
||||||
Amount1->setObjectName(QString("Amount") % QString::number(itemNumber));
|
Amount1->setObjectName(QString("Amount") % QString::number(itemNumber));
|
||||||
Amount1->setBaseSize(QSize(200, 0));
|
Amount1->setBaseSize(QSize(200, 0));
|
||||||
Amount1->setAlignment(Qt::AlignRight);
|
Amount1->setAlignment(Qt::AlignRight);
|
||||||
|
|
||||||
// Create the validator for send to/amount fields
|
// Create the validator for send to/amount fields
|
||||||
Amount1->setValidator(amtValidator);
|
Amount1->setValidator(amtValidator);
|
||||||
@@ -281,7 +281,7 @@ void MainWindow::addAddressSection() {
|
|||||||
horizontalLayout_13->addWidget(Amount1);
|
horizontalLayout_13->addWidget(Amount1);
|
||||||
|
|
||||||
auto AmtUSD1 = new QLabel(verticalGroupBox);
|
auto AmtUSD1 = new QLabel(verticalGroupBox);
|
||||||
AmtUSD1->setObjectName(QString("AmtUSD") % QString::number(itemNumber));
|
AmtUSD1->setObjectName(QString("AmtUSD") % QString::number(itemNumber));
|
||||||
horizontalLayout_13->addWidget(AmtUSD1);
|
horizontalLayout_13->addWidget(AmtUSD1);
|
||||||
|
|
||||||
auto horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
auto horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
@@ -289,7 +289,7 @@ void MainWindow::addAddressSection() {
|
|||||||
|
|
||||||
auto MemoBtn1 = new QPushButton(verticalGroupBox);
|
auto MemoBtn1 = new QPushButton(verticalGroupBox);
|
||||||
MemoBtn1->setObjectName(QString("MemoBtn") % QString::number(itemNumber));
|
MemoBtn1->setObjectName(QString("MemoBtn") % QString::number(itemNumber));
|
||||||
MemoBtn1->setText(tr("Memo"));
|
MemoBtn1->setText(tr("Memo"));
|
||||||
// Connect Memo Clicked button
|
// Connect Memo Clicked button
|
||||||
QObject::connect(MemoBtn1, &QPushButton::clicked, [=] () {
|
QObject::connect(MemoBtn1, &QPushButton::clicked, [=] () {
|
||||||
this->memoButtonClicked(itemNumber);
|
this->memoButtonClicked(itemNumber);
|
||||||
@@ -307,24 +307,24 @@ void MainWindow::addAddressSection() {
|
|||||||
MemoTxt1->setWordWrap(true);
|
MemoTxt1->setWordWrap(true);
|
||||||
sendAddressLayout->addWidget(MemoTxt1);
|
sendAddressLayout->addWidget(MemoTxt1);
|
||||||
|
|
||||||
ui->sendToLayout->insertWidget(itemNumber-1, verticalGroupBox);
|
ui->sendToLayout->insertWidget(itemNumber-1, verticalGroupBox);
|
||||||
|
|
||||||
// Disable recurring payments if a address section is added, since recurring payments
|
// Disable recurring payments if a address section is added, since recurring payments
|
||||||
// aren't supported for more than 1 address
|
// aren't supported for more than 1 address
|
||||||
delete sendTxRecurringInfo;
|
delete sendTxRecurringInfo;
|
||||||
sendTxRecurringInfo = nullptr;
|
sendTxRecurringInfo = nullptr;
|
||||||
ui->lblRecurDesc->setText("");
|
ui->lblRecurDesc->setText("");
|
||||||
ui->chkRecurring->setChecked(false);
|
ui->chkRecurring->setChecked(false);
|
||||||
ui->chkRecurring->setEnabled(false);
|
ui->chkRecurring->setEnabled(false);
|
||||||
|
|
||||||
// Set focus into the address
|
// Set focus into the address
|
||||||
Address1->setFocus();
|
Address1->setFocus();
|
||||||
|
|
||||||
// Delay the call to scroll to allow the scroll window to adjust
|
// Delay the call to scroll to allow the scroll window to adjust
|
||||||
QTimer::singleShot(10, [=] () {ui->sendToScrollArea->ensureWidgetVisible(ui->addAddressButton);});
|
QTimer::singleShot(10, [=] () {ui->sendToScrollArea->ensureWidgetVisible(ui->addAddressButton);});
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addressChanged(int itemNumber, const QString& text) {
|
void MainWindow::addressChanged(int itemNumber, const QString& text) {
|
||||||
auto addr = AddressBook::addressFromAddressLabel(text);
|
auto addr = AddressBook::addressFromAddressLabel(text);
|
||||||
setMemoEnabled(itemNumber, Settings::isZAddress(addr));
|
setMemoEnabled(itemNumber, Settings::isZAddress(addr));
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ void MainWindow::memoButtonClicked(int number, bool includeReplyTo) {
|
|||||||
|
|
||||||
void MainWindow::clearSendForm() {
|
void MainWindow::clearSendForm() {
|
||||||
// The last one is a spacer, so ignore that
|
// The last one is a spacer, so ignore that
|
||||||
int totalItems = ui->sendToWidgets->children().size() - 2;
|
int totalItems = ui->sendToWidgets->children().size() - 2;
|
||||||
|
|
||||||
// Clear the first recipient fields
|
// Clear the first recipient fields
|
||||||
auto addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address1"));
|
auto addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address1"));
|
||||||
@@ -451,14 +451,14 @@ void MainWindow::clearSendForm() {
|
|||||||
// Start the deletion after the first item, since we want to keep 1 send field there all there
|
// Start the deletion after the first item, since we want to keep 1 send field there all there
|
||||||
for (int i=1; i < totalItems; i++) {
|
for (int i=1; i < totalItems; i++) {
|
||||||
auto addressGroupBox = ui->sendToWidgets->findChild<QGroupBox*>(QString("AddressGroupBox") % QString::number(i+1));
|
auto addressGroupBox = ui->sendToWidgets->findChild<QGroupBox*>(QString("AddressGroupBox") % QString::number(i+1));
|
||||||
|
|
||||||
delete addressGroupBox;
|
delete addressGroupBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the recurring button
|
// Reset the recurring button
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
if (Settings::getInstance()->isTestnet()) {
|
||||||
ui->chkRecurring->setEnabled(true);
|
ui->chkRecurring->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->chkRecurring->setCheckState(Qt::Unchecked);
|
ui->chkRecurring->setCheckState(Qt::Unchecked);
|
||||||
ui->btnRecurSchedule->setEnabled(false);
|
ui->btnRecurSchedule->setEnabled(false);
|
||||||
@@ -471,23 +471,23 @@ void MainWindow::maxAmountChecked(int checked) {
|
|||||||
if (checked == Qt::Checked) {
|
if (checked == Qt::Checked) {
|
||||||
ui->Amount1->setReadOnly(true);
|
ui->Amount1->setReadOnly(true);
|
||||||
if (rpc == nullptr) return;
|
if (rpc == nullptr) return;
|
||||||
|
|
||||||
// Calculate maximum amount
|
// Calculate maximum amount
|
||||||
CAmount sumAllAmounts;
|
CAmount sumAllAmounts;
|
||||||
// Calculate all other amounts
|
// Calculate all other amounts
|
||||||
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
||||||
// Start counting the sum skipping the first one, because the MAX button is on the first one, and we don't
|
// Start counting the sum skipping the first one, because the MAX button is on the first one, and we don't
|
||||||
// want to include it in the sum.
|
// want to include it in the sum.
|
||||||
for (int i=1; i < totalItems; i++) {
|
for (int i=1; i < totalItems; i++) {
|
||||||
auto amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1));
|
auto amt = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1));
|
||||||
sumAllAmounts = sumAllAmounts + CAmount::fromDecimalString(amt->text());
|
sumAllAmounts = sumAllAmounts + CAmount::fromDecimalString(amt->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
sumAllAmounts = sumAllAmounts + Settings::getMinerFee();
|
sumAllAmounts = sumAllAmounts + Settings::getMinerFee();
|
||||||
|
|
||||||
auto maxamount = rpc->getModel()->getAvailableBalance() - sumAllAmounts;
|
auto maxamount = rpc->getModel()->getAvailableBalance() - sumAllAmounts;
|
||||||
maxamount = (maxamount < 0) ? CAmount::fromqint64(0): maxamount;
|
maxamount = (maxamount < 0) ? CAmount::fromqint64(0): maxamount;
|
||||||
|
|
||||||
ui->Amount1->setText(maxamount.toDecimalString());
|
ui->Amount1->setText(maxamount.toDecimalString());
|
||||||
} else if (checked == Qt::Unchecked) {
|
} else if (checked == Qt::Unchecked) {
|
||||||
// Just remove the readonly part, don't change the content
|
// Just remove the readonly part, don't change the content
|
||||||
@@ -495,61 +495,61 @@ void MainWindow::maxAmountChecked(int checked) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a Tx from the current state of the send page.
|
// Create a Tx from the current state of the send page.
|
||||||
Tx MainWindow::createTxFromSendPage() {
|
Tx MainWindow::createTxFromSendPage() {
|
||||||
Tx tx;
|
Tx tx;
|
||||||
|
|
||||||
// For each addr/amt in the sendTo tab
|
// For each addr/amt in the sendTo tab
|
||||||
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
int totalItems = ui->sendToWidgets->children().size() - 2; // The last one is a spacer, so ignore that
|
||||||
CAmount totalAmt;
|
CAmount totalAmt;
|
||||||
|
|
||||||
for (int i=0; i < totalItems; i++) {
|
for (int i=0; i < totalItems; i++) {
|
||||||
QString addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") % QString::number(i+1))->text().trimmed();
|
QString addr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Address") % QString::number(i+1))->text().trimmed();
|
||||||
|
|
||||||
// Remove label if it exists
|
// Remove label if it exists
|
||||||
addr = AddressBook::addressFromAddressLabel(addr);
|
addr = AddressBook::addressFromAddressLabel(addr);
|
||||||
// QString dustamt = "0";
|
// QString dustamt = "0";
|
||||||
QString amtStr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed();
|
QString amtStr = ui->sendToWidgets->findChild<QLineEdit*>(QString("Amount") % QString::number(i+1))->text().trimmed();
|
||||||
if (amtStr.isEmpty()) {
|
if (amtStr.isEmpty()) {
|
||||||
amtStr = "-1";; // The user didn't specify an amount
|
amtStr = "-1";; // The user didn't specify an amount
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
CAmount amt;
|
CAmount amt;
|
||||||
|
|
||||||
|
|
||||||
// Make sure it parses
|
// Make sure it parses
|
||||||
amtStr.toDouble(&ok);
|
amtStr.toDouble(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
amt = CAmount::fromqint64(-1);
|
amt = CAmount::fromqint64(-1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
amt = CAmount::fromDecimalString(amtStr);
|
amt = CAmount::fromDecimalString(amtStr);
|
||||||
totalAmt = totalAmt + amt;
|
totalAmt = totalAmt + amt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString memo = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
|
QString memo = ui->sendToWidgets->findChild<QLabel*>(QString("MemoTxt") % QString::number(i+1))->text().trimmed();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tx.toAddrs.push_back( ToFields{addr, amt, memo} );
|
tx.toAddrs.push_back( ToFields{addr, amt, memo} );
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tx.fee = Settings::getMinerFee();
|
tx.fee = Settings::getMinerFee();
|
||||||
|
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
||||||
|
|
||||||
// Function to split the address to make it easier to read.
|
// Function to split the address to make it easier to read.
|
||||||
// Split it into chunks of 4 chars.
|
// Split it into chunks of 4 chars.
|
||||||
auto fnSplitAddressForWrap = [=] (const QString& a) -> QString {
|
auto fnSplitAddressForWrap = [=] (const QString& a) -> QString {
|
||||||
if (Settings::isTAddress(a))
|
if (Settings::isTAddress(a))
|
||||||
return a;
|
return a;
|
||||||
@@ -601,8 +601,8 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
delete confirm.sendToAddrs->findChild<QLabel*>("labelMinerFee");
|
delete confirm.sendToAddrs->findChild<QLabel*>("labelMinerFee");
|
||||||
delete confirm.sendToAddrs->findChild<QLabel*>("minerFee");
|
delete confirm.sendToAddrs->findChild<QLabel*>("minerFee");
|
||||||
delete confirm.sendToAddrs->findChild<QLabel*>("minerFeeUSD");
|
delete confirm.sendToAddrs->findChild<QLabel*>("minerFeeUSD");
|
||||||
|
|
||||||
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
// For each addr/amt/memo, construct the JSON and also build the confirm dialog box
|
||||||
int row = 0;
|
int row = 0;
|
||||||
CAmount totalSpending;
|
CAmount totalSpending;
|
||||||
|
|
||||||
@@ -632,7 +632,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalUSDString());
|
AmtUSD->setText(toAddr.amount.toDecimalUSDString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (EUR)
|
// Amount (EUR)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
} else if (Settings::getInstance()->get_currency_name() == "EUR") {
|
||||||
@@ -640,7 +640,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalEURString());
|
AmtUSD->setText(toAddr.amount.toDecimalEURString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (BTC)
|
// Amount (BTC)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
} else if (Settings::getInstance()->get_currency_name() == "BTC") {
|
||||||
@@ -648,7 +648,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalBTCString());
|
AmtUSD->setText(toAddr.amount.toDecimalBTCString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (CNY)
|
// Amount (CNY)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
} else if (Settings::getInstance()->get_currency_name() == "CNY") {
|
||||||
@@ -656,7 +656,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalCNYString());
|
AmtUSD->setText(toAddr.amount.toDecimalCNYString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (RUB)
|
// Amount (RUB)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
} else if (Settings::getInstance()->get_currency_name() == "RUB") {
|
||||||
@@ -664,7 +664,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalRUBString());
|
AmtUSD->setText(toAddr.amount.toDecimalRUBString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (CAD)
|
// Amount (CAD)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
} else if (Settings::getInstance()->get_currency_name() == "CAD") {
|
||||||
@@ -672,7 +672,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalCADString());
|
AmtUSD->setText(toAddr.amount.toDecimalCADString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (SGD)
|
// Amount (SGD)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
} else if (Settings::getInstance()->get_currency_name() == "SGD") {
|
||||||
@@ -680,7 +680,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalSGDString());
|
AmtUSD->setText(toAddr.amount.toDecimalSGDString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (CHF)
|
// Amount (CHF)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
} else if (Settings::getInstance()->get_currency_name() == "CHF") {
|
||||||
@@ -688,7 +688,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalCHFString());
|
AmtUSD->setText(toAddr.amount.toDecimalCHFString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (INR)
|
// Amount (INR)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
} else if (Settings::getInstance()->get_currency_name() == "INR") {
|
||||||
@@ -696,7 +696,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalINRString());
|
AmtUSD->setText(toAddr.amount.toDecimalINRString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (GBP)
|
// Amount (GBP)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
} else if (Settings::getInstance()->get_currency_name() == "GBP") {
|
||||||
@@ -704,7 +704,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalGBPString());
|
AmtUSD->setText(toAddr.amount.toDecimalGBPString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
|
|
||||||
// Amount (AUD)
|
// Amount (AUD)
|
||||||
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
} else if (Settings::getInstance()->get_currency_name() == "AUD") {
|
||||||
@@ -712,7 +712,7 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
AmtUSD->setObjectName(QString("AmtUSD") % QString::number(i + 1));
|
||||||
AmtUSD->setText(toAddr.amount.toDecimalAUDString());
|
AmtUSD->setText(toAddr.amount.toDecimalAUDString());
|
||||||
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
AmtUSD->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
|
||||||
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
confirm.gridLayout->addWidget(AmtUSD, row, 2, 1, 1);
|
||||||
}
|
}
|
||||||
// Memo
|
// Memo
|
||||||
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.isEmpty()) {
|
if (Settings::isZAddress(toAddr.addr) && !toAddr.memo.isEmpty()) {
|
||||||
@@ -798,10 +798,10 @@ bool MainWindow::confirmTx(Tx tx, RecurringPaymentInfo* rpi) {
|
|||||||
// Syncing warning
|
// Syncing warning
|
||||||
confirm.syncingWarning->setVisible(Settings::getInstance()->isSyncing());
|
confirm.syncingWarning->setVisible(Settings::getInstance()->isSyncing());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Show the dialog and submit it if the user confirms
|
// Show the dialog and submit it if the user confirms
|
||||||
return d.exec() == QDialog::Accepted;
|
return d.exec() == QDialog::Accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send button clicked
|
// Send button clicked
|
||||||
@@ -824,9 +824,9 @@ void MainWindow::sendButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show a dialog to confirm the Tx
|
// Show a dialog to confirm the Tx
|
||||||
if (confirmTx(tx, sendTxRecurringInfo)) {
|
if (confirmTx(tx, sendTxRecurringInfo)) {
|
||||||
// If this is a recurring payment, save the hash so we can
|
// If this is a recurring payment, save the hash so we can
|
||||||
// update the payment if it submits.
|
// update the payment if it submits.
|
||||||
QString recurringPaymentHash;
|
QString recurringPaymentHash;
|
||||||
|
|
||||||
// Recurring payments are enabled only if there is exactly 1 destination address.
|
// Recurring payments are enabled only if there is exactly 1 destination address.
|
||||||
@@ -843,8 +843,18 @@ void MainWindow::sendButton() {
|
|||||||
auto d = new QDialog(this);
|
auto d = new QDialog(this);
|
||||||
auto connD = new Ui_ConnectionDialog();
|
auto connD = new Ui_ConnectionDialog();
|
||||||
connD->setupUi(d);
|
connD->setupUi(d);
|
||||||
QPixmap logo(":/img/res/logobig.gif");
|
QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated.gif");;
|
||||||
connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
QMovie *movie2 = new QMovie(":/img/res/silentdragonlite-animated-dark.gif");;
|
||||||
|
auto theme = Settings::getInstance()->get_theme_name();
|
||||||
|
if (theme == "dark" || theme == "midnight") {
|
||||||
|
movie2->setScaledSize(QSize(512,512));
|
||||||
|
connD->topIcon->setMovie(movie2);
|
||||||
|
movie2->start();
|
||||||
|
} else {
|
||||||
|
movie1->setScaledSize(QSize(512,512));
|
||||||
|
connD->topIcon->setMovie(movie1);
|
||||||
|
movie1->start();
|
||||||
|
}
|
||||||
|
|
||||||
connD->status->setText(tr("Please wait..."));
|
connD->status->setText(tr("Please wait..."));
|
||||||
connD->statusDetail->setText(tr("Computing your transaction"));
|
connD->statusDetail->setText(tr("Computing your transaction"));
|
||||||
@@ -852,8 +862,8 @@ void MainWindow::sendButton() {
|
|||||||
d->show();
|
d->show();
|
||||||
|
|
||||||
// And send the Tx
|
// And send the Tx
|
||||||
rpc->executeTransaction(tx,
|
rpc->executeTransaction(tx,
|
||||||
[=] (QString txid) {
|
[=] (QString txid) {
|
||||||
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
ui->statusBar->showMessage(Settings::txidStatusMessage + " " + txid);
|
||||||
|
|
||||||
connD->status->setText(tr("Done!"));
|
connD->status->setText(tr("Done!"));
|
||||||
@@ -868,40 +878,40 @@ void MainWindow::sendButton() {
|
|||||||
// And switch to the balances tab
|
// And switch to the balances tab
|
||||||
ui->tabWidget->setCurrentIndex(0);
|
ui->tabWidget->setCurrentIndex(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Force a UI update so we get the unconfirmed Tx
|
// Force a UI update so we get the unconfirmed Tx
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
|
|
||||||
// If this was a recurring payment, update the payment with the info
|
// If this was a recurring payment, update the payment with the info
|
||||||
if (!recurringPaymentHash.isEmpty()) {
|
if (!recurringPaymentHash.isEmpty()) {
|
||||||
// Since this is the send button payment, this is the first payment
|
// Since this is the send button payment, this is the first payment
|
||||||
Recurring::getInstance()->updatePaymentItem(recurringPaymentHash, 0,
|
Recurring::getInstance()->updatePaymentItem(recurringPaymentHash, 0,
|
||||||
txid, "", PaymentStatus::COMPLETED);
|
txid, "", PaymentStatus::COMPLETED);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Errored out
|
// Errored out
|
||||||
[=] (QString opid, QString errStr) {
|
[=] (QString opid, QString errStr) {
|
||||||
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
ui->statusBar->showMessage(QObject::tr(" Tx ") % opid % QObject::tr(" failed"), 15 * 1000);
|
||||||
|
|
||||||
d->accept();
|
d->accept();
|
||||||
d->close();
|
d->close();
|
||||||
delete connD;
|
delete connD;
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
if (!opid.isEmpty())
|
if (!opid.isEmpty())
|
||||||
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
errStr = QObject::tr("The transaction with id ") % opid % QObject::tr(" failed. The error was") + ":\n\n" + errStr;
|
||||||
|
|
||||||
// If this was a recurring payment, update the payment with the failure
|
// If this was a recurring payment, update the payment with the failure
|
||||||
if (!recurringPaymentHash.isEmpty()) {
|
if (!recurringPaymentHash.isEmpty()) {
|
||||||
// Since this is the send button payment, this is the first payment
|
// Since this is the send button payment, this is the first payment
|
||||||
Recurring::getInstance()->updatePaymentItem(recurringPaymentHash, 0,
|
Recurring::getInstance()->updatePaymentItem(recurringPaymentHash, 0,
|
||||||
"", errStr, PaymentStatus::ERROR);
|
"", errStr, PaymentStatus::ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MainWindow::doSendTxValidations(Tx tx) {
|
QString MainWindow::doSendTxValidations(Tx tx) {
|
||||||
@@ -915,7 +925,7 @@ QString MainWindow::doSendTxValidations(Tx tx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
// This technically shouldn't be possible, but issue #62 seems to have discovered a bug
|
||||||
// somewhere, so just add a check to make sure.
|
// somewhere, so just add a check to make sure.
|
||||||
if (toAddr.amount.toqint64() < 0) {
|
if (toAddr.amount.toqint64() < 0) {
|
||||||
return QString(tr("Amount for address '%1' is invalid!").arg(toAddr.addr));
|
return QString(tr("Amount for address '%1' is invalid!").arg(toAddr.addr));
|
||||||
}
|
}
|
||||||
@@ -937,4 +947,3 @@ QString MainWindow::doSendTxValidations(Tx tx) {
|
|||||||
void MainWindow::cancelButton() {
|
void MainWindow::cancelButton() {
|
||||||
clearSendForm();
|
clearSendForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,11 @@
|
|||||||
<string>dark</string>
|
<string>dark</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>midnight</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="chkFetchPrices">
|
<widget class="QCheckBox" name="chkFetchPrices">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
Reference in New Issue
Block a user