mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 07:11:29 +02:00
coins: don't refresh for each freeze/thaw
This commit is contained in:
+2
-8
@@ -324,18 +324,12 @@ QVector<CoinsInfo*> CoinsWidget::currentEntries() {
|
||||
}
|
||||
|
||||
void CoinsWidget::freezeCoins(QStringList &pubkeys) {
|
||||
for (auto &pubkey : pubkeys) {
|
||||
m_wallet->coins()->freeze(pubkey);
|
||||
}
|
||||
m_wallet->coins()->refresh();
|
||||
m_wallet->coins()->freeze(pubkeys);
|
||||
m_wallet->updateBalance();
|
||||
}
|
||||
|
||||
void CoinsWidget::thawCoins(QStringList &pubkeys) {
|
||||
for (auto &pubkey : pubkeys) {
|
||||
m_wallet->coins()->thaw(pubkey);
|
||||
}
|
||||
m_wallet->coins()->refresh();
|
||||
m_wallet->coins()->thaw(pubkeys);
|
||||
m_wallet->updateBalance();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public slots:
|
||||
void disallowSending();
|
||||
|
||||
private slots:
|
||||
void onDataPasted(const QString &data);
|
||||
void onDataFromQR(const QString &data);
|
||||
|
||||
private:
|
||||
void setupComboBox();
|
||||
|
||||
+36
-32
@@ -105,48 +105,52 @@ quint64 Coins::count() const
|
||||
return m_rows.length();
|
||||
}
|
||||
|
||||
void Coins::freeze(QString &publicKey)
|
||||
void Coins::freeze(QStringList &publicKeys)
|
||||
{
|
||||
crypto::public_key pk;
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
return;
|
||||
|
||||
for (const auto& publicKey : publicKeys) {
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->freeze(pk);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "freeze: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->freeze(pk);
|
||||
refresh();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "freeze: " << e.what();
|
||||
}
|
||||
|
||||
emit coinFrozen();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void Coins::thaw(QString &publicKey)
|
||||
void Coins::thaw(QStringList &publicKeys)
|
||||
{
|
||||
crypto::public_key pk;
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
return;
|
||||
|
||||
for (const auto& publicKey : publicKeys) {
|
||||
if (!epee::string_tools::hex_to_pod(publicKey.toStdString(), pk))
|
||||
{
|
||||
qWarning() << "Invalid public key: " << publicKey;
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->thaw(pk);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "thaw: " << e.what();
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_wallet2->thaw(pk);
|
||||
refresh();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
qWarning() << "thaw: " << e.what();
|
||||
}
|
||||
|
||||
emit coinThawed();
|
||||
refresh();
|
||||
}
|
||||
|
||||
QVector<CoinsInfo*> Coins::coins_from_txid(const QString &txid)
|
||||
|
||||
@@ -31,8 +31,10 @@ public:
|
||||
CoinsInfo * coin(int index);
|
||||
void refresh();
|
||||
void refreshUnlocked();
|
||||
void freeze(QString &publicKey);
|
||||
void thaw(QString &publicKey);
|
||||
|
||||
void freeze(QStringList &publicKeys);
|
||||
void thaw(QStringList &publicKeys);
|
||||
|
||||
QVector<CoinsInfo*> coins_from_txid(const QString &txid);
|
||||
QVector<CoinsInfo*> coinsFromKeyImage(const QStringList &keyimages);
|
||||
void setDescription(const QString &publicKey, quint32 accountIndex, const QString &description);
|
||||
@@ -43,8 +45,6 @@ public:
|
||||
signals:
|
||||
void refreshStarted() const;
|
||||
void refreshFinished() const;
|
||||
void coinFrozen() const;
|
||||
void coinThawed() const;
|
||||
void descriptionChanged() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user