QwuiApplicationFactory Class Reference

Application factory. This class uses a creator function to create new applications instances. The creator function corresponds to the traditionnal main() function for a web application. More...

#include <qwuiapplicationfactory.h>

Inheritance diagram for QwuiApplicationFactory:
QwuiAbstractResourceProviderFactory

List of all members.

Public Member Functions

 QwuiApplicationFactory (QwuiApplicationCreator creatorFunction, const QStringList &args)
virtual ~QwuiApplicationFactory ()
virtual
QwuiAbstractResourceProvider
create (const QString &sessionId) const

Private Attributes

QwuiApplicationCreator m_creatorFunction
QStringList m_args

Detailed Description

Application factory. This class uses a creator function to create new applications instances. The creator function corresponds to the traditionnal main() function for a web application.

//
// the traditionnal main function only starts the application server.
//
int main(int argc, char** argv)
{
    QCoreApplication app(argc, argv);
    QwuiApplicationServer webAppServer(webMain);
    webAppServer.setBuiltInServerPort(8888);
    webAppServer.exec();
    return app.exec();
}

//
// This is the main function executed by the application server for each new session.
//
QwuiApplication* webMain(const QString& sessionId, const QStringList& args)
{
    Q_UNUSED(args);

    QwuiApplication* webApp = new QwuiApplication(sessionId);
    QwuiMainWebget* mw = new QwuiMainWebget(NULL, "mw");
    mw->setTitle("QtWui Test");
    QwuiLabel* helloWorld = new QwuiLabel(mw, "helloWorld");
    webApp->setMainWebget(helloWorld);
    helloWorld->setText("Hello World !");
    return webApp;
}

Constructor & Destructor Documentation

QwuiApplicationFactory::QwuiApplicationFactory ( QwuiApplicationCreator  creatorFunction,
const QStringList &  args 
)
Parameters:
creatorFunction creator function corresponding to the main() function for a web application.
args command line arguments.
QwuiApplicationFactory::~QwuiApplicationFactory (  )  [virtual]

Member Function Documentation

QwuiAbstractResourceProvider * QwuiApplicationFactory::create ( const QString &  sessionId  )  const [virtual]
Parameters:
sessionId Session identifier to use for the new application.
Returns:
a new QwuiApplication instance.

Implements QwuiAbstractResourceProviderFactory.


Member Data Documentation

QStringList QwuiApplicationFactory::m_args [private]

The documentation for this class was generated from the following files:
Generated on Fri Jun 4 01:18:58 2010 for QtWui : Web User Interfaces for Qt by  doxygen 1.6.3