Hush lite wallet
https://faq.hush.is/sdl
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
// Copyright 2019-2022 The Hush developers
|
|
// Released under the GPLv3
|
|
#include "addresscombo.h"
|
|
#include "addressbook.h"
|
|
#include "settings.h"
|
|
|
|
AddressCombo::AddressCombo(QWidget* parent): QComboBox(parent)
|
|
{}
|
|
|
|
QString AddressCombo::itemText(int i)
|
|
{
|
|
QString txt = QComboBox::itemText(i);
|
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
|
}
|
|
|
|
QString AddressCombo::currentText()
|
|
{
|
|
QString txt = QComboBox::currentText();
|
|
return AddressBook::addressFromAddressLabel(txt.split("(")[0].trimmed());
|
|
}
|
|
|
|
void AddressCombo::setCurrentText(const QString& text)
|
|
{
|
|
for (int i=0; i < count(); i++)
|
|
if (itemText(i) == text)
|
|
QComboBox::setCurrentIndex(i);
|
|
|
|
}
|
|
|
|
void AddressCombo::addItem(const QString& text, CAmount bal)
|
|
{
|
|
QString txt = AddressBook::addLabelToAddress(text);
|
|
if (bal.toqint64() > 0)
|
|
txt = txt % "(" % bal.toDecimalhushString() % ")";
|
|
|
|
QComboBox::addItem(txt);
|
|
}
|
|
|
|
void AddressCombo::insertItem(int index, const QString& text, CAmount bal)
|
|
{
|
|
QString txt = AddressBook::addLabelToAddress(text) %
|
|
"(" % bal.toDecimalhushString() % ")";
|
|
QComboBox::insertItem(index, txt);
|
|
}
|
|
|