Ejemplo n.º 1
0
    void UpdateService::startChecking() {
        const bool startWorker = m_SettingsModel->getCheckForUpdates();

        if (startWorker) {
            m_UpdatesCheckerWorker = new UpdatesCheckerWorker();
            QThread *thread = new QThread();
            m_UpdatesCheckerWorker->moveToThread(thread);

            QObject::connect(thread, SIGNAL(started()), m_UpdatesCheckerWorker, SLOT(process()));
            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(stopped()), thread, SLOT(quit()));

            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(stopped()), m_UpdatesCheckerWorker, SLOT(deleteLater()));
            QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));

            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(updateAvailable(QString)),
                             this, SIGNAL(updateAvailable(QString)));

            QObject::connect(m_UpdatesCheckerWorker, SIGNAL(stopped()),
                             this, SLOT(workerFinished()));

            thread->start();
        } else {
            LOG_INFO << "Update service disabled";
        }
    }
Ejemplo n.º 2
0
  void updateTotal(const Resources& newTotal) {
    total = newTotal;
    shared = total.shared();
    hasGpu_ = total.gpus().getOrElse(0) > 0;

    updateAvailable();
  }
Ejemplo n.º 3
0
void ThreadNet::onRedirectFinished()
{
  QUrl redirectUrl = QString(http_update_reply->rawHeader("Location"));
  qDebug()<<"@ThreadNet::onRedirectFinished(): Redirect url from http header:"<<redirectUrl.toString();

  http_update_manager->deleteLater();
  http_update_reply->deleteLater();

  http_update_manager = new QNetworkAccessManager(this);
  http_update_reply = http_update_manager->get(QNetworkRequest(redirectUrl));

  connect(http_update_reply, &QNetworkReply::readyRead,
          [this]() {
            http_update_file.append(http_update_reply->readAll());
          });
  connect(http_update_reply, &QNetworkReply::finished,
          [this]() {
            qDebug()<<"Downloaded: "<<http_update_file;
            QJsonParseError json_error;
            QJsonDocument json_document = QJsonDocument::fromJson(http_update_file, &json_error);
            if(json_error.error == QJsonParseError::NoError)
              {
                if(json_document.isObject())
                  {
                    QJsonObject json_obj = json_document.object();
                    GlobalData::update_struct.version[0] = json_obj.value("stable_version").toInt();
                    GlobalData::update_struct.version[1] = json_obj.value("beta_version").toInt();
                    GlobalData::update_struct.version[2] = json_obj.value("alpha_version").toInt();
                    GlobalData::update_struct.message = json_obj.value("message").toString();
                    GlobalData::update_struct.title = json_obj.value("title").toString();
										if(memcmp(GlobalData::update_struct.version,
															GlobalData::current_version,
															sizeof(GlobalData::current_version)) != 0)
											{
                        qDebug()<<"@ThreadNet::onRedirectFinished(): update available";
                        emit updateAvailable();
                      }
                    else
                      {
                        qDebug()<<"@ThreadNet::onRedirectFinished(): already the newest version";
                      }
                  }
                else
                  {
                    qDebug()<<"!@ThreadNet::onRedirectFinished(): Update Json Document IS NOT AN OBJECT!";
                  }
              }
            else
              {
                qDebug()<<"!@ThreadNet::onRedirectFinished(): Update Json Document Parse ERROR!";
              }

            qDebug()<<"@ThreadNet: Got update file: "<<http_update_file;
            http_update_manager->deleteLater();
            http_update_reply->deleteLater();
          });
}
Ejemplo n.º 4
0
 Slave(
     const SlaveInfo& _info,
     const protobuf::slave::Capabilities& _capabilities,
     bool _activated,
     const Resources& _total,
     const Resources& _allocated)
   : info(_info),
     capabilities(_capabilities),
     activated(_activated),
     total(_total),
     allocated(_allocated),
     shared(_total.shared()),
     hasGpu_(_total.gpus().getOrElse(0) > 0)
 {
   updateAvailable();
 }
Ejemplo n.º 5
0
void UpdateChecker::checkUpdate() {
    QString applicationName = ApplicationManager::getInstance()->getApplicationName().remove(" ");

    /**
     * dokumentacja dla http://agila.bluebraces.com/service/checkUpdate/$appName/$versionCode
     *
     * @param $appName dozwolone wartości "AgilaFaktury", "AgilaS3" (bez spacji!)
     * @param $versionCode - aktualny numer wersji kodu
     * @return 'NONE' - niewłaściwa liczba argumentów
     * @return 'INCORRECT_APP_NAME' - niewłasciwa nazwa aplikacji
     * @return '{"newVersionCode":2,"newVersionName":"1.2","downloadLink":...}' - odpowiedz JSON
     */

    QStringList args; // kolejność ma znaczenie!
    args << applicationName << QVariant(ApplicationInfo::getVersionCode()).toString();

    HttpRequester *requester = new HttpRequester();
    try {
        QString response = requester->sendAgilaServiceRequest("checkUpdate", args);
        delete requester;

        if(response == "NONE") {
            emit noUpdateAvailable();
        }
        else if(response == "INCORRECT_APP_NAME") {
            //  "Błąd wywołania requestu! Błąd: 102";
        }
        else if(response.startsWith("{"))
        {
           // jest dostępna aktualizacja

            JsonObject *jObject = new JsonObject(response);

            UpdateInfo updateInfo;
            updateInfo.setNewVersionCode(jObject->getInt("newVersionCode"));
            updateInfo.setNewVersionName(jObject->getString("newVersionName"));
            updateInfo.setDownloadLink(jObject->getString("downloadLink"));
            delete jObject;

            emit updateAvailable(updateInfo);
        }

    } catch(NoHttpResponseException *e) {

        delete requester;
    }
}
Ejemplo n.º 6
0
void SnakeUpdateChecker::findVersion()
{
    if(SnakeTray::debug()) qDebug("Latest version is '%s' (%s>%s)",m_page.latin1(),QString::number(m_page.toFloat()).latin1(),QString::number(m_current_version.toFloat()).latin1());

    if( m_page.isEmpty() )
        return;

    if( m_page.toFloat() > m_current_version.toFloat() )
    {
        if(SnakeTray::debug()) qDebug("New version available!");
        emit updateAvailable( m_page );
        KMessageBox::information(0,"There is a new version available, you can get it at http://snaketray.sourceforge.net/ !", "New version available"/*, "Updates"*/ );
    }
    else
    {
        if(SnakeTray::debug()) qDebug("You are using an up to date version");
    }

}
Ejemplo n.º 7
0
void PlaylistEdit::createConnections()
{
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settings()));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
    connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newPlaylist()));
    connect(ui->actionDelete, SIGNAL(triggered()), this, SLOT(deleteItem()));
    connect(ui->actionAdd, SIGNAL(triggered()), this, SLOT(addItem()));
    connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
    connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(exit()));
    connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(menuOpenExport()));
    connect(ui->actionExportTvheadend, SIGNAL(triggered()), this, SLOT(exportTvheadend()));
    connect(ui->actionExportXmltvId, SIGNAL(triggered()), this, SLOT(exportXmltvId()));
    connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));

    connect(ui->editName, SIGNAL(textChanged(QString)), this, SLOT(setTitle(QString)));

    connect(ui->buttonApplyNum, SIGNAL(clicked()), this, SLOT(editChannelNumber()));
    connect(ui->editNumber, SIGNAL(returnPressed()), ui->buttonApplyNum, SLOT(click()));
    connect(ui->editChannelName, SIGNAL(textChanged(QString)), this, SLOT(editChannelName(QString)));
    connect(ui->editUrl, SIGNAL(textChanged(QString)), this, SLOT(editChannelUrl(QString)));
    connect(ui->editCategories, SIGNAL(textChanged(QString)), this, SLOT(editChannelCategories(QString)));
    connect(ui->editLanguage, SIGNAL(textChanged(QString)), this, SLOT(editChannelLanguage(QString)));
    connect(ui->editEpg, SIGNAL(textChanged(QString)), this, SLOT(editChannelEpg(QString)));
    connect(ui->editLogo, SIGNAL(textChanged(QString)), this, SLOT(editChannelLogo(QString)));

    connect(ui->actionUp, SIGNAL(triggered()), this, SLOT(moveUp()));
    connect(ui->actionDown, SIGNAL(triggered()), this, SLOT(moveDown()));

    connect(ui->playlist, SIGNAL(itemSelected(Channel *)), this, SLOT(editItem(Channel *)));

#if EDITOR
    connect(_update, SIGNAL(newUpdate()), this, SLOT(updateAvailable()));
    connect(ui->actionUpdate, SIGNAL(triggered()), _update, SLOT(check()));
#endif

#if WITH_EDITOR_VLCQT
    connect(ui->buttonUpdate, SIGNAL(toggled(bool)), this, SLOT(refreshPlaylist(bool)));
#endif
}
Ejemplo n.º 8
0
    void SelfUpdater::run()
    {
        if(network.networkAccessible() == QNetworkAccessManager::NotAccessible) {
            qDebug() << "[SelfUpdater] Run skipped, because no network.";
            return;
        }

        // setup download folder
        downloadFolder = QCoreApplication::applicationDirPath()+QDir::separator()+"downloads";
        if (!QDir(downloadFolder).exists()) {
            QDir(downloadFolder).mkpath(".");
        }

        if(updateAvailable())
        {
            qDebug() << "[SelfUpdater] Update available \n VersionInfo:" << versionInfo;

            emit notifyUpdateAvailable(versionInfo);

            if(settings->get("selfupdater/autoupdate").toBool()) {
                doUpdate();
            }
        }
    }
Ejemplo n.º 9
0
FenPrincipale::FenPrincipale(QWidget *parent) :
    QMainWindow(parent), ui(new Ui::FenPrincipale), m_fenOptions(NULL), m_trayWarningShown(false), m_auth(new Auth(this)), m_handler(new DownloadHandler(this)),
    m_infoExtractor(new InfoExtractor(this)), m_vitesseTransfert(new VitesseTransfert(this, DOWNLOAD_SPEED_UPDATE_INTERVAL, DOWNLOAD_SPEED_AVERAGE_TIME)),
    m_versionCheck(new VersionCheckThread(this, VERSION_HOST, APP_NAME, VERSION, VERSION_NBR)), m_currentDownload(), m_waitTimer(new QTimer(this)),
    m_updateDownloadTimer(new QTimer(this)), m_waitTime(0), m_isDownloading(false)
{
    ui->setupUi(this);
    setWindowTitle(APP_NAME " - v" VERSION);

    //Icône système
    m_menu = new QMenu(this);
    m_retablirAction = new QAction("Rétablir", m_menu);
    m_startAction = new QAction("Télécharger", m_menu);
    m_stopAction = new QAction("Arrêter", m_menu);
    m_quitterAction = new QAction("Quitter", m_menu);
    m_tray = new QSystemTrayIcon(windowIcon(), this);

    m_menu->addAction(m_retablirAction);
    m_menu->addAction(m_startAction);
    m_menu->addAction(m_stopAction);
    m_menu->addAction(m_quitterAction);
    m_retablirAction->setVisible(false);
    m_stopAction->setVisible(false);
    m_tray->setContextMenu(m_menu);
    m_tray->show();

    qApp->setActiveWindow(this);
    loadSettings();

    //UI
    connect(ui->adresse, SIGNAL(returnPressed()), this, SLOT(on_btn_ajouter_clicked()));
    connect(m_waitTimer, SIGNAL(timeout()), this, SLOT(waitTimerTick()));
    connect(m_infoExtractor, SIGNAL(infoAvailable(QString,QString,QString,QString)), this, SLOT(infoAvailable(QString,QString,QString,QString)));
    connect(m_infoExtractor, SIGNAL(infoUnavailable(QString,ExtractionError)), this, SLOT(infoUnavailable(QString,ExtractionError)));
    connect(m_updateDownloadTimer, SIGNAL(timeout()), this, SLOT(updateDownloadTick()));
    connect(m_versionCheck, SIGNAL(update(QString, QString)), this, SLOT(updateAvailable(QString, QString)));
    connect(m_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayClicked(QSystemTrayIcon::ActivationReason)));
    connect(m_retablirAction, SIGNAL(triggered()), this, SLOT(retablir()));
    connect(m_startAction, SIGNAL(triggered()), this, SLOT(on_btn_go_clicked()));
    connect(m_stopAction, SIGNAL(triggered()), this, SLOT(on_btn_arreter_clicked()));
    connect(m_quitterAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(QApplication::clipboard(), SIGNAL(changed(QClipboard::Mode)), this, SLOT(clipboardChange()));

    //Raccourcis
    connect(new QShortcut(QKeySequence("Ctrl+Q"), this), SIGNAL(activated()), qApp, SLOT(quit()));
    connect(new QShortcut(QKeySequence("Ctrl+D"), this), SIGNAL(activated()), ui->btn_details, SLOT(toggle()));
    connect(new QShortcut(QKeySequence("Ctrl+Up"), this), SIGNAL(activated()), this, SLOT(on_btn_monter_clicked()));
    connect(new QShortcut(QKeySequence("Ctrl+Shift+Up"), this), SIGNAL(activated()), this, SLOT(on_btn_monter_clicked()));
    connect(new QShortcut(QKeySequence("Ctrl+Down"), this), SIGNAL(activated()), this, SLOT(on_btn_descendre_clicked()));
    connect(new QShortcut(QKeySequence("Ctrl+Shift+Down"), this), SIGNAL(activated()), this, SLOT(on_btn_descendre_clicked()));
    connect(new QShortcut(QKeySequence("Del"), this), SIGNAL(activated()), this, SLOT(on_btn_supprimer_clicked()));

    //Téléchargement
    connect(m_auth, SIGNAL(authed(AuthInfo)), this, SLOT(authSuccess(AuthInfo)));
    connect(m_auth, SIGNAL(authError(AuthError)), this, SLOT(authFail(AuthError)));
    connect(m_handler, SIGNAL(error(DownloadError)), this, SLOT(error(DownloadError)));
    connect(m_handler, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(updateDownload(qint64, qint64)));
    connect(m_handler, SIGNAL(finished()), this, SLOT(downloadComplete()));
    connect(m_handler, SIGNAL(waitTime(int, QString)), this, SLOT(waitTimerStart(int, QString)));

    console("Authentification...");
    m_auth->login(m_login, m_password);
    m_updateDownloadTimer->setInterval(DOWNLOAD_SPEED_UPDATE_INTERVAL);
    m_versionCheck->start();
    m_waitTimer->setInterval(1000);
    clipboardChange();  //Initialise la zone d'adresse avec les adresses déjà présentes en mémoire.
    setDetailsVisible(ui->btn_details->isChecked());
    ui->btn_arreter->hide();
    ui->liste->setCurrentRow(0);

    sLog->out(APP_NAME " startup.");
}
void QAudioOutputPrivate::feedback()
{
    QMetaObject::invokeMethod(this, SLOT(updateAvailable()), Qt::QueuedConnection);
}
Ejemplo n.º 11
0
  void allocate(const Resources& toAllocate)
  {
    allocated += toAllocate;

    updateAvailable();
  }
Ejemplo n.º 12
0
void QAudioOutputPrivate::feedback()
{
    updateAvailable();
}
Ejemplo n.º 13
0
void Commands::CommandManager::connectEntitiesSignalsSlots() const {
    if (m_SecretsManager != NULL && m_UploadInfoRepository != NULL) {
        QObject::connect(m_SecretsManager, SIGNAL(beforeMasterPasswordChange(QString, QString)),
                         m_UploadInfoRepository, SLOT(onBeforeMasterPasswordChanged(QString, QString)));

        QObject::connect(m_SecretsManager, SIGNAL(afterMasterPasswordReset()),
                         m_UploadInfoRepository, SLOT(onAfterMasterPasswordReset()));
    }

    if (m_ArtItemsModel != NULL && m_FilteredItemsModel != NULL) {
        QObject::connect(m_ArtItemsModel, SIGNAL(selectedArtworksRemoved(int)),
                         m_FilteredItemsModel, SLOT(onSelectedArtworksRemoved(int)));
    }

    if (m_SettingsModel != NULL && m_TelemetryService != NULL) {
        QObject::connect(m_SettingsModel, SIGNAL(userStatisticsChanged(bool)),
                         m_TelemetryService, SLOT(changeReporting(bool)));
    }

    if (m_SpellCheckerService != NULL && m_FilteredItemsModel != NULL) {
        QObject::connect(m_SpellCheckerService, SIGNAL(serviceAvailable(bool)),
                         m_FilteredItemsModel, SLOT(onSpellCheckerAvailable(bool)));
    }

    if (m_ArtworksRepository != NULL && m_ArtItemsModel != NULL) {
        QObject::connect(m_ArtworksRepository, SIGNAL(filesUnavailable()),
                         m_ArtItemsModel, SLOT(onFilesUnavailableHandler()));
    }

    if (m_ArtItemsModel != NULL && m_UndoRedoManager != NULL) {
        QObject::connect(m_UndoRedoManager, SIGNAL(undoStackEmpty()),
                         m_ArtItemsModel, SLOT(onUndoStackEmpty()));
    }

    if (m_LanguagesModel != NULL && m_KeywordsSuggestor != NULL) {
        QObject::connect(m_LanguagesModel, SIGNAL(languageChanged()),
                         m_KeywordsSuggestor, SLOT(onLanguageChanged()));
    }

    if (m_SpellCheckerService != NULL && m_ArtItemsModel != NULL) {
        QObject::connect(m_SpellCheckerService, SIGNAL(userDictUpdate(QStringList)),
                         m_ArtItemsModel, SLOT(userDictUpdateHandler(QStringList)));
        QObject::connect(m_SpellCheckerService, SIGNAL(userDictCleared()),
                         m_ArtItemsModel, SLOT(userDictClearedHandler()));
    }

    if (m_SpellCheckerService != NULL && m_CombinedArtworksModel != NULL) {
        QObject::connect(m_SpellCheckerService, SIGNAL(userDictUpdate(QStringList)),
                         m_CombinedArtworksModel, SLOT(userDictUpdateHandler(QStringList)));
        QObject::connect(m_SpellCheckerService, SIGNAL(userDictCleared()),
                         m_CombinedArtworksModel, SLOT(userDictClearedHandler()));
    }

    if (m_HelpersQmlWrapper != NULL && m_UpdateService != NULL) {
        QObject::connect(m_UpdateService, SIGNAL(updateAvailable(QString)),
                         m_HelpersQmlWrapper, SIGNAL(updateAvailable(QString)));

        QObject::connect(m_UpdateService, SIGNAL(updateDownloaded(QString)),
                         m_HelpersQmlWrapper, SLOT(updateIsDownloaded(QString)));
    }
}
Ejemplo n.º 14
0
void UpdateChecker::updateCheckFinished(bool notifyNoUpdate)
{
	QLOG_DEBUG() << "Finished downloading repo index. Checking for new versions.";

	QJsonParseError jsonError;
	QByteArray data;
	{
		ByteArrayDownloadPtr dl =
			std::dynamic_pointer_cast<ByteArrayDownload>(indexJob->first());
		data = dl->m_data;
		indexJob.reset();
	}

	QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonError);
	if (jsonError.error != QJsonParseError::NoError || !jsonDoc.isObject())
	{
		QLOG_ERROR() << "Failed to parse GoUpdate repository index. JSON error"
					 << jsonError.errorString() << "at offset" << jsonError.offset;
		return;
	}

	QJsonObject object = jsonDoc.object();

	bool success = false;
	int apiVersion = object.value("ApiVersion").toVariant().toInt(&success);
	if (apiVersion != API_VERSION || !success)
	{
		QLOG_ERROR() << "Failed to check for updates. API version mismatch. We're using"
					 << API_VERSION << "server has" << apiVersion;
		return;
	}

	QLOG_DEBUG() << "Processing repository version list.";
	QJsonObject newestVersion;
	QJsonArray versions = object.value("Versions").toArray();
	for (QJsonValue versionVal : versions)
	{
		QJsonObject version = versionVal.toObject();
		if (newestVersion.value("Id").toVariant().toInt() <
			version.value("Id").toVariant().toInt())
		{
			newestVersion = version;
		}
	}

	// We've got the version with the greatest ID number. Now compare it to our current build
	// number and update if they're different.
	int newBuildNumber = newestVersion.value("Id").toVariant().toInt();
	if (newBuildNumber != BuildConfig.VERSION_BUILD)
	{
		QLOG_DEBUG() << "Found newer version with ID" << newBuildNumber;
		// Update!
		emit updateAvailable(m_repoUrl, newestVersion.value("Name").toVariant().toString(),
							 newBuildNumber);
	}
	else if (notifyNoUpdate)
	{
		emit noUpdateFound();
	}

	m_updateChecking = false;
}
Ejemplo n.º 15
0
  // Actual allocation is done by an instance of real allocator,
  // which is specified by the template parameter.
  TestAllocator() : real(createAllocator<T>())
  {
    // We use 'ON_CALL' and 'WillByDefault' here to specify the
    // default actions (call in to the real allocator). This allows
    // the tests to leverage the 'DoDefault' action.
    // However, 'ON_CALL' results in a "Uninteresting mock function
    // call" warning unless each test puts expectations in place.
    // As a result, we also use 'EXPECT_CALL' and 'WillRepeatedly'
    // to get the best of both worlds: the ability to use 'DoDefault'
    // and no warnings when expectations are not explicit.

    ON_CALL(*this, initialize(_, _, _))
      .WillByDefault(InvokeInitialize(this));
    EXPECT_CALL(*this, initialize(_, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, recover(_, _))
      .WillByDefault(InvokeRecover(this));
    EXPECT_CALL(*this, recover(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, addFramework(_, _, _, _, _))
      .WillByDefault(InvokeAddFramework(this));
    EXPECT_CALL(*this, addFramework(_, _, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, removeFramework(_))
      .WillByDefault(InvokeRemoveFramework(this));
    EXPECT_CALL(*this, removeFramework(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, activateFramework(_))
      .WillByDefault(InvokeActivateFramework(this));
    EXPECT_CALL(*this, activateFramework(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, deactivateFramework(_))
      .WillByDefault(InvokeDeactivateFramework(this));
    EXPECT_CALL(*this, deactivateFramework(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateFramework(_, _, _))
      .WillByDefault(InvokeUpdateFramework(this));
    EXPECT_CALL(*this, updateFramework(_, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, addSlave(_, _, _, _, _, _))
      .WillByDefault(InvokeAddSlave(this));
    EXPECT_CALL(*this, addSlave(_, _, _, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, removeSlave(_))
      .WillByDefault(InvokeRemoveSlave(this));
    EXPECT_CALL(*this, removeSlave(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateSlave(_, _, _, _))
      .WillByDefault(InvokeUpdateSlave(this));
    EXPECT_CALL(*this, updateSlave(_, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, addResourceProvider(_, _, _))
      .WillByDefault(InvokeAddResourceProvider(this));
    EXPECT_CALL(*this, addResourceProvider(_, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, activateSlave(_))
      .WillByDefault(InvokeActivateSlave(this));
    EXPECT_CALL(*this, activateSlave(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, deactivateSlave(_))
      .WillByDefault(InvokeDeactivateSlave(this));
    EXPECT_CALL(*this, deactivateSlave(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateWhitelist(_))
      .WillByDefault(InvokeUpdateWhitelist(this));
    EXPECT_CALL(*this, updateWhitelist(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, requestResources(_, _))
      .WillByDefault(InvokeRequestResources(this));
    EXPECT_CALL(*this, requestResources(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateAllocation(_, _, _, _))
      .WillByDefault(InvokeUpdateAllocation(this));
    EXPECT_CALL(*this, updateAllocation(_, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateAvailable(_, _))
      .WillByDefault(InvokeUpdateAvailable(this));
    EXPECT_CALL(*this, updateAvailable(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateUnavailability(_, _))
      .WillByDefault(InvokeUpdateUnavailability(this));
    EXPECT_CALL(*this, updateUnavailability(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateInverseOffer(_, _, _, _, _))
      .WillByDefault(InvokeUpdateInverseOffer(this));
    EXPECT_CALL(*this, updateInverseOffer(_, _, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, getInverseOfferStatuses())
      .WillByDefault(InvokeGetInverseOfferStatuses(this));
    EXPECT_CALL(*this, getInverseOfferStatuses())
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, recoverResources(_, _, _, _))
      .WillByDefault(InvokeRecoverResources(this));
    EXPECT_CALL(*this, recoverResources(_, _, _, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, suppressOffers(_, _))
      .WillByDefault(InvokeSuppressOffers(this));
    EXPECT_CALL(*this, suppressOffers(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, reviveOffers(_, _))
      .WillByDefault(InvokeReviveOffers(this));
    EXPECT_CALL(*this, reviveOffers(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, setQuota(_, _))
      .WillByDefault(InvokeSetQuota(this));
    EXPECT_CALL(*this, setQuota(_, _))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, removeQuota(_))
      .WillByDefault(InvokeRemoveQuota(this));
    EXPECT_CALL(*this, removeQuota(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, updateWeights(_))
      .WillByDefault(InvokeUpdateWeights(this));
    EXPECT_CALL(*this, updateWeights(_))
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, pause())
      .WillByDefault(InvokePause(this));
    EXPECT_CALL(*this, pause())
      .WillRepeatedly(DoDefault());

    ON_CALL(*this, resume())
      .WillByDefault(InvokeResume(this));
    EXPECT_CALL(*this, resume())
      .WillRepeatedly(DoDefault());
  }
Ejemplo n.º 16
0
  void unallocate(const Resources& toUnallocate)
  {
    allocated -= toUnallocate;

    updateAvailable();
  }
Ejemplo n.º 17
0
void UpdateChecker::processData()
{

    QByteArray buf;
    buf.append(_socket->readAll());

    bool endOfLine = false;

    while ((!endOfLine))
    {

        char ch;
        if(_socket->bytesAvailable()>0)
        {
            int bytesRead = _socket->read(&ch, sizeof(ch));
            if (bytesRead == sizeof(ch))
            {
                //cnt++;
                buf.append( ch );
                if(_socket->bytesAvailable()==0)
                {
                    endOfLine = true;

                }

            }
        }
        else
        {
            break;
        }


    }
    QString message(buf);
    QStringList parts = message.split("###",QString::SkipEmptyParts);
    if(parts.length() < 2)
    {
        qDebug() << "No version file found";
        emit noUpdateAvailable();
    }
    QString version= parts[1];
    qDebug() << version;
    _socket->close();
    QStringList tokens = version.split(".",QString::SkipEmptyParts);
    quint8 major_v = tokens[0].toInt();
    quint8 minor_v = tokens[1].toInt();
    quint8 rev_v = tokens[2].toInt();
    if(major_v > VERSION_MAJOR)
    {
        emit updateAvailable(version);
        return;
    }
    if(minor_v > VERSION_MINOR)
    {
        emit updateAvailable(version);
        return;
    }
    if(rev_v > VERSION_REV)
    {
        emit updateAvailable(version);
        return;
    }
    emit noUpdateAvailable();

}