Esempio n. 1
0
void FacebookSession::onFriendListReady()
{

    if (sender()) {
        QNetworkReply *reply = qobject_cast<QNetworkReply*> (sender());

        if (reply) {
            QString data = reply->readAll();
            Json::Value root;
            Json::Reader jsonReader;
            bool parsingSuccessful = jsonReader.parse(data.toStdString(), root);

            if (parsingSuccessful) {
                if (root.isMember("error")) {
                    qDebug() << data;
                    QVariantMap errorData;
                    errorData["command"] = QVariant("login");
                    errorData["token"] = QVariant("");
                    Q_EMIT sourceUpdated(errorData);
                    return;
                }
                const Json::Value data_list = root["data"];

                for ( int index = 0; index < data_list.size(); ++index) {
                    const char *friendID = data_list[index]["id"].asCString();
                    FacebookUserInfo *info = new FacebookUserInfo(d->manager, QString(friendID), d->mToken, this);
                    connect(info, SIGNAL(finished(FacebookUserInfo*)), this, SLOT(onUserInfoReady(FacebookUserInfo*)));
                }
            }
        }
    }
}
Esempio n. 2
0
Clock::Clock(QObject *parent) : PlexyDesk::ControllerInterface (parent)
{
    clock = new ClockWidget(QRectF(0, 0, 210, 210));

    if (connectToDataSource("timerengine")) {
        connect(dataSource(), SIGNAL(sourceUpdated(QVariantMap)), this, SLOT(onDataUpdated(QVariantMap)));
    }
}
Esempio n. 3
0
void FacebookSession::setArguments(QVariant &args)
{
    qDebug() << Q_FUNC_INFO << args;
    QVariantMap param = args.toMap();

    QString command = param["command"].toString();

    if (command == "login") {
        // it's expected that the controller sends us the key
        // so we check if the key is emptry if not notify the controller
        // with a emptry response
        QString key = param["token"].toString();

        if (key.isEmpty() || key.isNull())  {
            //Notify the client about the missing key.
            QVariantMap response;
            response["command"] = QVariant("login");
            response["token"] = QVariant("");
            d->data = response;
            qDebug() << Q_FUNC_INFO << "No key found";
            Q_EMIT sourceUpdated(response);
        }
    }

    if (command == "friends") {
        QString key = param["token"].toString();

        if (key.isEmpty() || key.isNull())  {
            //Notify the client about the missing key.
            QVariantMap response;
            response["command"] = QVariant("login");
            response["token"] = QVariant("");
            d->data = response;
            qDebug() << Q_FUNC_INFO << "No key found";
            Q_EMIT sourceUpdated(response);
            return;
        }

        d->mToken = key;
        QUrl url ("https://graph.facebook.com/me/friends?access_token=" + key);
        QNetworkReply *reply = d->manager->get(QNetworkRequest(url));

        connect(reply, SIGNAL(finished()), this, SLOT(onFriendListReady()));
    }
}
Esempio n. 4
0
void FacebookSession::onUserInfoReady(FacebookUserInfo *job)
{
    FacebookUserInfo *user = job;

    if (user)
       Q_EMIT sourceUpdated(user->userInfo());
    else
        qDebug() << Q_FUNC_INFO << "Failed converating data";

    delete job;
}
Esempio n. 5
0
AuthPlugin::AuthPlugin(QObject *object) : PlexyDesk::ControllerInterface (object)
{
     mWidget = new PlexyDesk::AuthWidget(QRectF(0, 0, 480, 320));
     mWidget->setController(this);
     mWidget->setVisible(false);

     connect(mWidget, SIGNAL(facebookToken(QString)), this, SLOT(onFacebookToken(QString)));

     mContactUI = new FacebookContactUI(QRectF(0.0, 0.0, 488.0, 320.0));
     mContactUI->setController(this);
     mContactUI->setVisible(true);

     if (connectToDataSource("facebookengine")) {
         connect(dataSource(), SIGNAL(sourceUpdated(QVariantMap)), this, SLOT(onDataUpdated(QVariantMap)));
     }
}
Esempio n. 6
0
void LocatoinData::timerEvent(QTimerEvent *timerevent) {
  bps_event_t *event = NULL;
  bps_get_event(&event, -1);

  if (event) {
    if (bps_event_get_domain(event) == geolocation_get_domain()) {
      Q_EMIT sourceUpdated(d->geoLocationEvent(event));
    } else {
      qDebug() << Q_FUNC_INFO << "Not a Geo Info Event";
      geolocation_stop_events(0);
      this->startGeoTracking();
    }
  } else {
    qDebug() << Q_FUNC_INFO << "Event not ready";
  }
}
Esempio n. 7
0
// ****************************************************************************
// Constructor:  ELPipelineBuilder::ELPipelineBuilder
//
// Programmer:  Jeremy Meredith
// Creation:    August  2, 2012
//
// Modifications:
// ****************************************************************************
ELPipelineBuilder::ELPipelineBuilder(QWidget *parent)
    : QWidget(parent)
{
    currentPipeline = -1;

    // Top layout
    QGridLayout *topLayout = new QGridLayout(this);
    pipelineChooser = new QComboBox(this);
    connect(pipelineChooser, SIGNAL(activated(int)), 
            this, SLOT(activatePipeline(int)));
    topLayout->addWidget(new QLabel("Pipeline: ", this), 0,0, 1,1);
    topLayout->addWidget(pipelineChooser, 0,1, 1,1);

    QPushButton *newPipelineBtn = new QPushButton("New Pipeline", this);
    topLayout->addWidget(newPipelineBtn, 1,0, 1,2);
    connect(newPipelineBtn, SIGNAL(clicked()),
            this, SLOT(NewPipeline()));

    QSplitter *topSplitter = new QSplitter(Qt::Vertical, this);
    topLayout->addWidget(topSplitter, 3, 0, 1, 2);

    QGroupBox *pipelineGroup = new QGroupBox("Pipeline",
                                             topSplitter);

    QGridLayout *pipelineLayout = new QGridLayout(pipelineGroup);

    //
    // The pipeline tree
    //
    tree = new QTreeWidget(pipelineGroup);
    tree->setHeaderLabels(QStringList() << "Operation" << "Settings");
    //tree->setHeaderHidden(true);
    pipelineLayout->addWidget(tree, 0,0);
    connect(tree, SIGNAL(itemSelectionChanged()),
            this, SLOT(rowSelected()));

    //
    // The operator menu
    //
    QMenu *opMenu = new QMenu();
    ///\todo: these choice names must currently match the exact text in
    /// Operation::GetOperationName.  We should loosed this restriction.
    const char *operations[] = {
        "Isosurface",
        "Elevate",
        "ExternalFace",
        "Histogram",
        "SurfaceNormals",
        "Transform",
        NULL
    };
    for (int i=0; operations[i] != NULL; i++)
    {
        QAction *op= opMenu->addAction(operations[i]);
        op->setData(QString(operations[i]));
        connect(op, SIGNAL(triggered()), this, SLOT(newOperation()));
    }
    QPushButton *addOpButton = new QPushButton("Add Operation", pipelineGroup);
    addOpButton->setMenu(opMenu);
    pipelineLayout->addWidget(addOpButton, 1,0);

    //
    // add execute button (probably not the best place for it)
    //
    QPushButton *deleteOpButton = new QPushButton("Delete Operation", pipelineGroup);
    pipelineLayout->addWidget(deleteOpButton, 2, 0);
    connect(deleteOpButton, SIGNAL(clicked()),
            this, SLOT(deleteCurrentOp()));


    //
    // add execute button (probably not the best place for it)
    //
    QPushButton *executeButton = new QPushButton("Execute", pipelineGroup);
    pipelineLayout->addWidget(executeButton, 3, 0);
    connect(executeButton, SIGNAL(clicked()),
            this, SLOT(executePipeline()));

    //
    // Settings
    //
    settingsGroup = new QGroupBox("Settings", topSplitter);
    QGridLayout *settingsLayout = new QGridLayout(settingsGroup);

    //
    // sources widgets
    //
    sourceSettings = new ELSources(settingsGroup);
    connect(sourceSettings, SIGNAL(sourceChanged()),
            this, SLOT(sourceUpdated()));
    settingsLayout->addWidget(sourceSettings);

    topSplitter->setStretchFactor(0,30);
    topSplitter->setStretchFactor(1,50);

    // add one pipeline
    Pipeline::allPipelines.push_back(new Pipeline);
    activatePipeline(0);
    pipelineChooser->addItem("");
}
void GooglePlacesEngineData::timerEvent(QTimerEvent *event) {
  Q_EMIT sourceUpdated(readAll());
}
Esempio n. 9
0
void BBConnData::timerEvent(QTimerEvent *event)
{
    Q_EMIT sourceUpdated(readAll());
}