当前位置: 首页>>代码示例>>C++>>正文


C++ QTime函数代码示例

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


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

示例1: QDate

void Cashbox::updateTotals()
{
    QString text;// = "<h1>Свод по кассе</h1><br>";

    QSqlQuery query;
    double summOnStart = 0;

    QDate start_date = QDate(2000,1,1);
    QTime start_time = QTime(0,0,0);

    QSettings *settings = data->getSettings();

    query.prepare(settings->value("cashbox/queries/first_shiftwork_document").toString());
    query.bindValue(":store", data->getVariables()->value("current_base_id"));
    query.bindValue(":user", data->getVariables()->value("user_id"));

    if(!query.exec()){
        qDebug()<<posInFile<<query.lastError().text()<<endl<<query.lastQuery()<<endl<<query.boundValues();
    }else {
        if(query.next()){
            start_date = query.value(0).toDate();
            start_time = query.value(1).toTime();
        }
    }


    text += "<h2>Товарные операции</h2>";
    query.prepare(settings->value("cashbox/queries/goods_operations_sum").toString());
    query.bindValue(":time_start",start_time);
    query.bindValue(":date_start",start_date);
    query.bindValue(":date_start2",start_date);

    if(!query.exec()){
        qDebug()<<posInFile<<query.lastError().text()<<endl<<query.lastQuery()<<endl<<query.boundValues();
    }
    while (query.next()) {
        text += "<li>"+query.value(0).toString() + ": "+ QString::number(query.value(1).toDouble(),'f',2);
        summOnStart -= query.value(1).toDouble();
    }

    text += "<h2>Денежные операции</h2>";
    query.prepare(settings->value("cashbox/queries/money_operations_sum").toString());
    query.bindValue(":time_start",start_time);
    query.bindValue(":date_start",start_date);
    query.bindValue(":date_start2",start_date);
   // qDebug()<<query.lastQuery()<<Service::join(query.boundValues());
    if(!query.exec()){
        qDebug()<<posInFile<<query.lastError().text()<<endl<<query.lastQuery()<<endl<<query.boundValues();
    }
    while (query.next()) {
        text += "<li>"+query.value(0).toString() + ": "+ QString::number(query.value(1).toDouble(),'f',2);
        summOnStart -= query.value(1).toDouble();
    }

    query.prepare(settings->value("cashbox/queries/rests_goods_sum").toString());
    if(!query.exec()){
        qDebug()<<posInFile<<query.lastError().text()<<endl<<query.lastQuery()<<endl<<query.boundValues();
    }
    double rests = 0;
    while (query.next())
       rests += query.value(0).toDouble();

    query.prepare(settings->value("cashbox/queries/rests_money_sum").toString());
    if(!query.exec()){
        qDebug()<<posInFile<<query.lastError().text()<<endl<<query.lastQuery()<<endl<<query.boundValues();
    }
    while (query.next())
       rests += query.value(0).toDouble();

    text += "<h2>Остаток в кассе: "+ QString::number(rests,'f',2)+"</h2>";
    summOnStart += rests;


    text = "Смена с "+start_date.toString("dd.MM.yyyy")+" "+start_time.toString("hh:mm:ss")
             + "<h2>Остаток на начало: "+ QString::number(summOnStart,'f',2)+"</h2>"
             + text;



    totals.setText(text);
}
开发者ID:dmitry-aka-jok,项目名称:jpos2,代码行数:81,代码来源:cashbox.cpp

示例2: QDialog

UI_AveragerWindow::UI_AveragerWindow(QWidget *w_parent, int annot_nr)
{
  int i, n;

  long long recording_duration;

  struct annotationblock *annot;

  mainwindow = (UI_Mainwindow *)w_parent;

  averager_dialog = new QDialog(w_parent);

  averager_dialog->setMinimumSize(600, 400);
  averager_dialog->setMaximumSize(600, 400);
  averager_dialog->setWindowTitle("Average waveforms");
  averager_dialog->setModal(true);
  averager_dialog->setAttribute(Qt::WA_DeleteOnClose, true);

  annotLabel = new QLabel(averager_dialog);
  annotLabel->setGeometry(20, 20, 100, 25);
  annotLabel->setText("Use annotation:");

  annotNameLabel = new QLabel(averager_dialog);
  annotNameLabel->setGeometry(130, 20, 200, 25);

  signalLabel = new QLabel(averager_dialog);
  signalLabel->setGeometry(340, 20, 100, 25);
  signalLabel->setText("Select signal(s):");

  list = new QListWidget(averager_dialog);
  list->setGeometry(450, 20, 130, 360);
  list->setSelectionBehavior(QAbstractItemView::SelectRows);
  list->setSelectionMode(QAbstractItemView::ExtendedSelection);

  time1.setHMS(0, 0, 0, 0);

  recording_duration = (mainwindow->edfheaderlist[0]->datarecords * mainwindow->edfheaderlist[0]->long_data_record_duration) / TIME_DIMENSION;

  time2.setHMS((recording_duration / 3600) % 24, (recording_duration % 3600) / 60, recording_duration % 60, 0);

  time1Label = new QLabel(averager_dialog);
  time1Label->setGeometry(20, 65, 100, 25);
  time1Label->setText("From (hh:mm:ss)");

  timeEdit1 = new QTimeEdit(averager_dialog);
  timeEdit1->setGeometry(130, 65, 110, 25);
  timeEdit1->setDisplayFormat("hh:mm:ss.zzz");
  timeEdit1->setMinimumTime(QTime(0, 0, 0, 0));
  timeEdit1->setMaximumTime(time2);

  time2Label = new QLabel(averager_dialog);
  time2Label->setGeometry(20, 110, 100, 25);
  time2Label->setText("To (hh:mm:ss)");

  timeEdit2 = new QTimeEdit(averager_dialog);
  timeEdit2->setGeometry(130, 110, 110, 25);
  timeEdit2->setDisplayFormat("hh:mm:ss.zzz");
  timeEdit2->setMinimumTime(QTime(0, 0, 0, 0));
  timeEdit2->setMaximumTime(time2);
  timeEdit2->setTime(time2);

  ratioLabel = new QLabel(averager_dialog);
  ratioLabel->setGeometry(20, 155, 100, 75);
  ratioLabel->setText("Ratio of time\n"
                      "before and after\n"
                      "trigger:");

  ratioBox = new QComboBox(averager_dialog);
  ratioBox->setGeometry(130, 180, 100, 25);
  ratioBox->addItem("10 / 90");
  ratioBox->addItem("25 / 75");
  ratioBox->addItem("50 / 50");
  ratioBox->setCurrentIndex(mainwindow->average_ratio);

  bufsizeLabel = new QLabel(averager_dialog);
  bufsizeLabel->setGeometry(20, 250, 100, 25);
  bufsizeLabel->setText("Average period:");

  avg_periodspinbox = new QDoubleSpinBox(averager_dialog);
  avg_periodspinbox->setGeometry(130, 250, 100, 25);
  avg_periodspinbox->setDecimals(3);
  avg_periodspinbox->setRange(0.01, 300.0);
  avg_periodspinbox->setSuffix(" sec");
  avg_periodspinbox->setValue(mainwindow->average_period);

  CloseButton = new QPushButton(averager_dialog);
  CloseButton->setGeometry(20, 355, 100, 25);
  CloseButton->setText("Cancel");

  StartButton = new QPushButton(averager_dialog);
  StartButton->setGeometry(310, 355, 100, 25);
  StartButton->setText("Start");

  for(i=0; i<mainwindow->signalcomps; i++)
  {
    if(mainwindow->signalcomp[i]->alias[0] != 0)
    {
      new QListWidgetItem(mainwindow->signalcomp[i]->alias, list);
    }
    else
//.........这里部分代码省略.........
开发者ID:aung2phyowai,项目名称:EDFbrowser,代码行数:101,代码来源:averager_dialog.cpp

示例3: switch


//.........这里部分代码省略.........
    "START_HOUR int not null,"+
    "START_SECS int not null,"+
    "CART_NUMBER int unsigned,"+
    "TITLE char(255),"+
    "LENGTH int,"+
    "INSERT_BREAK enum('N','Y') default 'N',"+
    "INSERT_TRACK enum('N','Y') default 'N',"+
    "INSERT_FIRST int unsigned default 0,"+
    "TRACK_STRING char(255),"+
    "EXT_DATA char(32),"+
    "EXT_EVENT_ID char(32),"+
    "EXT_ANNC_TYPE char(8),"+
    "EXT_CART_NAME char(32),"+
    "LINK_START_TIME time default NULL,"+
    "LINK_LENGTH int default NULL,"+
    "EVENT_USED enum('N','Y') default 'N',"+
    "INDEX START_TIME_IDX (START_HOUR,START_SECS))";
  q=new RDSqlQuery(sql);
  delete q;

  //
  // Parse and Save
  //
  int line_id=0;
  bool insert_found=false;
  bool cart_ok=false;
  bool start_time_ok=false;
  bool line_used=false;
  bool insert_break=false;
  bool insert_track=false;
  bool break_first=false;
  bool track_first=false;
  QString track_label;
  QTime link_time;
  int link_length=-1;

  while(fgets(buf,RD_MAX_IMPORT_LINE_LENGTH,infile)!=NULL) {
    line_used=false;
    str_buf=QString(buf);

    //
    // Cart Number
    //
    cartnum=0;
    cartname=str_buf.mid(cart_offset,cart_length).stripWhiteSpace();

    //
    // Start Time
    //
    start_time_ok=true;
    start_hour=str_buf.mid(hours_offset,hours_length).toInt(&ok);
    if((!ok)||(start_hour<0)||(start_hour>23)) {
      start_time_ok=false;
    }
    start_minutes=str_buf.mid(minutes_offset,minutes_length).toInt(&ok);
    if((!ok)||(start_minutes<0)) {
      start_time_ok=false;
    }
    start_seconds=str_buf.mid(seconds_offset,seconds_length).toInt(&ok);
    if((!ok)||(start_seconds<0)||(start_seconds>59)) {
      start_time_ok=false;
    }

    //
    // Length
    //
开发者ID:radio-helsinki-graz,项目名称:rivendell,代码行数:67,代码来源:rdsvc.cpp

示例4: dt

void tst_QDjangoHttpController::testDateTime()
{
    const QDateTime dt(QDate(2014, 7, 14), QTime(11, 22, 33), Qt::UTC);
    QCOMPARE(QDjangoHttpController::httpDateTime(dt), QString("Mon, 14 Jul 2014 11:22:33 GMT"));
    QCOMPARE(QDjangoHttpController::httpDateTime("Mon, 14 Jul 2014 11:22:33 GMT"), dt);
}
开发者ID:arBmind,项目名称:qdjango,代码行数:6,代码来源:tst_qdjangohttpcontroller.cpp

示例5: newRecordCreated

void Group8Strategy::processTrade(const Trade &t)
{
    if (m_magic.contains(t.instrument())) {
        MagicData &data = m_magic[t.instrument()];

        if (t.price() >= data.previousPrice) {
            if (data.isRising == false) {
                data.currentConsecutiveChanges = 0;
            }
            data.isRising = true;
        } else {
            if (data.isRising == true) {
                data.currentConsecutiveChanges = 0;
            }
            data.isRising = false;
        }

        data.previousPrice = t.price();
        data.previousVolume = t.volume();

        data.currentConsecutiveChanges++;


        if (5 <= data.currentConsecutiveChanges && t.time().secsTo(QTime(16,00)) >= 50) {
            data.currentConsecutiveChanges = 0;

                if (data.isRising) {
                        auto r = Record::Ptr::create();
                        r->setBidId(6666);
                        r->setAskId(0);
                        r->setBidOrAsk(Record::BidAsk::Bid);
                        r->setDate(t.date());
                        r->setTime(t.time());
                        r->setInstrument(t.instrument());
                        r->setType(Record::Type::ENTER);
                        r->setVolume(data.previousVolume);
                        r->setPrice(t.price());
                        r->setValue(r->price() * r->volume());
                        emit newRecordCreated(r);
                        qDebug() << "created a bid";

                        //this is bad
                        data.totalBought += data.previousVolume;
                } else {
                       auto r = Record::Ptr::create();
                        r->setAskId(6666);
                        r->setBidId(0);
                        r->setBidOrAsk(Record::BidAsk::Ask);
                        r->setDate(t.date());
                        r->setTime(t.time());
                        r->setInstrument(t.instrument());
                        r->setType(Record::Type::ENTER);
                        r->setVolume(data.totalBought-data.totalSold);
                        r->setPrice(t.price());
                        r->setValue(r->price() * r->volume());
                        emit newRecordCreated(r);

                        qDebug() << "created a ask";

                        //this is bad.
                        data.totalSold += data.totalBought-data.totalSold;

                }


        }
        //qDebug() << abs(QTime(15,40).secsTo(t.time()));
        //qDebug() <<(data.totalBought-data.totalSold);

        if( abs(QTime(16,00).secsTo(t.time())) < 50 && (data.totalBought-data.totalSold) > 0) {
            qDebug() << data.totalBought-data.totalSold;
            data.currentConsecutiveChanges = 0;
            auto r = Record::Ptr::create();
             r->setAskId(6666);
             r->setBidId(0);
             r->setBidOrAsk(Record::BidAsk::Ask);
             r->setDate(t.date());
             r->setTime(t.time());
             r->setInstrument(t.instrument());
             r->setType(Record::Type::ENTER);
             r->setVolume(data.totalBought-data.totalSold);
             r->setPrice(t.price());
             r->setValue(r->price() * r->volume());
             emit newRecordCreated(r);

             //this is bad.
             data.totalSold += data.totalBought-data.totalSold;
        }
    }
}
开发者ID:shocklateboy92,项目名称:se3011,代码行数:90,代码来源:group8-strategy.cpp

示例6: qDebug

//==========
//     PRIVATE
// ==========
void LPConfig::loadDatasetConfiguration(QString dataset, bool replicated){
  qDebug() <<" - Loading dataset configuration:" << dataset;
  //Load the dataset values
  isReplicated = replicated;
  // - Local settings
  if( !LPBackend::datasetInfo(dataset, localSchedule, localSnapshots) ){
    localSchedule = 1; //daily at 1 AM
    localSnapshots = 7;
  }	  
  // - Replication settings
  bool ok=false;
  if(isReplicated){
    ok = LPBackend::replicationInfo(dataset, remoteHost, remoteUser, remotePort, remoteDataset, remoteFreq);
  }
  if(!ok){
    isReplicated = false;
    remotePort = 22;
    remoteFreq = -1; //sync
    remoteHost = "";
    remoteUser = "";
    remoteDataset = "";
  }
  //Now put the values into the UI
  // - local settings
  if(localSchedule == -5){ //5 minutes
    ui->combo_local_schedule->setCurrentIndex(5);	  
  }else if(localSchedule == -10){ //10 minutes
    ui->combo_local_schedule->setCurrentIndex(4);	
  }else if(localSchedule == -30){ //30 minutes
    ui->combo_local_schedule->setCurrentIndex(3);	  
  }else if(localSchedule == -60){ //assume hourly
    ui->combo_local_schedule->setCurrentIndex(2);	 
  }else if(localSchedule > 0 && localSchedule < 24){ //daily @ hour
    ui->combo_local_schedule->setCurrentIndex(1);
    ui->time_local_daily->setTime( QTime(localSchedule, 0) );
  }else{ //assume auto
    localSchedule = -999; //just to make sure it does not match anything else
    ui->combo_local_schedule->setCurrentIndex(0);
  }
  setLocalKeepNumber();
	
  // - Replication settings
  ui->groupReplicate->setChecked(isReplicated);
  ui->lineHostName->setText(remoteHost);
  ui->lineUserName->setText(remoteUser);
  ui->lineRemoteDataset->setText(remoteDataset);
  ui->spinPort->setValue(remotePort);
  if(remoteFreq >=0 && remoteFreq < 24){
    ui->combo_remote_schedule->setCurrentIndex(1); //Daily @
    ui->time_replicate->setTime( QTime(remoteFreq,0) );
  }else if(remoteFreq == -60){
    ui->combo_remote_schedule->setCurrentIndex(2); //Hourly
  }else if(remoteFreq == -30){
    ui->combo_remote_schedule->setCurrentIndex(3); // 30 minutes
  }else if(remoteFreq == -10){
    ui->combo_remote_schedule->setCurrentIndex(4); // 10 minutes
  }else if(remoteFreq == -2){
    ui->combo_remote_schedule->setCurrentIndex(5); // Manual mode
  }else{
    remoteFreq = -999; //just to make sure it is the "other" case
    ui->combo_remote_schedule->setCurrentIndex(0); // Sync
  }
  //Now update the visibility of items appropriately
  on_combo_local_schedule_currentIndexChanged(ui->combo_local_schedule->currentIndex());
  on_combo_remote_schedule_currentIndexChanged(ui->combo_remote_schedule->currentIndex());
}
开发者ID:KhuramAli,项目名称:pcbsd,代码行数:69,代码来源:LPConfig.cpp

示例7: fOut

void modCalcJD::processLines( QTextStream &istream, int inputData ) {
    QFile fOut( OutputFileBatch->url().toLocalFile() );
    fOut.open(QIODevice::WriteOnly);
    QTextStream ostream(&fOut);

    QString line;
    long double jd(0);
    double mjd(0);
    KStarsDateTime dt;

    while ( ! istream.atEnd() ) {
        line = istream.readLine();
        line = line.trimmed();
        QStringList data = line.split( ' ', QString::SkipEmptyParts );

        if ( inputData == 0 ) { //Parse date & time
            //Is the first field parseable as a date or date&time?
            if ( data[0].length() > 10 )
                dt = KStarsDateTime::fromString( data[0] );
            else
                dt = KStarsDateTime( QDate::fromString( data[0] ), QTime(0,0,0) );

            //DEBUG
            kDebug() << data[0];
            if ( dt.isValid() ) kDebug() << dt.toString();

            if ( dt.isValid() ) {
                //Try to parse the second field as a time
                if ( data.size() > 1 ) {
                    QString s = data[1];
                    if ( s.length() == 4 ) s = '0'+s;
                    QTime t = QTime::fromString( s );
                    if ( t.isValid() ) dt.setTime( t );
                }

            } else { //Did not parse the first field as a date; try it as a time
                QTime t = QTime::fromString( data[0] );
                if ( t.isValid() ) {
                    dt.setTime( t );
                    //Now try the second field as a date
                    if ( data.size() > 1 ) {
                        QDate d = QDate::fromString( data[1] );
                        if ( d.isValid() ) dt.setDate( d );
                        else dt.setDate( QDate::currentDate() );
                    }
                }
            }

            if ( dt.isValid() ) {
                //Compute JD and MJD
                jd = dt.djd();
                mjd = jd - MJD0;
            }

        } else if ( inputData == 1 ) {//Parse Julian day
            bool ok(false);
            jd = data[0].toDouble(&ok);
            if ( ok ) {
                dt.setDJD( jd );
                mjd = jd - MJD0;
            }
        } else if ( inputData == 2 ) {//Parse Modified Julian day
            bool ok(false);
            mjd = data[0].toDouble(&ok);
            if ( ok ) {
                jd = mjd + MJD0;
                dt.setDJD( jd );
            }
        }

        //Write to output file
        ostream << KGlobal::locale()->formatDateTime( dt, KLocale::LongDate ) << "  "
                << QString::number( jd, 'f', 2 ) << "  "
                << QString::number( mjd, 'f', 2 ) << endl;

    }

    fOut.close();
}
开发者ID:pandian4github,项目名称:kstars-hackfest,代码行数:79,代码来源:modcalcjd.cpp

示例8: QDateTime

void DayPage::refresh()
{

    m_dateLabel->setText(m_day.toString());
    m_itemList->clear();

    // Today's item
    QList<QOrganizerItem> items = m_manager->items(QDateTime(m_day), QDateTime(m_day, QTime(23, 59, 59)));

    foreach (const QOrganizerItem &item, items)
    {
        QOrganizerEventTime eventTime = item.detail<QOrganizerEventTime>();
        if (!eventTime.isEmpty()) {
            QString time = eventTime.startDateTime().time().toString("hh:mm");
            QListWidgetItem* listItem = new QListWidgetItem();
            if (item.type() == QOrganizerItemType::TypeEventOccurrence)
                listItem->setText(QString("Event occurrence:%1-%2").arg(time).arg(item.displayLabel()));
            else
                listItem->setText(QString("Event:%1-%2").arg(time).arg(item.displayLabel()));
            QVariant data = QVariant::fromValue<QOrganizerItem>(item);
            listItem->setData(ORGANIZER_ITEM_ROLE, data);
            m_itemList->addItem(listItem);
        }
        
        QOrganizerTodoTime todoTime = item.detail<QOrganizerTodoTime>();
        if (!todoTime.isEmpty()) {
            QString time = todoTime.startDateTime().time().toString("hh:mm");
            QListWidgetItem* listItem = new QListWidgetItem();
            listItem->setText(QString("Todo:%1-%2").arg(time).arg(item.displayLabel()));
            QVariant data = QVariant::fromValue<QOrganizerItem>(item);
            listItem->setData(ORGANIZER_ITEM_ROLE, data);
            m_itemList->addItem(listItem);
        }

        QOrganizerJournalTime journalTime = item.detail<QOrganizerJournalTime>();
        if (!journalTime.isEmpty()) {
            QString time = journalTime.entryDateTime().time().toString("hh:mm");
            QListWidgetItem* listItem = new QListWidgetItem();
            listItem->setText(QString("Journal:%1-%2").arg(time).arg(item.displayLabel()));
            QVariant data = QVariant::fromValue<QOrganizerItem>(item);
            listItem->setData(ORGANIZER_ITEM_ROLE, data);
            m_itemList->addItem(listItem);
        }
        
        // TODO: other item types
    }
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:46,代码来源:daypage.cpp

示例9: QDialog

UI_JumpMenuDialog::UI_JumpMenuDialog(QWidget *w_parent)
{
  mainwindow = (UI_Mainwindow *)w_parent;

  jump_dialog = new QDialog(w_parent);

  jump_dialog->setMinimumSize(QSize(435, 200));
  jump_dialog->setMaximumSize(QSize(435, 200));
  jump_dialog->setWindowTitle("Jump to");
  jump_dialog->setModal(TRUE);
  jump_dialog->setAttribute(Qt::WA_DeleteOnClose, TRUE);

  label1 = new QLabel(jump_dialog);
  label1->setGeometry(QRect(10, 10, 155, 25));
  label1->setText(" dd      hh:mm:ss.ms ");

  daybox1 = new QSpinBox(jump_dialog);
  daybox1->setGeometry(QRect(10, 45, 45, 25));
  daybox1->setRange(0, 30);
  daybox1->setEnabled(FALSE);

  daybox2 = new QSpinBox(jump_dialog);
  daybox2->setGeometry(QRect(10, 80, 45, 25));
  daybox2->setRange(0, 30);
  daybox2->setEnabled(FALSE);

  timeEdit1 = new QTimeEdit(jump_dialog);
  timeEdit1->setGeometry(QRect(65, 45, 110, 25));
  timeEdit1->setDisplayFormat("hh:mm:ss.zzz");
  timeEdit1->setMinimumTime(QTime(0, 0, 0, 0));
  timeEdit1->setEnabled(FALSE);

  timeEdit2 = new QTimeEdit(jump_dialog);
  timeEdit2->setGeometry(QRect(65, 80, 110, 25));
  timeEdit2->setDisplayFormat("hh:mm:ss.zzz");
  timeEdit2->setMinimumTime(QTime(0, 0, 0, 0));
  timeEdit2->setEnabled(FALSE);

  label2 = new QLabel("Offset from start of recording", jump_dialog);
  label2->setGeometry(QRect(185, 45, 250, 25));

  label3 = new QLabel("Absolute time", jump_dialog);
  label3->setGeometry(QRect(185, 80, 250, 25));

  jumpButton = new QPushButton(jump_dialog);
  jumpButton->setGeometry(QRect(10, 165, 100, 25));
  jumpButton->setText("Jump");
  jumpButton->setEnabled(FALSE);

  CloseButton = new QPushButton(jump_dialog);
  CloseButton->setGeometry(QRect(325, 165, 100, 25));
  CloseButton->setText("Cancel");

  if(mainwindow->files_open)
  {
    daybox1->setEnabled(TRUE);
    daybox2->setEnabled(TRUE);
    timeEdit1->setEnabled(TRUE);
    timeEdit2->setEnabled(TRUE);

    starttime = mainwindow->edfheaderlist[mainwindow->sel_viewtime]->l_starttime
                + mainwindow->edfheaderlist[mainwindow->sel_viewtime]->starttime_offset;

    starttime /= 10000;

    time2.setHMS((int)((starttime / 3600000LL) % 24LL), (int)((starttime % 3600000LL) / 60000LL), (int)((starttime % 60000LL) / 1000LL), (int)(starttime % 1000LL));

    timeEdit2->setMinimumTime(QTime((int)((starttime / 3600000LL) % 24LL), (int)((starttime % 3600000LL) / 60000LL), (int)((starttime % 60000LL) / 1000LL), (int)(starttime % 1000LL)));

    timeEdit2->setTime(time2);

    recording_duration = mainwindow->edfheaderlist[0]->datarecords * mainwindow->edfheaderlist[0]->long_data_record_duration;
    recording_duration /= (TIME_DIMENSION / 1000LL);

    jumpButton->setEnabled(TRUE);
  }

  QObject::connect(CloseButton, SIGNAL(clicked()),                  jump_dialog, SLOT(close()));
  QObject::connect(jumpButton,  SIGNAL(clicked()),                  this,        SLOT(jumpbutton_pressed()));
  QObject::connect(timeEdit1,   SIGNAL(timeChanged(const QTime &)), this,        SLOT(offsettime_changed(const QTime &)));
  QObject::connect(timeEdit2,   SIGNAL(timeChanged(const QTime &)), this,        SLOT(absolutetime_changed(const QTime &)));
  QObject::connect(daybox1,     SIGNAL(valueChanged(int)),          this,        SLOT(offsetday_changed(int)));
  QObject::connect(daybox2,     SIGNAL(valueChanged(int)),          this,        SLOT(absoluteday_changed(int)));

  jump_dialog->exec();
}
开发者ID:RTMilliken,项目名称:EDFbrowser,代码行数:86,代码来源:jump_dialog.cpp

示例10: read_item

    QString read_item( const Outlook::_AppointmentItemPtr &item, QXmlStreamReader &reader, bool dump_exception )
    {
        TRACE(OutlookSyncPlugin) << "OutlookDatebookSync::read_item";

        Outlook::UserPropertiesPtr props = item->GetUserProperties();
        Q_ASSERT(props);

        // We need to clear the recurrence pattern now or we will fail to update recurring events
        if ( !dump_exception )
            item->ClearRecurrencePattern();

        enum State {
            Idle, When, Alarm, Repeat, Exception, Categories
        };
        State state = Idle;
        Outlook::RecurrencePatternPtr recpat = 0;

        QString key;
        QXmlStreamAttributes attributes;
        QString value;
        QStringList categories;
        bool utc = false;
        bool allday = false;
        while (!reader.atEnd()) {
            bool loop = true;
            switch(reader.readNext()) {
                case QXmlStreamReader::StartElement:
                    key = reader.qualifiedName().toString();
                    value = QString();
                    attributes = reader.attributes();
                    if ( key == "When" )
                        state = When;
                    if ( state == When && key == "StartDate" ) {
                        allday = true;
                    }
                    if ( state == When && key == "Start" ) {
                        allday = false;
                    }
                    if ( key == "Alarm" ) {
                        state = Alarm;
                        LOG() << "item->PutReminderSet" << false;
                        item->PutReminderSet( false );
                    }
                    if ( state == Alarm && key == "Type" || key == "Delay" ) {
                        // Outlook only wants to see alarms set on events in the future
                        // If we sync an event in the past with an alarm it will go off
                        // immediately, something that can be annoying when you do an
                        // initial sync with lots of events with alarms.
                        if ( date_to_qdatetime(item->GetStart()) > QDateTime::currentDateTime() ) {
                            LOG() << "item->PutReminderSet" << true;
                            item->PutReminderSet( true );
                        }
                    }
                    if ( !dump_exception ) {
                        if ( key == "Repeat" ) {
                            state = Repeat;
                        }
                        if ( state == Repeat && key == "Type" ) {
                            recpat = item->GetRecurrencePattern();
                            recpat->PutPatternStartDate( item->GetStart() );
                        }
                        if ( state == Repeat && key == "Exception" ) {
                            state = Exception;
                        }
                    }
                    if ( key == "Categories" )
                        state = Categories;
                    break;
                case QXmlStreamReader::Characters:
                    value += reader.text().toString();
                    break;
                case QXmlStreamReader::EndElement:
                    key = reader.qualifiedName().toString();
                    //LOG() << "key" << key << "value" << value;
                    READ_STRING(Description,Subject);
                    READ_STRING(Location,Location);
                    if ( key == "TimeZone" ) {
                        utc = ( !value.isEmpty() );
                    }
                    if ( state == When ) {
                        if ( allday ) {
                            item->PutAllDayEvent( true );
                            READ_DATE(StartDate,Start);
                            // We can't just read the end date because Outlook does it differently to Qtopia.
                            // Qtopia gives us something like "starts 7/10/08, ends 7/10/08" but Outlook
                            // expects "starts 7/10/08 00:00:00, ends 8/10/08 00:00:00".
                            // Simply add one day to the end date to get something Outlook won't barf over.
                            if ( key == "EndDate" ) {
                                QDate dt = stringToDate(value);
                                QDateTime actual( dt.addDays(1), QTime(0,0,0) );
                                LOG() << "item->PutEnd" << actual;
                                item->PutEnd( qdatetime_to_date(actual) );
                            }
                        } else {
                            item->PutAllDayEvent( false );
                            if ( key == "Start" ) {
                                QDateTime dt = stringToDateTime(value, utc);
                                if ( utc ) {
                                    dt.setTimeSpec( Qt::UTC );
                                    dt = dt.toLocalTime();
//.........这里部分代码省略.........
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:101,代码来源:datebook.cpp

示例11: AMScanConfigurationView

REIXSRIXSScanConfigurationView::REIXSRIXSScanConfigurationView(REIXSXESScanConfiguration* config, QWidget *parent) :
	AMScanConfigurationView(parent)
{
	if(config) {
		configuration_ = config;
		ownsConfiguration_ = false;
	}
	else {
		configuration_ = new REIXSXESScanConfiguration(this);
		ownsConfiguration_ = true;
	}

	chooseScanDialog_ = 0;
	/*
	image_ = new MPlotSeriesBasic();
	image_->setColorMap(*colorMap_);
	*/

	currentScan_ = 0;

	queueView_ = new AMActionRunnerQueueView3(AMActionRunner3::workflow());

	detectorOptions = new QGroupBox("Initial Setup");
	stopScanOptions = new QGroupBox("Stop scan when...");
	nameOptions = new QGroupBox("Scan meta-data");
	XASEnergySelect = new QGroupBox("Select Scan Energy");

	energyBox_ = new QDoubleSpinBox();
	energyBox_->setDecimals(2);
	energyBox_->setEnabled(true);
	energyBox_->setRange(92,2000);
	energyBox_->setValue(configuration_->energy());
	energyBox_->setSingleStep(0.1);

	energyBoxLabel_ = new QLabel("RIXS Excitation Energy:");

	slitWidthBox_= new QDoubleSpinBox();
	slitWidthBox_->setRange(5,500);
	slitWidthBox_->setValue(configuration_->slitWidth());
	slitWidthBox_->setSingleStep(5);
	slitWidthBox_->setDecimals(0);
	slitWidthBox_->setEnabled(configuration_->applySlitWidth());
	applySlitWidthBox_ = new QCheckBox("Slit Width");
	applySlitWidthBox_->setChecked(configuration_->applySlitWidth());


	polarizationBox_ = new QComboBox();
	polarizationBox_->addItem("Circular Left");
	polarizationBox_->addItem("Circular Right");
	polarizationBox_->addItem("Linear Horizontal");
	polarizationBox_->addItem("Linear Vertical +");
	polarizationBox_->addItem("Linear Vertical -");
	polarizationBox_->addItem("Linear Inclined");
	polarizationBox_->setCurrentIndex(configuration_->polarization());
	polarizationBox_->setEnabled(configuration_->applyPolarization());
	applyPolarizationBox_ = new QCheckBox("Polarization");
	applyPolarizationBox_->setChecked(configuration_->applyPolarization());


	polarizationAngleBox_ = new QDoubleSpinBox();
	polarizationAngleBox_->setDecimals(0);
	polarizationAngleBox_->setRange(-180,180);
	polarizationAngleBox_->setEnabled((configuration_->applyPolarization() && (configuration_->polarization() == 5)));
	polarizationAngleBox_->setValue(configuration_->polarizationAngle());
	polarizationAngleBox_->setSingleStep(10);

	polarizationAngleLabel_ = new QLabel();
	polarizationAngleLabel_->setText("      Angle");

	doNotClearExistingCountsOption_ = new QCheckBox("Do not clear previous detector data");

	maximumTotalCounts_ = new QDoubleSpinBox();
	maximumTimeEdit_ = new QTimeEdit();

	numberEdit_ = new QSpinBox();
	numberEdit_->setRange(0, 10000);
	numberEdit_->setEnabled(false);
	nameEdit_ = new QLineEdit();
	sampleSelector_ = new AMSamplePre2013Editor(AMDatabase::database("user"));
	autoNamingCheckBox_ = new QCheckBox("from last sample move");

	maximumTotalCounts_->setDecimals(0);
	maximumTotalCounts_->setRange(10, 1000000000);
	maximumTimeEdit_->setDisplayFormat("hh:mm:ss");

	XASScanName_ = new QLabel("Select XAS Scan...");

	/*
	addEnergy_ =  new QPushButton();
	addEnergy_->setText("Add Energy");
	QIcon down;
	down.addFile(QString::fromUtf8(":/22x22/go-down-dark.png"), QSize(), QIcon::Normal, QIcon::Off);
	addEnergy_->setIcon(down);
	queueScan_ = new QPushButton();
	queueScan_->setText("Add This Energy");
	*/

	loadXASData_ = new QPushButton();
	loadXASData_->setText("Load XAS Scan");

//.........这里部分代码省略.........
开发者ID:acquaman,项目名称:acquaman,代码行数:101,代码来源:REIXSRIXSScanConfigurationView.cpp

示例12: QTime

QTime TimeBar::getTime()
{
    QTime time = QTime();
    time.setHMS(ms / (1000*60*60), (ms % (1000*60*60)) / (1000*60), ((ms % (1000*60*60)) % (1000*60)) / 1000);
    return time;
}
开发者ID:aITy,项目名称:24hoursRace,代码行数:6,代码来源:timebar.cpp

示例13: Q_ASSERT

QVariant Device::data(const QModelIndex &index, int role) const
{
    log_entry entry;
    QTime mstime;
    int div = 1;

    Q_ASSERT(index.row() < m_log.size());

    switch (role) {
    case Qt::EditRole:
        switch ( index.column() ) {
        case Device::REGISTER:
            entry = m_log.read( index.row() );
            return get_register_name(entry) +
                        QString().sprintf(" 0x%08X",
                            entry.offset + (m_base >= 0x50000000 ? m_base : 0));
        default:
            break;
        }
    case Qt::DisplayRole:
        entry = m_log.read( index.row() );

        switch ( index.column() ) {
        case Device::REGISTER:
            if (entry.is_irq)
                return QString("IRQ ") + QString::number(entry.offset);

            if (entry.is_error) {
                const char *format =
                        entry.is_write ? "write%d to 0x%X" : "read%d 0x%X";
                return QString().sprintf(format, entry.rw_size, entry.offset);
            }

            if (entry.clk_disabled || entry.in_reset)
                return get_register_name(entry) +
                        " clk_enb: " + QString::number(!entry.clk_disabled) +
                        " rst: " + QString::number(entry.in_reset);

            return get_register_name(entry);
        case Device::VALUE:
            if (entry.is_irq)
                return QString("STATUS ") + QString::number(entry.value);

            return QString().sprintf("0x%08X",
                            entry.is_write? entry.new_value : entry.value);
        case Device::TIME:
            mstime = QTime(0, 0).addMSecs(entry.time / 1000);
            return mstime.toString("hh:mm:ss.zzz") +
                            QString().sprintf(".%03d", entry.time % 1000);
        case Device::CPU_PC:
            return QString().sprintf("[%d] @0x%08X", entry.cpu_id, entry.cpu_pc);
        default:
            break;
        }
        break;
    case Qt::BackgroundRole:
        entry = m_log.read( index.row() );

        if (m_regFilter.length() &&
                get_register_name(entry).indexOf(m_regFilter) == -1)
            div = 2;

        if (index.column() == Device::CPU_PC)
            return QVariant();

        if (entry.is_irq) {
            if (entry.value)
                return QColor(255 / div, 192 / div, 255 / div);
            else
                return QColor(192 / div, 255 / div, 255 / div);
        }

        if (entry.is_error)
            return QColor(255 / div, 150 / div, 150 / div); // light red

        if (index.column() == Device::REGISTER) {
            if (entry.clk_disabled || entry.in_reset)
                return QColor(255 / div, 150 / div, 150 / div); // light red
        }

        if (!entry.is_write)
            return QColor(200 / div, 255 / div, 200 / div); // light green

        if (entry.value != entry.new_value)
            return QColor(0xf4 / div, 0xa7 / div, 0); // brown

        return QColor(255 / div, 255 / div, 150 / div); // light yellow
    case Qt::ToolTipRole:
        switch ( index.column() ) {
        case Device::TIME:
            entry = m_log.read( index.row() );
            return QString::number(entry.time) + "us";
        case Device::REGISTER:
            entry = m_log.read( index.row() );
            return QString().sprintf("0x%08X", entry.offset);
        default:
            break;
        }
        break;
    case Qt::ForegroundRole:
//.........这里部分代码省略.........
开发者ID:digetx,项目名称:tegra2_qemu_trace_viewer,代码行数:101,代码来源:device.cpp

示例14: it

void XMMSSensor::update()
{
    QString format;
    SensorParams *sp;
    Meter *meter;
    QObjectListIt it( *objList );

#ifdef HAVE_XMMS

    int pos;
    QString title;
    int songLength = 0;
    int currentTime = 0;
    bool isPlaying = false;
    bool isRunning = xmms_remote_is_running(0);

    if( isRunning )
    {
        isPlaying = xmms_remote_is_playing(0);
        pos = xmms_remote_get_playlist_pos(0);
        qDebug("unicode start");
        title = codec->toUnicode( QCString( xmms_remote_get_playlist_title( 0, pos ) )  );
        qDebug("unicode end");
        if( title.isEmpty() )
            title = "XMMS";

        qDebug("Title: %s", title.ascii());
        songLength = xmms_remote_get_playlist_time( 0, pos );
        currentTime = xmms_remote_get_output_time( 0 );
    }
#endif // HAVE_XMMS

    while (it != 0)
    {
        sp = (SensorParams*)(*it);
        meter = sp->getMeter();

#ifdef HAVE_XMMS

        if( isRunning )
        {

            format = sp->getParam("FORMAT");


            if (format.length() == 0 )
            {
                format = "%title %time / %length";
            }

            if( format == "%ms" )
            {
                meter->setMax( songLength );
                meter->setValue( currentTime );
            }
            else

                if ( format == "%full" )
                {
                    meter->setValue( 1 );
                }
                else

                {


                    format.replace( QRegExp("%title", false), title );

                    format.replace( QRegExp("%length", false), QTime( 0,0,0 ).
                                    addMSecs( songLength )
                                    .toString( "h:mm:ss" ) );

                    format.replace( QRegExp("%time", false), QTime( 0,0,0 ).
                                    addMSecs( currentTime )
                                    .toString( "h:mm:ss" ) );

                    if( isPlaying  )
                    {
                        format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).
                                        addMSecs( songLength )
                                        .addMSecs(-currentTime )
                                        .toString( "h:mm:ss" ) );
                    }

                    else
                    {
                        format.replace( QRegExp("%remain", false), QTime( 0,0,0 ).toString("h:mm:ss" ) );
                    }
                    meter->setValue(format);
                }
        }
        else
#endif // HAVE_XMMS

        {
            meter->setValue("");
        }
        ++it;

    }
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:101,代码来源:xmmssensor.cpp

示例15: i18n

void Groupwise::getFreeBusy(const KURL &url)
{
    QString file = url.filename();
    if(file.right(4) != ".ifb")
    {
        QString error = i18n("Illegal filename. File has to have '.ifb' suffix.");
        errorMessage(error);
    }
    else
    {
        QString email = file.left(file.length() - 4);
        debugMessage("Email: " + email);

        // Sanitise local Nuernberg email addresses
        kdDebug() << "Email before sanitizing: " << email << endl;
        email = email.replace(QRegExp("\\.EMEA5-1\\.EMEA5"), "");
        email = email.replace(QRegExp("\\.Suse.INTERNET"), "");
        kdDebug() << "Email after sanitizing: " << email << endl;

        QString u = soapUrl(url);

        QString user = url.user();
        QString pass = url.pass();

        debugMessage("URL: " + u);
        debugMessage("User: " + user);
        debugMessage("Password: " + pass);

        KCal::FreeBusy *fb = new KCal::FreeBusy;

        if(user.isEmpty() || pass.isEmpty())
        {
            errorMessage(i18n("Need username and password to read Free/Busy information."));
        }
        else
        {
            GroupwiseServer server(u, user, pass, 0);

            // FIXME: Read range from configuration or URL parameters.
            QDate start = QDate::currentDate().addDays(-3);
            QDate end = QDate::currentDate().addDays(60);

            fb->setDtStart(start);
            fb->setDtEnd(end);

            kdDebug() << "Login" << endl;

            if(!server.login())
            {
                errorMessage(i18n("Unable to login: ") + server.errorText());
            }
            else
            {
                kdDebug() << "Read free/busy" << endl;
                if(!server.readFreeBusy(email, start, end, fb))
                {
                    errorMessage(i18n("Unable to read free/busy data: ") + server.errorText());
                }
                kdDebug() << "Read free/busy" << endl;
                server.logout();
            }
        }

#if 0
        QDateTime s = QDateTime(QDate(2004, 9, 27), QTime(10, 0));
        QDateTime e = QDateTime(QDate(2004, 9, 27), QTime(11, 0));

        fb->addPeriod(s, e);
#endif

        // FIXME: This does not take into account the time zone!
        KCal::ICalFormat format;

        QString ical = format.createScheduleMessage(fb, KCal::Scheduler::Publish);

        data(ical.utf8());

        finished();
    }
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:80,代码来源:groupwise.cpp


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