UI polish
This commit is contained in:
@@ -144,6 +144,7 @@ QList<double> Turnstile::splitAmount(double amount, int parts) {
|
|||||||
return amounts;
|
return amounts;
|
||||||
|
|
||||||
fillAmounts(amounts, amount, parts);
|
fillAmounts(amounts, amount, parts);
|
||||||
|
qDebug() << amounts;
|
||||||
|
|
||||||
// Ensure they all add up!
|
// Ensure they all add up!
|
||||||
double sumofparts = 0;
|
double sumofparts = 0;
|
||||||
@@ -159,7 +160,7 @@ QList<double> Turnstile::splitAmount(double amount, int parts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Turnstile::fillAmounts(QList<double>& amounts, double amount, int count) {
|
void Turnstile::fillAmounts(QList<double>& amounts, double amount, int count) {
|
||||||
if (count == 1 || amount < 1) {
|
if (count == 1 || amount < 0.01) {
|
||||||
// Split the chaff.
|
// Split the chaff.
|
||||||
// Chaff is all amounts lesser than 0.0001 ZEC. The chaff will be added to the
|
// Chaff is all amounts lesser than 0.0001 ZEC. The chaff will be added to the
|
||||||
// dev fee, and is done so to protect privacy.
|
// dev fee, and is done so to protect privacy.
|
||||||
@@ -175,16 +176,19 @@ void Turnstile::fillAmounts(QList<double>& amounts, double amount, int count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get a random amount off the amount (between half and full) and call recursively.
|
// Get a random amount off the amount (between half and full) and call recursively.
|
||||||
auto curAmount = std::rand() % (int)std::floor(amount);
|
// Multiply by hundered, because we'll operate on 0.01 ZEC minimum. We'll divide by 100 later
|
||||||
|
double curAmount = std::rand() % (int)std::floor(amount * 100);
|
||||||
|
|
||||||
// Try to round it off
|
// Try to round it off
|
||||||
// TODO: Do this via log
|
auto places = (int)std::floor(std::log10(curAmount));
|
||||||
if (curAmount > 1000) {
|
if (places > 0) {
|
||||||
curAmount = std::floor(curAmount / 100) * 100;
|
auto a = std::pow(10, places);
|
||||||
} else if (curAmount > 100) {
|
curAmount = std::floor(curAmount / a) * a;
|
||||||
curAmount = std::floor(curAmount / 10) * 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// And divide by 100
|
||||||
|
curAmount = curAmount / 100;
|
||||||
|
|
||||||
if (curAmount > 0)
|
if (curAmount > 0)
|
||||||
amounts.push_back(curAmount);
|
amounts.push_back(curAmount);
|
||||||
|
|
||||||
|
|||||||
110
src/turnstile.ui
110
src/turnstile.ui
@@ -32,33 +32,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" rowspan="2">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Total Fees</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
|
||||||
<string>Privacy Level</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Miner Fee:</string>
|
<string>Privacy Level</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -75,46 +58,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Dev Fee: </string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0" colspan="2">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="2">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>0.0004 ZEC $0.04</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="2">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>0.0004 ZEC $0.04</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2">
|
<item row="2" column="1" colspan="2">
|
||||||
<widget class="QComboBox" name="migrateZaddList">
|
<widget class="QComboBox" name="migrateZaddList">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -181,6 +124,55 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0" rowspan="2" colspan="3">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Miner Fees</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>0.0004 ZEC $0.04</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total Balance</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -31,14 +31,8 @@ public:
|
|||||||
QVBoxLayout *verticalLayout_2;
|
QVBoxLayout *verticalLayout_2;
|
||||||
QGridLayout *gridLayout;
|
QGridLayout *gridLayout;
|
||||||
QLabel *msgIcon;
|
QLabel *msgIcon;
|
||||||
QLabel *label_3;
|
|
||||||
QLabel *label_2;
|
QLabel *label_2;
|
||||||
QLabel *label_4;
|
|
||||||
QLabel *label;
|
QLabel *label;
|
||||||
QLabel *label_5;
|
|
||||||
QSpacerItem *verticalSpacer;
|
|
||||||
QLabel *label_6;
|
|
||||||
QLabel *label_7;
|
|
||||||
QComboBox *migrateZaddList;
|
QComboBox *migrateZaddList;
|
||||||
QComboBox *privLevel;
|
QComboBox *privLevel;
|
||||||
QLabel *label_8;
|
QLabel *label_8;
|
||||||
@@ -46,6 +40,10 @@ public:
|
|||||||
QComboBox *migrateTo;
|
QComboBox *migrateTo;
|
||||||
QFrame *line;
|
QFrame *line;
|
||||||
QLabel *fromBalance;
|
QLabel *fromBalance;
|
||||||
|
QSpacerItem *verticalSpacer;
|
||||||
|
QLabel *label_5;
|
||||||
|
QLabel *label_7;
|
||||||
|
QLabel *label_3;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
|
|
||||||
void setupUi(QDialog *Turnstile)
|
void setupUi(QDialog *Turnstile)
|
||||||
@@ -67,73 +65,38 @@ public:
|
|||||||
|
|
||||||
gridLayout->addWidget(msgIcon, 0, 0, 1, 1);
|
gridLayout->addWidget(msgIcon, 0, 0, 1, 1);
|
||||||
|
|
||||||
label_3 = new QLabel(groupBox);
|
|
||||||
label_3->setObjectName(QStringLiteral("label_3"));
|
|
||||||
label_3->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
|
|
||||||
|
|
||||||
gridLayout->addWidget(label_3, 6, 0, 2, 1);
|
|
||||||
|
|
||||||
label_2 = new QLabel(groupBox);
|
label_2 = new QLabel(groupBox);
|
||||||
label_2->setObjectName(QStringLiteral("label_2"));
|
label_2->setObjectName(QStringLiteral("label_2"));
|
||||||
|
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||||
|
sizePolicy.setHorizontalStretch(0);
|
||||||
|
sizePolicy.setVerticalStretch(0);
|
||||||
|
sizePolicy.setHeightForWidth(label_2->sizePolicy().hasHeightForWidth());
|
||||||
|
label_2->setSizePolicy(sizePolicy);
|
||||||
|
|
||||||
gridLayout->addWidget(label_2, 5, 0, 1, 1);
|
gridLayout->addWidget(label_2, 5, 0, 1, 1);
|
||||||
|
|
||||||
label_4 = new QLabel(groupBox);
|
|
||||||
label_4->setObjectName(QStringLiteral("label_4"));
|
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
||||||
sizePolicy.setHorizontalStretch(0);
|
|
||||||
sizePolicy.setVerticalStretch(0);
|
|
||||||
sizePolicy.setHeightForWidth(label_4->sizePolicy().hasHeightForWidth());
|
|
||||||
label_4->setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
gridLayout->addWidget(label_4, 6, 1, 1, 1);
|
|
||||||
|
|
||||||
label = new QLabel(groupBox);
|
label = new QLabel(groupBox);
|
||||||
label->setObjectName(QStringLiteral("label"));
|
label->setObjectName(QStringLiteral("label"));
|
||||||
QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
|
||||||
sizePolicy1.setHorizontalStretch(0);
|
label->setSizePolicy(sizePolicy);
|
||||||
sizePolicy1.setVerticalStretch(0);
|
|
||||||
sizePolicy1.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
|
|
||||||
label->setSizePolicy(sizePolicy1);
|
|
||||||
|
|
||||||
gridLayout->addWidget(label, 2, 0, 1, 1);
|
gridLayout->addWidget(label, 2, 0, 1, 1);
|
||||||
|
|
||||||
label_5 = new QLabel(groupBox);
|
|
||||||
label_5->setObjectName(QStringLiteral("label_5"));
|
|
||||||
sizePolicy.setHeightForWidth(label_5->sizePolicy().hasHeightForWidth());
|
|
||||||
label_5->setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
gridLayout->addWidget(label_5, 7, 1, 1, 1);
|
|
||||||
|
|
||||||
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
|
|
||||||
gridLayout->addItem(verticalSpacer, 8, 0, 1, 2);
|
|
||||||
|
|
||||||
label_6 = new QLabel(groupBox);
|
|
||||||
label_6->setObjectName(QStringLiteral("label_6"));
|
|
||||||
|
|
||||||
gridLayout->addWidget(label_6, 6, 2, 1, 1);
|
|
||||||
|
|
||||||
label_7 = new QLabel(groupBox);
|
|
||||||
label_7->setObjectName(QStringLiteral("label_7"));
|
|
||||||
|
|
||||||
gridLayout->addWidget(label_7, 7, 2, 1, 1);
|
|
||||||
|
|
||||||
migrateZaddList = new QComboBox(groupBox);
|
migrateZaddList = new QComboBox(groupBox);
|
||||||
migrateZaddList->setObjectName(QStringLiteral("migrateZaddList"));
|
migrateZaddList->setObjectName(QStringLiteral("migrateZaddList"));
|
||||||
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
sizePolicy2.setHorizontalStretch(0);
|
sizePolicy1.setHorizontalStretch(0);
|
||||||
sizePolicy2.setVerticalStretch(0);
|
sizePolicy1.setVerticalStretch(0);
|
||||||
sizePolicy2.setHeightForWidth(migrateZaddList->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(migrateZaddList->sizePolicy().hasHeightForWidth());
|
||||||
migrateZaddList->setSizePolicy(sizePolicy2);
|
migrateZaddList->setSizePolicy(sizePolicy1);
|
||||||
migrateZaddList->setEditable(false);
|
migrateZaddList->setEditable(false);
|
||||||
|
|
||||||
gridLayout->addWidget(migrateZaddList, 2, 1, 1, 2);
|
gridLayout->addWidget(migrateZaddList, 2, 1, 1, 2);
|
||||||
|
|
||||||
privLevel = new QComboBox(groupBox);
|
privLevel = new QComboBox(groupBox);
|
||||||
privLevel->setObjectName(QStringLiteral("privLevel"));
|
privLevel->setObjectName(QStringLiteral("privLevel"));
|
||||||
sizePolicy2.setHeightForWidth(privLevel->sizePolicy().hasHeightForWidth());
|
sizePolicy1.setHeightForWidth(privLevel->sizePolicy().hasHeightForWidth());
|
||||||
privLevel->setSizePolicy(sizePolicy2);
|
privLevel->setSizePolicy(sizePolicy1);
|
||||||
|
|
||||||
gridLayout->addWidget(privLevel, 5, 1, 1, 2);
|
gridLayout->addWidget(privLevel, 5, 1, 1, 2);
|
||||||
|
|
||||||
@@ -145,8 +108,8 @@ public:
|
|||||||
|
|
||||||
label_9 = new QLabel(groupBox);
|
label_9 = new QLabel(groupBox);
|
||||||
label_9->setObjectName(QStringLiteral("label_9"));
|
label_9->setObjectName(QStringLiteral("label_9"));
|
||||||
sizePolicy1.setHeightForWidth(label_9->sizePolicy().hasHeightForWidth());
|
sizePolicy.setHeightForWidth(label_9->sizePolicy().hasHeightForWidth());
|
||||||
label_9->setSizePolicy(sizePolicy1);
|
label_9->setSizePolicy(sizePolicy);
|
||||||
|
|
||||||
gridLayout->addWidget(label_9, 4, 0, 1, 1);
|
gridLayout->addWidget(label_9, 4, 0, 1, 1);
|
||||||
|
|
||||||
@@ -167,6 +130,33 @@ public:
|
|||||||
|
|
||||||
gridLayout->addWidget(fromBalance, 3, 1, 1, 1);
|
gridLayout->addWidget(fromBalance, 3, 1, 1, 1);
|
||||||
|
|
||||||
|
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
gridLayout->addItem(verticalSpacer, 7, 0, 2, 3);
|
||||||
|
|
||||||
|
label_5 = new QLabel(groupBox);
|
||||||
|
label_5->setObjectName(QStringLiteral("label_5"));
|
||||||
|
sizePolicy.setHeightForWidth(label_5->sizePolicy().hasHeightForWidth());
|
||||||
|
label_5->setSizePolicy(sizePolicy);
|
||||||
|
|
||||||
|
gridLayout->addWidget(label_5, 6, 0, 1, 1);
|
||||||
|
|
||||||
|
label_7 = new QLabel(groupBox);
|
||||||
|
label_7->setObjectName(QStringLiteral("label_7"));
|
||||||
|
QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
|
sizePolicy2.setHorizontalStretch(0);
|
||||||
|
sizePolicy2.setVerticalStretch(0);
|
||||||
|
sizePolicy2.setHeightForWidth(label_7->sizePolicy().hasHeightForWidth());
|
||||||
|
label_7->setSizePolicy(sizePolicy2);
|
||||||
|
label_7->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
gridLayout->addWidget(label_7, 6, 1, 1, 2);
|
||||||
|
|
||||||
|
label_3 = new QLabel(groupBox);
|
||||||
|
label_3->setObjectName(QStringLiteral("label_3"));
|
||||||
|
|
||||||
|
gridLayout->addWidget(label_3, 3, 0, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
verticalLayout_2->addLayout(gridLayout);
|
verticalLayout_2->addLayout(gridLayout);
|
||||||
|
|
||||||
@@ -193,17 +183,15 @@ public:
|
|||||||
Turnstile->setWindowTitle(QApplication::translate("Turnstile", "Turnstile Migration", nullptr));
|
Turnstile->setWindowTitle(QApplication::translate("Turnstile", "Turnstile Migration", nullptr));
|
||||||
groupBox->setTitle(QApplication::translate("Turnstile", "Turnstile Migration", nullptr));
|
groupBox->setTitle(QApplication::translate("Turnstile", "Turnstile Migration", nullptr));
|
||||||
msgIcon->setText(QString());
|
msgIcon->setText(QString());
|
||||||
label_3->setText(QApplication::translate("Turnstile", "Total Fees", nullptr));
|
|
||||||
label_2->setText(QApplication::translate("Turnstile", "Privacy Level", nullptr));
|
label_2->setText(QApplication::translate("Turnstile", "Privacy Level", nullptr));
|
||||||
label_4->setText(QApplication::translate("Turnstile", "Miner Fee:", nullptr));
|
|
||||||
label->setText(QApplication::translate("Turnstile", "From", nullptr));
|
label->setText(QApplication::translate("Turnstile", "From", nullptr));
|
||||||
label_5->setText(QApplication::translate("Turnstile", "Dev Fee: ", nullptr));
|
|
||||||
label_6->setText(QApplication::translate("Turnstile", "0.0004 ZEC $0.04", nullptr));
|
|
||||||
label_7->setText(QApplication::translate("Turnstile", "0.0004 ZEC $0.04", nullptr));
|
|
||||||
migrateZaddList->setCurrentText(QString());
|
migrateZaddList->setCurrentText(QString());
|
||||||
label_8->setText(QApplication::translate("Turnstile", "<html><head/><body><p>Funds from Sprout z-Addresses (which start with "zc") need to be moved to the upgraded Sapling z-Addresses (which start with "zs"). The funds cannot be moved directly, but need to be sent through intermediate "transparent" addresses in privacy-preserving way.</p><p>This migration can be done automatically for you.</p></body></html>", nullptr));
|
label_8->setText(QApplication::translate("Turnstile", "<html><head/><body><p>Funds from Sprout z-Addresses (which start with "zc") need to be moved to the upgraded Sapling z-Addresses (which start with "zs"). The funds cannot be moved directly, but need to be sent through intermediate "transparent" addresses in privacy-preserving way.</p><p>This migration can be done automatically for you.</p></body></html>", nullptr));
|
||||||
label_9->setText(QApplication::translate("Turnstile", "To", nullptr));
|
label_9->setText(QApplication::translate("Turnstile", "To", nullptr));
|
||||||
fromBalance->setText(QApplication::translate("Turnstile", "Balance", nullptr));
|
fromBalance->setText(QApplication::translate("Turnstile", "Balance", nullptr));
|
||||||
|
label_5->setText(QApplication::translate("Turnstile", "Miner Fees", nullptr));
|
||||||
|
label_7->setText(QApplication::translate("Turnstile", "0.0004 ZEC $0.04", nullptr));
|
||||||
|
label_3->setText(QApplication::translate("Turnstile", "Total Balance", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user