mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	TxInfoDialog: improve UI
This commit is contained in:
		
							parent
							
								
									3e534fd536
								
							
						
					
					
						commit
						22abca4578
					
				
					 13 changed files with 165 additions and 78 deletions
				
			
		| 
						 | 
					@ -6,7 +6,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "libwalletqt/CoinsInfo.h"
 | 
					#include "libwalletqt/CoinsInfo.h"
 | 
				
			||||||
#include "libwalletqt/WalletManager.h"
 | 
					#include "libwalletqt/WalletManager.h"
 | 
				
			||||||
 | 
					#include "libwalletqt/Transfer.h"
 | 
				
			||||||
#include "utils.h"
 | 
					#include "utils.h"
 | 
				
			||||||
 | 
					#include "utils/ColorScheme.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QMessageBox>
 | 
					#include <QMessageBox>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,12 +25,16 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx
 | 
				
			||||||
    ui->label_txid->setText(QString(txInfo->hash()));
 | 
					    ui->label_txid->setText(QString(txInfo->hash()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (txInfo->direction() == TransactionInfo::Direction_In) {
 | 
					    if (txInfo->direction() == TransactionInfo::Direction_In) {
 | 
				
			||||||
        ui->txKey->hide();
 | 
					        ui->frameTxKey->hide();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        QString txKey = m_wallet->getTxKey(txInfo->hash());
 | 
					        QString txKey = m_wallet->getTxKey(txInfo->hash());
 | 
				
			||||||
        txKey = txKey.isEmpty() ? "unknown" : txKey;
 | 
					        if (txKey.isEmpty()) {
 | 
				
			||||||
        ui->label_txKey->setText(txKey);
 | 
					            ui->btn_CopyTxKey->setEnabled(false);
 | 
				
			||||||
 | 
					            ui->btn_CopyTxKey->setToolTip("Transaction key unknown");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        m_txKey = txKey;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    connect(ui->btn_CopyTxKey, &QPushButton::pressed, this, &TransactionInfoDialog::copyTxKey);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString blockHeight = QString::number(txInfo->blockHeight());
 | 
					    QString blockHeight = QString::number(txInfo->blockHeight());
 | 
				
			||||||
    if (blockHeight == "0")
 | 
					    if (blockHeight == "0")
 | 
				
			||||||
| 
						 | 
					@ -47,11 +53,17 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qDebug() << m_wallet->coins()->coins_from_txid(txInfo->hash());
 | 
					    qDebug() << m_wallet->coins()->coins_from_txid(txInfo->hash());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString destinations = txInfo->destinations_formatted();
 | 
					    QTextCursor cursor = ui->destinations->textCursor();
 | 
				
			||||||
    if (destinations.isEmpty()) {
 | 
					    for (const auto& transfer : txInfo->transfers()) {
 | 
				
			||||||
 | 
					        auto address = transfer->address();
 | 
				
			||||||
 | 
					        auto amount = WalletManager::displayAmount(transfer->amount());
 | 
				
			||||||
 | 
					        auto index = m_wallet->subaddressIndex(address);
 | 
				
			||||||
 | 
					        cursor.insertText(address, Utils::addressTextFormat(index));
 | 
				
			||||||
 | 
					        cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
 | 
				
			||||||
 | 
					        cursor.insertBlock();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (txInfo->transfers().size() == 0) {
 | 
				
			||||||
        ui->frameDestinations->hide();
 | 
					        ui->frameDestinations->hide();
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        ui->destinations->setText(destinations);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui->txProofWidget->addWidget(m_txProofWidget);
 | 
					    ui->txProofWidget->addWidget(m_txProofWidget);
 | 
				
			||||||
| 
						 | 
					@ -59,6 +71,10 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx
 | 
				
			||||||
    this->adjustSize();
 | 
					    this->adjustSize();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TransactionInfoDialog::copyTxKey() {
 | 
				
			||||||
 | 
					    Utils::copyToClipboard(m_txKey);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TransactionInfoDialog::~TransactionInfoDialog() {
 | 
					TransactionInfoDialog::~TransactionInfoDialog() {
 | 
				
			||||||
    delete ui;
 | 
					    delete ui;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,6 +5,7 @@
 | 
				
			||||||
#define FEATHER_TRANSACTIONINFODIALOG_H
 | 
					#define FEATHER_TRANSACTIONINFODIALOG_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <QDialog>
 | 
					#include <QDialog>
 | 
				
			||||||
 | 
					#include <QTextCharFormat>
 | 
				
			||||||
#include <QtSvg/QSvgWidget>
 | 
					#include <QtSvg/QSvgWidget>
 | 
				
			||||||
#include "libwalletqt/Coins.h"
 | 
					#include "libwalletqt/Coins.h"
 | 
				
			||||||
#include "libwalletqt/TransactionInfo.h"
 | 
					#include "libwalletqt/TransactionInfo.h"
 | 
				
			||||||
| 
						 | 
					@ -24,11 +25,14 @@ public:
 | 
				
			||||||
    ~TransactionInfoDialog() override;
 | 
					    ~TransactionInfoDialog() override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
					    void copyTxKey();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Ui::TransactionInfoDialog *ui;
 | 
					    Ui::TransactionInfoDialog *ui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TransactionInfo *m_txInfo;
 | 
					    TransactionInfo *m_txInfo;
 | 
				
			||||||
    Wallet *m_wallet;
 | 
					    Wallet *m_wallet;
 | 
				
			||||||
    TxProofWidget *m_txProofWidget;
 | 
					    TxProofWidget *m_txProofWidget;
 | 
				
			||||||
 | 
					    QString m_txKey;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif //FEATHER_TRANSACTIONINFODIALOG_H
 | 
					#endif //FEATHER_TRANSACTIONINFODIALOG_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,9 @@
 | 
				
			||||||
   <string>Transaction</string>
 | 
					   <string>Transaction</string>
 | 
				
			||||||
  </property>
 | 
					  </property>
 | 
				
			||||||
  <layout class="QVBoxLayout" name="verticalLayout_4">
 | 
					  <layout class="QVBoxLayout" name="verticalLayout_4">
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <layout class="QHBoxLayout" name="horizontalLayout_2"/>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QGroupBox" name="groupBox">
 | 
					    <widget class="QGroupBox" name="groupBox">
 | 
				
			||||||
     <property name="title">
 | 
					     <property name="title">
 | 
				
			||||||
| 
						 | 
					@ -33,25 +36,6 @@
 | 
				
			||||||
     </layout>
 | 
					     </layout>
 | 
				
			||||||
    </widget>
 | 
					    </widget>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					 | 
				
			||||||
    <widget class="QGroupBox" name="txKey">
 | 
					 | 
				
			||||||
     <property name="title">
 | 
					 | 
				
			||||||
      <string>Transaction key:</string>
 | 
					 | 
				
			||||||
     </property>
 | 
					 | 
				
			||||||
     <layout class="QVBoxLayout" name="verticalLayout_5">
 | 
					 | 
				
			||||||
      <item>
 | 
					 | 
				
			||||||
       <widget class="QLabel" name="label_txKey">
 | 
					 | 
				
			||||||
        <property name="text">
 | 
					 | 
				
			||||||
         <string>txKey</string>
 | 
					 | 
				
			||||||
        </property>
 | 
					 | 
				
			||||||
        <property name="textInteractionFlags">
 | 
					 | 
				
			||||||
         <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
 | 
					 | 
				
			||||||
        </property>
 | 
					 | 
				
			||||||
       </widget>
 | 
					 | 
				
			||||||
      </item>
 | 
					 | 
				
			||||||
     </layout>
 | 
					 | 
				
			||||||
    </widget>
 | 
					 | 
				
			||||||
   </item>
 | 
					 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
					    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
| 
						 | 
					@ -131,6 +115,22 @@
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <spacer name="verticalSpacer_2">
 | 
				
			||||||
 | 
					     <property name="orientation">
 | 
				
			||||||
 | 
					      <enum>Qt::Vertical</enum>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <property name="sizeType">
 | 
				
			||||||
 | 
					      <enum>QSizePolicy::Maximum</enum>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <property name="sizeHint" stdset="0">
 | 
				
			||||||
 | 
					      <size>
 | 
				
			||||||
 | 
					       <width>0</width>
 | 
				
			||||||
 | 
					       <height>15</height>
 | 
				
			||||||
 | 
					      </size>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					    </spacer>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QFrame" name="frameDestinations">
 | 
					    <widget class="QFrame" name="frameDestinations">
 | 
				
			||||||
     <property name="frameShape">
 | 
					     <property name="frameShape">
 | 
				
			||||||
| 
						 | 
					@ -152,13 +152,6 @@
 | 
				
			||||||
      <property name="bottomMargin">
 | 
					      <property name="bottomMargin">
 | 
				
			||||||
       <number>0</number>
 | 
					       <number>0</number>
 | 
				
			||||||
      </property>
 | 
					      </property>
 | 
				
			||||||
      <item>
 | 
					 | 
				
			||||||
       <widget class="Line" name="line_2">
 | 
					 | 
				
			||||||
        <property name="orientation">
 | 
					 | 
				
			||||||
         <enum>Qt::Horizontal</enum>
 | 
					 | 
				
			||||||
        </property>
 | 
					 | 
				
			||||||
       </widget>
 | 
					 | 
				
			||||||
      </item>
 | 
					 | 
				
			||||||
      <item>
 | 
					      <item>
 | 
				
			||||||
       <widget class="QLabel" name="label_destinations">
 | 
					       <widget class="QLabel" name="label_destinations">
 | 
				
			||||||
        <property name="text">
 | 
					        <property name="text">
 | 
				
			||||||
| 
						 | 
					@ -168,9 +161,15 @@
 | 
				
			||||||
      </item>
 | 
					      </item>
 | 
				
			||||||
      <item>
 | 
					      <item>
 | 
				
			||||||
       <widget class="QTextEdit" name="destinations">
 | 
					       <widget class="QTextEdit" name="destinations">
 | 
				
			||||||
        <property name="maximumSize">
 | 
					        <property name="sizePolicy">
 | 
				
			||||||
 | 
					         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
 | 
				
			||||||
 | 
					          <horstretch>0</horstretch>
 | 
				
			||||||
 | 
					          <verstretch>0</verstretch>
 | 
				
			||||||
 | 
					         </sizepolicy>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					        <property name="minimumSize">
 | 
				
			||||||
         <size>
 | 
					         <size>
 | 
				
			||||||
          <width>16777215</width>
 | 
					          <width>0</width>
 | 
				
			||||||
          <height>100</height>
 | 
					          <height>100</height>
 | 
				
			||||||
         </size>
 | 
					         </size>
 | 
				
			||||||
        </property>
 | 
					        </property>
 | 
				
			||||||
| 
						 | 
					@ -182,29 +181,76 @@
 | 
				
			||||||
     </layout>
 | 
					     </layout>
 | 
				
			||||||
    </widget>
 | 
					    </widget>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					 | 
				
			||||||
    <widget class="Line" name="line_3">
 | 
					 | 
				
			||||||
     <property name="orientation">
 | 
					 | 
				
			||||||
      <enum>Qt::Horizontal</enum>
 | 
					 | 
				
			||||||
     </property>
 | 
					 | 
				
			||||||
    </widget>
 | 
					 | 
				
			||||||
   </item>
 | 
					 | 
				
			||||||
   <item>
 | 
					 | 
				
			||||||
    <layout class="QVBoxLayout" name="txProofWidget"/>
 | 
					 | 
				
			||||||
   </item>
 | 
					 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <spacer name="verticalSpacer">
 | 
					    <spacer name="verticalSpacer">
 | 
				
			||||||
     <property name="orientation">
 | 
					     <property name="orientation">
 | 
				
			||||||
      <enum>Qt::Vertical</enum>
 | 
					      <enum>Qt::Vertical</enum>
 | 
				
			||||||
     </property>
 | 
					     </property>
 | 
				
			||||||
 | 
					     <property name="sizeType">
 | 
				
			||||||
 | 
					      <enum>QSizePolicy::Maximum</enum>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
     <property name="sizeHint" stdset="0">
 | 
					     <property name="sizeHint" stdset="0">
 | 
				
			||||||
      <size>
 | 
					      <size>
 | 
				
			||||||
       <width>20</width>
 | 
					       <width>0</width>
 | 
				
			||||||
       <height>0</height>
 | 
					       <height>15</height>
 | 
				
			||||||
      </size>
 | 
					      </size>
 | 
				
			||||||
     </property>
 | 
					     </property>
 | 
				
			||||||
    </spacer>
 | 
					    </spacer>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <widget class="QFrame" name="frameTxKey">
 | 
				
			||||||
 | 
					     <property name="frameShape">
 | 
				
			||||||
 | 
					      <enum>QFrame::NoFrame</enum>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <property name="frameShadow">
 | 
				
			||||||
 | 
					      <enum>QFrame::Raised</enum>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					     <layout class="QHBoxLayout" name="horizontalLayout_3">
 | 
				
			||||||
 | 
					      <property name="leftMargin">
 | 
				
			||||||
 | 
					       <number>0</number>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <property name="topMargin">
 | 
				
			||||||
 | 
					       <number>0</number>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <property name="rightMargin">
 | 
				
			||||||
 | 
					       <number>0</number>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <property name="bottomMargin">
 | 
				
			||||||
 | 
					       <number>0</number>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <item>
 | 
				
			||||||
 | 
					       <widget class="QPushButton" name="btn_CopyTxKey">
 | 
				
			||||||
 | 
					        <property name="text">
 | 
				
			||||||
 | 
					         <string>Copy</string>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </widget>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item>
 | 
				
			||||||
 | 
					       <widget class="QLabel" name="label">
 | 
				
			||||||
 | 
					        <property name="text">
 | 
				
			||||||
 | 
					         <string>Transaction Key</string>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </widget>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					      <item>
 | 
				
			||||||
 | 
					       <spacer name="horizontalSpacer">
 | 
				
			||||||
 | 
					        <property name="orientation">
 | 
				
			||||||
 | 
					         <enum>Qt::Horizontal</enum>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					        <property name="sizeHint" stdset="0">
 | 
				
			||||||
 | 
					         <size>
 | 
				
			||||||
 | 
					          <width>40</width>
 | 
				
			||||||
 | 
					          <height>20</height>
 | 
				
			||||||
 | 
					         </size>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </spacer>
 | 
				
			||||||
 | 
					      </item>
 | 
				
			||||||
 | 
					     </layout>
 | 
				
			||||||
 | 
					    </widget>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <layout class="QVBoxLayout" name="txProofWidget"/>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
  </layout>
 | 
					  </layout>
 | 
				
			||||||
 </widget>
 | 
					 </widget>
 | 
				
			||||||
 <resources/>
 | 
					 <resources/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,7 +109,8 @@ void TxConfAdvDialog::setupConstructionData(ConstructionInfo *ci) {
 | 
				
			||||||
    for (const auto& o: outputs) {
 | 
					    for (const auto& o: outputs) {
 | 
				
			||||||
        auto address = o->address();
 | 
					        auto address = o->address();
 | 
				
			||||||
        auto amount = WalletManager::displayAmount(o->amount());
 | 
					        auto amount = WalletManager::displayAmount(o->amount());
 | 
				
			||||||
        cursor.insertText(address, textFormat(address));
 | 
					        auto index = m_ctx->currentWallet->subaddressIndex(address);
 | 
				
			||||||
 | 
					        cursor.insertText(address, Utils::addressTextFormat(index));
 | 
				
			||||||
        cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
 | 
					        cursor.insertText(QString(" %1").arg(amount), QTextCharFormat());
 | 
				
			||||||
        cursor.insertBlock();
 | 
					        cursor.insertBlock();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -183,23 +184,6 @@ void TxConfAdvDialog::closeDialog() {
 | 
				
			||||||
    QDialog::reject();
 | 
					    QDialog::reject();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QTextCharFormat TxConfAdvDialog::textFormat(const QString &address) {
 | 
					 | 
				
			||||||
    auto index = m_ctx->currentWallet->subaddressIndex(address);
 | 
					 | 
				
			||||||
    if (index.first == 0 && index.second == 0) {
 | 
					 | 
				
			||||||
        QTextCharFormat rec;
 | 
					 | 
				
			||||||
        rec.setBackground(QBrush(ColorScheme::YELLOW.asColor(true)));
 | 
					 | 
				
			||||||
        rec.setToolTip("Wallet change/primary address");
 | 
					 | 
				
			||||||
        return rec;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (index.first >= 0) {
 | 
					 | 
				
			||||||
        QTextCharFormat rec;
 | 
					 | 
				
			||||||
        rec.setBackground(QBrush(ColorScheme::GREEN.asColor(true)));
 | 
					 | 
				
			||||||
        rec.setToolTip("Wallet receive address");
 | 
					 | 
				
			||||||
        return rec;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return QTextCharFormat();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TxConfAdvDialog::~TxConfAdvDialog() {
 | 
					TxConfAdvDialog::~TxConfAdvDialog() {
 | 
				
			||||||
    delete ui;
 | 
					    delete ui;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,8 +42,6 @@ private:
 | 
				
			||||||
    void signedQrCode();
 | 
					    void signedQrCode();
 | 
				
			||||||
    void signedSaveFile();
 | 
					    void signedSaveFile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QTextCharFormat textFormat(const QString &address);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    Ui::TxConfAdvDialog *ui;
 | 
					    Ui::TxConfAdvDialog *ui;
 | 
				
			||||||
    AppContext *m_ctx;
 | 
					    AppContext *m_ctx;
 | 
				
			||||||
    PendingTransaction *m_tx = nullptr;
 | 
					    PendingTransaction *m_tx = nullptr;
 | 
				
			||||||
| 
						 | 
					@ -52,6 +50,4 @@ private:
 | 
				
			||||||
    QMenu *m_exportSignedMenu;
 | 
					    QMenu *m_exportSignedMenu;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif //FEATHER_TXCONFADVDIALOG_H
 | 
					#endif //FEATHER_TXCONFADVDIALOG_H
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,14 +58,14 @@ TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QStrin
 | 
				
			||||||
    ui->label_address->setFont(ModelUtils::getMonospaceFont());
 | 
					    ui->label_address->setFont(ModelUtils::getMonospaceFont());
 | 
				
			||||||
    ui->label_address->setToolTip(address);
 | 
					    ui->label_address->setToolTip(address);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (subaddressIndex.first >= 0) {
 | 
					    if (subaddressIndex.isValid()) {
 | 
				
			||||||
        ui->label_note->setText("Note: this is a churn transaction.");
 | 
					        ui->label_note->setText("Note: this is a churn transaction.");
 | 
				
			||||||
        ui->label_note->show();
 | 
					        ui->label_note->show();
 | 
				
			||||||
        ui->label_address->setStyleSheet(ColorScheme::GREEN.asStylesheet(true));
 | 
					        ui->label_address->setStyleSheet(ColorScheme::GREEN.asStylesheet(true));
 | 
				
			||||||
        ui->label_address->setToolTip("Wallet receive address");
 | 
					        ui->label_address->setToolTip("Wallet receive address");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (subaddressIndex.first == 0 && subaddressIndex.second == 0) {
 | 
					    if (subaddressIndex.isPrimary()) {
 | 
				
			||||||
        ui->label_address->setStyleSheet(ColorScheme::YELLOW.asStylesheet(true));
 | 
					        ui->label_address->setStyleSheet(ColorScheme::YELLOW.asStylesheet(true));
 | 
				
			||||||
        ui->label_address->setToolTip("Wallet change/primary address");
 | 
					        ui->label_address->setToolTip("Wallet change/primary address");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,6 +144,10 @@ QList<QString> TransactionInfo::destinations() const
 | 
				
			||||||
    return dests;
 | 
					    return dests;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QList<Transfer*> TransactionInfo::transfers() const {
 | 
				
			||||||
 | 
					    return m_transfers;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString TransactionInfo::rings_formatted() const
 | 
					QString TransactionInfo::rings_formatted() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QString rings;
 | 
					    QString rings;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,6 +76,7 @@ public:
 | 
				
			||||||
    //! used in tx details popup
 | 
					    //! used in tx details popup
 | 
				
			||||||
    QList<QString> destinations() const;
 | 
					    QList<QString> destinations() const;
 | 
				
			||||||
    QString destinations_formatted() const;
 | 
					    QString destinations_formatted() const;
 | 
				
			||||||
 | 
					    QList<Transfer*> transfers() const;
 | 
				
			||||||
    QString rings_formatted() const;
 | 
					    QString rings_formatted() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,8 @@ class Transfer : public QObject
 | 
				
			||||||
    Q_PROPERTY(quint64 amount READ amount)
 | 
					    Q_PROPERTY(quint64 amount READ amount)
 | 
				
			||||||
    Q_PROPERTY(QString address READ address)
 | 
					    Q_PROPERTY(QString address READ address)
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    explicit Transfer(uint64_t _amount, QString _address,  QObject *parent = 0): QObject(parent), m_amount(_amount), m_address(std::move(_address)) {};
 | 
					    explicit Transfer(uint64_t _amount, QString _address,  QObject *parent = 0)
 | 
				
			||||||
 | 
					            : QObject(parent), m_amount(_amount), m_address(std::move(_address)) {};
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    friend class TransactionInfo;
 | 
					    friend class TransactionInfo;
 | 
				
			||||||
    friend class ConstructionInfo;
 | 
					    friend class ConstructionInfo;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -150,13 +150,13 @@ QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const
 | 
				
			||||||
    return QString::fromStdString(m_walletImpl->address(accountIndex, addressIndex));
 | 
					    return QString::fromStdString(m_walletImpl->address(accountIndex, addressIndex));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QPair<int, int> Wallet::subaddressIndex(const QString &address) const
 | 
					SubaddressIndex Wallet::subaddressIndex(const QString &address) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    std::pair<uint32_t, uint32_t> i;
 | 
					    std::pair<uint32_t, uint32_t> i;
 | 
				
			||||||
    if (!m_walletImpl->subaddressIndex(address.toStdString(), i)) {
 | 
					    if (!m_walletImpl->subaddressIndex(address.toStdString(), i)) {
 | 
				
			||||||
        return QPair<int, int>(-1, -1);
 | 
					        return SubaddressIndex(-1, -1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return QPair<int, int>(i.first, i.second);
 | 
					    return SubaddressIndex(i.first, i.second);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString Wallet::path() const
 | 
					QString Wallet::path() const
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -30,6 +30,22 @@ struct TxProof {
 | 
				
			||||||
    QString error;
 | 
					    QString error;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					struct SubaddressIndex {
 | 
				
			||||||
 | 
					    SubaddressIndex(int major, int minor)
 | 
				
			||||||
 | 
					        : major(major), minor(minor) {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool isValid() const {
 | 
				
			||||||
 | 
					        return major >= 0 && minor >= 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool isPrimary() const {
 | 
				
			||||||
 | 
					        return major == 0 && minor == 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    int major;
 | 
				
			||||||
 | 
					    int minor;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TransactionHistory;
 | 
					class TransactionHistory;
 | 
				
			||||||
class TransactionHistoryModel;
 | 
					class TransactionHistoryModel;
 | 
				
			||||||
class TransactionHistoryProxyModel;
 | 
					class TransactionHistoryProxyModel;
 | 
				
			||||||
| 
						 | 
					@ -139,9 +155,8 @@ public:
 | 
				
			||||||
    //! returns wallet's public address
 | 
					    //! returns wallet's public address
 | 
				
			||||||
    Q_INVOKABLE QString address(quint32 accountIndex, quint32 addressIndex) const;
 | 
					    Q_INVOKABLE QString address(quint32 accountIndex, quint32 addressIndex) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //! returns the subaddress index (major, minor) of the address
 | 
					    //! returns the subaddress index of the address
 | 
				
			||||||
    // (-1, -1) if address does not belong to wallet
 | 
					    Q_INVOKABLE SubaddressIndex subaddressIndex(const QString &address) const;
 | 
				
			||||||
    Q_INVOKABLE QPair<int, int> subaddressIndex(const QString &address) const;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //! returns wallet file's path
 | 
					    //! returns wallet file's path
 | 
				
			||||||
    QString path() const;
 | 
					    QString path() const;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,6 +14,7 @@
 | 
				
			||||||
#include "utils/config.h"
 | 
					#include "utils/config.h"
 | 
				
			||||||
#include "utils/tails.h"
 | 
					#include "utils/tails.h"
 | 
				
			||||||
#include "utils/whonix.h"
 | 
					#include "utils/whonix.h"
 | 
				
			||||||
 | 
					#include "utils/ColorScheme.h"
 | 
				
			||||||
#include "globals.h"
 | 
					#include "globals.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Application log for current session
 | 
					// Application log for current session
 | 
				
			||||||
| 
						 | 
					@ -551,3 +552,19 @@ QString Utils::balanceFormat(quint64 balance) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return str;
 | 
					    return str;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index) {
 | 
				
			||||||
 | 
					    if (index.isPrimary()) {
 | 
				
			||||||
 | 
					        QTextCharFormat rec;
 | 
				
			||||||
 | 
					        rec.setBackground(QBrush(ColorScheme::YELLOW.asColor(true)));
 | 
				
			||||||
 | 
					        rec.setToolTip("Wallet change/primary address");
 | 
				
			||||||
 | 
					        return rec;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (index.isValid()) {
 | 
				
			||||||
 | 
					        QTextCharFormat rec;
 | 
				
			||||||
 | 
					        rec.setBackground(QBrush(ColorScheme::GREEN.asColor(true)));
 | 
				
			||||||
 | 
					        rec.setToolTip("Wallet receive address");
 | 
				
			||||||
 | 
					        return rec;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return QTextCharFormat();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -11,11 +11,13 @@
 | 
				
			||||||
#include <QtNetwork>
 | 
					#include <QtNetwork>
 | 
				
			||||||
#include <QApplication>
 | 
					#include <QApplication>
 | 
				
			||||||
#include <QMainWindow>
 | 
					#include <QMainWindow>
 | 
				
			||||||
 | 
					#include <QTextCharFormat>
 | 
				
			||||||
#include <sstream>
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <monero_seed/monero_seed.hpp>
 | 
					#include <monero_seed/monero_seed.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "networktype.h"
 | 
					#include "networktype.h"
 | 
				
			||||||
 | 
					#include "libwalletqt/Wallet.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct logMessage
 | 
					struct logMessage
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -99,6 +101,7 @@ public:
 | 
				
			||||||
    static int maxLength(const QVector<QString> &array);
 | 
					    static int maxLength(const QVector<QString> &array);
 | 
				
			||||||
    static QMap<QString, QLocale> localeCache;
 | 
					    static QMap<QString, QLocale> localeCache;
 | 
				
			||||||
    static QString balanceFormat(quint64 balance);
 | 
					    static QString balanceFormat(quint64 balance);
 | 
				
			||||||
 | 
					    static QTextCharFormat addressTextFormat(const SubaddressIndex &index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    template<typename QEnum>
 | 
					    template<typename QEnum>
 | 
				
			||||||
    static QString QtEnumToString (const QEnum value)
 | 
					    static QString QtEnumToString (const QEnum value)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue