Plugin Config outline work

This commit is contained in:
twiddle 2024-05-18 22:12:23 -04:00
parent 140547b38e
commit 777ae42ba9
10 changed files with 136 additions and 186 deletions

@ -1 +1 @@
Subproject commit 9abafde37423c204401a2322d152e8b3cc5d267a
Subproject commit 6a9c825056cbec61f91295812556bb0d3c926b9b

View file

@ -40,6 +40,7 @@
<file>assets/images/file.png</file>
<file>assets/images/file_manager_32px.png</file>
<file>assets/images/gnome-calc.png</file>
<file>assets/images/atomic-icon.png</file>
<file>assets/images/hd_32px.png</file>
<file>assets/images/history.png</file>
<file>assets/images/i2p.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View file

@ -6,6 +6,7 @@
#include "utils/AppData.h"
#include "utils/config.h"
#include "utils/Networking.h"
AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
: WindowModalDialog(parent)
@ -15,33 +16,19 @@ AtomicConfigDialog::AtomicConfigDialog(QWidget *parent)
this->fillListWidgets();
connect(ui->btn_selectAll, &QPushButton::clicked, this, &AtomicConfigDialog::selectAll);
connect(ui->btn_deselectAll, &QPushButton::clicked, this, &AtomicConfigDialog::deselectAll);
connect(ui->btn_autoInstall,&QPushButton::clicked, this, &AtomicConfigDialog::downloadBinary);
connect(ui->btn_selectFile,&QPushButton::clicked, this, &AtomicConfigDialog::selectBinary);
connect(ui->buttonBox, &QDialogButtonBox::accepted, [this]{
conf()->set(Config::fiatSymbols, this->checkedFiat());
conf()->set(Config::cryptoSymbols, this->checkedCrypto());
this->accept();
});
this->adjustSize();
}
QStringList AtomicConfigDialog::checkedFiat() {
return this->getChecked(ui->list_fiat);
}
QStringList AtomicConfigDialog::checkedCrypto() {
return this->getChecked(ui->list_crypto);
}
void AtomicConfigDialog::selectAll() {
this->setCheckState(this->getVisibleListWidget(), Qt::Checked);
}
void AtomicConfigDialog::deselectAll() {
this->setCheckState(this->getVisibleListWidget(), Qt::Unchecked);
}
void AtomicConfigDialog::setCheckState(QListWidget *widget, Qt::CheckState checkState) {
QListWidgetItem *item;
@ -63,13 +50,7 @@ QStringList AtomicConfigDialog::getChecked(QListWidget *widget) {
return checked;
}
QListWidget* AtomicConfigDialog::getVisibleListWidget() {
if (ui->tabWidget->currentIndex() == 0) {
return ui->list_fiat;
} else {
return ui->list_crypto;
}
}
void AtomicConfigDialog::fillListWidgets() {
QStringList cryptoCurrencies = appData()->prices.markets.keys();
@ -78,8 +59,6 @@ void AtomicConfigDialog::fillListWidgets() {
QStringList checkedCryptoCurrencies = conf()->get(Config::cryptoSymbols).toStringList();
QStringList checkedFiatCurrencies = conf()->get(Config::fiatSymbols).toStringList();
ui->list_crypto->addItems(cryptoCurrencies);
ui->list_fiat->addItems(fiatCurrencies);
auto setChecked = [](QListWidget *widget, const QStringList &checked){
QListWidgetItem *item;
@ -94,8 +73,13 @@ void AtomicConfigDialog::fillListWidgets() {
}
};
setChecked(ui->list_crypto, checkedCryptoCurrencies);
setChecked(ui->list_fiat, checkedFiatCurrencies);
}
void AtomicConfigDialog::downloadBinary() {
};
void AtomicConfigDialog::selectBinary() {
};
AtomicConfigDialog::~AtomicConfigDialog() = default;

View file

@ -21,18 +21,13 @@ public:
explicit AtomicConfigDialog(QWidget *parent = nullptr);
~AtomicConfigDialog() override;
QStringList checkedFiat();
QStringList checkedCrypto();
private slots:
void selectAll();
void deselectAll();
private:
void setCheckState(QListWidget *widget, Qt::CheckState checkState);
QStringList getChecked(QListWidget *widget);
void fillListWidgets();
QListWidget* getVisibleListWidget();
void downloadBinary();
void selectBinary();
QScopedPointer<Ui::AtomicConfigDialog> ui;
};

View file

@ -14,57 +14,6 @@
<string>Atomic config</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Fiat</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="list_fiat"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Crypto</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="list_crypto"/>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -75,16 +24,16 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btn_selectAll">
<widget class="QPushButton" name="btn_autoInstall">
<property name="text">
<string>Select all</string>
<string>Auto Install Swap Tool</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_deselectAll">
<widget class="QPushButton" name="btn_selectFile">
<property name="text">
<string>Deselect all</string>
<string>Select Path to Binary</string>
</property>
</widget>
</item>

View file

@ -36,7 +36,7 @@ QString AtomicPlugin::description() {
}
QString AtomicPlugin::icon() {
return "gnome-calc.png";
return "atomic-icon.png";
}
QStringList AtomicPlugin::socketData() {

View file

@ -0,0 +1,9 @@
### Atomic Plugin
Built in xmr-btc atomic swap
## Installation
## Usage
Navigate to the Atomic tab after opening your wallet. Click the configure button.
// Config Settings

View file

@ -134,6 +134,14 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::tickers, {QS("tickers"), QStringList{"XMR", "BTC", "XMR/BTC"}}},
{Config::tickersShowFiatBalance, {QS("tickersShowFiatBalance"), true}},
// Atomic
{Config::rendezVous, {QS("rendezVous"), QStringList{"/dns4/xmr-btc-asb.coblox.tech/tcp/9939/p2p/12D3KooWCdMKjesXMJz1SiZ7HgotrxuqhQJbP5sgBm2BwP1cqThi",
"/dnsaddr/atomic.money/p2p/12D3KooWNfiwKyDpAbW7XSgw5xmoMJzMXsJxR91FbUJiuWU1vBGb",
"/dnsaddr/xmr.darkness.su/p2p/12D3KooWLWpQtmuPoQvMJxs6KRGMrc39ohkNbRNaXWJhW3DfQD6e",
"/dnsaddr/swapanarchy.cfd/p2p/12D3KooWMgGjeW7ErQxCQzaeHiXxJn42wegCPFepixEXfBJT1PNS",
"/onion3/spqfqxirmlrhq7gbiwn4jn35c77gu2kof26i6psoc6bbyduol3zty6qd:9841/p2p/12D3KooWM9ipr33nEtxyCBF7fdbHsMrRzHaSf1bEVYzV8XSBSMet"}}},
{Config::swapPath, {QS("swapPath"), ""}},
};

View file

@ -148,6 +148,10 @@ public:
// Tickers
tickers,
tickersShowFiatBalance,
// Atomic Settings
rendezVous,
swapPath,
};
enum PrivacyLevel {