HttpSampleApp.cpp Example File
httptest/src/HttpSampleApp.cpp
#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <QSettings>
#include "HttpSampleApp.hpp"
#include "ExternalIP.hpp"
#include "RequestHeaders.hpp"
#include "PostHttp.hpp"
#include "AppSettings.hpp"
using namespace bb::cascades;
HttpSampleApp::HttpSampleApp()
{
QCoreApplication::setOrganizationName("Example");
QCoreApplication::setApplicationName("HttpSample");
qmlRegisterType<PostHttp>("Network.PostHttp", 1, 0, "PostHttp");
qmlRegisterType<ExternalIP>("Network.ExternalIP", 1, 0, "ExternalIP");
qmlRegisterType<RequestHeaders>("Network.RequestHeaders", 1, 0, "RequestHeaders");
qmlRegisterType<QTimer>("my.library", 1, 0, "QTimer");
QmlDocument* qml = QmlDocument::create("asset:///main.qml").parent(this);
qml->setContextProperty("_httpsample", this);
AbstractPane* root = qml->createRootObject<AbstractPane>();
Application::instance()->setScene(root);
}
void HttpSampleApp::setPostBody(const QString &body)
{
if (m_postBody == body)
return;
m_postBody = body;
emit postBodyChanged();
}
QString HttpSampleApp::postBody() const
{
return m_postBody;
}
void HttpSampleApp::setUseHttps(bool value)
{
if (AppSettings::isUsingHttps() == value)
return;
AppSettings::setHttps(value);
emit useHttpsChanged();
}
bool HttpSampleApp::useHttps() const
{
return AppSettings::isUsingHttps();
}