• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QDateTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QDateTime函数的典型用法代码示例。如果您正苦于以下问题:C++ QDateTime函数的具体用法?C++ QDateTime怎么用?C++ QDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了QDateTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MetadataFactory

DTC::VideoLookupList* Video::LookupVideo( const QString    &Title,
                                              const QString    &Subtitle,
                                              const QString    &Inetref,
                                              int              Season,
                                              int              Episode,
                                              const QString    &GrabberType  )
{
    DTC::VideoLookupList *pVideoLookups = new DTC::VideoLookupList();

    MetadataLookupList list;

    MetadataFactory *factory = new MetadataFactory(NULL);

    if (factory)
        list = factory->SynchronousLookup(Title, Subtitle,
                                         Inetref, Season, Episode, GrabberType);

    if ( !list.size() )
        return pVideoLookups;

    for( int n = 0; n < list.size(); n++ )
    {
        DTC::VideoLookup *pVideoLookup = pVideoLookups->AddNewVideoLookup();

        MetadataLookup *lookup = list[n];

        if (lookup)
        {
            pVideoLookup->setTitle(lookup->GetTitle());
            pVideoLookup->setSubTitle(lookup->GetSubtitle());
            pVideoLookup->setSeason(lookup->GetSeason());
            pVideoLookup->setEpisode(lookup->GetEpisode());
            pVideoLookup->setYear(lookup->GetYear());
            pVideoLookup->setTagline(lookup->GetTagline());
            pVideoLookup->setDescription(lookup->GetDescription());
            pVideoLookup->setCertification(lookup->GetCertification());
            pVideoLookup->setInetref(lookup->GetInetref());
            pVideoLookup->setHomePage(lookup->GetHomepage());
            pVideoLookup->setReleaseDate(QDateTime(lookup->GetReleaseDate()));
            pVideoLookup->setUserRating(lookup->GetUserRating());
            pVideoLookup->setLength(lookup->GetRuntime());
            pVideoLookup->setLanguage(lookup->GetLanguage());
            pVideoLookup->setCountries(lookup->GetCountries());
            pVideoLookup->setPopularity(lookup->GetPopularity());
            pVideoLookup->setBudget(lookup->GetBudget());
            pVideoLookup->setRevenue(lookup->GetRevenue());
            pVideoLookup->setIMDB(lookup->GetIMDB());
            pVideoLookup->setTMSRef(lookup->GetTMSref());

            ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
            ArtworkList::iterator c;
            for (c = coverartlist.begin(); c != coverartlist.end(); ++c)
            {
                DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
                art->setType("coverart");
                art->setUrl((*c).url);
                art->setThumbnail((*c).thumbnail);
                art->setWidth((*c).width);
                art->setHeight((*c).height);
            }
            ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
            ArtworkList::iterator f;
            for (f = fanartlist.begin(); f != fanartlist.end(); ++f)
            {
                DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
                art->setType("fanart");
                art->setUrl((*f).url);
                art->setThumbnail((*f).thumbnail);
                art->setWidth((*f).width);
                art->setHeight((*f).height);
            }
            ArtworkList bannerlist = lookup->GetArtwork(kArtworkBanner);
            ArtworkList::iterator b;
            for (b = bannerlist.begin(); b != bannerlist.end(); ++b)
            {
                DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
                art->setType("banner");
                art->setUrl((*b).url);
                art->setThumbnail((*b).thumbnail);
                art->setWidth((*b).width);
                art->setHeight((*b).height);
            }
            ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
            ArtworkList::iterator s;
            for (s = screenshotlist.begin(); s != screenshotlist.end(); ++s)
            {
                DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
                art->setType("screenshot");
                art->setUrl((*s).url);
                art->setThumbnail((*s).thumbnail);
                art->setWidth((*s).width);
                art->setHeight((*s).height);
            }

            delete lookup;
        }
    }

    pVideoLookups->setCount         ( list.count()                 );
    pVideoLookups->setAsOf          ( QDateTime::currentDateTime() );
//.........这里部分代码省略.........
开发者ID:StefanRoss,项目名称:mythtv,代码行数:101,代码来源:video.cpp


示例2: refreshMetrics

// Refresh not up to date metrics
void MetricAggregator::refreshMetrics()
{
    refreshMetrics(QDateTime());
}
开发者ID:Gerryboy1964,项目名称:GoldenCheetah,代码行数:5,代码来源:MetricAggregator.cpp


示例3: QDateTime

    QDateTime InfoTimeDestination::dateTime() const
    {
	return QDateTime( QDate( m_year, m_month, m_day ),
			  QTime( m_hour, m_minute, 0 ) );
    }
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:5,代码来源:InfoTimeDestination.cpp


示例4: Q_D

/*!
    Sets minimum \a minTime and maximum \a maxTime in QTime format. This will allow the user to set a time range on datetime picker.

    \param minTime minimum time in QTime format.
    \param maxTime maximum time in QTime format.

    \sa setMinimumTime \sa setMaximumTime
*/
void HbDateTimePicker::setTimeRange(const QTime &minTime, const QTime &maxTime)
{
    Q_D(HbDateTimePicker);
    setDateTimeRange(QDateTime(d->mMinimumDate.date(), minTime),
                     QDateTime(d->mMinimumDate.date(), maxTime));
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:14,代码来源:hbdatetimepicker.cpp


示例5: qDebug

        qDebug() << "Failed to save the recurrent event; error:" << defaultManager.error();
    //! [Creating a recurrent event]

    //! [Retrieving occurrences of a particular recurrent event within a time period]
    QList<QOrganizerItem> instances = defaultManager.itemOccurrences(marshmallowMeeting, startDateTime, endDateTime);
    //! [Retrieving occurrences of a particular recurrent event within a time period]
    qDebug() << "dumping retrieved instances:";
    foreach(const QOrganizerItem& currInst, instances)
    {
        dumpItem(currInst);
        qDebug() << "....................";
    }


    //! [Retrieving the next 5 occurrences of a particular recurrent event]
    instances = defaultManager.itemOccurrences(marshmallowMeeting, QDateTime::currentDateTime(), QDateTime(), 5);
    //! [Retrieving the next 5 occurrences of a particular recurrent event]

    //! [Retrieving the next 10 occurrences of any item (Agenda View)]
    instances = defaultManager.items(QDateTime::currentDateTime(), QDateTime());
    instances = instances.mid(0, 10);
    //! [Retrieving the next 10 occurrences of any item (Agenda View)]

    //! [Creating a non-recurrent entry]
    // a default constructed journal will have it's date/time set to the current date/time.
    QOrganizerJournal journal;
    journal.setDescription("The conference went well.  We all agree that marshmallows are awesome, "\
                    "but we were unable to reach any agreement as to how we could possibly "\
                    "increase our intake of marshmallows.  Several action points were assigned "\
                    "to various members of the group; I have been tasked with finding a good "\
                    "recipe that combines both marshmallows and chocolate, by next Wednesday.");
开发者ID:tmcguire,项目名称:qt-mobility,代码行数:31,代码来源:qtorganizerdocsample.cpp


示例6: QDateTime

void PublicationType::clearDate()
{
    m_date = QDateTime();
}
开发者ID:Nazardo,项目名称:QEbu,代码行数:4,代码来源:coremetadatatype.cpp


示例7: hasScaleBasedVisibility


//.........这里部分代码省略.........

  layerElement.appendChild( layerName );
  layerElement.appendChild( layerTitle );
  layerElement.appendChild( layerAbstract );

  // layer keyword list
  QStringList keywordStringList = keywordList().split( "," );
  if ( keywordStringList.size() > 0 )
  {
    QDomElement layerKeywordList = document.createElement( "keywordList" );
    for ( int i = 0; i < keywordStringList.size(); ++i )
    {
      QDomElement layerKeywordValue = document.createElement( "value" );
      QDomText layerKeywordText = document.createTextNode( keywordStringList.at( i ).trimmed() );
      layerKeywordValue.appendChild( layerKeywordText );
      layerKeywordList.appendChild( layerKeywordValue );
    }
    layerElement.appendChild( layerKeywordList );
  }

  // layer metadataUrl
  QString aDataUrl = dataUrl();
  if ( !aDataUrl.isEmpty() )
  {
    QDomElement layerDataUrl = document.createElement( "dataUrl" );
    QDomText layerDataUrlText = document.createTextNode( aDataUrl );
    layerDataUrl.appendChild( layerDataUrlText );
    layerDataUrl.setAttribute( "format", dataUrlFormat() );
    layerElement.appendChild( layerDataUrl );
  }

  // layer legendUrl
  QString aLegendUrl = legendUrl();
  if ( !aLegendUrl.isEmpty() )
  {
    QDomElement layerLegendUrl = document.createElement( "legendUrl" );
    QDomText layerLegendUrlText = document.createTextNode( aLegendUrl );
    layerLegendUrl.appendChild( layerLegendUrlText );
    layerLegendUrl.setAttribute( "format", legendUrlFormat() );
    layerElement.appendChild( layerLegendUrl );
  }

  // layer attribution
  QString aAttribution = attribution();
  if ( !aAttribution.isEmpty() )
  {
    QDomElement layerAttribution = document.createElement( "attribution" );
    QDomText layerAttributionText = document.createTextNode( aAttribution );
    layerAttribution.appendChild( layerAttributionText );
    layerAttribution.setAttribute( "href", attributionUrl() );
    layerElement.appendChild( layerAttribution );
  }

  // layer metadataUrl
  QString aMetadataUrl = metadataUrl();
  if ( !aMetadataUrl.isEmpty() )
  {
    QDomElement layerMetadataUrl = document.createElement( "metadataUrl" );
    QDomText layerMetadataUrlText = document.createTextNode( aMetadataUrl );
    layerMetadataUrl.appendChild( layerMetadataUrlText );
    layerMetadataUrl.setAttribute( "type", metadataUrlType() );
    layerMetadataUrl.setAttribute( "format", metadataUrlFormat() );
    layerElement.appendChild( layerMetadataUrl );
  }

  // timestamp if supported
  if ( timestamp() > QDateTime() )
  {
    QDomElement stamp = document.createElement( "timestamp" );
    QDomText stampText = document.createTextNode( timestamp().toString( Qt::ISODate ) );
    stamp.appendChild( stampText );
    layerElement.appendChild( stamp );
  }

  layerElement.appendChild( layerName );

  // zorder
  // This is no longer stored in the project file. It is superfluous since the layers
  // are written and read in the proper order.

  // spatial reference system id
  QDomElement mySrsElement = document.createElement( "srs" );
  mCRS->writeXML( mySrsElement, document );
  layerElement.appendChild( mySrsElement );

#if 0
  // <transparencyLevelInt>
  QDomElement transparencyLevelIntElement = document.createElement( "transparencyLevelInt" );
  QDomText    transparencyLevelIntText    = document.createTextNode( QString::number( getTransparency() ) );
  transparencyLevelIntElement.appendChild( transparencyLevelIntText );
  maplayer.appendChild( transparencyLevelIntElement );
#endif

  // now append layer node to map layer node

  writeCustomProperties( layerElement, document );

  return writeXml( layerElement, document );

} // bool QgsMapLayer::writeXML
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:101,代码来源:qgsmaplayer.cpp


示例8: Q_ASSERT_X

	void DailyRollingFileAppender::computeRollOverTime()
	{
	    // Q_ASSERT_X(, "DailyRollingFileAppender::computeRollOverTime()", "Lock must be held by caller")
	    Q_ASSERT_X(!mActiveDatePattern.isEmpty(), "DailyRollingFileAppender::computeRollOverTime()", "No active date pattern");
	
	    QDateTime now = QDateTime::currentDateTime();
	    QDate now_date = now.date();
	    QTime now_time = now.time();
	    QDateTime start;
	    
	    switch (mFrequency)
	    {
	        case MINUTELY_ROLLOVER:
	            {
	                start = QDateTime(now_date,
	                                  QTime(now_time.hour(),
	                                        now_time.minute(),
	                                        0, 0));
	                mRollOverTime = start.addSecs(60);
	            } 
	            break;
	        case HOURLY_ROLLOVER:
	            {
	                start = QDateTime(now_date,
	                                  QTime(now_time.hour(),
	                                        0, 0, 0));
	                mRollOverTime = start.addSecs(60*60);
	            }
	            break;
	        case HALFDAILY_ROLLOVER:
	            {
	                int hour = now_time.hour();
	                if (hour >=  12)
	                    hour = 12;
	                else
	                    hour = 0;
	                start = QDateTime(now_date,
	                                  QTime(hour, 0, 0, 0));
	                mRollOverTime = start.addSecs(60*60*12);
	            }
	            break;
	        case DAILY_ROLLOVER:
	            {
	                start = QDateTime(now_date,
	                                  QTime(0, 0, 0, 0));
	                mRollOverTime = start.addDays(1);
	            }
	            break;
	        case WEEKLY_ROLLOVER:
	            { 
	                // QT numbers the week days 1..7. The week starts on Monday.
	                // Change it to being numbered 0..6, starting with Sunday.
	                int day = now_date.dayOfWeek();
	                if (day == Qt::Sunday)
	                    day = 0;
	                start = QDateTime(now_date,
	                                  QTime(0, 0, 0, 0)).addDays(-1 * day);
	                mRollOverTime = start.addDays(7);
	            }
	            break;
	        case MONTHLY_ROLLOVER:
	            {
	                start = QDateTime(QDate(now_date.year(),
	                                        now_date.month(),
	                                        1),
	                                  QTime(0, 0, 0, 0));
	                mRollOverTime = start.addMonths(1);
	            }
	            break;
	        default:
	            Q_ASSERT_X(false, "DailyRollingFileAppender::computeInterval()", "Invalid datePattern constant");
	            mRollOverTime = QDateTime::fromTime_t(0);
	    }
	    
	    mRollOverSuffix = static_cast<DateTime>(start).toString(mActiveDatePattern);
	    Q_ASSERT_X(static_cast<DateTime>(now).toString(mActiveDatePattern) == mRollOverSuffix, 
	               "DailyRollingFileAppender::computeRollOverTime()", "File name changes within interval");
	    Q_ASSERT_X(mRollOverSuffix != static_cast<DateTime>(mRollOverTime).toString(mActiveDatePattern),
	               "DailyRollingFileAppender::computeRollOverTime()", "File name does not change with rollover");
	    
	    logger()->trace("Computing roll over time from %1: The interval start time is %2. The roll over time is %3",
	                    now,
	                    start,
	                    mRollOverTime);
	}
开发者ID:eilin1208,项目名称:QT_Test,代码行数:85,代码来源:dailyrollingfileappender.cpp


示例9: checkVariant

void tst_QXmppRpcIq::testDateTime()
{
    checkVariant(QDateTime(QDate(1998, 7, 17), QTime(14, 8, 55)),
                 QByteArray("<value><dateTime.iso8601>1998-07-17T14:08:55</dateTime.iso8601></value>"));
}
开发者ID:qxmpp-project,项目名称:qxmpp,代码行数:5,代码来源:tst_qxmpprpciq.cpp


示例10: QDate

void ClearPrivateData::dialogAccepted()
{
    QApplication::setOverrideCursor(Qt::WaitCursor);

    if (ui->history->isChecked()) {
        qint64 start = QDateTime::currentMSecsSinceEpoch();
        qint64 end = 0;

        const QDate today = QDate::currentDate();
        const QDate week = today.addDays(1 - today.dayOfWeek());
        const QDate month = QDate(today.year(), today.month(), 1);

        switch (ui->historyLength->currentIndex()) {
        case 0: //Later Today
            end = QDateTime(today).toMSecsSinceEpoch();
            break;
        case 1: //Week
            end = QDateTime(week).toMSecsSinceEpoch();
            break;
        case 2: //Month
            end = QDateTime(month).toMSecsSinceEpoch();
            break;
        case 3: //All
            break;
        }

        if (end == 0) {
            mApp->history()->clearHistory();
        }
        else {
            const QList<int> &indexes = mApp->history()->indexesFromTimeRange(start, end);
            mApp->history()->deleteHistoryEntry(indexes);
        }
    }

    if (ui->cookies->isChecked()) {
        mApp->cookieJar()->setAllCookies(QList<QNetworkCookie>());
    }

    if (ui->cache->isChecked()) {
        clearCache();
    }

    if (ui->databases->isChecked()) {
        clearWebDatabases();
    }

    if (ui->localStorage->isChecked()) {
        clearLocalStorage();
    }

    if (ui->icons->isChecked()) {
        clearIcons();
    }

    QApplication::restoreOverrideCursor();

    ui->clear->setEnabled(false);
    ui->clear->setText(tr("Done"));

    QTimer::singleShot(1000, this, SLOT(close()));
}
开发者ID:DmitriK,项目名称:qupzilla,代码行数:62,代码来源:clearprivatedata.cpp


示例11: QDateTime

HUrl::HUrl()
{
    this->_set(QString(), QDateTime());         // Null QDateTime is not valid()
}
开发者ID:simio,项目名称:H.VHS,代码行数:4,代码来源:hurl.cpp


示例12: accessed

/*!
    If \a time is \c CreationTime, return when the file was created.
    If \a time is \c ModificationTime, return when the file was most
    recently modified. If \a time is \c AccessTime, return when the
    file was most recently accessed (e.g. read or written).
    If the time cannot be determined return QDateTime() (an invalid
    date time).

    This virtual function must be reimplemented by all subclasses.

    \sa setFileName(), QDateTime, QDateTime::isValid(), FileTime
 */
QDateTime QAbstractFileEngine::fileTime(FileTime time) const
{
    Q_UNUSED(time);
    return QDateTime();
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:17,代码来源:qabstractfileengine.cpp


示例13: QDateTime

QDateTime EPGItem::end() const
{
    return QDateTime( m_start ).addSecs( m_duration );
}
开发者ID:0xheart0,项目名称:vlc,代码行数:4,代码来源:EPGItem.cpp


示例14: CodecPlugin

soundkonverter_codec_ffmpeg::soundkonverter_codec_ffmpeg( QObject *parent, const QStringList& args  )
    : CodecPlugin( parent )
{
    Q_UNUSED(args)

    binaries["ffmpeg"] = "";

    KSharedConfig::Ptr conf = KGlobal::config();
    KConfigGroup group;

    group = conf->group( "Plugin-"+name() );
    configVersion = group.readEntry( "configVersion", 0 );
    experimentalCodecsEnabled = group.readEntry( "experimentalCodecsEnabled", false );
    ffmpegVersionMajor = group.readEntry( "ffmpegVersionMajor", 0 );
    ffmpegVersionMinor = group.readEntry( "ffmpegVersionMinor", 0 );
    ffmpegLastModified = group.readEntry( "ffmpegLastModified", QDateTime() );
    ffmpegCodecList = group.readEntry( "codecList", QStringList() ).toSet();

    CodecData data;
    FFmpegCodecData ffmpegData;

    // WARNING enabled codecs need to be rescanned everytime new codecs are added here -> increase plugin version

    data.ffmpegCodecList.clear();
    data.codecName = "wav";
    ffmpegData.name = "wav";
    ffmpegData.external = false;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "ogg vorbis";
    ffmpegData.name = "libvorbis";
    ffmpegData.external = true;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    ffmpegData.name = "vorbis";
    ffmpegData.external = true; // ?
    ffmpegData.experimental = true;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

//     data.ffmpegCodecList.clear();
//     data.codecName = "opus";
//     ffmpegData.name = "opus";
//     ffmpegData.external = true;
//     ffmpegData.experimental = false;
//     data.ffmpegCodecList.append( ffmpegData );
//     codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "mp3";
    ffmpegData.name = "libmp3lame";
    ffmpegData.external = true;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "flac";
    ffmpegData.name = "flac";
    ffmpegData.external = false;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "wma";
    ffmpegData.name = "wmav2";
    ffmpegData.external = false;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    ffmpegData.name = "wmav1";
    ffmpegData.external = false;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "aac";
    ffmpegData.name = "libfaac";
    ffmpegData.external = true;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    ffmpegData.name = "aac";
    ffmpegData.external = false;
    ffmpegData.experimental = true;
    data.ffmpegCodecList.append( ffmpegData );
    codecList.append( data );

    data.ffmpegCodecList.clear();
    data.codecName = "m4a/aac";
    ffmpegData.name = "libfaac";
    ffmpegData.external = true;
    ffmpegData.experimental = false;
    data.ffmpegCodecList.append( ffmpegData );
    ffmpegData.name = "aac";
    ffmpegData.external = false;
    ffmpegData.experimental = true;
//.........这里部分代码省略.........
开发者ID:unwork-inc,项目名称:soundkonverter,代码行数:101,代码来源:soundkonverter_codec_ffmpeg.cpp


示例15: toInt

  int n;

  if((n=RDGetSqlValue("CUTS","CUT_NAME",cut_name,"END_POINT",cut_db).
      toInt())!=-1) {
    return n;
  }
  return (int)length();
}


void RDCut::logPlayout() const
{
  QString sql=
    QString().sprintf("update CUTS set LAST_PLAY_DATETIME=\"%s\",\
                       PLAY_COUNTER=%d,LOCAL_COUNTER=%d where CUT_NAME=\"%s\"",
		      (const char *)QDateTime(QDate::currentDate(),
		        QTime::currentTime()).toString("yyyy-MM-dd hh:mm:ss"),
		      playCounter()+1,localCounter()+1,(const char *)cut_name);
  RDSqlQuery *q=new RDSqlQuery(sql);
  delete q;
}


bool RDCut::copyTo(RDStation *station,RDUser *user,
		   const QString &cutname,RDConfig *config) const
{
#ifdef WIN32
  return false;
#else
  QString sql;
  RDSqlQuery *q;
  bool ret=true;
开发者ID:LucaSoldi,项目名称:rivendell,代码行数:32,代码来源:rdcut.cpp


示例16: Q_UNUSED

QDateTime KGPGFile::keyExpires(const QString& name)
{
  Q_UNUSED(name);
  return QDateTime();
}
开发者ID:KDE,项目名称:kmymoney,代码行数:5,代码来源:kgpgfile.cpp


示例17: isValid

bool RDCut::isValid() const
{
  return isValid(QDateTime(QDate::currentDate(),QTime::currentTime()));
}
开发者ID:LucaSoldi,项目名称:rivendell,代码行数:4,代码来源:rdcut.cpp


示例18: qxt_d

/*!
 * \reimp
 */
void QxtHttpSessionManager::processEvents()
{
    if (QThread::currentThreadId() != qxt_d().mainThread)
    {
        QMetaObject::invokeMethod(this, "processEvents", Qt::QueuedConnection);
        return;
    }
    QxtHttpSessionManagerPrivate& d = qxt_d();
    QMutexLocker locker(&d.eventLock);
    if (!d.eventQueue.count()) return;

    int ct = d.eventQueue.count(), sessionID = 0, requestID = 0, pagePos = -1;
    QxtWebRedirectEvent* re = 0;
    QxtWebPageEvent* pe = 0;
    for (int i = 0; i < ct; i++)
    {
        if (d.eventQueue[i]->type() != QxtWebEvent::Page && d.eventQueue[i]->type() != QxtWebEvent::Redirect) continue;
        pagePos = i;
        sessionID = d.eventQueue[i]->sessionID;
        if (d.eventQueue[pagePos]->type() == QxtWebEvent::Redirect)
        {
            re = static_cast<QxtWebRedirectEvent*>(d.eventQueue[pagePos]);
        }
        pe = static_cast<QxtWebPageEvent*>(d.eventQueue[pagePos]);
        requestID = pe->requestID;
        break;
    }
    if (pagePos == -1) return; // no pages to send yet

    QHttpResponseHeader header;
    QList<int> removeIDs;
    QxtWebEvent* e = 0;
    for (int i = 0; i < pagePos; i++)
    {
        if (d.eventQueue[i]->sessionID != sessionID) continue;
        e = d.eventQueue[i];
        if (e->type() == QxtWebEvent::StoreCookie)
        {
            QxtWebStoreCookieEvent* ce = static_cast<QxtWebStoreCookieEvent*>(e);
            QString cookie = ce->name + '=' + ce->data;
            if (!ce->path.isEmpty())
                cookie += "; path=" + ce->path;
            if (ce->expiration.isValid())
            {
                cookie += "; max-age=" + QString::number(QDateTime::currentDateTime().secsTo(ce->expiration))
                          + "; expires=" + ce->expiration.toUTC().toString("ddd, dd-MMM-YYYY hh:mm:ss GMT");
            }
            header.addValue("set-cookie", cookie);
            removeIDs.push_front(i);
        }
        else if (e->type() == QxtWebEvent::RemoveCookie)
        {
            QxtWebRemoveCookieEvent* ce = static_cast<QxtWebRemoveCookieEvent*>(e);
            QString path;
            if(!ce->path.isEmpty()) path = "path=" + ce->path + "; ";
            header.addValue("set-cookie", ce->name + "=; "+path+"max-age=0; expires=" + QDateTime(QDate(1970, 1, 1)).toString("ddd, dd-MMM-YYYY hh:mm:ss GMT"));
            removeIDs.push_front(i);
        }
    }
    removeIDs.push_front(pagePos);

    QIODevice* device = connector()->getRequestConnection(requestID);
    QxtWebContent* content = qobject_cast<QxtWebContent*>(device);
    // TODO: This should only be invoked when pipelining occurs
    // In theory it shouldn't cause any problems as POST is specced to not be pipelined
    if (content) content->ignoreRemainingContent();
    QHash<QPair<int,int>,QxtWebRequestEvent*>::iterator iPending =
	qxt_d().pendingRequests.find(QPair<int,int>(sessionID, requestID));
    if(iPending != qxt_d().pendingRequests.end()){
	delete *iPending;
	qxt_d().pendingRequests.erase(iPending);
    }

    QxtHttpSessionManagerPrivate::ConnectionState& state = qxt_d().connectionState[connector()->getRequestConnection(requestID)];
    QIODevice* source;
    header.setStatusLine(pe->status, pe->statusMessage, state.httpMajorVersion, state.httpMinorVersion);

    if (re)
    {
        header.setValue("location", re->destination);
    }

    // Set custom header values
    for (QMultiHash<QString, QString>::iterator it = pe->headers.begin(); it != pe->headers.end(); ++it)
    {
        header.setValue(it.key(), it.value());
    }

    header.setContentType(pe->contentType);
    if (state.httpMajorVersion == 0 || (state.httpMajorVersion == 1 && state.httpMinorVersion == 0))
        pe->chunked = false;

    source = pe->dataSource;
    state.finishedTransfer = false;
    bool emptyContent = !source->bytesAvailable() && !pe->streaming;
    state.readyRead = source->bytesAvailable();
    state.streaming = pe->streaming;
//.........这里部分代码省略.........
开发者ID:AshotN,项目名称:tomahawk,代码行数:101,代码来源:qxthttpsessionmanager.cpp


示例19: while

QString CustomEdit::evaluate(QString clause)
{
    int s0=0;
    int e0=0;

    while (1) {
        s0 = clause.indexOf (QRegExp("\\{[A-Z]+\\}"), e0);

        if (s0 < 0)
            break;

        e0 = clause.indexOf ("}", s0);

        QString mid = clause.mid(s0 + 1, e0 - s0 - 1);
        QString repl = "";

        if (!mid.compare("TITLE")) {
            repl = m_pginfo->GetTitle();
            repl.replace("\'","\'\'");
        } else if (!mid.compare("SUBTITLE")) {
            repl = m_pginfo->GetSubtitle();
            repl.replace("\'","\'\'");
        } else if (!mid.compare("DESCR")) {
            repl = m_pginfo->GetDescription();
            repl.replace("\'","\'\'");
        } else if (!mid.compare("SERIESID")) {
            repl = QString("%1").arg(m_pginfo->GetSeriesID());
        } else if (!mid.compare("PROGID")) {
            repl = m_pginfo->GetProgramID();
        } else if (!mid.compare("SEASON")) {
            repl = QString::number(m_pginfo->GetSeason());
        } else if (!mid.compare("EPISODE")) {
            repl = QString::number(m_pginfo->GetEpisode());
        } else if (!mid.compare("CATEGORY")) {
            repl = m_pginfo->GetCategory();
        } else if (!mid.compare("CHANID")) {
            repl = QString("%1").arg(m_pginfo->GetChanID());
        } else if (!mid.compare("CHANNUM")) {
            repl = m_pginfo->GetChanNum();
        } else if (!mid.compare("SCHEDID")) {
            repl = m_pginfo->GetChannelSchedulingID();
        } else if (!mid.compare("CHANNAME")) {
            repl = m_pginfo->GetChannelName();
        } else if (!mid.compare("DAYNAME")) {
            repl = m_pginfo->GetScheduledStartTime().toString("dddd");
        } else if (!mid.compare("STARTDATE")) {
            repl = m_pginfo->GetScheduledStartTime().toString("yyyy-mm-dd hh:mm:ss");
        } else if (!mid.compare("ENDDATE")) {
            repl = m_pginfo->GetScheduledEndTime().toString("yyyy-mm-dd hh:mm:ss");
        } else if (!mid.compare("STARTTIME")) {
            repl = m_pginfo->GetScheduledStartTime().toString("hh:mm");
        } else if (!mid.compare("ENDTIME")) {
            repl = m_pginfo->GetScheduledEndTime().toString("hh:mm");
        } else if (!mid.compare("STARTSEC")) {
            QDateTime date = m_pginfo->GetScheduledStartTime();
            QDateTime midnight = QDateTime(date.date());
            repl = QString("%1").arg(midnight.secsTo(date));
        } else if (!mid.compare("ENDSEC")) {
            QDateTime date = m_pginfo->GetScheduledEndTime(); 
            QDateTime midnight = QDateTime(date.date());
            repl = QString("%1").arg(midnight.secsTo(date));
        }
        // unknown tags are simply removed
        clause.replace(s0, e0 - s0 + 1, repl);
    }
    return clause;
}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:67,代码来源:customedit.cpp


示例20: QDateTime

void OSCPacketDispatcher::dispatchMessage(OSCMessage& message, QHostAddress& address)
{
    QDateTime dtimeNull = QDateTime();
    dispatchMessage(message, address, dtimeNull);
}
开发者ID:dodata3,项目名称:reroot,代码行数:5,代码来源:OSCPacketDispatcher.cpp



注:本文中的QDateTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QDesktopWidget函数代码示例发布时间:2022-05-30
下一篇:
C++ QDate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap