Beispiel #1
0
/*!
  Translate from QDateTime to double

  \param dateTime Datetime value
  \return Number of milliseconds since 1970-01-01T00:00:00 UTC has passed.

  \sa toDateTime(), QDateTime::toMSecsSinceEpoch()
  \warning For values very far below or above 1970-01-01 UTC rounding errors
           will happen due to the limited significance of a double.
 */
double QwtDate::toDouble( const QDateTime &dateTime )
{
    const int msecsPerDay = 86400000;

    const QDateTime dt = qwtToTimeSpec( dateTime, Qt::UTC );

    const double days = dt.date().toJulianDay() - QwtDate::JulianDayForEpoch;

    const QTime time = dt.time();
    const double secs = 3600.0 * time.hour() +
        60.0 * time.minute() + time.second();

    return days * msecsPerDay + time.msec() + 1000.0 * secs;
}
QRect NextAvailabiliyManager::simplifiedDateToRect(const int weekDay, const QTime &start, const QTime &end)
{
    // TOP : day of week
    //   1px = 1minute
    //   linear Monday to Sunday
    //   1 day = 1440 minutes
    // X = month + day
    // WIDTH = year
    // HEIGHT = durationInMinutes
    int day = (weekDay-1) * 1440;
    int top = start.hour() * 60 + start.minute() + day;
    int durationInMinutes = start.secsTo(end) / 60;
    return QRect(0, top, 11, durationInMinutes);
}
Beispiel #3
0
QTime SessionDefaults::correctFPTime(const QTime &time) const
{
    int hour = time.hour();
    int min = time.minute();
    int sec = time.second();

    int t = getFPLength() * 60 - hour * 3600 - min * 60 - sec;
    hour = t/3600;
    min = (t%3600)/60;
    sec = (t%3600)%60;
    QTime newTime(hour, min, sec);

    return newTime;
}
Beispiel #4
0
void FileImportDialog::on_buttonBox_accepted() {
    QFile f(fileLineEdit->text());
    f.open(QFile::ReadOnly);
    QString content = f.readAll();
    QStringList trames = content.split("@");
    int i=0;
    QTime base = QTime::currentTime();
    foreach(QString trame, trames) {
        Data* d = m_parent->getSensorMgr()->addData(trame);
        if(d != NULL)
            d->time = QTime(base.hour(),base.minute(),base.second()+i);

        i++;
    }
Beispiel #5
0
void LiveTVChain::AppendNewProgram(ProgramInfo *pginfo, QString channum,
                                   QString inputname, bool discont)
{
    QMutexLocker lock(&m_lock);

    QTime tmptime = pginfo->GetRecordingStartTime().time();

    LiveTVChainEntry newent;
    newent.chanid = pginfo->GetChanID();
    newent.starttime = pginfo->GetRecordingStartTime();
    newent.starttime.setTime(QTime(tmptime.hour(), tmptime.minute(),
                                   tmptime.second()));
    newent.discontinuity = discont;
    newent.hostprefix = m_hostprefix;
    newent.cardtype = m_cardtype;
    newent.channum = channum;
    newent.inputname = inputname;

    m_chain.append(newent);

    MSqlQuery query(MSqlQuery::InitCon());
    query.prepare("INSERT INTO tvchain (chanid, starttime, endtime, chainid,"
                  " chainpos, discontinuity, watching, hostprefix, cardtype, "
                  " channame, input) "
                  "VALUES(:CHANID, :START, :END, :CHAINID, :CHAINPOS, "
                  " :DISCONT, :WATCHING, :PREFIX, :CARDTYPE, :CHANNAME, "
                  " :INPUT );");
    query.bindValue(":CHANID", pginfo->GetChanID());
    query.bindValue(":START", pginfo->GetRecordingStartTime());
    query.bindValue(":END", pginfo->GetRecordingEndTime());
    query.bindValue(":CHAINID", m_id);
    query.bindValue(":CHAINPOS", m_maxpos);
    query.bindValue(":DISCONT", discont);
    query.bindValue(":WATCHING", 0);
    query.bindValue(":PREFIX", m_hostprefix);
    query.bindValue(":CARDTYPE", m_cardtype);
    query.bindValue(":CHANNAME", channum);
    query.bindValue(":INPUT", inputname);

    if (!query.exec() || !query.isActive())
        MythDB::DBError("Chain: AppendNewProgram", query);
    else
        VERBOSE(VB_RECORD, QString("Chain: Appended@%3 '%1_%2'")
                .arg(newent.chanid)
                .arg(newent.starttime.toString("yyyyMMddhhmmss"))
                .arg(m_maxpos));

    m_maxpos++;
    BroadcastUpdate();
}
void EdrcPlugin::testConsultResultXml()
{
    Utils::Randomizer r;
    r.setPathToFiles(settings()->path(Core::ISettings::BundleResourcesPath) + "/textfiles/");

    // Test Unique CR XML
    ConsultResult r2;
    r2.setConsultResult(1);
    r2.setChronicDiseaseState(ConsultResult::ChronicDisease);
    r2.setDiagnosisPosition(ConsultResult::A);
    r2.setMedicalFollowUp(ConsultResult::N);
    r2.setSymptomaticState(ConsultResult::Symptomatic);
    r2.setSelectedCriterias(QList<int>() << 1 << 2);
    r2.setHtmlCommentOnCR("<p>This the CR<b>comment</b><br></p>");
    r2.setHtmlCommentOnCriterias("<p>This the criteria<b>comment</b><br></p>");
    QDateTime dt = QDateTime::currentDateTime();
    r2.setDateOfExamination(dt);
    QTime time = dt.time();
    dt.time().setHMS(time.hour(), time.minute(), time.second());
    dt.setTime(time);

    QString extra;
    QList<ConsultResult> list = ConsultResult::fromXml(r2.toXml("<xtra>bla bla</xtra>"), &extra);
    extra = extra.simplified();
    QCOMPARE(list.count(), 1);
    QString control = QString("<%1> <xtra>bla bla</xtra> </%1>").arg(Constants::XML_EXTRA_TAG);
    QCOMPARE(extra, control);
    QVERIFY(r2 == list.at(0));
    QVERIFY(r2.toXml() == list.at(0).toXml());

    // Test Multiple CR XML
    list.clear();
    for(int i=0; i<10; ++i) {
        ConsultResult cr;
        cr.setConsultResult(r.randomInt(1, 300));
        cr.setDiagnosisPosition(ConsultResult::DiagnosisPosition(r.randomInt(0, 3)));
        cr.setMedicalFollowUp(ConsultResult::MedicalFollowUp(r.randomInt(0, 2)));
        cr.setSymptomaticState(ConsultResult::SymptomaticState(r.randomInt(0, 1)));
        cr.setChronicDiseaseState(ConsultResult::ChronicDiseaseState(r.randomInt(0, 1)));
        cr.setSelectedCriterias(QList<int>() << r.randomInt(0, 300) << r.randomInt(0, 300));
        cr.setHtmlCommentOnCR(r.randomString(r.randomInt(10, 500)));
        cr.setHtmlCommentOnCriterias(r.randomString(r.randomInt(10, 500)));
        cr.setDateOfExamination(r.randomDateTime(QDateTime::currentDateTime().addMonths(-10)));
        list << cr;
    }
    QString xml = ConsultResult::listToXml(list, "<xtra>bla bla</xtra>");
    QList<ConsultResult> fromXmlList = ConsultResult::fromXml(xml, &extra);
    QCOMPARE(list.count(), fromXmlList.count());
    QCOMPARE(list, fromXmlList);
}
Beispiel #7
0
void VlcWidgetSeek::updateCurrentTime(const int &time)
{
    if (_lock)
        return;

    QTime currentTime = QTime(0,0,0,0).addMSecs(time);

    QString display = "mm:ss";
    if (currentTime.hour() > 0)
        display = "hh:mm:ss";

    _labelElapsed->setText(currentTime.toString(display));
    _seek->setValue(time);
}
Beispiel #8
0
static inline void qwtFloorTime( 
    QwtDate::IntervalType intervalType, QDateTime &dt )
{
    // when dt is inside the special hour where DST is ending
    // an hour is no unique. Therefore we have to
    // use UTC time.

    const Qt::TimeSpec timeSpec = dt.timeSpec();

    if ( timeSpec == Qt::LocalTime )
        dt = dt.toTimeSpec( Qt::UTC );

    const QTime t = dt.time();
    switch( intervalType )
    {
        case QwtDate::Second:
        {
            dt.setTime( QTime( t.hour(), t.minute(), t.second() ) );
            break;
        }
        case QwtDate::Minute:
        {
            dt.setTime( QTime( t.hour(), t.minute(), 0 ) );
            break;
        }
        case QwtDate::Hour:
        {
            dt.setTime( QTime( t.hour(), 0, 0 ) );
            break;
        }   
        default:
            break;
    }

    if ( timeSpec == Qt::LocalTime )
        dt = dt.toTimeSpec( Qt::LocalTime );
}
Beispiel #9
0
double Dialog::total_fee(QTime it,QTime ot)
{
    double total=0;
    int i=1;
    QTime et,st,t(0,0);
    if(ot<it)
    {
        et=t;
    }
    else
        et=ot;
    QSqlQuery l;
    if(et.hour()==0&&et.minute()==0)
        l.exec("select *from sfsz where end_time>\'"+it.toString()+"\' or end_time='0:00' order by start_time");
    else
        l.exec("select *from sfsz where start_time<\'"+et.toString()+"\' and end_time>\'"+it.toString()+"\' order by end_time");
    st=it;
    while(l.next())
    {
        if(i==0)
            st=l.value(0).toTime();
        if(et>=l.value(1).toTime()||et==t)
        {
            double to=l.value(1).toTime().hour()-st.hour()+(double)(l.value(1).toTime().minute()-st.minute())/60;
            if(l.value(1).toTime().hour()==0&&l.value(1).toTime().minute()==0)
            {
                to+=24;
            }
            total+=l.value(2).toDouble()*(to);
        }
        else
        {
           total+=l.value(2).toDouble()*(et.hour()-st.hour()+(double)(et.minute()-st.minute())/60);
        }
        i=0;
    }
    if(ot<it)
    {
        l.exec("select *from sfsz1 where start_time<\'"+ot.toString()+"\' order by start_time");
        while(l.next())
        {
            if(ot<l.value(1).toTime()||(l.value(1).toTime().hour()==0&&l.value(1).toTime().minute()==0))
               total+=l.value(2).toDouble()*(ot.hour()-l.value(0).toTime().hour()+(double)(ot.minute()-l.value(0).toTime().minute())/60);
            else
               total+=l.value(2).toDouble()*(l.value(1).toTime().hour()-l.value(0).toTime().hour()+(double)(l.value(1).toTime().minute()-l.value(0).toTime().minute())/60);
        }
    }
    return total;
}
Beispiel #10
0
QString DownloadItem::remaingTimeToString(QTime time)
{
    if (time < QTime(0, 0, 10)) {
        return tr("few seconds");
    }
    else if (time < QTime(0, 1)) {
        return tr("%n seconds", "", time.second());
    }
    else if (time < QTime(1, 0)) {
        return tr("%n minutes", "", time.minute());
    }
    else {
        return tr("%n hours", "", time.hour());
    }
}
Beispiel #11
0
QTime operator/(QTime l,int r)
{
        //convert everything into milliseconds, devide, and convert back
        int left=l.hour()*60*60*1000 + l.minute()*60*1000 + l.second()*1000 + l.msec();
        int result = left/r;
        int ms = result%1000;
        result = (result - ms)/1000;
        int s = result%60;
        result = (result - s)/60;
        int m = result%60;
        result = (result - m)/60;
        int h = result;
	QTime re(h,m,s,ms);
	return re;
}
Beispiel #12
0
Programmation::Programmation(const int id, const QDate &d, const QTime &dur, const QTime &h):id(id),date(d),duree(dur),horaire(h)
{
   ProgManager::Iterator it = ProgManager::getInstance()->getIterator();
   int jour = d.day();
   /*int debut = h.hour();
   int fin = debut + dur.hour();*/
   QTime debut=h;
   QTime fin;
   fin.setHMS(h.hour()+dur.hour(),h.minute()+dur.minute(),h.second()+dur.second());
   /*bool commencePendant=false;
   bool terminePendant=false;*/
   bool horaireinvalide=false;
   bool memeJour=false;
   while(it.courant() != ProgManager::getInstance()->end())
   {
       Programmation *p = it.valeur();
       /*int pH = p->getHoraire().hour();
       int pFin = pH + p->getDuree().hour();*/
       int pJour = it.valeur()->getDate().day();
     /*  commencePendant = (debut >= pH && debut <= pFin); //On autorise qu'un evenement se finisse à une heure h et qu'un autre commence tout de suite après
       terminePendant = (fin >= pH && fin <= pFin);*/
       QTime pDeb=p->getHoraire();
       QTime pFin;
       pFin.setHMS(p->getHoraire().hour()+p->getDuree().hour(),p->getHoraire().minute()+p->getDuree().minute(),p->getHoraire().second()+p->getDuree().second());
       /*commencePendant= (debut>=pDeb && debut<pFin);
       terminePendant= (fin>pDeb && fin<=pFin);*/
       horaireinvalide=(debut<=pDeb && fin>=pFin)
               || (debut<=pDeb && (fin<=pFin && fin>pDeb))
               || ((debut>=pDeb && debut<pFin) && fin>=pFin)
               || ((debut>=pDeb && debut<pFin) && (fin>=pDeb && fin<=pFin));
       memeJour = jour == pJour;
       if( memeJour && horaireinvalide)
               throw AgendaException("Une programmation occupe déjà une partie de cette plage horaire");
       it.next();
   }
}
Beispiel #13
0
a1time Validity::getDate() const
{
	a1time date(dateTime());
	QTime time;

	if (midnight) {
		time = endDate ? QTime(23,59,59) : QTime(0,0,0);
		date.setTimeSpec(Qt::UTC);
	} else {
		time = date.time();
		time.setHMS(time.hour(), time.minute(), 0);
	}
	date.setTime(time);
	return date;
}
Beispiel #14
0
static QString getRandomFileName(size_t length)
{
    const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");

    QTime currentTime = QTime::currentTime();
    qsrand(currentTime.hour() + currentTime.second() + currentTime.minute() + currentTime.msec());
    QString randomString;
    for(size_t i=0; i<length; ++i)
    {
        int index = qrand() % possibleCharacters.length();
        QChar nextChar = possibleCharacters.at(index);
        randomString.append(nextChar);
    }
    return randomString;
}
Beispiel #15
0
void MainWindow::on_save_clicked()
{
    QTime time = QTime::currentTime();
    QDate date = QDate::currentDate();
    QString name;
   if(date.day()<10)
        name += "0";
    name += QString::number(date.day())+".";
    if(date.month()<10)
        name += "0";
    name += QString::number(date.month())+".";
    name += QString::number(date.year())+"_";
    if(time.hour()<10)
        name += "0";
    name += QString::number(time.hour())+"-";
    if(time.minute()<10)
        name += "0";
    name += QString::number(time.minute())+"-";
    if(time.second()<10)
        name += "0";
    name += QString::number(time.second());
    QFile file(name+".png");
    qDebug() << name;
    file.open(QIODevice::WriteOnly);
    QMessageBox msgBox;
    msgBox.setStandardButtons(QMessageBox::Ok);
    if(ui->outputGraph->pixmap()->save(&file,"PNG")) {
        msgBox.setText("Saved to program folder with name: "+name+".png");
        msgBox.setWindowTitle("Saved!");
    }
    else {
        msgBox.setText("Error saving.");
        msgBox.setWindowTitle("Error!");
    }
    msgBox.exec();
}
Beispiel #16
0
ChimeryMainWindow::ChimeryMainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    QTime currentT = QTime::currentTime();
    cycButtons = new QLinkedList<QPushButton *>();
    cycGaps = new QLinkedList<QSpinBox *>();
    times = new QLinkedList<QDateTime *>();
    QWidget * central = new QWidget(this);
    setCentralWidget(central);
    QGridLayout * lay = new QGridLayout(central);
    central->setLayout(lay);
    cycStart = new QTimeEdit(QTime(currentT.hour(), currentT.minute() - (currentT.minute() % 5) + 5), central);
    cycNum = new QSpinBox(central);
    cycNum->setRange(1, 12);
    cycNum->setValue(8);
    cycDur = new QSpinBox(central);
    cycDur->setRange(5, 90);
    cycDur->setValue(50);
    cycDur->setSingleStep(5);
    cycStartL = new QLabel("Start Time", central);
    cycNumL = new QLabel("Cycles", central);
    cycDurL = new QLabel("Duration", central);
    gapL = NULL; 
    gogogo = NULL;
    begin = new QSound(":art/begin.wav", this);
    end = new QSound(":art/end.wav", this);
    lay->addWidget(cycStartL, 0, 0, 1, 1);
    lay->addWidget(cycNumL, 0, 1, 1, 1);
    lay->addWidget(cycDurL, 0, 2, 1, 1);
    lay->addWidget(cycStart, 1, 0, 1, 1);
    lay->addWidget(cycNum, 1, 1, 1, 1);
    lay->addWidget(cycDur, 1, 2, 1, 1);
    adjustSize();
    about = new ChimeryAboutWindow(this);
    menus = new ChimeryMenus(this, about);
    systray = new QSystemTrayIcon(this);
    systray->setContextMenu(menus->menu);
    active_icon = new QIcon(":art/chimeryactivelogo.svg");
    passive_icon = new QIcon(":art/chimerylogo.svg");
    QObject::connect(cycStart, SIGNAL(timeChanged(QTime)), this, SLOT(cyc()), Qt::QueuedConnection);
    QObject::connect(cycNum, SIGNAL(valueChanged(int)), this, SLOT(cyc()), Qt::QueuedConnection); 
    QObject::connect(cycDur, SIGNAL(valueChanged(int)), this, SLOT(cyc()), Qt::QueuedConnection); 
    timer = new QTimer(this);
    timer->setTimerType(Qt::VeryCoarseTimer);
    timer->setSingleShot(true);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(chime()), Qt::QueuedConnection);
    cyc();
}
Beispiel #17
0
void Agenda::ajouterProgrammation(const TacheUnitaire & t, const QDate& d, const QTime& h){
   vector <Programmation *> & listeProgrammation = trouverProgrammation(t);
   // si la programmation existe déjà, on ne peut pas la programmer à nouveau
   if (listeProgrammation.size() != 0 ) {
      throw CalendarException("erreur ajouterProgrammation, cette fonction ne peut être appelée que si la tâche n'a jamais été programmée");
   }

   int minute_fin = h.minute() + t.getDuree().getMinute();
   int heure_fin = h.hour() + t.getDuree().getHeure() + (minute_fin / 60) ;
   minute_fin = minute_fin % 60;
   if ( !QTime::isValid(heure_fin, minute_fin, 0) ) {
      throw CalendarException("erreur ajouterProgrammation : une programmation ne peut pas être à cheval sur deux jours");
   }

   ajouterProgrammation(t, d, h, *(new QTime(heure_fin, minute_fin)) );
}
Beispiel #18
0
void lemon::updateClock()
{
  QTime time = QTime::currentTime();
  QString text = time.toString("hh:mm");
  if ((time.second() % 2) == 0)
    text[2] = '.';
  labelTime->setText(text);
  if ((time.hour()==0) && (time.minute()==0) && (time.second()==0) ) updateDate();

  ///On kde 4.3 some bug resizes the window and the taskbar over mainview. I dont want taskbar, it means full screen is deactivated. How can we set fullScreen MODE?
  if (geometry() != QApplication::desktop()->screenGeometry(this)) {
    //qDebug()<<"FIXING WINDOW SIZE from:"<<geometry();
    //setGeometry(QApplication::desktop()->screenGeometry(this));
    //Doing this the size is fixed but the taskbar is show over mainview
  }
}
Beispiel #19
0
QString Patient::getPatientID()
{
    QTime time;
    QDate date;
    QDate cDate = date.currentDate();
    QTime cTime = time.currentTime();
    QString year = QString("%1").arg(cDate.year(),4,10,QChar('0'));
    QString mon = QString("%1").arg(cDate.month(),2,10,QChar('0'));

    QString day = QString("%1").arg(cDate.day(),2,10,QChar('0'));
    QString hour = QString("%1").arg(cTime.hour(),2,10,QChar('0'));
    QString min = QString("%1").arg(cTime.minute(),2,10,QChar('0'));
    QString sec = QString("%1").arg(cTime.second(),2,10,QChar('0'));
    QString patientID = QString("%1%2%3-%4%5%6").arg(year,mon,day,hour,min,sec);
    return patientID;
}
Beispiel #20
0
QString Patient:: getCurrentTime()
{
    QTime time;
    QDate date;
    QDate cDate = date.currentDate();
    QTime cTime = time.currentTime();
    QString year = QString("%1").arg(cDate.year(),4,10,QChar('0'));
    QString mon = QString("%1").arg(cDate.month(),2,10,QChar('0'));

    QString day = QString("%1").arg(cDate.day(),2,10,QChar('0'));
    QString hour = QString("%1").arg(cTime.hour(),2,10,QChar('0'));
    QString min = QString("%1").arg(cTime.minute(),2,10,QChar('0'));
    QString sec = QString("%1").arg(cTime.second(),2,10,QChar('0'));
    QString Time = QString("%1/%2/%3 %4:%5:%6").arg(year,mon,day,hour,min,sec);
    return Time;
}
Beispiel #21
0
void Widget::on_pushButton_clicked()
{
    memset(versions,0,12*2*sizeof(int));
    QDate dat = QDate::currentDate();
    QTime tim = QTime::currentTime();
    QByteArray cmd;
    cmd.append(char(0x01));
    cmd.append(char(0x00));
    cmd.append(char(dat.year()-2000));
    cmd.append(char(dat.month()));
    cmd.append(char(dat.day()));
    cmd.append(char(tim.hour()));
    cmd.append(char(tim.minute()));
    cmd.append(char(tim.second()));
    g_dialog->cmdSocket->writeDatagram(cmd,QHostAddress("192.168.1.255"),UDP_CMD_WRITE_PORT);
}
Beispiel #22
0
QTime operator*(QTime l,int r)
{
	int left=l.hour()*60*60*1000 + l.minute()*60*1000 + l.second()*1000 + l.msec();
	int result=left*r;
	int ms = result%1000;
	result = (result - ms)/1000;
	int s = result%60;
	result = (result - s)/60;
	int m = result%60;
	result = (result - m)/60;
	int h = result;
	QTime re;
	if (h<24) re.setHMS(h,m,s,ms);
	else re.setHMS(0,0,0,0);
	return re;
}
Beispiel #23
0
  QString CDInfoDialog::framesTime(unsigned frames)
  {
      QTime time;
      double ms;

      ms = frames * 1000 / 75.0;
      time = time.addMSecs((int)ms);

      // Use ".zzz" for milliseconds...
      QString temp2;
      if (time.hour() > 0)
          temp2 = time.toString(QLatin1String( "hh:mm:ss" ));
      else
          temp2 = time.toString(QLatin1String( "mm:ss" ));
      return temp2;
  } // framesTime
Beispiel #24
0
void WPSRun::SetTimeDateStarttoCurrent()
{
    //Начинаем с 00:00 текущего дня
    //Считаем заданный промежуток
//    QDateTime curStart = QDateTime::fromString("2012-09-15_00:00:00", "yyyy-MM-dd_hh:mm:ss");
//    QDateTime curEnd = QDateTime::fromString("2012-09-15_06:00:00", "yyyy-MM-dd_hh:mm:ss");
    //Считаем 1 день
    QDateTime curStart = QDateTime::currentDateTime();
    QTime ntime = curStart.time();
    ntime.setHMS(GetPrevSrok(ntime.hour()),0,0);
    curStart.setTime(ntime);

    //curStart = curStart.addDays(1);  // Считаем со следующих суток
    QDateTime curEnd = curStart.addDays(1); //Одни сутки
    p_namelist_tool->SetDates(&curStart,&curEnd);
}
Beispiel #25
0
/* @NOTE この関数は近い将来撤去されます */
nlPixelShader nlCreatePixelShader( 
                                  const nlInt8* script, 
                                  unsigned int scriptSize, 
                                  const nlInt8* funcName,
                                  nlEngineContext& cxt )
{
    ID3DBlob* pBlob = NULL;
    ID3DBlob* pErrorBlob = NULL;
    nlPixelShader pixelShader;
    pixelShader.shader_ = NULL;
#ifndef INTROMODE
    const DWORD flag = D3D10_SHADER_ENABLE_STRICTNESS | D3D10_SHADER_PACK_MATRIX_ROW_MAJOR;
    HRESULT hr = D3D10CompileShader( script, scriptSize, funcName, shaderMacros, NULL, funcName, "ps_4_0", flag, &pBlob, &pErrorBlob );
    if( FAILED(hr) )
    {
        std::string error = std::string("[")+std::string(funcName)+std::string("]")+std::string(DXGetErrorDescriptionA(hr));
        error.resize(error.size()-1);/* 改行コードを取り除く */
        if(pErrorBlob)
        { 
            error += std::string( (nlInt8*)pErrorBlob->GetBufferPointer() );
            error.resize(error.size()-1);/* 改行コードを取り除く */
        }
        NL_ERR( ERR_018, error.c_str() );
        /* ファイルに書き出す */
        QString fileName;
        QTime now = QDateTime::currentDateTime().time();
        fileName.sprintf("err_%s_%d_%d_d.log",funcName,now.hour(),now.minute(),now.second() );
        QString path = sandboxPath(SP_APP)+fileName;
        QFile dataFile(path);
        dataFile.open(QIODevice::WriteOnly|QIODevice::Text);
        dataFile.write( script );
        /**/
        pixelShader.shader_ = NULL;
        return pixelShader;
    }
#else
    const DWORD flag = D3D10_SHADER_ENABLE_STRICTNESS | D3D10_SHADER_PACK_MATRIX_ROW_MAJOR|D3D10_SHADER_OPTIMIZATION_LEVEL3;
    HRESULT hr = D3D10CompileShader( script, scriptSize, funcName, shaderMacros, NULL, funcName, "ps_4_0", flag, &pBlob, &pErrorBlob );
    if( FAILED(hr) )
    {
        MessageBox( NULL, (nlInt8*)pErrorBlob->GetBufferPointer(), "", MB_OK );
    }
#endif
    NL_HR_VALID( cxt.d3dDevice->CreatePixelShader(pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, &pixelShader.shader_ ) );

    return pixelShader;
}
Beispiel #26
0
void rkFrame::updateTime(void)
{
	QDate date = QDate::currentDate();
	QString str;
	str.sprintf("%04d-%02d-%02d", date.year(), date.month(), date.day());
	dateLabel->setText(str);

	QTime time = QTime::currentTime();
	str.sprintf("%02d:%02d:%02d", time.hour(), time.minute(), time.second());
	timeLabel->setText(str);

	if (ctx.usbflag) {
		showIcon(IconUsb);
	} else {
		hideIcon(IconUsb);
	}
}
ExtDateTime millisecondsToExtDateTime(double ms) {
  ExtDateTime edt;
  edt.setTime_t(0);
  if (ms > 0.0) {
    double milli = fmod(ms, 1000.0);
    ms = (ms - milli) / 1000.0;
    assert(ms < 60*365*24*60*60); // we can't handle big dates yet
    // this will have to change when we do
    edt.setTime_t(int(ms));
    QTime t = edt.time();
    t.setHMS(t.hour(), t.minute(), t.second(), int(milli));
    edt.setTime(t);
  } if (ms < 0.0) {
    abort(); // unhandled at this point
  }
  return edt;
}
Beispiel #28
0
QTime SessionDefaults::correctQualiTime(const QTime &time, int qualiPeriod) const
{
    int hour = time.hour();
    int min = time.minute();
    int sec = time.second();

    int sLength = 10 + (qualiLengths.size() - qualiPeriod)*5;

    int t = sLength * 60 - hour * 3600 - min * 60 - sec;

    hour = t/3600;
    min = (t%3600)/60;
    sec = (t%3600)%60;
    QTime newTime(hour, min, sec);

    return newTime;
}
void
BinClockWidget::updateState()
{
    QTime t = QTime::currentTime();
    int data[2];
    data[1] = t.minute();
    data[0] = (t.hour()-1) % 12 + 1;
    int i;
    for (i = 1; i >= 0; i--) {
        if (data[i] != displayData[i]) {
            displayData[i] = data[i];
            updateLine(i);
        } else {
            break;
        }
    }
}
Beispiel #30
0
/*!
 Replacement for localtime_r() which is not available on MinGW.

 We use this on all of Qt's platforms for portability.
 */
struct tm gmtimeQt(const QDateTime &input)
{
    tm result;

    const QDate date(input.date());
    result.tm_year = date.year() - 1900;
    result.tm_mon = date.month();
    result.tm_mday = date.day();
    result.tm_wday = date.dayOfWeek();
    result.tm_yday = date.dayOfYear();

    const QTime time(input.time());
    result.tm_sec = time.second();
    result.tm_min = time.minute();
    result.tm_hour = time.hour();

    return result;
}