mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 19:49:28 +00:00
refactor: misc cleanup
This commit is contained in:
parent
d68fbce9e1
commit
91ff2bc7f0
12 changed files with 19 additions and 82 deletions
2
monero
2
monero
|
@ -1 +1 @@
|
||||||
Subproject commit 4e02392274e1b5f7a038171deee2e445128b2e35
|
Subproject commit 31ced6d76a1aaa1bfb9011c86987937b7042f3ce
|
|
@ -18,8 +18,4 @@ CalcWindow::CalcWindow(QWidget *parent)
|
||||||
this->setWindowIcon(icons()->icon("gnome-calc.png"));
|
this->setWindowIcon(icons()->icon("gnome-calc.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcWindow::closeEvent(QCloseEvent *foo) {
|
|
||||||
emit closed();
|
|
||||||
}
|
|
||||||
|
|
||||||
CalcWindow::~CalcWindow() = default;
|
CalcWindow::~CalcWindow() = default;
|
|
@ -18,14 +18,9 @@ public:
|
||||||
explicit CalcWindow(QWidget *parent = nullptr);
|
explicit CalcWindow(QWidget *parent = nullptr);
|
||||||
~CalcWindow() override;
|
~CalcWindow() override;
|
||||||
|
|
||||||
signals:
|
|
||||||
void closed();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void closeEvent(QCloseEvent *bar) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CalcWindow> ui;
|
QScopedPointer<Ui::CalcWindow> ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FEATHER_CALCWINDOW_H
|
#endif // FEATHER_CALCWINDOW_H
|
||||||
|
|
||||||
|
|
|
@ -13,17 +13,20 @@ class Transfer : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Transfer(uint64_t _amount, QString _address, QObject *parent = 0)
|
explicit Transfer(uint64_t amount, QString address, QObject *parent = nullptr)
|
||||||
: QObject(parent), m_amount(_amount), m_address(std::move(_address)) {};
|
: QObject(parent)
|
||||||
private:
|
, m_amount(amount)
|
||||||
friend class TransactionInfo;
|
, m_address(std::move(address)) {};
|
||||||
friend class ConstructionInfo;
|
|
||||||
quint64 m_amount;
|
|
||||||
QString m_address;
|
|
||||||
public:
|
|
||||||
quint64 amount() const { return m_amount; }
|
quint64 amount() const { return m_amount; }
|
||||||
QString address() const { return m_address; }
|
QString address() const { return m_address; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class TransactionInfo;
|
||||||
|
friend class ConstructionInfo;
|
||||||
|
|
||||||
|
quint64 m_amount;
|
||||||
|
QString m_address;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRANSACTIONINFO_H
|
#endif // TRANSFER_H
|
||||||
|
|
|
@ -3,18 +3,6 @@
|
||||||
|
|
||||||
#include "SubaddressRow.h"
|
#include "SubaddressRow.h"
|
||||||
|
|
||||||
bool SubaddressRow::setHidden(bool hidden) {
|
|
||||||
m_hidden = hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SubaddressRow::setUsed(bool used) {
|
|
||||||
m_used = used;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SubaddressRow::setPinned(bool pinned) {
|
|
||||||
m_used = pinned;
|
|
||||||
}
|
|
||||||
|
|
||||||
qsizetype SubaddressRow::getRow() const {
|
qsizetype SubaddressRow::getRow() const {
|
||||||
return m_row;
|
return m_row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,6 @@ public:
|
||||||
, m_hidden(hidden)
|
, m_hidden(hidden)
|
||||||
, m_pinned(pinned) {}
|
, m_pinned(pinned) {}
|
||||||
|
|
||||||
bool setUsed(bool used);
|
|
||||||
bool setHidden(bool hidden);
|
|
||||||
bool setPinned(bool pinned);
|
|
||||||
|
|
||||||
qsizetype getRow() const;
|
qsizetype getRow() const;
|
||||||
const QString& getAddress() const;
|
const QString& getAddress() const;
|
||||||
const QString& getLabel() const;
|
const QString& getLabel() const;
|
||||||
|
|
|
@ -145,17 +145,6 @@ QString TransactionRow::paymentId() const
|
||||||
return m_paymentId;
|
return m_paymentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TransactionRow::destinations_formatted() const
|
|
||||||
{
|
|
||||||
QString destinations;
|
|
||||||
for (auto const& t: m_transfers) {
|
|
||||||
if (!destinations.isEmpty())
|
|
||||||
destinations += "<br> ";
|
|
||||||
destinations += WalletManager::displayAmount(t->amount()) + ": " + t->address();
|
|
||||||
}
|
|
||||||
return destinations;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QString> TransactionRow::destinations() const
|
QList<QString> TransactionRow::destinations() const
|
||||||
{
|
{
|
||||||
QList<QString> dests;
|
QList<QString> dests;
|
||||||
|
|
|
@ -42,24 +42,18 @@ public:
|
||||||
quint64 confirmations() const;
|
quint64 confirmations() const;
|
||||||
quint64 confirmationsRequired() const;
|
quint64 confirmationsRequired() const;
|
||||||
quint64 unlockTime() const;
|
quint64 unlockTime() const;
|
||||||
//! transaction_id
|
|
||||||
QString hash() const;
|
QString hash() const;
|
||||||
QDateTime timestamp() const;
|
QDateTime timestamp() const;
|
||||||
QString date() const;
|
QString date() const;
|
||||||
QString time() const;
|
QString time() const;
|
||||||
QString paymentId() const;
|
QString paymentId() const;
|
||||||
//! only applicable for output transactions
|
|
||||||
//! used in tx details popup
|
|
||||||
QList<QString> destinations() const;
|
QList<QString> destinations() const;
|
||||||
QString destinations_formatted() const;
|
|
||||||
QList<Transfer*> transfers() const;
|
QList<Transfer*> transfers() const;
|
||||||
QString rings_formatted() const;
|
QString rings_formatted() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit TransactionRow();
|
explicit TransactionRow();
|
||||||
|
|
||||||
// TransactionRow(const Monero::TransactionInfo *pimpl, QObject *parent = nullptr);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class TransactionHistory;
|
friend class TransactionHistory;
|
||||||
mutable QList<Transfer*> m_transfers;
|
mutable QList<Transfer*> m_transfers;
|
||||||
|
|
|
@ -11,19 +11,11 @@ AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook)
|
||||||
, m_addressBook(addressBook)
|
, m_addressBook(addressBook)
|
||||||
, m_showFullAddresses(false)
|
, m_showFullAddresses(false)
|
||||||
{
|
{
|
||||||
connect(m_addressBook, &AddressBook::refreshStarted, this, &AddressBookModel::startReset);
|
connect(m_addressBook, &AddressBook::refreshStarted, this, &AddressBookModel::beginResetModel);
|
||||||
connect(m_addressBook, &AddressBook::refreshFinished, this, &AddressBookModel::endReset);
|
connect(m_addressBook, &AddressBook::refreshFinished, this, &AddressBookModel::endResetModel);
|
||||||
m_contactIcon = icons()->icon("person.svg");
|
m_contactIcon = icons()->icon("person.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookModel::startReset(){
|
|
||||||
beginResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookModel::endReset(){
|
|
||||||
endResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
int AddressBookModel::rowCount(const QModelIndex &) const
|
int AddressBookModel::rowCount(const QModelIndex &) const
|
||||||
{
|
{
|
||||||
return m_addressBook->count();
|
return m_addressBook->count();
|
||||||
|
|
|
@ -30,17 +30,13 @@ public:
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||||
|
|
||||||
Q_INVOKABLE bool deleteRow(int row);
|
bool deleteRow(int row);
|
||||||
|
|
||||||
bool isShowFullAddresses() const;
|
bool isShowFullAddresses() const;
|
||||||
void setShowFullAddresses(bool show);
|
void setShowFullAddresses(bool show);
|
||||||
bool writeCSV(const QString &path);
|
bool writeCSV(const QString &path);
|
||||||
QMap<QString, QString> readCSV(const QString &path);
|
QMap<QString, QString> readCSV(const QString &path);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void startReset();
|
|
||||||
void endReset();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AddressBook * m_addressBook;
|
AddressBook * m_addressBook;
|
||||||
QIcon m_contactIcon;
|
QIcon m_contactIcon;
|
||||||
|
|
|
@ -17,16 +17,8 @@ SubaddressModel::SubaddressModel(QObject *parent, Subaddress *subaddress)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
, m_subaddress(subaddress)
|
, m_subaddress(subaddress)
|
||||||
{
|
{
|
||||||
connect(m_subaddress, &Subaddress::refreshStarted, this, &SubaddressModel::startReset);
|
connect(m_subaddress, &Subaddress::refreshStarted, this, &SubaddressModel::beginResetModel);
|
||||||
connect(m_subaddress, &Subaddress::refreshFinished, this, &SubaddressModel::endReset);
|
connect(m_subaddress, &Subaddress::refreshFinished, this, &SubaddressModel::endResetModel);
|
||||||
}
|
|
||||||
|
|
||||||
void SubaddressModel::startReset(){
|
|
||||||
beginResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SubaddressModel::endReset(){
|
|
||||||
endResetModel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SubaddressModel::rowCount(const QModelIndex &parent) const
|
int SubaddressModel::rowCount(const QModelIndex &parent) const
|
||||||
|
|
|
@ -42,10 +42,6 @@ public:
|
||||||
|
|
||||||
void setCurrentSubaddressAccount(quint32 accountIndex);
|
void setCurrentSubaddressAccount(quint32 accountIndex);
|
||||||
|
|
||||||
public slots:
|
|
||||||
void startReset();
|
|
||||||
void endReset();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Subaddress *m_subaddress;
|
Subaddress *m_subaddress;
|
||||||
QVariant parseSubaddressRow(const SubaddressRow &subaddress, const QModelIndex &index, int role) const;
|
QVariant parseSubaddressRow(const SubaddressRow &subaddress, const QModelIndex &index, int role) const;
|
||||||
|
|
Loading…
Reference in a new issue