27 lines
890 B
C++
27 lines
890 B
C++
#include "httpproxyserver.h"
|
|
#include "QDesktopServices"
|
|
|
|
void startHTTPServer() {
|
|
if (HttpProxyServer::Instance == 0) {
|
|
quint16 port = 8000;
|
|
HttpProxyServer::Instance = new HttpProxyServer(port);
|
|
}
|
|
|
|
// URL, который вы хотите открыть
|
|
// QString urlString = "http://localhost:8000/"; //HttpServer::Instance->getDefaultPath();
|
|
// QUrl url(urlString);
|
|
// // Проверка, является ли URL валидным
|
|
// if (url.isValid()) {
|
|
// // Открытие URL в системном браузере
|
|
// if (QDesktopServices::openUrl(url)) {
|
|
// qDebug() << "URL opened successfully:" << urlString;
|
|
// }
|
|
// else {
|
|
// qDebug() << "Failed to open URL:" << urlString;
|
|
// }
|
|
// }
|
|
// else {
|
|
// qDebug() << "Invalid URL:" << urlString;
|
|
// }
|
|
}
|