refactor: misc cleanup

This commit is contained in:
tobtoht 2023-11-23 21:18:11 +01:00
parent d68fbce9e1
commit 91ff2bc7f0
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
12 changed files with 19 additions and 82 deletions

2
monero

@ -1 +1 @@
Subproject commit 4e02392274e1b5f7a038171deee2e445128b2e35
Subproject commit 31ced6d76a1aaa1bfb9011c86987937b7042f3ce

View file

@ -18,8 +18,4 @@ CalcWindow::CalcWindow(QWidget *parent)
this->setWindowIcon(icons()->icon("gnome-calc.png"));
}
void CalcWindow::closeEvent(QCloseEvent *foo) {
emit closed();
}
CalcWindow::~CalcWindow() = default;

View file

@ -18,14 +18,9 @@ public:
explicit CalcWindow(QWidget *parent = nullptr);
~CalcWindow() override;
signals:
void closed();
private:
void closeEvent(QCloseEvent *bar) override;
private:
QScopedPointer<Ui::CalcWindow> ui;
};
#endif // FEATHER_CALCWINDOW_H

View file

@ -13,17 +13,20 @@ class Transfer : public QObject
Q_OBJECT
public:
explicit Transfer(uint64_t _amount, QString _address, QObject *parent = 0)
: QObject(parent), m_amount(_amount), m_address(std::move(_address)) {};
private:
friend class TransactionInfo;
friend class ConstructionInfo;
quint64 m_amount;
QString m_address;
public:
explicit Transfer(uint64_t amount, QString address, QObject *parent = nullptr)
: QObject(parent)
, m_amount(amount)
, m_address(std::move(address)) {};
quint64 amount() const { return m_amount; }
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

View file

@ -3,18 +3,6 @@
#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 {
return m_row;
}

View file

@ -19,10 +19,6 @@ public:
, m_used(used)
, m_hidden(hidden)
, m_pinned(pinned) {}
bool setUsed(bool used);
bool setHidden(bool hidden);
bool setPinned(bool pinned);
qsizetype getRow() const;
const QString& getAddress() const;

View file

@ -145,17 +145,6 @@ QString TransactionRow::paymentId() const
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> dests;

View file

@ -42,24 +42,18 @@ public:
quint64 confirmations() const;
quint64 confirmationsRequired() const;
quint64 unlockTime() const;
//! transaction_id
QString hash() const;
QDateTime timestamp() const;
QString date() const;
QString time() const;
QString paymentId() const;
//! only applicable for output transactions
//! used in tx details popup
QList<QString> destinations() const;
QString destinations_formatted() const;
QList<Transfer*> transfers() const;
QString rings_formatted() const;
private:
explicit TransactionRow();
// TransactionRow(const Monero::TransactionInfo *pimpl, QObject *parent = nullptr);
private:
friend class TransactionHistory;
mutable QList<Transfer*> m_transfers;

View file

@ -11,19 +11,11 @@ AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook)
, m_addressBook(addressBook)
, m_showFullAddresses(false)
{
connect(m_addressBook, &AddressBook::refreshStarted, this, &AddressBookModel::startReset);
connect(m_addressBook, &AddressBook::refreshFinished, this, &AddressBookModel::endReset);
connect(m_addressBook, &AddressBook::refreshStarted, this, &AddressBookModel::beginResetModel);
connect(m_addressBook, &AddressBook::refreshFinished, this, &AddressBookModel::endResetModel);
m_contactIcon = icons()->icon("person.svg");
}
void AddressBookModel::startReset(){
beginResetModel();
}
void AddressBookModel::endReset(){
endResetModel();
}
int AddressBookModel::rowCount(const QModelIndex &) const
{
return m_addressBook->count();

View file

@ -30,17 +30,13 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const 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;
void setShowFullAddresses(bool show);
bool writeCSV(const QString &path);
QMap<QString, QString> readCSV(const QString &path);
public slots:
void startReset();
void endReset();
private:
AddressBook * m_addressBook;
QIcon m_contactIcon;

View file

@ -17,16 +17,8 @@ SubaddressModel::SubaddressModel(QObject *parent, Subaddress *subaddress)
: QAbstractTableModel(parent)
, m_subaddress(subaddress)
{
connect(m_subaddress, &Subaddress::refreshStarted, this, &SubaddressModel::startReset);
connect(m_subaddress, &Subaddress::refreshFinished, this, &SubaddressModel::endReset);
}
void SubaddressModel::startReset(){
beginResetModel();
}
void SubaddressModel::endReset(){
endResetModel();
connect(m_subaddress, &Subaddress::refreshStarted, this, &SubaddressModel::beginResetModel);
connect(m_subaddress, &Subaddress::refreshFinished, this, &SubaddressModel::endResetModel);
}
int SubaddressModel::rowCount(const QModelIndex &parent) const

View file

@ -42,10 +42,6 @@ public:
void setCurrentSubaddressAccount(quint32 accountIndex);
public slots:
void startReset();
void endReset();
private:
Subaddress *m_subaddress;
QVariant parseSubaddressRow(const SubaddressRow &subaddress, const QModelIndex &index, int role) const;