mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-02 15:55:39 +00:00
Initial work
This commit is contained in:
commit
63d1c4abdf
11
main.cpp
Normal file
11
main.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
19
mainwindow.cpp
Normal file
19
mainwindow.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
|
QMainWindow(parent),
|
||||||
|
ui(new Ui::MainWindow)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionExit_triggered()
|
||||||
|
{
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
25
mainwindow.h
Normal file
25
mainwindow.h
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_actionExit_triggered();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
55
mainwindow.ui
Normal file
55
mainwindow.ui
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>MainWindow</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralWidget"/>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>24</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuFile">
|
||||||
|
<property name="title">
|
||||||
|
<string>File</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionSettings"/>
|
||||||
|
<addaction name="actionGamepad_Mapping"/>
|
||||||
|
<addaction name="actionExit"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuFile"/>
|
||||||
|
</widget>
|
||||||
|
<action name="actionSettings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionGamepad_Mapping">
|
||||||
|
<property name="text">
|
||||||
|
<string>Gamepad Mapping</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionExit">
|
||||||
|
<property name="text">
|
||||||
|
<string>Exit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
36
moonlight-qt.pro
Normal file
36
moonlight-qt.pro
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2018-04-28T14:01:01
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui network
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = moonlight-qt
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
mainwindow.cpp \
|
||||||
|
nvhttp.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
mainwindow.h \
|
||||||
|
nvhttp.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
mainwindow.ui
|
33
nvhttp.cpp
Normal file
33
nvhttp.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "nvhttp.h"
|
||||||
|
|
||||||
|
#include <QUuid>
|
||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
|
NvHTTP::NvHTTP(QString address)
|
||||||
|
{
|
||||||
|
m_BaseUrlHttp.setScheme("http");
|
||||||
|
m_BaseUrlHttps.setScheme("https");
|
||||||
|
m_BaseUrlHttp.setHost(address);
|
||||||
|
m_BaseUrlHttps.setHost(address);
|
||||||
|
m_BaseUrlHttp.setPort(47989);
|
||||||
|
m_BaseUrlHttps.setPort(47984);
|
||||||
|
}
|
||||||
|
|
||||||
|
QNetworkReply*
|
||||||
|
NvHTTP::openConnection(QUrl baseUrl,
|
||||||
|
QString command,
|
||||||
|
QString arguments,
|
||||||
|
bool enableTimeout)
|
||||||
|
{
|
||||||
|
QUrl url(baseUrl);
|
||||||
|
|
||||||
|
url.setPath(command +
|
||||||
|
"?uniqueid=" + "0" +
|
||||||
|
"&uuid=" + QUuid::createUuid().toString() +
|
||||||
|
((arguments != nullptr) ? (arguments + "&") : ""));
|
||||||
|
|
||||||
|
QNetworkReply* reply = m_Nam.get(QNetworkRequest(url));
|
||||||
|
reply->ignoreSslErrors(QList<QSslError>{ QSslError::SelfSignedCertificate });
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
21
nvhttp.h
Normal file
21
nvhttp.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
|
||||||
|
class NvHTTP
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NvHTTP(QString address);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QNetworkReply*
|
||||||
|
openConnection(QUrl baseUrl,
|
||||||
|
QString command,
|
||||||
|
QString arguments,
|
||||||
|
bool enableTimeout);
|
||||||
|
|
||||||
|
QUrl m_BaseUrlHttp;
|
||||||
|
QUrl m_BaseUrlHttps;
|
||||||
|
QNetworkAccessManager m_Nam;
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user