moonlight-qt/app/gui/popupmanager.cpp

42 lines
1.5 KiB
C++
Raw Normal View History

2018-04-29 15:17:31 +00:00
#include "popupmanager.h"
2018-05-01 02:45:20 +00:00
QMessageBox *popupmanager::pinMsgBox = nullptr;
popupmanager::popupmanager(){}
2018-04-29 15:17:31 +00:00
// 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.
2018-05-01 02:09:31 +00:00
void popupmanager::displayPinDialog(QString pin, QWidget* parent) {
2018-04-29 15:17:31 +00:00
2018-05-01 02:45:20 +00:00
popupmanager::pinMsgBox = new QMessageBox( parent );
popupmanager::pinMsgBox->setAttribute( Qt::WA_DeleteOnClose ); //makes sure the msgbox is deleted automatically when closed
popupmanager::pinMsgBox->setStandardButtons( QMessageBox::Ok );
popupmanager::pinMsgBox->setText("Please enter the number " + pin + " on the GFE dialog on the computer.");
popupmanager::pinMsgBox->setInformativeText("This dialog will be dismissed once complete.");
popupmanager::pinMsgBox->open();
2018-04-29 15:17:31 +00:00
}
// to be called when the pairing is complete
2018-05-01 02:09:31 +00:00
void popupmanager::closePinDialog() {
2018-04-29 15:17:31 +00:00
pinMsgBox->close();
delete pinMsgBox;
}
2018-05-01 02:09:31 +00:00
QString popupmanager::getHostnameDialog(QWidget* parent) {
2018-04-29 15:17:31 +00:00
bool ok;
QString responseHost
2018-05-01 02:09:31 +00:00
= QInputDialog::getText(parent, QObject::tr("Add Host Manually"),
QObject::tr("IP Address or Hostname of GeForce PC"),
2018-04-29 15:17:31 +00:00
QLineEdit::Normal,
2018-05-01 02:09:31 +00:00
QObject::tr("default string"),
2018-04-29 15:17:31 +00:00
&ok);
if (ok && !responseHost.isEmpty()) {
return responseHost;
} else {
2018-05-01 02:09:31 +00:00
return QObject::tr("");
2018-04-29 15:17:31 +00:00
}
}
2018-05-01 02:09:31 +00:00