Aditya Kulkarni
5 years ago
12 changed files with 262 additions and 473 deletions
File diff suppressed because one or more lines are too long
@ -1,59 +0,0 @@ |
|||
#include "ellidedlabel.h" |
|||
|
|||
EllidedLabel::EllidedLabel(QWidget *parent, const QString &text) |
|||
: QFrame(parent) |
|||
, elided(false) |
|||
, content(text) |
|||
{ |
|||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
|||
} |
|||
|
|||
void EllidedLabel::setText(const QString &newText) |
|||
{ |
|||
content = newText; |
|||
update(); |
|||
} |
|||
|
|||
void EllidedLabel::paintEvent(QPaintEvent *event) |
|||
{ |
|||
QFrame::paintEvent(event); |
|||
|
|||
QPainter painter(this); |
|||
QFontMetrics fontMetrics = painter.fontMetrics(); |
|||
|
|||
bool didElide = false; |
|||
int lineSpacing = fontMetrics.lineSpacing(); |
|||
int y = 0; |
|||
|
|||
QTextLayout textLayout(content, painter.font()); |
|||
textLayout.beginLayout(); |
|||
forever { |
|||
QTextLine line = textLayout.createLine(); |
|||
|
|||
if (!line.isValid()) |
|||
break; |
|||
|
|||
line.setLineWidth(width()); |
|||
int nextLineY = y + lineSpacing; |
|||
|
|||
if (height() >= nextLineY + lineSpacing) { |
|||
line.draw(&painter, QPoint(0, y)); |
|||
y = nextLineY; |
|||
//! [2]
|
|||
//! [3]
|
|||
} else { |
|||
QString lastLine = content.mid(line.textStart()); |
|||
QString elidedLastLine = fontMetrics.elidedText(lastLine, Qt::ElideRight, width()); |
|||
painter.drawText(QPoint(0, y + fontMetrics.ascent()), elidedLastLine); |
|||
line = textLayout.createLine(); |
|||
didElide = line.isValid(); |
|||
break; |
|||
} |
|||
} |
|||
textLayout.endLayout(); |
|||
|
|||
if (didElide != elided) { |
|||
elided = didElide; |
|||
emit elisionChanged(didElide); |
|||
} |
|||
} |
@ -1,30 +0,0 @@ |
|||
#ifndef ELLIDEDLABEL_H |
|||
#define ELLIDEDLABEL_H |
|||
|
|||
#include "precompiled.h" |
|||
|
|||
class EllidedLabel : public QFrame |
|||
{ |
|||
Q_OBJECT |
|||
Q_PROPERTY(QString text READ text WRITE setText) |
|||
Q_PROPERTY(bool isElided READ isElided) |
|||
|
|||
public: |
|||
explicit EllidedLabel(QWidget *parent = nullptr, const QString &text = ""); |
|||
|
|||
void setText(const QString &text); |
|||
const QString & text() const { return content; } |
|||
bool isElided() const { return elided; } |
|||
|
|||
protected: |
|||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; |
|||
|
|||
signals: |
|||
void elisionChanged(bool elided); |
|||
|
|||
private: |
|||
bool elided; |
|||
QString content; |
|||
}; |
|||
|
|||
#endif // ELLIDEDLABEL_H
|
@ -1,196 +0,0 @@ |
|||
/********************************************************************************
|
|||
** Form generated from reading UI file 'mainwindow.ui' |
|||
** |
|||
** Created by: Qt User Interface Compiler version 5.12.3 |
|||
** |
|||
** WARNING! All changes made in this file will be lost when recompiling UI file! |
|||
********************************************************************************/ |
|||
|
|||
#ifndef UI_MAINWINDOW_H |
|||
#define UI_MAINWINDOW_H |
|||
|
|||
#include <QtCore/QVariant> |
|||
#include <QtWidgets/QApplication> |
|||
#include <QtWidgets/QGridLayout> |
|||
#include <QtWidgets/QGroupBox> |
|||
#include <QtWidgets/QHBoxLayout> |
|||
#include <QtWidgets/QLabel> |
|||
#include <QtWidgets/QLineEdit> |
|||
#include <QtWidgets/QMainWindow> |
|||
#include <QtWidgets/QMenuBar> |
|||
#include <QtWidgets/QPushButton> |
|||
#include <QtWidgets/QScrollArea> |
|||
#include <QtWidgets/QSpacerItem> |
|||
#include <QtWidgets/QStatusBar> |
|||
#include <QtWidgets/QToolBar> |
|||
#include <QtWidgets/QVBoxLayout> |
|||
#include <QtWidgets/QWidget> |
|||
|
|||
QT_BEGIN_NAMESPACE |
|||
|
|||
class Ui_MainWindow |
|||
{ |
|||
public: |
|||
QWidget *centralWidget; |
|||
QGridLayout *gridLayout; |
|||
QGroupBox *Save; |
|||
QHBoxLayout *horizontalLayout; |
|||
QSpacerItem *horizontalSpacer; |
|||
QPushButton *btnSavePDF; |
|||
QPushButton *btnSaveJSON; |
|||
QGroupBox *Config; |
|||
QGridLayout *gridLayout_3; |
|||
QLabel *label_3; |
|||
QLineEdit *txttaddrs; |
|||
QLineEdit *txtEntropy; |
|||
QLabel *label; |
|||
QLineEdit *txtzaddrs; |
|||
QPushButton *btnGenerate; |
|||
QLabel *label_2; |
|||
QScrollArea *scrollArea; |
|||
QWidget *scroll; |
|||
QVBoxLayout *verticalLayout; |
|||
QMenuBar *menuBar; |
|||
QToolBar *mainToolBar; |
|||
QStatusBar *statusBar; |
|||
|
|||
void setupUi(QMainWindow *MainWindow) |
|||
{ |
|||
if (MainWindow->objectName().isEmpty()) |
|||
MainWindow->setObjectName(QString::fromUtf8("MainWindow")); |
|||
MainWindow->resize(927, 930); |
|||
centralWidget = new QWidget(MainWindow); |
|||
centralWidget->setObjectName(QString::fromUtf8("centralWidget")); |
|||
gridLayout = new QGridLayout(centralWidget); |
|||
gridLayout->setSpacing(6); |
|||
gridLayout->setContentsMargins(11, 11, 11, 11); |
|||
gridLayout->setObjectName(QString::fromUtf8("gridLayout")); |
|||
Save = new QGroupBox(centralWidget); |
|||
Save->setObjectName(QString::fromUtf8("Save")); |
|||
horizontalLayout = new QHBoxLayout(Save); |
|||
horizontalLayout->setSpacing(6); |
|||
horizontalLayout->setContentsMargins(11, 11, 11, 11); |
|||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); |
|||
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); |
|||
|
|||
horizontalLayout->addItem(horizontalSpacer); |
|||
|
|||
btnSavePDF = new QPushButton(Save); |
|||
btnSavePDF->setObjectName(QString::fromUtf8("btnSavePDF")); |
|||
|
|||
horizontalLayout->addWidget(btnSavePDF); |
|||
|
|||
btnSaveJSON = new QPushButton(Save); |
|||
btnSaveJSON->setObjectName(QString::fromUtf8("btnSaveJSON")); |
|||
|
|||
horizontalLayout->addWidget(btnSaveJSON); |
|||
|
|||
|
|||
gridLayout->addWidget(Save, 2, 0, 1, 1); |
|||
|
|||
Config = new QGroupBox(centralWidget); |
|||
Config->setObjectName(QString::fromUtf8("Config")); |
|||
gridLayout_3 = new QGridLayout(Config); |
|||
gridLayout_3->setSpacing(6); |
|||
gridLayout_3->setContentsMargins(11, 11, 11, 11); |
|||
gridLayout_3->setObjectName(QString::fromUtf8("gridLayout_3")); |
|||
label_3 = new QLabel(Config); |
|||
label_3->setObjectName(QString::fromUtf8("label_3")); |
|||
|
|||
gridLayout_3->addWidget(label_3, 1, 0, 1, 1); |
|||
|
|||
txttaddrs = new QLineEdit(Config); |
|||
txttaddrs->setObjectName(QString::fromUtf8("txttaddrs")); |
|||
|
|||
gridLayout_3->addWidget(txttaddrs, 0, 3, 1, 1); |
|||
|
|||
txtEntropy = new QLineEdit(Config); |
|||
txtEntropy->setObjectName(QString::fromUtf8("txtEntropy")); |
|||
|
|||
gridLayout_3->addWidget(txtEntropy, 1, 1, 1, 3); |
|||
|
|||
label = new QLabel(Config); |
|||
label->setObjectName(QString::fromUtf8("label")); |
|||
|
|||
gridLayout_3->addWidget(label, 0, 0, 1, 1); |
|||
|
|||
txtzaddrs = new QLineEdit(Config); |
|||
txtzaddrs->setObjectName(QString::fromUtf8("txtzaddrs")); |
|||
|
|||
gridLayout_3->addWidget(txtzaddrs, 0, 1, 1, 1); |
|||
|
|||
btnGenerate = new QPushButton(Config); |
|||
btnGenerate->setObjectName(QString::fromUtf8("btnGenerate")); |
|||
|
|||
gridLayout_3->addWidget(btnGenerate, 2, 0, 1, 1); |
|||
|
|||
label_2 = new QLabel(Config); |
|||
label_2->setObjectName(QString::fromUtf8("label_2")); |
|||
|
|||
gridLayout_3->addWidget(label_2, 0, 2, 1, 1); |
|||
|
|||
|
|||
gridLayout->addWidget(Config, 0, 0, 1, 1); |
|||
|
|||
scrollArea = new QScrollArea(centralWidget); |
|||
scrollArea->setObjectName(QString::fromUtf8("scrollArea")); |
|||
scrollArea->setStyleSheet(QString::fromUtf8("")); |
|||
scrollArea->setWidgetResizable(true); |
|||
scroll = new QWidget(); |
|||
scroll->setObjectName(QString::fromUtf8("scroll")); |
|||
scroll->setGeometry(QRect(0, 0, 907, 637)); |
|||
verticalLayout = new QVBoxLayout(scroll); |
|||
verticalLayout->setSpacing(6); |
|||
verticalLayout->setContentsMargins(11, 11, 11, 11); |
|||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); |
|||
scrollArea->setWidget(scroll); |
|||
|
|||
gridLayout->addWidget(scrollArea, 1, 0, 1, 1); |
|||
|
|||
MainWindow->setCentralWidget(centralWidget); |
|||
menuBar = new QMenuBar(MainWindow); |
|||
menuBar->setObjectName(QString::fromUtf8("menuBar")); |
|||
menuBar->setGeometry(QRect(0, 0, 927, 22)); |
|||
MainWindow->setMenuBar(menuBar); |
|||
mainToolBar = new QToolBar(MainWindow); |
|||
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); |
|||
MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); |
|||
statusBar = new QStatusBar(MainWindow); |
|||
statusBar->setObjectName(QString::fromUtf8("statusBar")); |
|||
MainWindow->setStatusBar(statusBar); |
|||
QWidget::setTabOrder(txtzaddrs, txttaddrs); |
|||
QWidget::setTabOrder(txttaddrs, txtEntropy); |
|||
QWidget::setTabOrder(txtEntropy, btnGenerate); |
|||
QWidget::setTabOrder(btnGenerate, btnSavePDF); |
|||
QWidget::setTabOrder(btnSavePDF, btnSaveJSON); |
|||
QWidget::setTabOrder(btnSaveJSON, scrollArea); |
|||
|
|||
retranslateUi(MainWindow); |
|||
|
|||
QMetaObject::connectSlotsByName(MainWindow); |
|||
} // setupUi
|
|||
|
|||
void retranslateUi(QMainWindow *MainWindow) |
|||
{ |
|||
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "Zec Sapling Paper Wallet", nullptr)); |
|||
Save->setTitle(QString()); |
|||
btnSavePDF->setText(QApplication::translate("MainWindow", "Save as PDF", nullptr)); |
|||
btnSaveJSON->setText(QApplication::translate("MainWindow", "Save as JSON", nullptr)); |
|||
Config->setTitle(QApplication::translate("MainWindow", "Config", nullptr)); |
|||
label_3->setText(QApplication::translate("MainWindow", "Additional Entropy", nullptr)); |
|||
txttaddrs->setText(QApplication::translate("MainWindow", "0", nullptr)); |
|||
label->setText(QApplication::translate("MainWindow", "Number of z addresses", nullptr)); |
|||
txtzaddrs->setText(QApplication::translate("MainWindow", "1", nullptr)); |
|||
btnGenerate->setText(QApplication::translate("MainWindow", "Generate Wallets", nullptr)); |
|||
label_2->setText(QApplication::translate("MainWindow", "Number of t addresses", nullptr)); |
|||
} // retranslateUi
|
|||
|
|||
}; |
|||
|
|||
namespace Ui { |
|||
class MainWindow: public Ui_MainWindow {}; |
|||
} // namespace Ui
|
|||
|
|||
QT_END_NAMESPACE |
|||
|
|||
#endif // UI_MAINWINDOW_H
|
@ -1,144 +0,0 @@ |
|||
/********************************************************************************
|
|||
** Form generated from reading UI file 'wallet.ui' |
|||
** |
|||
** Created by: Qt User Interface Compiler version 5.12.3 |
|||
** |
|||
** WARNING! All changes made in this file will be lost when recompiling UI file! |
|||
********************************************************************************/ |
|||
|
|||
#ifndef UI_WALLET_H |
|||
#define UI_WALLET_H |
|||
|
|||
#include <QtCore/QVariant> |
|||
#include <QtWidgets/QApplication> |
|||
#include <QtWidgets/QFrame> |
|||
#include <QtWidgets/QGridLayout> |
|||
#include <QtWidgets/QLabel> |
|||
#include <QtWidgets/QSpacerItem> |
|||
#include <QtWidgets/QVBoxLayout> |
|||
#include <QtWidgets/QWidget> |
|||
#include "qrcodelabel.h" |
|||
|
|||
QT_BEGIN_NAMESPACE |
|||
|
|||
class Ui_WalletWidget |
|||
{ |
|||
public: |
|||
QGridLayout *gridLayout; |
|||
QFrame *line; |
|||
QVBoxLayout *verticalLayout_3; |
|||
QSpacerItem *verticalSpacer_3; |
|||
QLabel *label_3; |
|||
QLabel *lblPrivateKey; |
|||
QSpacerItem *verticalSpacer_4; |
|||
QVBoxLayout *verticalLayout; |
|||
QSpacerItem *verticalSpacer; |
|||
QLabel *label_2; |
|||
QLabel *lblAddress; |
|||
QSpacerItem *verticalSpacer_2; |
|||
QRCodeLabel *qrPrivateKey; |
|||
QRCodeLabel *qrAddress; |
|||
|
|||
void setupUi(QWidget *WalletWidget) |
|||
{ |
|||
if (WalletWidget->objectName().isEmpty()) |
|||
WalletWidget->setObjectName(QString::fromUtf8("WalletWidget")); |
|||
WalletWidget->resize(847, 533); |
|||
gridLayout = new QGridLayout(WalletWidget); |
|||
gridLayout->setObjectName(QString::fromUtf8("gridLayout")); |
|||
line = new QFrame(WalletWidget); |
|||
line->setObjectName(QString::fromUtf8("line")); |
|||
line->setFrameShape(QFrame::HLine); |
|||
line->setFrameShadow(QFrame::Sunken); |
|||
|
|||
gridLayout->addWidget(line, 1, 0, 1, 4); |
|||
|
|||
verticalLayout_3 = new QVBoxLayout(); |
|||
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); |
|||
verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); |
|||
|
|||
verticalLayout_3->addItem(verticalSpacer_3); |
|||
|
|||
label_3 = new QLabel(WalletWidget); |
|||
label_3->setObjectName(QString::fromUtf8("label_3")); |
|||
label_3->setStyleSheet(QString::fromUtf8("font-weight: bold;")); |
|||
|
|||
verticalLayout_3->addWidget(label_3); |
|||
|
|||
lblPrivateKey = new QLabel(WalletWidget); |
|||
lblPrivateKey->setObjectName(QString::fromUtf8("lblPrivateKey")); |
|||
lblPrivateKey->setWordWrap(true); |
|||
|
|||
verticalLayout_3->addWidget(lblPrivateKey); |
|||
|
|||
verticalSpacer_4 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); |
|||
|
|||
verticalLayout_3->addItem(verticalSpacer_4); |
|||
|
|||
|
|||
gridLayout->addLayout(verticalLayout_3, 2, 0, 1, 3); |
|||
|
|||
verticalLayout = new QVBoxLayout(); |
|||
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); |
|||
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); |
|||
|
|||
verticalLayout->addItem(verticalSpacer); |
|||
|
|||
label_2 = new QLabel(WalletWidget); |
|||
label_2->setObjectName(QString::fromUtf8("label_2")); |
|||
label_2->setStyleSheet(QString::fromUtf8("font-weight: bold;")); |
|||
label_2->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|||
|
|||
verticalLayout->addWidget(label_2); |
|||
|
|||
lblAddress = new QLabel(WalletWidget); |
|||
lblAddress->setObjectName(QString::fromUtf8("lblAddress")); |
|||
lblAddress->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); |
|||
lblAddress->setWordWrap(true); |
|||
|
|||
verticalLayout->addWidget(lblAddress); |
|||
|
|||
verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); |
|||
|
|||
verticalLayout->addItem(verticalSpacer_2); |
|||
|
|||
|
|||
gridLayout->addLayout(verticalLayout, 0, 1, 1, 3); |
|||
|
|||
qrPrivateKey = new QRCodeLabel(WalletWidget); |
|||
qrPrivateKey->setObjectName(QString::fromUtf8("qrPrivateKey")); |
|||
|
|||
gridLayout->addWidget(qrPrivateKey, 2, 3, 1, 1); |
|||
|
|||
qrAddress = new QRCodeLabel(WalletWidget); |
|||
qrAddress->setObjectName(QString::fromUtf8("qrAddress")); |
|||
qrAddress->setMouseTracking(false); |
|||
|
|||
gridLayout->addWidget(qrAddress, 0, 0, 1, 1); |
|||
|
|||
|
|||
retranslateUi(WalletWidget); |
|||
|
|||
QMetaObject::connectSlotsByName(WalletWidget); |
|||
} // setupUi
|
|||
|
|||
void retranslateUi(QWidget *WalletWidget) |
|||
{ |
|||
WalletWidget->setWindowTitle(QApplication::translate("WalletWidget", "Form", nullptr)); |
|||
label_3->setText(QApplication::translate("WalletWidget", "Private Key", nullptr)); |
|||
lblPrivateKey->setText(QApplication::translate("WalletWidget", "TextLabel", nullptr)); |
|||
label_2->setText(QApplication::translate("WalletWidget", "Address", nullptr)); |
|||
lblAddress->setText(QApplication::translate("WalletWidget", "TextLabel", nullptr)); |
|||
qrPrivateKey->setText(QApplication::translate("WalletWidget", "TextLabel", nullptr)); |
|||
qrAddress->setText(QApplication::translate("WalletWidget", "TextLabel", nullptr)); |
|||
} // retranslateUi
|
|||
|
|||
}; |
|||
|
|||
namespace Ui { |
|||
class WalletWidget: public Ui_WalletWidget {}; |
|||
} // namespace Ui
|
|||
|
|||
QT_END_NAMESPACE |
|||
|
|||
#endif // UI_WALLET_H
|
Loading…
Reference in new issue