#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(&networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(onResult(QNetworkReply*)) );
}
MainWindow::~MainWindow()
{
delete ui;
}
// funtion used to login to facebook
void MainWindow
::sendLoginRecuest(QUrl url
) {
url = "https://www.facebook.com/";
netRequest.setUrl(url);
netReply = networkManager.get(netRequest);
}
// response to our login atempt
void MainWindow::reciveRecuest()
{
// Do somthing...
}
// Exit function
void MainWindow::on_actionExit_triggered()
{
close();
}
// Exit function \\
void MainWindow::on_loginButton_clicked()
{
sendLoginRecuest(url);
}
// This is what happens when the request is finsihed
void MainWindow::onResult(QNetworkReply *reply)
{
if (reply->error() != QNetworkReply::NoError)
{
"Request Faild: ",
} else {
"Request Completed with no errors. ",
ui->textBrowser->setText("Ok test");
QScriptEngine engine;
QScriptValue result = engine.evaluate(data);
ui->textBrowser->append(data);
}
ui->textBrowser->update();
}