Exemple #1
0
QVariantList OAuthData::toList() const
{
  QVariantList list;
  list.append(provider);
  list.append(name);
  list.append(htmlName);
  list.append(toUrl("${STATE}"));
  return list;
}
void QgsFilePickerWidget::setFilePath( QString path )
{
  if ( path == QSettings().value( "qgis/nullValue", "NULL" ) )
  {
    path = "";
  }
  mFilePath = path;
  mLineEdit->setText( path );
  mLinkLabel->setText( toUrl( path ) );
  emit fileChanged( mFilePath );
}
Exemple #3
0
QVariantMap OAuthData::toJSON(const QByteArray &state) const
{
  ChatId s(state);
  if (s.isNull())
    s.init(ChatId::MessageId);

  QVariantMap data;
  data[LS("name")]     = name;
  data[LS("htmlName")] = htmlName;
  data[LS("url")]      = toUrl(s.toBase32());
  data[LS("type")]     = type;
  return data;
}
void Song::toListItem(string host, string port, string bitrate, itemRecord& item) const {
    TRACE("Song::toListItem");
    string url = toUrl(host, port, bitrate);
    
    memset(&item,0,sizeof(itemRecord));
    item.album    = strdup(album  .c_str());
    item.artist   = strdup(artist .c_str());
    item.title    = strdup(title  .c_str());
    item.genre    = strdup(genre  .c_str());
    item.filename = strdup(url    .c_str());
    item.comment  = strdup(comment.c_str());
    item.track    =        track;
    item.year     =        year;
    item.length   =        songlen;
}
Exemple #5
0
int main(int argc, char *argv[]) {
    QCoreApplication a(argc, argv);

    auto b = new QtCoroutine([](const QtYield & yield)->void {
        QNetworkAccessManager nasm;
        QUrl url("http://www.google.com/");
        QNetworkRequest request(url);

        auto reply = nasm.get(request);
        qDebug() << "GET http://www.google.com/";
        // NOTE yield to main event loop until request finished
        yield(reply, SIGNAL(finished()));

        // follow 301/302 redirection
        auto a = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
        while (a.isValid()) {
            QUrl target = a.toUrl();
            qDebug() << "redirect to" << target;
            if (target.isRelative()) {
                target = url.resolved(target);
            }
            request.setUrl(target);

            reply->deleteLater();
            reply = nasm.get(request);
            // NOTE yield to main event loop until request finished
            yield(reply, SIGNAL(finished()));

            a = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
        }

        auto data = reply->readAll();
        reply->deleteLater();

        qDebug() << data;
    });
    // NOTE when coroutine finished (i.e. reaches end or return), `finished()` emitted
    b->connect(b, SIGNAL(finished()), SLOT(deleteLater()));
    a.connect(b, SIGNAL(finished()), SLOT(quit()));
    b->start();

    return a.exec();
}
SettingsManager::SettingsManager() :
    mSettings("Nocturn")
{
    assert(!mThisPointer);
    mThisPointer = this;

    mSettings.beginGroup("Streams");
    const QStringList& streams(mSettings.childKeys());
    bool url = false;
    QString name;
    for (auto it(streams.begin()); it != streams.end(); ++it)
    {
        auto value(mSettings.value(*it));
        url = !url;
        if (url)
        {
            name = value.toString();
        } else {
            mAudioStreams.push_back(std::make_pair(name, value.toUrl()));
        }
    }
    mSettings.endGroup();
}
Exemple #7
0
int main(int argc, const char* argv[])
{

    if(argc < 6)
    {
        printf("not enough arguments\n");
        usage(argv[0]);
        exit(1);
    }

    // Get the options and parameters
    parseArgs(argc, argv);

    printf("From: %s\n", fromAor ? fromAor : "null");
    printf("To: %s\n", toAor ? toAor : "null");
    printf("SIP Port: %d\n", sipPort);

    // Create a user agent
    SipUserAgent userAgent(sipPort, sipPort);

    // Create an IM client
    Url toUrl(toAor);
    Url fromUrl(fromAor);
    UtlString fromDisplay;
    fromUrl.getDisplayName(fromDisplay);
    if(fromDisplay.isNull())
    {
        fromUrl.getUserId(fromDisplay);
    }

    if(fromDisplay.isNull())
    {
        fromDisplay = "me";
    }

    SipPimClient imClient(userAgent, fromUrl);
    imClient.start();

    // Register a call back to print out the incoming message
    imClient.setIncomingImTextHandler(imTextPrinter);

    // Prompt if not running in batch mode
    UtlBoolean doPrompt = isatty(STDIN_FILENO);
    if ( doPrompt )
    {
       printf("Enter IM text or -h for help\n");
       printf("%s: ", fromDisplay.data());
    }

    // Main loop: collect text and send it
    UtlBoolean done = FALSE;
    UtlBoolean isCommand = FALSE;
    char* commandLine = NULL;
    char buffer[1024];

    while(!done &&
        (commandLine = fgets(buffer,1023,stdin)))
    {

        isCommand = FALSE;
        if(*commandLine == '-')
        {
            switch(commandLine[1])
            {
            case 'a': // away
                isCommand = TRUE;
                // set the state to closed or away
                break;

            case 'h':
            case '?':
                isCommand = TRUE;
                printf("Enter: \n\t-h for help\n\t-q to quit\n");
                break;

            case 'p': // present
                isCommand = TRUE;
                // set the state to open or present
                break;

            case 'q':
                done = TRUE;
                isCommand = TRUE;
                break;

            default:
                break;
            }
        }

        // Assume it is text to send to the other end
        if(!isCommand && *commandLine)
        {
            int sipStatusCode = -1;
            UtlString sipStatusText;

            imClient.sendPagerMessage(toUrl, commandLine,
                sipStatusCode, sipStatusText);

            if(sipStatusCode >= 300)
            {
                printf("Failed to send message: %s\n",
                    sipStatusText.data());
            }
        }

        if ( doPrompt )
        {
            printf("%s: ", fromDisplay.data());
        }
    }
    return(0);
}
void QgsFilePickerWidget::textEdited( QString path )
{
  mFilePath = path;
  mLinkLabel->setText( toUrl( path ) );
  emit fileChanged( mFilePath );
}
QString QgsVirtualLayerDefinition::toString() const
{
  return QString( toUrl().toEncoded() );
}