Esempio n. 1
0
tcrypt::tcrypt( QWidget * parent,bool e,
		std::function< void( const QString&,const QStringList& ) > p,
		std::function< void() > q ) :
	QDialog( parent ),m_ui( new Ui::tcrypt ),m_success( std::move( p ) ),m_cancelled( std::move( q ) )
{
	m_ui->setupUi( this ) ;
	this->setFixedSize( this->size() ) ;

	connect( m_ui->pbSend,SIGNAL( clicked() ),this,SLOT( pbSend() ) ) ;
	connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ;
	connect( m_ui->pbAddKeyFile,SIGNAL( clicked() ),this,SLOT( pbAddKeyFIle() ) ) ;

	connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ),
		 this,SLOT(currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ;
	connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),
		 this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ;

	this->installEventFilter( this ) ;
	m_ui->tableWidget->setColumnWidth( 0,426 ) ;

	if( e ){

		m_ui->pbSend->setText( tr( "&Set" ) ) ;
	}

	this->show() ;
}
LXQt::Wallet::password_dialog::password_dialog(QWidget *parent,
        const QString &walletName,
        const QString &appName,
        std::function< void(const QString &) > && p,
        std::function< void() > && q,
        std::function< void(bool) > * z) :
    QDialog(parent), m_ui(new Ui::password_dialog), m_password(std::move(p)), m_cancel(std::move(q))
{
    m_ui->setupUi(this);

    this->setFixedSize(this->size());

    this->setWindowFlags(this->windowFlags()|Qt::WindowStaysOnTopHint);

    if (parent)
    {
        this->setWindowIcon(parent->windowIcon());
    }

    connect(m_ui->pushButtonSend, SIGNAL(clicked()), this, SLOT(pbSend()));
    connect(m_ui->pushButtonCancel, SIGNAL(clicked()), this, SLOT(pbCancel()));
    connect(m_ui->pushButtonOK_2, SIGNAL(clicked()), this, SLOT(pbOK_2()));

    m_ui->pushButtonOK_2->setVisible(false);
    m_ui->textEdit_2->setVisible(false);
    m_ui->textEdit->setVisible(false);
    m_ui->pushButtonOK->setVisible(false);

    m_banner = m_ui->textEdit->toHtml().arg(appName, walletName);
    m_ui->labelWalletDoesNotExist->setVisible(false);
    m_ui->labelHeader->setText(m_banner);

    *z = [this](bool correctPassword)
    {
        if (correctPassword)
        {
            this->HideUI();
        }
        else
        {
            m_ui->labelHeader->setText(tr("Wallet could not be opened with the presented key"));
            m_ui->textEdit->setVisible(false);
            m_ui->labelWalletDoesNotExist->setVisible(false);
            m_ui->labelHeader->setVisible(true);
            m_ui->lineEditKey->setVisible(true);
            m_ui->lineEditKey->setEnabled(false);
            m_ui->pushButtonSend->setVisible(false);
            m_ui->pushButtonCancel->setVisible(false);
            m_ui->pushButtonOK->setVisible(false);
            m_ui->pushButtonOK_2->setVisible(true);
            m_ui->pushButtonOK_2->setFocus();
        }
    };

    this->installEventFilter(this);

    this->show();
}