AsemanApplication::AsemanApplication(int &argc, char **argv, ApplicationType appType) :
    QObject()
{
    if(!aseman_app_singleton)
        aseman_app_singleton = this;

    p = new AsemanApplicationPrivate;
    p->appType = appType;
    p->app_owner = true;

    switch(p->appType)
    {
#ifdef QT_CORE_LIB
    case CoreApplication:
        p->app = new QCoreApplication(argc, argv);
        connect(p->app, SIGNAL(organizationNameChanged())  , SIGNAL(organizationNameChanged()));
        connect(p->app, SIGNAL(organizationDomainChanged()), SIGNAL(organizationDomainChanged()));
        connect(p->app, SIGNAL(applicationNameChanged())   , SIGNAL(applicationNameChanged()));
        connect(p->app, SIGNAL(applicationVersionChanged()), SIGNAL(applicationVersionChanged()));
        break;
#endif
#ifdef QT_GUI_LIB
    case GuiApplication:
        p->app = new QGuiApplication(argc, argv);
        connect(p->app, SIGNAL(lastWindowClosed()), SIGNAL(lastWindowClosed()));

        p->globalFont = static_cast<QGuiApplication*>(p->app)->font();
        break;
#endif
#ifdef QT_WIDGETS_LIB
    case WidgetApplication:
        p->app = new QtSingleApplication(argc, argv);
        connect(p->app, SIGNAL(messageReceived(QString)), SIGNAL(messageReceived(QString)));

        p->globalFont = static_cast<QtSingleApplication*>(p->app)->font();
        break;
#endif
    default:
        p->app = 0;
        break;
    }
}
Exemple #2
0
QQmlApplication::QQmlApplication(QQmlApplicationPrivate &dd, QObject *parent)
    : QObject(dd, parent)
{
    connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
            this, SIGNAL(aboutToQuit()));
    connect(QCoreApplication::instance(), SIGNAL(applicationNameChanged()),
            this, SIGNAL(nameChanged()));
    connect(QCoreApplication::instance(), SIGNAL(applicationVersionChanged()),
            this, SIGNAL(versionChanged()));
    connect(QCoreApplication::instance(), SIGNAL(organizationNameChanged()),
            this, SIGNAL(organizationChanged()));
    connect(QCoreApplication::instance(), SIGNAL(organizationDomainChanged()),
            this, SIGNAL(domainChanged()));
}