コード例 #1
0
void WizardWelcome::loadWelcomePage()
{
    qDebug() << Q_FUNC_INFO;

    disconnectWifiObserver();

    WebWizard* webWizard = QBookApp::instance()->browserWizard();

    connect(webWizard, SIGNAL(registerOK()), this, SLOT(goWizardFinished()));
    connect(webWizard, SIGNAL(registerFailed()), this, SLOT(showRegisterFailed()));
    connect(webWizard, SIGNAL(goToWifi()), this, SLOT(goToWifi()));
    connect(webWizard, SIGNAL(connectionProblem()), this, SLOT(connectivityProblem()), Qt::UniqueConnection);
    connect(webWizard, SIGNAL(serialInvalid()), this, SLOT(serialInvalidHandle()), Qt::UniqueConnection);
    connect(webWizard, SIGNAL(processHeadersFailed()), this, SLOT(headersProblem()), Qt::UniqueConnection);

    QString landingUrl = QBook::settings().value("serviceURLs/landing",QVariant("http://landing.mundoreader.com/?")).toString();
    QString version = QBOOKAPP_VERSION;
    QString lang = QBook::settings().value("setting/language",QVariant("es")).toString();
    QString email = QBook::settings().value("eMail").toString();
    QString activated;
    if(QBook::settings().value("setting/activated", false).toBool())
        activated = "1";
    else
        activated = "0";
    qDebug() << Q_FUNC_INFO << "activated:"  << activated;

    QString url = QBookApp::instance()->getDeviceServices()->generateWelcomePageUrl(DeviceInfo::getInstance()->getSerialNumber(), landingUrl, version, lang, email, activated);

    qDebug() << "Loading url: " << url;
    webWizard->forceUrl(url);
    QBookApp::instance()->pushForm(webWizard);
}
コード例 #2
0
ファイル: window.cpp プロジェクト: 7omate/pydio-sync-ui
Window::Window()
{
    QCommandLineParser parser;
    QCommandLineOption pathToAgentOption("p", "Path to sync agent", "agentPath");
    parser.addOption(pathToAgentOption);
    QCommandLineOption skipAgentStartOption("s", "Do not try to start agent on start up", "skipAgentStart");
    parser.addOption(skipAgentStartOption);
    QCommandLineOption dumbTestOption("test", "Super simple start/stop test.");
    parser.addOption(dumbTestOption);
    parser.process(*qApp);
    bool startAgent = true;
    if(parser.isSet(skipAgentStartOption) && parser.value(skipAgentStartOption) == "true"){
        startAgent = false;
    }
    cmdHelper = new CmdHelper(this, (parser.isSet(pathToAgentOption))?parser.value(pathToAgentOption):"");
    if(parser.isSet(dumbTestOption)){
        QTimer *t = new QTimer(this);
        connect(t, SIGNAL(timeout()), qApp, SLOT(quit()));
        t->setInterval(5000);
        t->setSingleShot(true);
        t->start();
        qDebug()<<"Dumb test, will exit in 5 seconds...";
    }
    else{
        if(startAgent){
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
            cmdHelper->launchAgentProcess();
#elif defined(Q_OS_MAC)
            qDebug()<<"Starting agent via launchctl command.";
            cmdHelper->launchAgentMac();
#endif

        }

        if(CHECK_FOR_UPDATE){
            updateDialog = new UpdateDialog(this);
            updatePinger = new PydioUpdatePinger(this);
            connect(updatePinger, SIGNAL(updateFound(QString,QString,QString,QString)),
                    updateDialog, SLOT(proposeDownload(QString,QString,QString,QString)));
            updatePinger->lookForUpdate();
        }

        QString dataDir = CmdHelper::getAppDataDir() +'/'+ PORT_CONFIG_FILE_NAME;
        portConfigurer = new PortConfigurer(dataDir);
        pollTimer = new QTimer(this);
        pollTimer->setInterval(POLL_INTERVAL);
        pollTimer->setSingleShot(true);

        httpManager = new HTTPManager(this);
        this->createTrayIcon();
        tray->show();

        aboutDialog = new AboutDialog(this);

        connect(pollTimer, SIGNAL(timeout()), httpManager, SLOT(poll()));
        connect(httpManager, SIGNAL(requestFinished()), pollTimer, SLOT(start()));
        connect(httpManager, SIGNAL(newJob(Job*)), tray, SLOT(onNewJob(Job*)));
        connect(httpManager, SIGNAL(jobUpdated(QString)), tray, SLOT(onJobUpdate(QString)));
        connect(httpManager, SIGNAL(jobDeleted(QString)), tray, SLOT(onJobDeleted(QString)));
        connect(httpManager, SIGNAL(connectionProblem()), tray, SLOT(connectionLost()));
        connect(httpManager, SIGNAL(agentReached()), this, SLOT(agentReached()));
        connect(httpManager, SIGNAL(noActiveJobsAtLaunch()), this, SLOT(show()));
        connect(httpManager, SIGNAL(jobsCleared()), tray, SLOT(jobsCleared()));
        connect(httpManager, SIGNAL(webUI404()), this, SLOT(notFoundFromPython()));
        connect(httpManager, SIGNAL(noInternetConnection()), tray, SLOT(noInternetConnection()));
        connect(httpManager, SIGNAL(internetConnectionOk()), tray, SLOT(internetConnectionOk()));
        connect(httpManager, SIGNAL(connectionProblem()), this, SLOT(connectionLost()));
        connect(httpManager, SIGNAL(jobNotifyMessage(QString,QString,QString)), tray, SLOT(notificationReceived(QString,QString,QString)));

        connect(tray, SIGNAL(about()), this, SLOT(about()));
        connect(tray, SIGNAL(pauseSync()), httpManager, SLOT(pauseSync()));
        connect(tray, SIGNAL(resumeSync()), httpManager, SLOT(resumeSync()));
        connect(tray, SIGNAL(quit()), this, SLOT(cleanQuit()));
        connect(tray, SIGNAL(launchAgentSignal()), cmdHelper, SLOT(launchAgentProcess()));
//        connect(cmdHelper, SIGNAL(winAgentLaunched()), this, SLOT(show()));

        settingsWebView = new QWebView();

        jsDialog = new JSEventHandler(this);

        portConfigurer->updatePorts();
        httpManager->setUrl(AGENT_SERVER_URL + portConfigurer->port(), portConfigurer->username(), portConfigurer->password());
        httpManager->poll();

        //this->setWindowFlags(Qt::Tool);
        setWindowTitle(PYDIO_DATA_DIR);
        setWindowIcon(QIcon(":/images/PydioSync-Systray-Mac.png"));
    }
}