learning static c++

This commit is contained in:
R. Aidan Campbell
2018-04-30 19:09:31 -07:00
parent de08b527f8
commit 21e0066be0
4 changed files with 17 additions and 16 deletions

View File

@@ -1,13 +1,11 @@
#include "popupmanager.h"
popupmanager::popupmanager();
// 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.
static void popupmanager::displayPinDialog(QString pin) {
void popupmanager::displayPinDialog(QString pin, QWidget* parent) {
pinMsgBox = new QMessageBox( this );
pinMsgBox = new QMessageBox( parent );
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.");
@@ -16,23 +14,24 @@ static void popupmanager::displayPinDialog(QString pin) {
}
// to be called when the pairing is complete
static void popupmanager::closePinDialog() {
void popupmanager::closePinDialog() {
pinMsgBox->close();
delete pinMsgBox;
}
static QString popupmanager::getHostnameDialog() {
QString popupmanager::getHostnameDialog(QWidget* parent) {
bool ok;
QString responseHost
= QInputDialog::getText(this, tr("Add Host Manually"),
tr("IP Address or Hostname of GeForce PC"),
= QInputDialog::getText(parent, QObject::tr("Add Host Manually"),
QObject::tr("IP Address or Hostname of GeForce PC"),
QLineEdit::Normal,
tr("default string"),
QObject::tr("default string"),
&ok);
if (ok && !responseHost.isEmpty()) {
return responseHost;
} else {
return tr("");
return QObject::tr("");
}
}