Merge pull request 'Send: Always include pref. currency in combobox' (#169) from tobtoht/feather:send_pref_cur into master

Reviewed-on: https://git.wownero.com/feather/feather/pulls/169
This commit is contained in:
tobtoht 2020-11-24 21:26:37 +00:00
commit 16414ba2e9
3 changed files with 20 additions and 42 deletions

View file

@ -29,6 +29,8 @@ SendWidget::SendWidget(QWidget *parent) :
ui->label_conversionAmount->setText(""); ui->label_conversionAmount->setText("");
ui->label_conversionAmount->hide(); ui->label_conversionAmount->hide();
ui->btn_openAlias->hide(); ui->btn_openAlias->hide();
this->setupComboBox();
} }
void SendWidget::currencyComboChanged(int index) { void SendWidget::currencyComboChanged(int index) {
@ -185,8 +187,23 @@ void SendWidget::onEndTransaction() {
ui->btnSend->setEnabled(true); ui->btnSend->setEnabled(true);
} }
void SendWidget::setupComboBox() {
ui->comboCurrencySelection->clear();
QStringList defaultCurrencies = {"XMR", "USD", "EUR", "CNY", "JPY", "GBP"};
QString preferredCurrency = config()->get(Config::preferredFiatCurrency).toString();
if (defaultCurrencies.contains(preferredCurrency)) {
defaultCurrencies.removeOne(preferredCurrency);
}
ui->comboCurrencySelection->insertItems(0, defaultCurrencies);
ui->comboCurrencySelection->insertItem(1, preferredCurrency);
}
void SendWidget::onPreferredFiatCurrencyChanged() { void SendWidget::onPreferredFiatCurrencyChanged() {
this->updateConversionLabel(); this->updateConversionLabel();
this->setupComboBox();
} }
SendWidget::~SendWidget() { SendWidget::~SendWidget() {

View file

@ -48,6 +48,8 @@ signals:
void createTransaction(const QString &address, double amount, const QString &description, bool all); void createTransaction(const QString &address, double amount, const QString &description, bool all);
private: private:
void setupComboBox();
Ui::SendWidget *ui; Ui::SendWidget *ui;
AppContext *m_ctx; AppContext *m_ctx;
double amount(); double amount();

View file

@ -105,48 +105,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="comboCurrencySelection"> <widget class="QComboBox" name="comboCurrencySelection"/>
<item>
<property name="text">
<string>XMR</string>
</property>
</item>
<item>
<property name="text">
<string>EUR</string>
</property>
</item>
<item>
<property name="text">
<string>USD</string>
</property>
</item>
<item>
<property name="text">
<string>GBP</string>
</property>
</item>
<item>
<property name="text">
<string>AUD</string>
</property>
</item>
<item>
<property name="text">
<string>JPY</string>
</property>
</item>
<item>
<property name="text">
<string>NZD</string>
</property>
</item>
<item>
<property name="text">
<string>RMB</string>
</property>
</item>
</widget>
</item> </item>
</layout> </layout>
</item> </item>