StaticPage::StaticPage(QWidget *parent) :
        QStackedWidget(parent),
        ui(new Ui::StaticPage)
{
    ui->setupUi(this);

    m_ykConfig = 0;
    m_keyPresent = false;
    clearState();

    //Connect pages
    connectPages();

    //Connect help buttons
    connectHelpButtons();

    //Connect other signals and slots
    connect(YubiKeyFinder::getInstance(), SIGNAL(keyFound(bool, bool*, int)),
            this, SLOT(keyFound(bool, bool*)));

    connect(ui->quickResetBtn, SIGNAL(clicked()),
            this, SLOT(resetQuickPage()));
    connect(ui->advResetBtn, SIGNAL(clicked()),
            this, SLOT(resetAdvPage()));

    ui->quickResultsWidget->resizeColumnsToContents();
    ui->advResultsWidget->resizeColumnsToContents();

    QRegExp rx("^[a-f0-9]{0,72}$");
    ui->quickScanCodesTxt->setValidator(new QRegExpValidator(rx, this));
}
ToolPage::ToolPage(QWidget *parent) :
        QStackedWidget(parent),
        ui(new Ui::ToolPage)
{
    ui->setupUi(this);

    //Connect pages
    connectPages();

    //Connect help buttons
    connectHelpButtons();

    //Connect other signals and slots
    connect(ui->converterResetBtn, SIGNAL(clicked()),
            this, SLOT(resetConverterPage()));
    connect(ui->chalRespResetBtn, SIGNAL(clicked()),
            this, SLOT(resetChalRespPage()));
    connect(ui->chalRespPerformBtn, SIGNAL(clicked()),
            this, SLOT(performChallengeResponse()));
    connect(ui->chalRespChallenge, SIGNAL(editingFinished()),
            this, SLOT(on_chalRespChallenge_editingFinished()));
    connect(ui->ndefResetBtn, SIGNAL(clicked()),
            this, SLOT(resetNdefPage()));
    connect(ui->ndefProgramBtn, SIGNAL(clicked()),
            this, SLOT(programNdef()));

    connect(YubiKeyFinder::getInstance(), SIGNAL(keyFound(bool, bool*)),
            this, SLOT(keyFound(bool, bool*)));
}
ChalRespPage::ChalRespPage(QWidget *parent) :
        QStackedWidget(parent),
        ui(new Ui::ChalRespPage)
{
    ui->setupUi(this);

    m_ykConfig = 0;
    m_keyPresent = false;
    clearState();

    //Connect pages
    connectPages();

    //Connect help buttons
    connectHelpButtons();

    //Connect other signals and slots
    connect(YubiKeyFinder::getInstance(), SIGNAL(keyFound(bool, bool*, int)),
            this, SLOT(keyFound(bool, bool*)));

    connect(ui->quickResetBtn, SIGNAL(clicked()),
            this, SLOT(resetQuickPage()));
    connect(ui->advResetBtn, SIGNAL(clicked()),
            this, SLOT(resetAdvPage()));

    connect(ui->advRequireUserInputCheck, SIGNAL(clicked(bool)),
            this, SLOT(requireInput_clicked(bool)));
    connect(ui->quickRequireUserInputCheck, SIGNAL(clicked(bool)),
            this, SLOT(requireInput_clicked(bool)));

    connect(ui->advHmacVarInputRadio, SIGNAL(clicked()),
            this, SLOT(hmac_lt64_clicked()));
    connect(ui->advHmacFixedInputRadio, SIGNAL(clicked()),
            this, SLOT(hmac_lt64_clicked()));

    ui->quickResultsWidget->resizeColumnsToContents();
    ui->advResultsWidget->resizeColumnsToContents();

    loadSettings();
}