Now with (unused) code for a pin dialog

This commit is contained in:
R. Aidan Campbell 2018-04-28 18:47:19 -07:00
parent 073d965f6d
commit a2ba98e38e
2 changed files with 22 additions and 2 deletions

View file

@ -35,6 +35,7 @@ MainWindow::~MainWindow()
{ {
delete ui; delete ui;
delete myButton; delete myButton;
delete pinMsgBox;
} }
void MainWindow::on_actionExit_triggered() void MainWindow::on_actionExit_triggered()
@ -56,5 +57,22 @@ void MainWindow::on_newHostBtn_clicked()
} else { } else {
// silently close, user canceled // silently close, user canceled
} }
}
// this opens a non-blocking informative message telling the user to enter the given pin
// it is open-loop: if the user cancels, nothing happens
// it is expected that upon pairing completion, the ::closePinDialog function will be called.
void MainWindow::displayPinDialog(QString pin = tr("ERROR")) {
pinMsgBox = new QMessageBox( this );
pinMsgBox->setAttribute( Qt::WA_DeleteOnClose ); //makes sure the msgbox is deleted automatically when closed
pinMsgBox->setStandardButtons( QMessageBox::Ok );
pinMsgBox->setText("Please enter the number " + pin + " on the GFE dialog on the computer.");
pinMsgBox->setInformativeText("This dialog will be dismissed once complete.");
pinMsgBox->open();
}
// to be called when the pairing is complete
void MainWindow::closePinDialog() {
pinMsgBox->close();
} }

View file

@ -22,11 +22,13 @@ protected:
private slots: private slots:
void on_actionExit_triggered(); void on_actionExit_triggered();
void on_newHostBtn_clicked(); void on_newHostBtn_clicked();
void displayPinDialog(QString pin);
void closePinDialog();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
QAbstractButton *myButton = nullptr; QAbstractButton *myButton = nullptr;
QAbstractButton *newHostBtn = nullptr; QMessageBox *pinMsgBox = nullptr;
}; };