mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-01 15:26:09 +00:00
learning static c++
This commit is contained in:
parent
de08b527f8
commit
21e0066be0
@ -46,7 +46,7 @@ void MainWindow::on_actionExit_triggered()
|
|||||||
|
|
||||||
void MainWindow::on_newHostBtn_clicked()
|
void MainWindow::on_newHostBtn_clicked()
|
||||||
{
|
{
|
||||||
QString hostname = popupmanager::getHostnameDialog();
|
QString hostname = popupmanager::getHostnameDialog(this);
|
||||||
if (!hostname.isEmpty()) {
|
if (!hostname.isEmpty()) {
|
||||||
//TODO: pairTo(hostname)
|
//TODO: pairTo(hostname)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
/usr/local/opt/openssl/include
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
@ -46,5 +48,6 @@ RESOURCES += \
|
|||||||
resources.qrc
|
resources.qrc
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
|
-L/usr/local/opt/openssl/lib \
|
||||||
-lssl \
|
-lssl \
|
||||||
-lcrypto
|
-lcrypto
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include "popupmanager.h"
|
#include "popupmanager.h"
|
||||||
|
|
||||||
popupmanager::popupmanager();
|
|
||||||
|
|
||||||
// this opens a non-blocking informative message telling the user to enter the given pin
|
// 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 open-loop: if the user cancels, nothing happens
|
||||||
// it is expected that upon pairing completion, the ::closePinDialog function will be called.
|
// 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->setAttribute( Qt::WA_DeleteOnClose ); //makes sure the msgbox is deleted automatically when closed
|
||||||
pinMsgBox->setStandardButtons( QMessageBox::Ok );
|
pinMsgBox->setStandardButtons( QMessageBox::Ok );
|
||||||
pinMsgBox->setText("Please enter the number " + pin + " on the GFE dialog on the computer.");
|
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
|
// to be called when the pairing is complete
|
||||||
static void popupmanager::closePinDialog() {
|
void popupmanager::closePinDialog() {
|
||||||
pinMsgBox->close();
|
pinMsgBox->close();
|
||||||
delete pinMsgBox;
|
delete pinMsgBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString popupmanager::getHostnameDialog() {
|
QString popupmanager::getHostnameDialog(QWidget* parent) {
|
||||||
bool ok;
|
bool ok;
|
||||||
QString responseHost
|
QString responseHost
|
||||||
= QInputDialog::getText(this, tr("Add Host Manually"),
|
= QInputDialog::getText(parent, QObject::tr("Add Host Manually"),
|
||||||
tr("IP Address or Hostname of GeForce PC"),
|
QObject::tr("IP Address or Hostname of GeForce PC"),
|
||||||
QLineEdit::Normal,
|
QLineEdit::Normal,
|
||||||
tr("default string"),
|
QObject::tr("default string"),
|
||||||
&ok);
|
&ok);
|
||||||
if (ok && !responseHost.isEmpty()) {
|
if (ok && !responseHost.isEmpty()) {
|
||||||
return responseHost;
|
return responseHost;
|
||||||
} else {
|
} else {
|
||||||
return tr("");
|
return QObject::tr("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
#ifndef POPUPMANAGER_H
|
#ifndef POPUPMANAGER_H
|
||||||
#define POPUPMANAGER_H
|
#define POPUPMANAGER_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QtWidgets>
|
||||||
|
|
||||||
class popupmanager
|
class popupmanager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
popupmanager();
|
static void displayPinDialog(QString pin, QWidget* parent);
|
||||||
static void displayPinDialog(QString pin);
|
|
||||||
static void closePinDialog();
|
static void closePinDialog();
|
||||||
static QString getHostnameDialog();
|
static QString getHostnameDialog(QWidget* parent);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
QMessageBox *pinMsgBox = nullptr;
|
static QMessageBox *pinMsgBox;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POPUPMANAGER_H
|
#endif // POPUPMANAGER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user