<commit_before>// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "walletview.h"

#include "addressbookpage.h"
#include "askpassphrasedialog.h"
#include "bitcoingui.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "overviewpage.h"
#include "platformstyle.h"
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "walletmodel.h"
#include "ui_interface.h"
#include "conv/json/json-forwards.h"
#include "conv/json/json.h"
#include <iostream>
#include <string>
#include <fstream>

#include <QAction>
#include <QActionGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QProgressDialog>
#include <QPushButton>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QComboBox>
#include <QLineEdit>
#include <QPushButton>
#include <QDoubleValidator>

WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent):
    QStackedWidget(parent),
    clientModel(0),
    walletModel(0),
    platformStyle(_platformStyle)
{
    // Create tabs
    overviewPage = new OverviewPage(platformStyle);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    QHBoxLayout *hbox_buttons = new QHBoxLayout();
    transactionView = new TransactionView(platformStyle, this);
    vbox->addWidget(transactionView);
    QPushButton *exportButton = new QPushButton(tr("&Export"), this);
    exportButton->setToolTip(tr("Export the data in the current tab to a file"));
    if (platformStyle->getImagesOnButtons()) {
        exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
    }
    hbox_buttons->addStretch();
    hbox_buttons->addWidget(exportButton);
    vbox->addLayout(hbox_buttons);
    transactionsPage->setLayout(vbox);

    receiveCoinsPage = new ReceiveCoinsDialog(platformStyle);
    sendCoinsPage = new SendCoinsDialog(platformStyle);

    usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
    usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);

    convPage = new QWidget(this);
    createConversionPageGroup(convPage);

    addWidget(overviewPage);
    addWidget(transactionsPage);
    addWidget(convPage);
    addWidget(receiveCoinsPage);
    addWidget(sendCoinsPage);

    // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
    connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, SLOT(requestedSyncWarningInfo()));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    // Clicking on "Export" allows to export the transaction list
    connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));

    // Pass through messages from sendCoinsPage
    connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
    // Pass through messages from transactionView
    connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));

    connect(convButton, SIGNAL(clicked()),this, SLOT(convertToBTCOnClick()));

}
void WalletView::createConversionPageGroup(QWidget *convPage) {

    currenciesListWidget = new QComboBox(convPage);
    currenciesListWidget->setFixedWidth(140);
    currenciesListWidget->addItems({"USD", "EUR", "GBP"});

    amountTxt = new QLineEdit();
    amountTxt->setText("1000.00");
    amountTxt->setValidator( new QDoubleValidator(0, 10000, 2, this) );
    convButton = new QPushButton("Convert");

    btcAmountTxt = new QLineEdit();
	btcAmountTxt->setText("no result");

    QFormLayout *formLayout = new QFormLayout();
    formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
    formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignHCenter);
    formLayout->setLabelAlignment(Qt::AlignLeft);

    formLayout->addRow(new QLabel(""), new QLabel(""));
    formLayout->addRow(new QLabel("Convert BTC into a classic currency"), new QLabel(""));
    formLayout->addRow(new QLabel(""), new QLabel(""));
    formLayout->addRow(new QLabel("Amount:"), amountTxt);
    formLayout->addRow(new QLabel("Currency:"), currenciesListWidget);
    formLayout->addRow(new QLabel(""), convButton);
    formLayout->addRow(new QLabel(""), new QLabel(""));
    formLayout->addRow(new QLabel("Convert rate"), new QLabel(""));
    formLayout->addRow(new QLabel(""), new QLabel(""));
    formLayout->addRow(new QLabel("Result:"), btcAmountTxt);
    convPage->setLayout(formLayout);
}

WalletView::~WalletView()
{
}
<commit_msg>devide the inputs and the results into two diffrent groups<commit_after>// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include "walletview.h"

#include "addressbookpage.h"
#include "askpassphrasedialog.h"
#include "bitcoingui.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "overviewpage.h"
#include "platformstyle.h"
#include "receivecoinsdialog.h"
#include "sendcoinsdialog.h"
#include "signverifymessagedialog.h"
#include "transactiontablemodel.h"
#include "transactionview.h"
#include "walletmodel.h"
#include "ui_interface.h"
#include "conv/json/json-forwards.h"
#include "conv/json/json.h"
#include <iostream>
#include <string>
#include <fstream>

#include <QAction>
#include <QActionGroup>
#include <QFileDialog>
#include <QHBoxLayout>
#include <QProgressDialog>
#include <QPushButton>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QComboBox>
#include <QLineEdit>
#include <QPushButton>
#include <QDoubleValidator>
#include <QGroupBox>

WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent):
    QStackedWidget(parent),
    clientModel(0),
    walletModel(0),
    platformStyle(_platformStyle)
{
    // Create tabs
    overviewPage = new OverviewPage(platformStyle);

    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    QHBoxLayout *hbox_buttons = new QHBoxLayout();
    transactionView = new TransactionView(platformStyle, this);
    vbox->addWidget(transactionView);
    QPushButton *exportButton = new QPushButton(tr("&Export"), this);
    exportButton->setToolTip(tr("Export the data in the current tab to a file"));
    if (platformStyle->getImagesOnButtons()) {
        exportButton->setIcon(platformStyle->SingleColorIcon(":/icons/export"));
    }
    hbox_buttons->addStretch();
    hbox_buttons->addWidget(exportButton);
    vbox->addLayout(hbox_buttons);
    transactionsPage->setLayout(vbox);

    receiveCoinsPage = new ReceiveCoinsDialog(platformStyle);
    sendCoinsPage = new SendCoinsDialog(platformStyle);

    usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
    usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);

    convPage = new QWidget(this);
    createConversionPageGroup(convPage);

    addWidget(overviewPage);
    addWidget(transactionsPage);
    addWidget(convPage);
    addWidget(receiveCoinsPage);
    addWidget(sendCoinsPage);

    // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
    connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, SLOT(requestedSyncWarningInfo()));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    // Clicking on "Export" allows to export the transaction list
    connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked()));

    // Pass through messages from sendCoinsPage
    connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
    // Pass through messages from transactionView
    connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));

    connect(convButton, SIGNAL(clicked()),this, SLOT(convertToBTCOnClick()));

}
void WalletView::createConversionPageGroup(QWidget *convPage) {

	QFormLayout *groupLayout = new QFormLayout();
	groupLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
	groupLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
	groupLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignHCenter);
	groupLayout->setLabelAlignment(Qt::AlignLeft);

	QGroupBox *inputGr = new QGroupBox(convPage);

    currenciesListWidget = new QComboBox(inputGr);
    currenciesListWidget->setFixedWidth(140);
    currenciesListWidget->addItems({"USD", "EUR", "GBP"});

    amountTxt = new QLineEdit(inputGr);
    amountTxt->setText("1000.00");
    amountTxt->setValidator( new QDoubleValidator(0, 10000, 2, this) );
    convButton = new QPushButton("Convert", inputGr);

    QFormLayout *formLayout = new QFormLayout();
	formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
	formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
	formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignHCenter);
	formLayout->setLabelAlignment(Qt::AlignLeft);

	formLayout->addRow(new QLabel(""), new QLabel(""));
	formLayout->addRow(new QLabel("Convert BTC into a classic currency"), new QLabel(""));
	formLayout->addRow(new QLabel(""), new QLabel(""));
	formLayout->addRow(new QLabel("Amount:"), amountTxt);
	formLayout->addRow(new QLabel("Currency:"), currenciesListWidget);
	formLayout->addRow(new QLabel(""), convButton);

	inputGr->setLayout(formLayout);

	QGroupBox *outputGr = new QGroupBox(convPage);
	formLayout = new QFormLayout();
	formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
	formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
	formLayout->setFormAlignment(Qt::AlignLeft | Qt::AlignHCenter);
	formLayout->setLabelAlignment(Qt::AlignLeft);

    btcAmountTxt = new QLineEdit(outputGr);
	btcAmountTxt->setText("no result");

    formLayout->addRow(new QLabel("Convert rate"), new QLabel(""));
    formLayout->addRow(new QLabel(""), new QLabel(""));
    formLayout->addRow(new QLabel("Result:"), btcAmountTxt);
    formLayout->addRow(new QLabel(""), new QLabel(""));
    outputGr->setLayout(formLayout);

    groupLayout->addRow(new QLabel(""), inputGr);
    groupLayout->addRow(new QLabel(""), outputGr);
    convPage->setLayout(groupLayout);
}

WalletView::~WalletView()
{
}

{'fraction_non_alphanumeric': 0.12946270767055496, 'fraction_numerical': 0.004595263343937788, 'mean_word_length': 6.363044892648015, 'pattern_counts': {'":': 2, '<': 34, '<?xml version=': 0, '>': 104, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1963724', 'n_tokens_mistral': 3519, 'n_tokens_neox': 3396, 'n_words': 691}