Example #1
0
void FileLogger::handleMessage(QtMsgType type, const char *msg)
{
    if (type == QtDebugMsg)
    {
        QString message(msg);
        if (mFilterByLogMarker)
        {
            if(message.contains(KLogMarker))
            {
                QTextStream debugStream(&mDebugFile);
                QDateTime dateTime(QDateTime::currentDateTime());
                QString log2output = dateTime.toString("yyyy-MM-dd::hh:mm:ss.zzz") + " : " + message;
                debugStream<<log2output;
            }
            else
            {
                return;
            }
        }
        else
        {
            QTextStream debugStream(&mDebugFile);
            QDateTime dateTime(QDateTime::currentDateTime());
            QString log2output = dateTime.toString("yyyy-MM-dd::hh:mm:ss.zzz") + " : " + message;
            debugStream<<log2output<<endl;
        }
    }
}
Example #2
0
void Validity::hideTime(bool hide)
{
	if (hide) {
		if (!midnight && endDate)
			setDateTime(dateTime().addDays(-1));
		midnight = true;
	} else {
		if (midnight && endDate)
			setDateTime(dateTime().addDays(1));
		midnight = false;
		setTime(mytime);
	}
	updateFormatString();
}
/*
 This is _only_ called when QGeoPositionInfoValidator::valid() returns true for the position.
 This means that it is implied that:
 - (data.dwValidFields & GPS_VALID_LATITUDE) != 0
 - (data.dwValidFields & GPS_VALID_LONGITUDE) != 0
 - (data.dwValidFields & GPS_VALID_UTC_TIME) != 0

 This guarantees that the newly created position will be valid.
 If the code is changed such that this is no longer guaranteed then this method will need to be
 updated to test for those conditions.
*/
void QGeoPositionInfoSourceWinCE::dataUpdated(GPS_POSITION data)
{
    QGeoCoordinate coordinate(data.dblLatitude, data.dblLongitude);

    // The altitude is optional in QGeoCoordinate, so we do not strictly require that the
    // GPS_POSITION structure has valid altitude data in order to trigger an update.
    if ((data.dwValidFields & GPS_VALID_ALTITUDE_WRT_SEA_LEVEL) != 0)
        coordinate.setAltitude(data.flAltitudeWRTSeaLevel);

    QDate date(data.stUTCTime.wYear, data.stUTCTime.wMonth, data.stUTCTime.wDay);
    QTime time(data.stUTCTime.wHour, data.stUTCTime.wMinute, data.stUTCTime.wSecond,
               data.stUTCTime.wMilliseconds);

    QDateTime dateTime(date, time, Qt::UTC);

    QGeoPositionInfo pos(coordinate, dateTime);

    // The following properties are optional, and so are set if the data is present and valid in
    // the GPS_POSITION structure.
    if ((data.dwValidFields & GPS_VALID_SPEED) != 0)
        pos.setAttribute(QGeoPositionInfo::GroundSpeed, data.flSpeed);

    if ((data.dwValidFields & GPS_VALID_HEADING) != 0)
        pos.setAttribute(QGeoPositionInfo::Direction, data.flHeading);

    if ((data.dwValidFields & GPS_VALID_MAGNETIC_VARIATION) != 0)
        pos.setAttribute(QGeoPositionInfo::MagneticVariation, data.dblMagneticVariation);

    lastPosition = pos;
    emit positionUpdated(pos);
}
Q3DateTimeEdit* ossimQtPropertyDateItem::dateTimeEditor()
{
   if(theDateTimeEditor)
   {
      return theDateTimeEditor;
   }
   if(getOssimProperty().valid())
   {
      ossimDateProperty* dateProperty = PTR_CAST(ossimDateProperty,
                                                 getOssimProperty().get());
      if(dateProperty)
      {
         
         theDateTimeEditor = new Q3DateTimeEdit(theListView);
         QTime time(dateProperty->getDate().getHour(),
                    dateProperty->getDate().getMin(),
                    dateProperty->getDate().getSec());
         QDate date(dateProperty->getDate().getYear(),
                    dateProperty->getDate().getMonth(),
                    dateProperty->getDate().getDay());
         
         QDateTime dateTime(date, time);
         dateTimeEditor()->setDateTime(dateTime);
         connect(theDateTimeEditor,
                 SIGNAL(valueChanged(const QDateTime& )),
                 this,
                 SLOT(valueChanged(const QDateTime&)));
      }
   }
void ossimQtPropertyDateItem::showEditor()
{
   if(!getOssimProperty()) return;
   
   ossimQtPropertyItem::showEditor();
   ossimDateProperty* dateProperty = PTR_CAST(ossimDateProperty,
                                          getOssimProperty().get());
   if(dateProperty)
   {
      
      QTime time(dateProperty->getDate().getHour(),
                 dateProperty->getDate().getMin(),
                 dateProperty->getDate().getSec());
      QDate date(dateProperty->getDate().getYear(),
                 dateProperty->getDate().getMonth(),
                 dateProperty->getDate().getDay());
      
      QDateTime dateTime(date, time);
      
      dateTimeEditor()->blockSignals(TRUE);
      dateTimeEditor()->setDateTime(dateTime);
      dateTimeEditor()->blockSignals(FALSE);
      
      placeEditor(dateTimeEditor());
      
      dateTimeEditor()->show();
      dateTimeEditor()->setFocus();
   }
}
Example #6
0
  virtual QwtText label(double fracDays) const
  {
    Time timeFromFracDays(fracDays-m_startDateTime.date().dayOfYear()-m_startDateTime.time().totalDays());
    DateTime dateTime(m_startDateTime + timeFromFracDays);
    Date date = dateTime.date();
    Time time = dateTime.time();
    unsigned day = date.dayOfMonth();
    unsigned month = openstudio::month(date.monthOfYear());
    int hour = time.hours();
    int minutes = time.minutes();
    int seconds = time.seconds();

    QString s;

// zooming 
    double currentDuration = scaleDiv().upperBound() - scaleDiv().lowerBound();

    if (currentDuration < 1.0/24.0) // less than an hour
    {
      s.sprintf("%02d/%02d %02d:%02d:%02d", month, day, hour, minutes, seconds);
    }
    else if (currentDuration < 7.0) // less than a week
    {
      s.sprintf("%02d/%02d %02d:%02d", month, day, hour, minutes);
    }
    else // week or more
    {
      s.sprintf("%02d/%02d", month, day);
    }



    return s;
  }
Example #7
0
static QString parseDate(const QString &monthStr, const QString &dayStr, const QString &timeStr)
{
    int month=strToMonth(monthStr),
        day=-1,
        h=-1,
        m=-1,
        s=-1;

    if(-1!=month)
    {
        day=dayStr.toInt();
        h=timeStr.mid(0, 2).toInt();
        m=timeStr.mid(3, 2).toInt();
        s=timeStr.mid(6, 2).toInt();

        if(s>-1)
        {
            QDateTime dateTime(QDate(QDate::currentDate().year(), month, day), QTime(h, m, s));
            if (dateTime.isValid())
                return QLocale().toString(dateTime);
        }
    }

    return monthStr+QChar(' ')+dayStr+QChar(' ')+timeStr;
}
Example #8
0
void Logger::log(const QString& facility, const QString& message, LogLevelE level)
{
    LogFilterMap::const_iterator it(m_filters.find(facility));

    if(it == m_filters.end())
        m_filters[facility] = true; // add to existing facilities, enabled by default.
    else if(!it.value())
        return; // filtered out!

    // manage unlikely out-of-range value.
    level = level >= NUM_SEVERITY_LEVELS ? info : level;

    if(!m_levels[level]) // check if severity level is filtered out.
        return;

    QString dateTime(QDate::currentDate().toString("yyyy-MM-dd") +
                     QTime::currentTime().toString(" hh:mm:ss:zzz"));

    // The logging levels are: [E]RROR [W]ARNING [I]NFORMATION [S]UCCESS.
    QString levelFacility(QString("EWIS")[level] + " " + facility);

    foreach(ILogTransport* transport, m_transports) {
        transport->appendTime(dateTime);
        transport->appendLevelAndFacility(level, levelFacility);
        transport->appendMessage(message);
    }
Example #9
0
bool Interface_GUIDialogNumeric::show_and_get_date(void* kodiBase, tm *date, const char *heading)
{
  CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
  if (!addon)
  {
    CLog::Log(LOGERROR, "Interface_GUIDialogNumeric::%s - invalid data", __FUNCTION__);
    return false;
  }

  if (!date || !heading)
  {
    CLog::Log(LOGERROR,
              "Interface_GUIDialogNumeric::%s - invalid handler data (date='%p', heading='%p') on "
              "addon '%s'",
              __FUNCTION__, static_cast<void*>(date), heading, addon->ID().c_str());
    return false;
  }

  SYSTEMTIME systemTime;
  CDateTime dateTime(*date);
  dateTime.GetAsSystemTime(systemTime);
  if (CGUIDialogNumeric::ShowAndGetDate(systemTime, heading))
  {
    dateTime = systemTime;
    dateTime.GetAsTm(*date);
    return true;
  }
  return false;
}
Example #10
0
/**
 * Create CompleteRevocationRefs element that describes communication with OSCP responder.
 * @param responderName OCSP responder name as represented in responder public certification. Format as RFC2253
 * @param digestMethodUri digest method URI that was used for calculating ocspResponseHash
 * @param ocspResponseHash Digest of DER encode OCSP response
 * @param producedAt ProduceAt field of OCSP response
 */
void digidoc::SignatureTM::setCompleteRevocationRefs(const std::string& responderName, const std::string& digestMethodUri,
        const std::vector<unsigned char>& ocspResponseHash, const struct tm& producedAt )
{
    dsig::DigestMethodType method(xml_schema::Uri(digestMethodUri.c_str()));
    dsig::DigestValueType value(xml_schema::Base64Binary(&ocspResponseHash[0], ocspResponseHash.size()));

    xades::DigestAlgAndValueType digest(method, value);

    xades::ResponderIDType responderId;
    responderId.byName(xml_schema::String(responderName.c_str()));

	xml_schema::DateTime dateTime( util::date::makeDateTime( producedAt ) );
    xades::OCSPIdentifierType ocspId(responderId, dateTime);
    ocspId.uRI(xml_schema::Uri("#N0"));

    xades::OCSPRefType ocspRef(ocspId);
    ocspRef.digestAlgAndValue(digest);


    xades::OCSPRefsType ocspRefs;
    ocspRefs.oCSPRef().push_back(ocspRef);

    xades::CompleteRevocationRefsType completeRevocationRefs;
    completeRevocationRefs.oCSPRefs(ocspRefs);
    completeRevocationRefs.id(xml_schema::Id("S0-REVOCREFS"));
    //return completeRevocationRefs;

    unsignedSignatureProperties()->completeRevocationRefs().push_back(completeRevocationRefs);
}
void NewGeneDateTimeWidget::WidgetDataRefreshReceive(WidgetDataItem_DATETIME_WIDGET widget_data)
{

	if (!data_instance.code || !widget_data.identifier || !widget_data.identifier->code || *widget_data.identifier->code != "0" || (widget_data.identifier->flags != "s"
			&& widget_data.identifier->flags != "e"))
	{
		boost::format msg("Invalid widget refresh in NewGeneDateTimeWidget widget.");
		QMessageBox msgBox;
		msgBox.setText(msg.str().c_str());
		msgBox.exec();
		return;
	}

	if (widget_data.identifier->flags != data_instance.flags)
	{
		return;
	}

	QDate date_1970(1970, 1, 1);
	QTime time_12am(0, 0);
	QDateTime datetime_1970(date_1970, time_12am);

	QDateTime proposed_date_time = datetime_1970.addMSecs(widget_data.the_date_time);

	if (dateTime() != proposed_date_time)
	{
		setDateTime(proposed_date_time);
	}

}
CString CMultipleRequestsDlg::InterpretInvoiceQueryResponse(
    IResponsePtr& response ) 
{

  CString msg;
  msg.Format ( "Status: Code = %d, Message = %S"
    ", Severity = %S", response->StatusCode, 
    (BSTR)response->StatusMessage, (BSTR)response->StatusSeverity );
    
  IInvoiceRetListPtr invoiceRetList = response->Detail;
    
  if (invoiceRetList != NULL ) 
  {
    int count = invoiceRetList->Count;
    for( int ndx = 0; ndx < count; ndx++ )
    {
      IInvoiceRetPtr invoiceRet = invoiceRetList->GetAt(ndx);

      CString tmp;
      _bstr_t txnID =  invoiceRet->TxnID->GetValue();
      COleDateTime dateTime( invoiceRet->TxnDate->GetValue() );
      _bstr_t refNumber = invoiceRet->RefNumber->GetValue();

      tmp.Format( "\r\n\tInvoice (%d): TxnID = %S, "
        "TxnDate = %s, RefNumber = %S",
        ndx, (BSTR)txnID, dateTime.Format(), (BSTR)refNumber );
      msg += tmp;
    }
  }
  return msg;
}
Example #13
0
void DateTimeEdit::checkDateTimeChange(void) {
    this->blockSignals(true);
	if (itsUndefined) {
		if (itsPreviousDateTime == dateTime()) { // was undefined and did not change -> re-apply opacity effect
			// NOTE: if minimum date equals the date then the special value text is shown
			setSpecialValueText(itsSpecialValueText);
			QDateTimeEdit::setDateTime(minimumDateTime());
		}
		else {
			itsUndefined = false;
			setSpecialValueText("");
		}
		itsPreviousDateTime = dateTime();
	}
    this->blockSignals(false);
}
Example #14
0
// ---------------------------------------------------------------------------
// CWlanBgScan::TimeRelationToRange
// ---------------------------------------------------------------------------
//
CWlanBgScan::TRelation CWlanBgScan::TimeRelationToRange( const TTime& aTime, TUint aRangeStart, TUint aRangeEnd ) const
    {
#ifdef _DEBUG
    TBuf<KWlanBgScanMaxDateTimeStrLen> dbgString;
    TRAP_IGNORE( aTime.FormatL( dbgString, KWlanBgScanDateTimeFormat2 ) );
    DEBUG1( "CWlanBgScan::TimeRelationToRange() - time:  %S", &dbgString );
#endif
        
    TDateTime dateTime( aTime.DateTime() );
    
    TUint timeToCheck = ( dateTime.Hour() * KGetHours ) + dateTime.Minute();

    DEBUG2( "CWlanBgScan::TimeRelationToRange() - range: %04u - %04u", aRangeStart, aRangeEnd );

    CWlanBgScan::TRelation relation( ESmaller );
    
    if( aRangeStart == aRangeEnd )
        {
        DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
        relation = EGreater;
        }
    else if( aRangeStart > aRangeEnd )
        {
        DEBUG( "CWlanBgScan::TimeRelationToRange() - range crosses the midnight" );
        /**
         * As range crosses midnight, there is no way for the relation to be ESmaller.
         */
        if( timeToCheck < aRangeEnd || timeToCheck >= aRangeStart )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" );
            relation = EInsideRange;
            }
        else
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
            relation = EGreater;
            }
        }
    else
        {
        if( timeToCheck < aRangeStart )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: ESmaller" );
            relation = ESmaller;
            }
        else if( timeToCheck >= aRangeStart && timeToCheck < aRangeEnd )
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EInsideRange" );
            relation = EInsideRange;
            }
        else
            {
            DEBUG( "CWlanBgScan::TimeRelationToRange() - returning: EGreater" );
            relation = EGreater;
            }
        }
    
    return relation;
    }
Example #15
0
void Validity::localTime(int state)
{
	if (midnight)
		return;
	switch (state) {
	case Qt::Checked:
		setTimeSpec(Qt::LocalTime);
		setDateTime(dateTime().toLocalTime());
		break;
	case Qt::Unchecked:
		setTimeSpec(Qt::UTC);
		setDateTime(dateTime().toUTC());
		break;
	}
	updateFormatString();
	setMyTime(time());
}
Example #16
0
/**
 * Shift the times in a log of a string property
 * @param logEntry :: the string property
 * @param timeShift :: the time shift.
 */
void ChangeTimeZero::shiftTimeOfLogForStringProperty(
    PropertyWithValue<std::string> *logEntry, double timeShift) const {
  // Parse the log entry and replace all ISO8601 strings with an adjusted value
  auto value = logEntry->value();
  if (checkForDateTime(value)) {
    DateAndTime dateTime(value);
    DateAndTime shiftedTime = dateTime + timeShift;
    logEntry->setValue(shiftedTime.toISO8601String());
  }
}
void Element::setDisplayDate(bool displayDate) {
	const auto item = data();
	if (displayDate && !Has<DateBadge>()) {
		AddComponents(DateBadge::Bit());
		Get<DateBadge>()->init(dateTime());
		setPendingResize();
	} else if (!displayDate && Has<DateBadge>()) {
		RemoveComponents(DateBadge::Bit());
		setPendingResize();
	}
}
Example #18
0
void Validity::hideTime(bool hide)
{
	if (hide) {
		QString format;
		if (!endDate)
			format = QTime(0,0,0).toString(formatDate);
		else
			format = QTime(23,59,59).toString(formatDate);
		if (!midnight && endDate)
			setDateTime(dateTime().addDays(-1));
		midnight = true;
		setDisplayFormat(format);
	} else {
		setDisplayFormat(formatDate);
		if (midnight && endDate)
			setDateTime(dateTime().addDays(1));
		midnight = false;
		setTime(mytime);
	}
}
void GetLocalTime(SYSTEMTIME *systemTime)
{
    QDateTime dateTime(QDateTime::currentDateTime());
    systemTime->wYear = dateTime.date().year()%2000;
    systemTime->wMonth = dateTime.date().month();
    systemTime->wDayOfWeek = dateTime.date().dayOfWeek();
    systemTime->wDay = dateTime.date().day();
    systemTime->wHour = dateTime.time().hour();
    systemTime->wMinute = dateTime.time().minute();
    systemTime->wSecond = dateTime.time().second();
    systemTime->wMilliseconds = dateTime.time().msec();
}
void addShowDialog::on_addShowButton_clicked()
{
    //Get the date and time
    QDate date;
    QTime time;
    date = ui->calendarWidget->selectedDate();
    time = ui->timeEdit->time();

    //Merge them into a QDateTime
    QDateTime dateTime(date, time);

    //Get movie
    int movieID = movieModel->getMovieID(ui->movieCBB->currentIndex());

    //Get hall
    int hallID = hallModel->getHallID(ui->hallCBB->currentIndex());

    //Get 3D
    bool DDD = ui->DDDYesRB->isChecked();

    //Get subs
    bool subs = ui->subYesRB->isChecked();

    //Get language
    QString lang = ui->languageCBB->currentText();

    //Get price
    double price = ui->priceSpinBox->value();

    //set sail! wohoo
    if(role == Add)
        emit add_Show(dateTime, price, lang, DDD, subs, movieID, hallID);
    if(role == Edit)
    {
        QMessageBox msgBox(QMessageBox::Question,
                           "Edit Show",
                           "Are you sure you want to edit this show?"
                           "\n\nWarning: All bookings connected to this show will be deleted.",
                           QMessageBox::Yes | QMessageBox::No
                           );
        if(msgBox.exec() == QMessageBox::Yes)
        {
            emit edit_show(showID, dateTime, price, lang, DDD, subs, movieID, hallID);
        }
        else
        {
            return;
        }
    }

    close();
}
Example #21
0
void DateTimeEdit::focusInEvent(QFocusEvent* event)
{
	this->blockSignals(true);

	if (itsUndefined) {
		QDateTimeEdit::setDateTime(itsDefaultDateTime);
		setSpecialValueText("");
        itsPreviousDateTime = dateTime();
	}

    QDateTimeEdit::focusInEvent(event);
    this->blockSignals(false);
}
Example #22
0
void dateTimeTests::test_setGetDateTime()
{
    dateTime test, compare;
    QDate d = QDate::currentDate();
    QTime t = QTime::currentTime();

    compare.setDateTime(dateTime(d,t));
    test.setDateTime(compare.getDateTime());

    QCOMPARE(test.isNull(),false);
    QCOMPARE(compare.isNull(),false);
    QCOMPARE(test.getDateTime(), compare.getCurrentDateTime());
}
Example #23
0
			xml_schema::DateTime makeDateTime(const struct tm& lt)
			{
				xml_schema::DateTime dateTime( lt.tm_year + 1900
											 , static_cast<unsigned short>( lt.tm_mon + 1 )
											 , static_cast<unsigned short>( lt.tm_mday )
											 , static_cast<unsigned short>( lt.tm_hour )
											 , static_cast<unsigned short>( lt.tm_min )
											 , lt.tm_sec
											 , 0 //zone +0h
											 , 0 ); //zone +0min

				return dateTime;
			}
void putSns() {

// set datetime as the message to TARGET_ARN
	MinimalString dateTime(dateTimeProvider.getDateTime());
	dateTimeProvider.sync(dateTime.getCStr());

// Delivery attempt to Amazon SNS.
	publishInput.setMessage(dateTime);
	publishInput.setTargetArn(TARGET_ARN);
	PublishOutput publishOutput = snsClient.publish(publishInput, actionError);
	Serial.print("Sent message ID: ");
	Serial.println(publishOutput.getMessageId().getCStr());
}
Example #25
0
/**
 * @brief Graph::Graph
 * Widget that contains the graphical elements displayed to the user
 * @param bourse
 * @param parent
 */
Graph::Graph(Bourse* bourse, QWidget *parent) : QWidget(parent)
{
    this->bourse = bourse;

    customPlot = new QCustomPlot();

    QVector<double> x;
    QVector<double> y;

    QMap<int, double>::iterator i;
    QMap<int, double> cours = bourse->getCours();

    int j = 0;
    for (i = cours.begin(); i != cours.end(); ++i)
    {
        QDateTime dateTime(QDate::fromJulianDay(i.key()));
        x.append(dateTime.toTime_t());
        y.append(i.value());
        j++;
    }

    customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
    customPlot->xAxis->setTickLabelRotation(90);
    customPlot->xAxis->setDateTimeFormat("dd'-'MM'-'yyyy");

    customPlot->xAxis->setAutoTickStep(false);
    customPlot->xAxis->setAutoSubTicks(false);
    customPlot->xAxis->setSubTickCount(7);
    customPlot->xAxis->setTickStep(3600*24*7*4);

    customPlot->addGraph();
    customPlot->graph(0)->setData(x, y);

    customPlot->xAxis->setLabel("Date");
    customPlot->yAxis->setLabel("Price");

    customPlot->xAxis->setRange(x.last(), x.first());
    customPlot->yAxis->setRange(bourse->getMin(), bourse->getMax());
    customPlot->replot();

    labelPeriod = new QLabel(bourse->getMaxInflation());
    labelYear = new QLabel(bourse->getMaxYearInflation());

    QVBoxLayout *layout = new QVBoxLayout;

    layout->addWidget(customPlot,2);
    layout->addWidget(labelPeriod, 0);
    layout->addWidget(labelYear, 0);

    setLayout(layout);
}
Example #26
0
// --------------------------------------------------------------------------
//!
// --------------------------------------------------------------------------
void tCurrentInfoDialog::UpdateDialog()
{
    // Get the date time from the edit
    QDateTime dateTime( m_ActiveDate );

    // We want to update the graph here...
    QString errorMsg;
    if(m_pCurrentInfoObj->Query(dateTime, errorMsg, 10))
    {
        setWindowTitle( tr("Currents") + " - " + m_pCurrentInfoObj->Name() + " " + m_pCurrentInfoObj->m_stationNameAppend );

        // convert the heights data table into the correct format
        std::vector< tAt5CurrentsQuickInfoObject::tAt5CurrentsVelocity > At5Velocities = m_pCurrentInfoObj->m_currentsVelocities;
        QVector< QPair< qreal, tCurrentGraph::tCurrentVelocity > > velocities( At5Velocities.size() );
        for( uint i = 0; i < At5Velocities.size(); ++i )
        {
            QPair< qreal, tCurrentGraph::tCurrentVelocity > velocity;
            velocity.first = (qreal)i / 144;
            velocity.second.speed = (qreal)At5Velocities.at(i).speed;
            velocity.second.direction = (qreal)At5Velocities.at(i).direction;
            velocity.second.ebb = At5Velocities.at(i).ebb;
            velocities[i] = velocity;
        }
        m_pGraph->SetVelocities( velocities );

        // convert the extremes data table into the correct format
        std::vector< tAt5CurrentsQuickInfoObject::tAt5CurrentsExtreme > At5Extremes = m_pCurrentInfoObj->m_currentsExtremes;
        QVector< tCurrentGraph::tCurrentExtreme > extremes( At5Extremes.size() );
        for( uint i = 0; i < At5Extremes.size(); ++i )
        {
            tCurrentGraph::tCurrentExtreme extreme;
            extreme.time = At5Extremes.at(i).time.time();
            extreme.velocity.speed = At5Extremes.at(i).velocity.speed;
            extreme.velocity.direction = At5Extremes.at(i).velocity.direction;
            extreme.velocity.ebb = At5Extremes.at(i).velocity.ebb;
            extreme.type = (tCurrentGraph::tCurrentType)(At5Extremes.at(i).extreme_type);
            extremes[i] = extreme;
        }
        m_pGraph->SetExtremes( extremes );


        // sun rise, set
        int localOffset = tSystemSettings::Instance()->LocalTimeOffset() * 60;
        tSunData sunData;
        tSunMoon sunMoon;    
        sunData = sunMoon.SunCalculation( m_pCurrentInfoObj->GeoPosition().ToMCoord(), dateTime, localOffset );
        m_pGraph->SetSunRiseSet( sunData.Rise.time(), sunData.Set.time() );
    }
    m_pGraph->UpdateGraph(dateTime);
}
Example #27
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;
}
Example #28
0
void FileLogger::installMessageHandler(bool filterByMarker)
{
    QDateTime dateTime(QDateTime::currentDateTime());
    QString logFileName = KLogFileNamePrefix
                        + dateTime.toString("-yyyy-MM-dd-hh-mm-ss-zzz")
                        + KLogFileNameExt;

    mDebugFile.setFileName(logFileName);
    mFilterByLogMarker = filterByMarker;

    if (mDebugFile.open(QIODevice::Text | QIODevice::WriteOnly))
    {
        qInstallMsgHandler(FileLogger::handleMessage);
    }
}
void CWspHeaderReader::DecodeGenericDateValueL(RHeaderField& aHeader) const
	{
	TPtrC8 rawData;
	aHeader.RawDataL(rawData);
	CheckLengthL(rawData, 1);
	TWspPrimitiveDecoder wspDecoder(rawData);
	if( wspDecoder.VarType() == TWspPrimitiveDecoder::ELengthVal )
		{
		TDateTime dateTime(1970, EJanuary, 0, 0, 0, 0, 0);
		User::LeaveIfError(wspDecoder.Date(dateTime));
		SetNewDatePartL(aHeader, 0, dateTime);
		}
	else
		User::Leave(KErrCorrupt);
	}
void Element::recountDisplayDateInBlocks() {
	setDisplayDate([&] {
		const auto item = data();
		if (item->isEmpty()) {
			return false;
		}

		if (const auto previous = previousInBlocks()) {
			const auto prev = previous->data();
			return prev->isEmpty()
				|| (previous->dateTime().date() != dateTime().date());
		}
		return true;
	}());
}