Ejemplo n.º 1
0
void FormMain::createConnections() {
  // General connections.
  connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
  connect(m_ui->m_actionQuit, SIGNAL(triggered()), this, SLOT(close()));
  connect(m_ui->m_actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(showUpdates()));
  connect(m_ui->m_actionAboutToolkit, SIGNAL(triggered()), this, SLOT(showAbout()));
  connect(m_ui->m_actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
  connect(m_ui->m_actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));

  // View connections.
  connect(m_ui->m_actionViewSimulatorWindow, SIGNAL(toggled(bool)), this, SLOT(switchSimulatorWindow(bool)));
  connect(m_ui->m_actionStickSimulatorWindow, SIGNAL(toggled(bool)), m_simulatorWindow, SLOT(setIsSticked(bool)));

  // Extra simulator connections.
  connect(m_simulatorWindow, SIGNAL(closed()), this, SLOT(onSimulatorWindowClosed()));
  connect(m_simulatorWindow, SIGNAL(stopEnableChanged(bool)), m_ui->m_actionSimulatorStop, SLOT(setEnabled(bool)));
  connect(m_ui->m_actionSimulatorStop, SIGNAL(triggered()), m_simulatorWindow->m_ui->m_btnStopSimulation, SLOT(click()));
  connect(m_ui->m_actionSimulatorRun, SIGNAL(triggered()), this, SLOT(startSimulation()));
  connect(m_ui->m_actionSimulatorGoBack, SIGNAL(triggered()), this, SLOT(takeSimulationOneStepBack()));

  // Project connections.
  connect(m_ui->m_actionNewProject, SIGNAL(triggered()), this ,SLOT(openNewProjectDialog()));
  connect(m_ui->m_actionSaveProject, SIGNAL(triggered()), this ,SLOT(openSaveProjectDialog()));
  connect(m_ui->m_actionSaveProjectAs, SIGNAL(triggered()), this, SLOT(openSaveProjectAsDialog()));
  connect(m_ui->m_actionLoadProject, SIGNAL(triggered()), this ,SLOT(openLoadProjectDialog()));
  connect(m_ui->m_actionOpenOutputDirectory, SIGNAL(triggered()), this, SLOT(openOutputDirectory()));

  // Template system connections.
  connect(qApp->templateManager(), SIGNAL(newTemplateCoreCreated(TemplateCore*)), this, SLOT(setTemplateCore(TemplateCore*)));
  connect(qApp, SIGNAL(externalApplicationsRechecked()), this, SLOT(onExternalApplicationsChanged()));
  connect(m_ui->m_actionGenerateMobileApplication, SIGNAL(triggered()), this, SLOT(generateMobileApplication()));
  connect(m_ui->m_actionUploadApplicationToStore, SIGNAL(triggered()), this, SLOT(uploadMobileApplicationToStore()));
  connect(qApp->templateManager()->generator(), SIGNAL(generationStarted()), this, SLOT(onGenerationStarted()));
  connect(qApp->templateManager()->generator(), SIGNAL(generationFinished(TemplateCore::GenerationResult,QString)),
          this, SLOT(onGenerationDone(TemplateCore::GenerationResult,QString)));
  connect(qApp->templateManager()->generator(), SIGNAL(generationProgress(int,QString)), this, SLOT(onGenerationProgress(int,QString)));
}
Ejemplo n.º 2
0
void AWActions::versionReplyRecieved(QNetworkReply *reply,
                                     const bool showAnyway) const
{
    qCDebug(LOG_AW) << "Return code" << reply->error() << "with message"
                    << reply->errorString() << "and show anyway" << showAnyway;

    QJsonParseError error;
    QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
    if ((reply->error() != QNetworkReply::NoError)
        || (error.error != QJsonParseError::NoError)) {
        qCWarning(LOG_AW) << "Parse error" << error.errorString();
        return;
    }
    reply->deleteLater();

    // convert to map
    QVariantMap firstRelease = jsonDoc.toVariant().toList().first().toMap();
    QString version = firstRelease[QString("tag_name")].toString();
    version.remove(QString("V."));
    qCInfo(LOG_AW) << "Found version" << version;

    // FIXME: possible there is a better way to check versions
    int old_major = QString(VERSION).split(QChar('.')).at(0).toInt();
    int old_minor = QString(VERSION).split(QChar('.')).at(1).toInt();
    int old_patch = QString(VERSION).split(QChar('.')).at(2).toInt();
    int new_major = version.split(QChar('.')).at(0).toInt();
    int new_minor = version.split(QChar('.')).at(1).toInt();
    int new_patch = version.split(QChar('.')).at(2).toInt();
    if ((old_major < new_major)
        || ((old_major == new_major) && (old_minor < new_minor))
        || ((old_major == new_major) && (old_minor == new_minor)
            && (old_patch < new_patch)))
        return showUpdates(version);
    else if (showAnyway)
        return showInfo(version);
}
Ejemplo n.º 3
0
void FormMain::showUpdatesAfterBubbleClick() {
  display();
  showUpdates();
}