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

View file

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

View file

@ -1,153 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AtomicConfigDialog</class> <class>AtomicConfigDialog</class>
<widget class="QDialog" name="AtomicConfigDialog"> <widget class="QDialog" name="AtomicConfigDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>509</width> <width>509</width>
<height>574</height> <height>574</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Atomic config</string> <string>Atomic config</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="Line" name="line">
<property name="currentIndex"> <property name="orientation">
<number>0</number> <enum>Qt::Vertical</enum>
</property> </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">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="btn_selectAll">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_deselectAll">
<property name="text">
<string>Deselect all</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget> </widget>
<resources/> </item>
<connections> <item>
<connection> <layout class="QHBoxLayout" name="horizontalLayout_2">
<sender>buttonBox</sender> <item>
<signal>accepted()</signal> <widget class="QPushButton" name="btn_autoInstall">
<receiver>AtomicConfigDialog</receiver> <property name="text">
<slot>accept()</slot> <string>Auto Install Swap Tool</string>
<hints> </property>
<hint type="sourcelabel"> </widget>
<x>248</x> </item>
<y>254</y> <item>
</hint> <widget class="QPushButton" name="btn_selectFile">
<hint type="destinationlabel"> <property name="text">
<x>157</x> <string>Select Path to Binary</string>
<y>274</y> </property>
</hint> </widget>
</hints> </item>
</connection> <item>
<connection> <spacer name="horizontalSpacer">
<sender>buttonBox</sender> <property name="orientation">
<signal>rejected()</signal> <enum>Qt::Horizontal</enum>
<receiver>AtomicConfigDialog</receiver> </property>
<slot>reject()</slot> <property name="sizeHint" stdset="0">
<hints> <size>
<hint type="sourcelabel"> <width>40</width>
<x>316</x> <height>20</height>
<y>260</y> </size>
</hint> </property>
<hint type="destinationlabel"> </spacer>
<x>286</x> </item>
<y>274</y> <item>
</hint> <widget class="QDialogButtonBox" name="buttonBox">
</hints> <property name="orientation">
</connection> <enum>Qt::Horizontal</enum>
</connections> </property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AtomicConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AtomicConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>

View file

@ -36,7 +36,7 @@ QString AtomicPlugin::description() {
} }
QString AtomicPlugin::icon() { QString AtomicPlugin::icon() {
return "gnome-calc.png"; return "atomic-icon.png";
} }
QStringList AtomicPlugin::socketData() { 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::tickers, {QS("tickers"), QStringList{"XMR", "BTC", "XMR/BTC"}}},
{Config::tickersShowFiatBalance, {QS("tickersShowFiatBalance"), true}}, {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
tickers, tickers,
tickersShowFiatBalance, tickersShowFiatBalance,
// Atomic Settings
rendezVous,
swapPath,
}; };
enum PrivacyLevel { enum PrivacyLevel {