int CustomTimeCtrl::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: isAuto((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: isDateTime((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 2: dateTimeChanged((*reinterpret_cast< const QDateTime(*)>(_a[1]))); break; case 3: adjustDateTime((*reinterpret_cast< QModelIndex(*)>(_a[1])),(*reinterpret_cast< QVariant(*)>(_a[2]))); break; case 4: blockSignals((*reinterpret_cast< const bool(*)>(_a[1]))); break; case 5: setHasTime((*reinterpret_cast< bool(*)>(_a[1]))); break; case 6: onDateChanged((*reinterpret_cast< const QDate(*)>(_a[1]))); break; case 7: onTimeChanged((*reinterpret_cast< const QTime(*)>(_a[1]))); break; default: ; } _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDateTime*>(_v) = dateTime(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDateTime(*reinterpret_cast< QDateTime*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
/*! \reimp */ void QDateEditEx::keyPressEvent(QKeyEvent *event) { if (d->nullable && (event->key() >= Qt::Key_0) && (event->key() <= Qt::Key_9) && d->null) { setDateTime(QDateTime::currentDateTime()); } if (event->key() == Qt::Key_Tab && d->nullable && d->null) { QAbstractSpinBox::keyPressEvent(event); return; } if (event->key() == Qt::Key_Backspace && d->nullable){ QLineEdit *edit = qFindChild<QLineEdit *>(this, "qt_spinbox_lineedit"); if (edit->selectedText() == edit->text()) { setDateTime(QDateTime()); event->accept(); return; } } QDateEdit::keyPressEvent(event); }
void DateTimeDialog::createDialogContent() { ui->setupUi(dialog); double jd = StelApp::getInstance().getCore()->getJDay(); // UTC -> local tz // Add in a DeltaT correction. Divide DeltaT by 86400 to convert from seconds to days. double deltaT = 0.; if (StelApp::getInstance().getCore()->getCurrentLocation().planetName=="Earth") deltaT = StelApp::getInstance().getCore()->getDeltaT(jd)/86400.; setDateTime(jd + (StelApp::getInstance().getLocaleMgr().getGMTShift(jd)/24.0)-deltaT); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connectSpinnerEvents(); }
KLFLibEntry::KLFLibEntry(const QString& latex, const QDateTime& dt, const QImage& preview, const KLFStyle& style) : KLFPropertizedObject("KLFLibEntry") { initRegisteredProperties(); QString latexonly = stripCategoryTagsFromLatex(latex); QString category = categoryFromLatex(latex); QString tags = tagsFromLatex(latex); QSize previewsize = preview.size(); setLatex(latexonly); setDateTime(dt); setPreview(preview); setPreviewSize(previewsize); setCategory(category); setTags(tags); setStyle(style); }
void CodeDateTimeEdit::codeChanged(bool code) { if(!code) { setCalendarPopup(true); setButtonSymbols(QAbstractSpinBox::UpDownArrows); setDateTime(QDateTime::currentDateTime()); setDisplayFormat("dd/MM/yyyy hh:mm:ss"); codeLineEdit()->textChanged(codeLineEdit()->text()); } else { setDisplayFormat(QString()); setCalendarPopup(false); setButtonSymbols(QAbstractSpinBox::NoButtons); } }
void Validity::setDiff(const Validity *start, int number, int range) { QDateTime dt = start->dateTime(); switch (range) { case 0: dt = dt.addDays(number); break; case 1: dt = dt.addMonths(number); break; case 2: dt = dt.addYears(number); break; } // one day less if we go from 0:00:00 to 23:59:59 if (midnight) dt = dt.addDays(-1); setDateTime(dt); mytime = start->mytime; }
AlkQuoteItem::AlkQuoteItem(const AlkQuoteItem& item, QObject* parent): QObject(parent), d(new Private) { setSymbol(item.symbol()); setDateTime(item.dateTime()); setCurrentValue(item.currentValue()); setOpeningValue(item.openingValue()); setHighValue(item.highValue()); setLowValue(item.lowValue()); setClosingValue(item.closingValue()); setVolume(item.volume()); setMarketCap(item.marketCap()); setEarningsPerShare(item.earningsPerShare()); setChangeToday(item.changeToday()); setEbitda(item.ebitda()); setRecordId(item.recordId()); }
GPSListViewItem::GPSListViewItem(KIPI::Interface* interface, KIPIPlugins::ImagesListView *view, const KUrl& url) : KIPIPlugins::ImagesListViewItem(view, url), d(new GPSListViewItemPriv) { d->interface = interface; d->url = url; setEnabled(false); setIcon(KIPIPlugins::ImagesListView::Thumbnail, SmallIcon( "image-x-generic", KIconLoader::SizeLarge, KIconLoader::DisabledState )); setText(KIPIPlugins::ImagesListView::Filename, d->url.fileName()); double alt, lat, lng; KExiv2Iface::KExiv2 exiv2Iface; QMap<QString, QVariant> attributes; KIPI::ImageInfo info = d->interface->info(d->url); attributes = info.attributes(); if (attributes.contains("latitude") && attributes.contains("longitude") && attributes.contains("altitude")) { lat = attributes["latitude"].toDouble(); lng = attributes["longitude"].toDouble(); alt = attributes["altitude"].toDouble(); d->hasGPSInfo = true; } else { exiv2Iface.load(d->url.path()); d->hasGPSInfo = exiv2Iface.getGPSInfo(alt, lat, lng); } if (hasGPSInfo()) setGPSInfo(GPSDataContainer(alt, lat, lng, false), false); QDateTime dt = info.time(KIPI::FromInfo); if (!dt.isValid()) dt = exiv2Iface.getImageDateTime(); if (dt.isValid()) setDateTime(dt); }
void RetrieveTime() { tm test; for (;;) { if (NutSNTPGetTime(×erver, &ntp_time) == 0) { break; } else { NutSleep(200); puts("Time Error"); } } ntp_datetime = localtime(&ntp_time); tm RTCdate={ntp_datetime->tm_sec, ntp_datetime->tm_min, ntp_datetime->tm_hour, ntp_datetime->tm_mday, ntp_datetime->tm_mon, ntp_datetime->tm_year,1,1,1}; setDateTime(&RTCdate); isSynchronizedTimer = 60; getDateTime(&test); printf(" RTC time check = %d : %d : %d \n ", test.tm_hour, test.tm_min, test.tm_sec); }
int Q3DateTimeEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 4) qt_static_metacall(this, _c, _id, _a); _id -= 4; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDateTime*>(_v) = dateTime(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDateTime(*reinterpret_cast< QDateTime*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void ExifReaderWriter::readExif(QString pictureName) { Exiv2::Image::AutoPtr image = openExif(pictureName); if(image.get() == 0) return; Exiv2::ExifData &exifData = image->exifData(); if (exifData.empty()) { //qDebug() << "nejsou exif data"; emit(finished()); return; } //cteniGPS souradnic double lat = readLatLon("Exif.GPSInfo.GPSLatitude", exifData); double lon = readLatLon("Exif.GPSInfo.GPSLongitude", exifData); double alt = readAltitude("Exif.GPSInfo.GPSAltitude", exifData); if(lat < 1000 && lon<1000) { emit(setGps(lat, lon, alt)); } //////////////////////////// QDateTime *dateTime = NULL; //cteni data if((dateTime = readExifDate(exifData,"Exif.Photo.DateTimeOriginal")) == NULL) if((dateTime = readExifDate(exifData,"Exif.Image.DateTimeOriginal")) == NULL) if((dateTime = readExifDate(exifData,"Exif.Photo.DateTimeDigitized")) == NULL) dateTime = readExifDate(exifData,"Exif.Image.DateTime"); if(dateTime != NULL) emit(setDateTime(*dateTime)); emit(finished()); return; }
bool TranlogEntry::fromString(QString strNotation) { QStringList parts = strNotation.split("\t"); Q_ASSERT_X(parts.size()==4, "TranlogEntry::fromString(Qstring)", "Invalid file format!"); QString dtstring = parts.at(0); QString amountstring = parts.at(1); QString messagestring = parts.at(2); QString tagslist = parts.at(3); HisaabDateTime date; bool ok = date.fromString(dtstring); if( !ok ) return false; setDateTime(date); if( !isFloat(amountstring) ) return false; setAmount( amountstring.toFloat() ); setMessage(messagestring); QStringList tags = tagslist.split(" "); foreach(QString tag, tags) { addTag(tag); }
void Validity::setDate(const a1time &a) { setDateTime(a.qDateTime()); }
void KPropertyDateTimeEditor::setValue(const QVariant& value) { blockSignals(true); setDateTime(value.toDateTime()); blockSignals(false); }
void Lamp::updateMenuIndex(unsigned char dir) { switch (dir) { case 't': //top this->_menuIndex=0x0; this->_menuDepth=0x0; break; case 'c': //set time if(menuPosition()==0x0) break; if (menuPosition()==0x1111 || menuPosition()==0x2111 || menuPosition()==0x3111 || menuPosition()==0x1211 || menuPosition()==0x2211 || menuPosition()==0x3211 || menuPosition()==0x4211) { if (menuPosition() == 0x3111) this->_menuIndex = 0x1111; else if (menuPosition() == 0x4211) this->_menuIndex = 0x1211; else this->_menuIndex = this->_menuIndex + (1 << menuDepth()); break; } //set alarm if (menuPosition()==0x1121 || menuPosition()==0x2121 || menuPosition()==0x3121 || menuPosition()==0x1221) { if (menuPosition() == 0x3121) this->_menuIndex = 0x1121; else if (menuPosition() == 0x1221) this->_menuIndex = 0x1221; else this->_menuIndex = this->_menuIndex + (1 << menuDepth()); break; } //brightness / LCD backlight / lcd sleep time if (menuPosition() == 0x122 || menuPosition() == 0x132 || menuPosition() == 0x142) { break; } //AudioViz if (menuPosition()==0x1112) break; if (menuPosition()==0x12) { this->_menuDepth +=4; //ignore 0x112 replace with 0x212; if (getDisplayMode()==0) this->_menuIndex = 0x212; if (getDisplayMode()==1) this->_menuIndex = 0x212; if (getDisplayMode()==2) this->_menuIndex = 0x312; if (getDisplayMode()==3) this->_menuIndex = 0x412; break; } //Cycle if (menuPosition()==0x1212 || menuPosition()==0x2212 || menuPosition()==0x3212) { if (menuPosition() == 0x1212) this->_menuIndex = 0x2212; else if (menuPosition() == 0x2212) this->_menuIndex = 0x3212; else if (menuPosition() == 0x3212) this->_menuIndex = 0x1212; break; } //Random if (menuPosition()==0x1312 || menuPosition()==0x2312) { if (menuPosition() == 0x1312) this->_menuIndex = 0x2312; else if (menuPosition() == 0x2312) this->_menuIndex = 0x1312; break; } //Solid if (menuPosition()==0x1412 || menuPosition()==0x2412) { if (menuPosition() == 0x1412) this->_menuIndex = 0x2412; else if (menuPosition() == 0x2412) this->_menuIndex = 0x1412; break; } this->_menuDepth +=4; this-> _menuIndex = this->_menuIndex + (1 << menuDepth()); //ignore set weekday // if (menuPosition() == 0x1211) this->_menuIndex = 0x2211; break; case 'h': if (_alarming == true) _alarming = false; if (menuDepth() == 0x0) { this->_menuIndex=0x0; break; } this->_menuIndex =this->_menuIndex - (this->_menuCurrent << menuDepth()); this->_menuDepth -=4; break; //Going Left case 'l': //Clock if (menuPosition()==0x1111 || menuPosition()==0x2111 || menuPosition()==0x3111 || menuPosition()==0x1211 || menuPosition()==0x2211 || menuPosition()==0x3211 || menuPosition()==0x4211) { if (menuPosition()==0x01111 && tHour >0 ) tHour-- ; else if (menuPosition()==0x01111 && tHour ==0 ) tHour = 23; //hour if (menuPosition()==0x02111 && tMinute >0 ) tMinute-- ; else if (menuPosition()==0x02111 && tMinute ==0 ) tMinute = 59; //min if (menuPosition()==0x03111 && tHour >=12) tHour-=12; //am if (menuPosition()==0x01211 && tDay>0 ) tDay-- ; else if (menuPosition()==0x01211 && tDay ==0 ) tDay==6; //day if (menuPosition()==0x02211 && tDate >1 ) tDate-- ; else if (menuPosition()==0x02211 && tDate ==1 ) tDate==31; //day if (menuPosition()==0x03211 && tMonth >1 ) tMonth-- ; else if (menuPosition()==0x03211 && tMonth ==1 ) tMonth=12; //month if (menuPosition()==0x04211 && tYear >0 ) tYear-- ; else if (menuPosition()==0x04211 && tYear ==0 ) tYear=99; //year setDateTime(); break; } //Alarm if (menuPosition()==0x1121 || menuPosition()==0x2121 || menuPosition()==0x3121 || menuPosition()==0x1221) { if (menuPosition()==0x1121 && getAlarmHour() >1 ) setAlarmHour(getAlarmHour() - 1 ); else if (menuPosition()==0x1121 && getAlarmHour()==1) setAlarmHour(12); if (menuPosition()==0x2121 && getAlarmMin() >0 ) setAlarmMin(getAlarmMin() - 1 ); else if (menuPosition()==0x2121 && getAlarmMin()==0) setAlarmMin(59); if (menuPosition()==0x3121) setAlarmAM(true); if (menuPosition()==0x1221) setAlarmOn(false); break; } //brightness / LCD backlight / lcd sleep time if (menuPosition() == 0x122 || menuPosition() == 0x132 || menuPosition() == 0x142) { if (menuPosition()==0x122 && getLampBrightness()>1) setLampBrightness(getLampBrightness() - 1); if (menuPosition()==0x132 && getLCDBrightness()>1) setLCDBrightness(getLCDBrightness() - 1); // if (menuPosition()==0x142 && getLCDSleepTime()>10) setLCDSleepTime(getLCDSleepTime() - 1); delay(5); break; } //AudioViz Fade Speed // if (menuPosition()==0x1112) // { // if (getAudioFadeSpeed() >1 ) setAudioFadeSpeed(getAudioFadeSpeed()-1); // break; // } //Cycle if (menuPosition()==0x1212 || menuPosition()==0x2212 || menuPosition()==0x3212) { if (menuPosition()==0x1212 && getCycleHoldTime() >1 ) setCycleHoldTime(getCycleHoldTime() - 1 ); if (menuPosition()==0x2212 && getCycleFadeTime() >1 ) setCycleFadeTime(getCycleFadeTime() - 1 ); if (menuPosition()==0x3212 && getCycleSteps() >1 ) setCycleSteps(getCycleSteps() - 1 ); break; } //Random if (menuPosition()==0x1312 || menuPosition()==0x2312) { if (menuPosition()==0x1312 && getRandomHoldTime() >1 ) setRandomHoldTime(getRandomHoldTime() - 1 ); if (menuPosition()==0x2312 && getRandomFadeTime() >1 ) setRandomFadeTime(getRandomFadeTime() - 1 ); break; } //Solid if (menuPosition()==0x1412 || menuPosition()==0x2412) { if (menuPosition()==0x1412 && getColorHue() >0 ) setColorHue(getColorHue() - 1 ); if (menuPosition()==0x2412 && getColorSat() >0 ) setColorSat(getColorSat() - 1 ); break; } //limits moving left if (menuPosition() == 0x0) this->_menuIndex = 0x2; else if (menuPosition() == 0x11) this->_menuIndex = 0x21; else if (menuPosition() == 0x111) this->_menuIndex = 0x211; else if (menuPosition() == 0x121) this->_menuIndex = 0x221; else if (menuPosition() == 0x12) this->_menuIndex = 0x32; else if (menuPosition() == 0x212) this->_menuIndex = 0x412; else this->_menuIndex = this->_menuIndex - (1 << menuDepth()); //Display Mode if (menuPosition() == 0x112) setDisplayMode(0x0); if (menuPosition() == 0x212) setDisplayMode(0x1); if (menuPosition() == 0x312) setDisplayMode(0x2); if (menuPosition() == 0x412) setDisplayMode(0x3); break; //Going right case 'r': //Clock if (menuPosition()==0x1111 || menuPosition()==0x2111 || menuPosition()==0x3111 || menuPosition()==0x1211 || menuPosition()==0x2211 || menuPosition()==0x3211 || menuPosition()==0x4211) { if (menuPosition()==0x01111 && tHour <23 ) tHour++ ; else if (menuPosition()==0x01111 && tHour ==23 ) tHour = 0; //hour if (menuPosition()==0x02111 && tMinute <59 ) tMinute++ ; else if (menuPosition()==0x02111 && tMinute ==59 ) tMinute = 0; //min if (menuPosition()==0x03111 && tHour <=12) tHour+=12; //am if (menuPosition()==0x01211 && tDay<6 ) tDay++ ; else if (menuPosition()==0x01211 && tDay ==6 ) tDay==0; //day if (menuPosition()==0x02211 && tDate <31 ) tDate++ ; else if (menuPosition()==0x02211 && tDate ==31 ) tDate==1; //day if (menuPosition()==0x03211 && tMonth <12 ) tMonth++ ; else if (menuPosition()==0x03211 && tMonth ==12 ) tMonth=1; //month if (menuPosition()==0x04211 && tYear <99 ) tYear++ ; else if (menuPosition()==0x04211 && tYear ==99 ) tYear=0; //year setDateTime(); break; } //Alarm if (menuPosition()==0x1121 || menuPosition()==0x2121 || menuPosition()==0x3121 || menuPosition()==0x1221) { if (menuPosition()==0x1121 && getAlarmHour() < 12 ) setAlarmHour(getAlarmHour() + 1 ); else if (menuPosition()==0x1121 && getAlarmHour()==12) setAlarmHour(1); if (menuPosition()==0x2121 && getAlarmMin() < 59 ) setAlarmMin(getAlarmMin() + 1 ); else if (menuPosition()==0x2121 && getAlarmMin()==59) setAlarmMin(0); if (menuPosition()==0x3121) setAlarmAM(false); if (menuPosition()==0x1221) setAlarmOn(true); break; } //brightness / LCD backlight / lcd sleep time if (menuPosition() == 0x122 || menuPosition() == 0x132 || menuPosition() == 0x142) { if (menuPosition()==0x122 && getLampBrightness()<255) setLampBrightness(getLampBrightness() + 1); if (menuPosition()==0x132 && getLCDBrightness()<26) setLCDBrightness(getLCDBrightness() + 1); // if (menuPosition()==0x142 && getLCDSleepTime()<31) setLCDSleepTime(getLCDSleepTime() + 1); delay(5); break; } //AudioViz Fade Speed // if (menuPosition()==0x1112) // { // if (getAudioFadeSpeed() < 255 ) setAudioFadeSpeed(getAudioFadeSpeed()+1); // break; // } //Cycle if (menuPosition()==0x1212 || menuPosition()==0x2212 || menuPosition()==0x3212) { if (menuPosition()==0x1212 && getCycleHoldTime() <30 ) setCycleHoldTime(getCycleHoldTime() + 1 ); if (menuPosition()==0x2212 && getCycleFadeTime() <30 ) setCycleFadeTime(getCycleFadeTime() + 1 ); if (menuPosition()==0x3212 && getCycleSteps() <128 ) setCycleSteps(getCycleSteps() + 1 ); break; } //Random if (menuPosition()==0x1312 || menuPosition()==0x2312) { if (menuPosition()==0x1312 && getRandomHoldTime() <30 ) setRandomHoldTime(getRandomHoldTime() + 1 ); if (menuPosition()==0x2312 && getRandomFadeTime() <30) setRandomFadeTime(getRandomFadeTime() + 1 ); break; } //Solid if (menuPosition()==0x1412 || menuPosition()==0x2412) { if (menuPosition()==0x1412 && getColorHue() <255 ) setColorHue(getColorHue() + 1 ); if (menuPosition()==0x2412 && getColorSat() <255 ) setColorSat(getColorSat() + 1 ); break; } //limits moving right if (menuPosition() == 0x2) this->_menuIndex = 0x0; else if (menuPosition() == 0x21) this->_menuIndex = 0x11; else if (menuPosition() == 0x211) this->_menuIndex = 0x111; else if (menuPosition() == 0x221) this->_menuIndex = 0x121; else if (menuPosition() == 0x32) this->_menuIndex = 0x12; else if (menuPosition() == 0x412) this->_menuIndex = 0x212; else this->_menuIndex = this->_menuIndex + (1 << menuDepth()); //Display Mode if (menuPosition() == 0x112) setDisplayMode(0x0); if (menuPosition() == 0x212) setDisplayMode(0x1); if (menuPosition() == 0x312) setDisplayMode(0x2); if (menuPosition() == 0x412) setDisplayMode(0x3); default: break; } this->_menuCurrent = menuPosition() >> menuDepth(); drawMenu(menuPosition()); }
void ArduRCT_RealTimeClock::setTime(uint8_t hour, uint8_t minute, uint8_t second) { setDateTime(0xFFFF, 0xFF, 0xFF, hour, minute, second); }
RDateTime::RDateTime(const RDateTime &dt) { setDateTime(dt); }
terrama2::core::DataSetSeries terrama2::core::DataAccessorJsonCemaden::getSeries( const std::string& uri, const Filter& filter, DataSetPtr dataSet, std::shared_ptr<terrama2::core::FileRemover> /*remover*/) const { QString codestacao = QString::fromStdString(getCodePropertyName(dataSet)); QString inputTimestampProperty = QString::fromStdString(getInputTimestampPropertyName(dataSet)); std::string timestampProperty = getTimestampPropertyName(dataSet); QStringList staticData = QString::fromStdString(getStaticDataProperties(dataSet)).split(','); QString code = QString::fromStdString(getDCPCode(dataSet)); auto dataSetType = std::make_shared<te::da::DataSetType>(code.toStdString()); dataSetType->add(new te::dt::DateTimeProperty(timestampProperty, te::dt::TIME_INSTANT_TZ, true)); auto teDataSet = std::make_shared<te::mem::DataSet>(dataSetType.get()); te::core::URI teUri(uri); std::string filePath = getFolderMask(dataSet) + "/" + getDataMask(dataSet); auto jsonStr = readFileContents(teUri.path()+filePath); QJsonDocument doc = QJsonDocument::fromJson(jsonStr.c_str()); auto readingsArray = doc.object()["cemaden"].toArray(); // iterate over readings // and populate the dataset for(auto reading : readingsArray) { auto obj = reading.toObject(); //check if this is the DCP we want if(obj[codestacao].toString() != code) continue; auto timestampStr = obj[inputTimestampProperty].toString().toStdString(); auto timestamp = terrama2::core::TimeUtils::stringToTimestamp(timestampStr, "%Y-%m-%d %H:%M:%S%F"); // filter by timestamp if((filter.discardBefore && (*filter.discardBefore > *timestamp)) || (filter.discardAfter && (*filter.discardAfter < *timestamp))) continue; // create new item auto item = std::unique_ptr<te::mem::DataSetItem>(new te::mem::DataSetItem(teDataSet.get())); // add item to the end of the dataset teDataSet->moveLast(); teDataSet->add(item.get()); // check if the item has data bool hasData = false; // add timestamp to dataset item->setDateTime(timestampProperty, static_cast<te::dt::TimeInstantTZ*>(timestamp->clone())); for(auto val = obj.begin(); val != obj.end(); ++val) { auto key = val.key(); // ignore static data if(staticData.contains(key) || key == codestacao || key.toStdString() == timestampProperty) continue; // property name auto keyStr = key.toStdString(); // check if the property is already registered in the dataset auto properties = dataSetType->getProperties(); auto it = std::find_if(properties.cbegin(), properties.cend(), [&keyStr](te::dt::Property* property){ return property->getName() == keyStr; }); if(it == properties.cend()) { // update dataSetType te::dt::SimpleProperty* property = new te::dt::SimpleProperty(keyStr, te::dt::DOUBLE_TYPE, false); dataSetType->add(property); // update memory dataset structure teDataSet->add(keyStr, te::dt::DOUBLE_TYPE); } // add property value item->setDouble(keyStr, val.value().toDouble()); hasData = true; } if(!hasData) { // remove the item if no data was inserted teDataSet->remove(item.get()); } item.release(); } terrama2::core::DataSetSeries serie; serie.dataSet = dataSet; serie.syncDataSet = std::make_shared<terrama2::core::SynchronizedDataSet>(teDataSet); serie.teDataSetType = dataSetType; return serie; }
TranlogEntry::TranlogEntry(float amount, QString message, QDateTime dt) { setAmount(amount); setMessage(message); setDateTime(HisaabDateTime(dt)); }
/*! Sets the current \a date in the form of QDate. \param date date to be set on the datetime picker in QDate format \sa date */ void HbDateTimePicker::setDate(const QDate& date) { Q_D(HbDateTimePicker); setDateTime(QDateTime(date,d->mDateTime.time())); }
const file_header* append_(IoType& ar, const file_header& h_, file_type type, zip_package_writer_imp * m_imp){ file_header h = h_; AIO_PRE_CONDITION(m_imp); AIO_PRE_CONDITION(h.method == cm_deflate || h.method == cm_store); AIO_PRE_CONDITION(h.name.str().size() < uint16_t(-1) ); AIO_PRE_CONDITION(h.comments.size() < uint16_t(-1) ); if (m_imp->exist_(h.name)) return 0; auto header_size = K_fix_part_of_local_header + h.name.str().size() + K_sizeof_zip64_extra_field; auto dest_map = io::decorate<io::tail_archive , io::tail_read_map_p , io::tail_write_map_p >(m_imp->archive, m_imp->end_of_last + header_size); m_imp->dirty = true; if (h.method == cm_deflate){ if (type == ft_raw){ deflate_writer d_writer(dest_map); iref<io::writer> dest(d_writer); io::copy_data(ar, dest.get<io::writer>()); d_writer.finish(); h.uncompressed_size = d_writer.uncompressed_size(); h.compressed_size = d_writer.size(); h.crc32 = d_writer.crc32(); } else {// type == ft_defalted io::copy_data(ar, dest_map); } } else { // == cm_store auto size = io::copy_data(ar, dest_map); h.uncompressed_size = size; h.compressed_size = size; h.crc32 = crc32(dest_map); } setDateTime(h); h.relative_offset_ = m_imp->end_of_last; bool zip64_enabled = (h.uncompressed_size >= uint32_t(-1) || h.compressed_size >= uint32_t(-1) || h.relative_offset_ >= uint32_t(-1) ); { // fill extra data for zip64 io::buffer_out bout(h.extra); auto saver = io::exchange::as_sink(bout); save(saver, uint16_t(K_z64_extra_id)); // save(saver, uint16_t(28)); //sizeof extra data save(saver, uint64_t(h.uncompressed_size)); save(saver, uint64_t(h.compressed_size)); save(saver, uint64_t(h.relative_offset_)); save(saver, uint32_t(0)); //Disk Start Number } auto hview = m_imp->archive.get<io::write_map>().view_wr(ext_heap::handle(m_imp->end_of_last , m_imp->end_of_last + header_size)); io::fixed_buffer_io bout(hview.get<io::write_view>().address()); auto saver = io::exchange::as_sink(bout); saver & K_sig_local_eader; saver & h.reader_version & h.flags & h.method & h.modified_time & h.modified_date & h.crc32; if (zip64_enabled) saver & uint32_t(-1) & uint32_t(-1); else saver & uint32_t(h.compressed_size) & uint32_t(h.uncompressed_size); saver & uint16_t(h.name.str().size()) & uint16_t(h.extra.size()); bout.write(make_range(reinterpret_cast<const byte*>(h.name.str().begin()) , reinterpret_cast<const byte*>(h.name.str().end()))); bout.write(to_range(h.extra)); h.local_header_size_ = header_size; m_imp->items.push_back(h); m_imp->end_of_last += header_size + h.compressed_size; return &m_imp->items.back(); }
// ---------------------------------------------------------------------- void QmvTableItem::setContentFromEditor( QWidget * w ) { QString newvalue; if (!w) return; QString oldvalue = tupatt->currentValue(); if ( edit_prompting && !oldvalue.isNull() && oldvalue.length() > 0 && QMessageBox::information( parent_table, "setContentFromEditor:Save", QString("Are you sure that you want to replace the existing value of %1") .arg( oldvalue ), "Yes", "Cancel", 0, 1 ) != 0 ) { return; } QmvMultiLineEdit::SaveMode mode = QmvMultiLineEdit::SaveIfChanged; switch ( editor_type ) { case DateTime: newvalue = setDateTime( (( QmvTSWidget * ) w)->getDateTime() ); break; case CopyText: newvalue = ( (QmvMultiLineEdit *) w)->text(); setTexTCopy(newvalue); // do the replacements // update if mode is set. newvalue = text(); // setTexTCopy updates if possible. if ( parent_table->saveMode() ) tupatt->parentTuple()->save(); parent_table->updateCell( row(), col() ); break; case LineEdit: case ComboBox: case MultiLineEdit: default: if ( parent_table->saveMode() ) mode = QmvMultiLineEdit::SaveIfChanged; else mode = QmvMultiLineEdit::NeverSave; bool save_result = ( (QmvMultiLineEdit *) w)->save( mode ); // attempt a save if ( !save_result ) { if ( tupatt->parentTuple() && tupatt->parentTuple()->parentClass() ) { QString sql_error = tupatt->parentTuple()->lastError(); if (sql_error.length() < 1 ) sql_error = "Unknown Error Message"; QMessageBox::warning(0, "Save value:Warning", QString("The save failed<br><b>%1</b>") .arg(sql_error), "OK", 0 ); } } newvalue = ( (QmvMultiLineEdit *) w)->text(); // perhaps the save altered the value } // return the value to the tableitem setText( newvalue ); parent_table->redisplayRow( row(), col() ); }
/*! Sets the current \a time, to be set on datetime picker widget, in QTime format. \param time in QTime format. \sa time */ void HbDateTimePicker::setTime(const QTime &time) { Q_D(HbDateTimePicker); setDateTime(QDateTime(d->mDateTime.date(), time)); }
void NewGeneDateTimeWidget::HandleChanges(DataChangeMessage const & change_message) { UIOutputProject * project = projectManagerUI().getActiveUIOutputProject(); if (project == nullptr) { return; } std::for_each(change_message.changes.cbegin(), change_message.changes.cend(), [this](DataChange const & change) { switch (change.change_type) { case DATA_CHANGE_TYPE::DATA_CHANGE_TYPE__OUTPUT_MODEL__DATETIME_RANGE_CHANGE: { switch (change.change_intention) { case DATA_CHANGE_INTENTION__ADD: case DATA_CHANGE_INTENTION__REMOVE: { // Should never receive this. } break; case DATA_CHANGE_INTENTION__UPDATE: { if (change.child_identifiers.size() == 0) { return; // from lambda } std::for_each(change.child_identifiers.cbegin(), change.child_identifiers.cend(), [&change, this](WidgetInstanceIdentifier const & child_identifier) { // There is a start and an end datetime widget - child_identifier specifies which widget is being targeted. // Test here to see if it is the current widget being targeted. if (data_instance.code && child_identifier.code && *data_instance.code == *child_identifier.code && data_instance.flags == child_identifier.flags) { if (change.change_intention == DATA_CHANGE_INTENTION__UPDATE) { DataChangePacket_int64 * packet = static_cast<DataChangePacket_int64 *>(change.getPacket()); if (packet) { QDateTime const & currentValue = dateTime(); QDate date_1970(1970, 1, 1); QTime time_12am(0, 0); QDateTime datetime_1970(date_1970, time_12am); std::int64_t different_from_1970_in_ms = static_cast<std::int64_t>(datetime_1970.msecsTo(currentValue)); if (different_from_1970_in_ms != packet->getValue()) { QDateTime datetime_newvalue = datetime_1970; datetime_newvalue.addMSecs(packet->getValue()); if (dateTime() != datetime_newvalue) { setDateTime(datetime_newvalue); } } } else { // error condition ... todo } } } else { // error condition ... todo } }); } case DATA_CHANGE_INTENTION__RESET_ALL: { // Ditto above. } break; default: { } break; } } break; default: { } break; } }); }
DialogMenu::DialogMenu(QWidget *parent) : QDialog(parent), ui(new Ui::DialogMenu) { ui->setupUi(this); // *** -= КИРИЛИЗАЦИЯ !!! =- *** QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8")); //без курсор this->setCursor(QCursor(Qt::BlankCursor)); //connect buttons handlers connect(ui->btnMenuExit,SIGNAL(clicked()),this,SLOT(exitMenu())); connect(ui->btnSetDateTime,SIGNAL(clicked()),this,SLOT(setDateTime())); connect(ui->btnLoadRecipies,SIGNAL(clicked()),this,SLOT(loadRecipies())); connect(ui->btnSaveRecepies,SIGNAL(clicked()),this,SLOT(saveRecepies())); connect(ui->btnAbort,SIGNAL(clicked()),this,SLOT(onAbort())); connect(ui->btnReport,SIGNAL(clicked()),this,SLOT(Report())); connect(ui->btnHumiditySandUp,SIGNAL(clicked()),this,SLOT(onHumiditySandUp())); connect(ui->btnHumiditySandDwn,SIGNAL(clicked()),this,SLOT(onHumiditySandDown())); connect(ui->btnHumidityFractionUp,SIGNAL(clicked()),this,SLOT(onHumidityFractionUp())); connect(ui->btnHumidityFractionDwn,SIGNAL(clicked()),this,SLOT(onHumidityFractionDown())); connect(ui->btnDumpTimeUp,SIGNAL(clicked()),this,SLOT(onDumpTimeUp())); connect(ui->btnDumpTimeDwn,SIGNAL(clicked()),this,SLOT(onDumpTimeDown())); connect(ui->btnAdvCementUp,SIGNAL(clicked()),this,SLOT(onCementAdvUp())); connect(ui->btnAdvCementDwn,SIGNAL(clicked()),this,SLOT(onCementAdvDwn())); connect(ui->btnAdvFractUp,SIGNAL(clicked()),this,SLOT(onFractAdvUp())); connect(ui->btnAdvFracDwn,SIGNAL(clicked()),this,SLOT(onFractAdvDwn())); connect(ui->btnAdvSandUp,SIGNAL(clicked()),this,SLOT(onSandAdvUp())); connect(ui->btnAdvSandDwn,SIGNAL(clicked()),this,SLOT(onSandAdvDwn())); connect(ui->btnAdvPepelUp,SIGNAL(clicked()),this,SLOT(onPepelAdvUp())); connect(ui->btnAdvPepelDwn,SIGNAL(clicked()),this,SLOT(onPepelAdvDwn())); //Date/Time update connect(&clockTimer,SIGNAL(timeout()),this,SLOT(clockTick())); clockTimer.start(1000); ui->lineHumidityFraction->setText(QString("%1").arg(globals.HumidityFraction)); ui->lineHumiditySand->setText(QString("%1").arg(globals.HumiditySand)); ui->lineDumpTime->setText(QString("%1").arg(globals.DumpTime)); ui->lineAdvCement->setText(QString::number(globals.AdvScaleCement,'f',0)); ui->lineAdvFraction->setText(QString::number(globals.AdvScaleFraction,'f',0)); ui->lineAdvPepel->setText(QString::number(globals.AdvScalePepelina,'f',0)); ui->lineAdvSand->setText(QString::number(globals.AdvScaleSand,'f',0)); humidityChanged=false; //В зависимост от текущото състояние някои корекции могат да бъдат забранени. switch(states.State) { case Idle: //в това състояние всички бутони за достъпни освен ПРЕКРАТИ ЗАЯВКА ui->btnHumidityFractionDwn->setEnabled(true); ui->btnHumidityFractionUp->setEnabled(true); ui->lineHumidityFraction->setEnabled(true); ui->btnHumiditySandUp->setEnabled(true); ui->btnHumiditySandDwn->setEnabled(true); ui->lineHumiditySand->setEnabled(true); ui->btnDumpTimeUp->setEnabled(true); ui->btnDumpTimeDwn->setEnabled(true); ui->lineDumpTime->setEnabled(true); ui->btnAbort->setEnabled(false); ui->btnLoadRecipies->setEnabled(true); ui->btnSaveRecepies->setEnabled(true); ui->btnSetDateTime->setEnabled(true); ui->btnAdvCementUp->setEnabled(true); ui->btnAdvCementDwn->setEnabled(true); ui->lineAdvCement->setEnabled(true); ui->btnAdvFractUp->setEnabled(true); ui->btnAdvFracDwn->setEnabled(true); ui->lineAdvFraction->setEnabled(true); ui->btnAdvPepelUp->setEnabled(true); ui->btnAdvPepelDwn->setEnabled(true); ui->lineAdvPepel->setEnabled(true); ui->btnAdvSandUp->setEnabled(true); ui->btnAdvSandDwn->setEnabled(true); ui->lineAdvSand->setEnabled(true); break; case Fail: case Start: case Run: case Abort: case PowerDown: ui->btnHumidityFractionDwn->setEnabled(false); ui->btnHumidityFractionUp->setEnabled(false); ui->lineHumidityFraction->setEnabled(false); ui->btnHumiditySandUp->setEnabled(false); ui->btnHumiditySandDwn->setEnabled(false); ui->lineHumiditySand->setEnabled(false); ui->btnDumpTimeUp->setEnabled(false); ui->btnDumpTimeDwn->setEnabled(false); ui->lineDumpTime->setEnabled(false); ui->btnAbort->setEnabled(false); ui->btnLoadRecipies->setEnabled(false); ui->btnSaveRecepies->setEnabled(false); ui->btnSetDateTime->setEnabled(false); ui->btnAdvCementUp->setEnabled(false); ui->btnAdvCementDwn->setEnabled(false); ui->lineAdvCement->setEnabled(false); ui->btnAdvFractUp->setEnabled(false); ui->btnAdvFracDwn->setEnabled(false); ui->lineAdvFraction->setEnabled(false); ui->btnAdvPepelUp->setEnabled(false); ui->btnAdvPepelDwn->setEnabled(false); ui->lineAdvPepel->setEnabled(false); ui->btnAdvSandUp->setEnabled(false); ui->btnAdvSandDwn->setEnabled(false); ui->lineAdvSand->setEnabled(false); break; case Paused: ui->btnHumidityFractionDwn->setEnabled(false); ui->btnHumidityFractionUp->setEnabled(false); ui->lineHumidityFraction->setEnabled(false); ui->btnHumiditySandUp->setEnabled(false); ui->btnHumiditySandDwn->setEnabled(false); ui->lineHumiditySand->setEnabled(false); ui->btnDumpTimeUp->setEnabled(false); ui->btnDumpTimeDwn->setEnabled(false); ui->lineDumpTime->setEnabled(false); ui->btnAbort->setEnabled(true); ui->btnLoadRecipies->setEnabled(false); ui->btnSaveRecepies->setEnabled(false); ui->btnSetDateTime->setEnabled(false); ui->btnAdvCementUp->setEnabled(false); ui->btnAdvCementDwn->setEnabled(false); ui->lineAdvCement->setEnabled(false); ui->btnAdvFractUp->setEnabled(false); ui->btnAdvFracDwn->setEnabled(false); ui->lineAdvFraction->setEnabled(false); ui->btnAdvPepelUp->setEnabled(false); ui->btnAdvPepelDwn->setEnabled(false); ui->lineAdvPepel->setEnabled(false); ui->btnAdvSandUp->setEnabled(false); ui->btnAdvSandDwn->setEnabled(false); ui->lineAdvSand->setEnabled(false); break; } }
int QDateTimeEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QAbstractSpinBox::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 7) qt_static_metacall(this, _c, _id, _a); _id -= 7; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QDateTime*>(_v) = dateTime(); break; case 1: *reinterpret_cast< QDate*>(_v) = date(); break; case 2: *reinterpret_cast< QTime*>(_v) = time(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = maximumDateTime(); break; case 4: *reinterpret_cast< QDateTime*>(_v) = minimumDateTime(); break; case 5: *reinterpret_cast< QDate*>(_v) = maximumDate(); break; case 6: *reinterpret_cast< QDate*>(_v) = minimumDate(); break; case 7: *reinterpret_cast< QTime*>(_v) = maximumTime(); break; case 8: *reinterpret_cast< QTime*>(_v) = minimumTime(); break; case 9: *reinterpret_cast< Section*>(_v) = currentSection(); break; case 10: *reinterpret_cast<int*>(_v) = QFlag(displayedSections()); break; case 11: *reinterpret_cast< QString*>(_v) = displayFormat(); break; case 12: *reinterpret_cast< bool*>(_v) = calendarPopup(); break; case 13: *reinterpret_cast< int*>(_v) = currentSectionIndex(); break; case 14: *reinterpret_cast< int*>(_v) = sectionCount(); break; case 15: *reinterpret_cast< Qt::TimeSpec*>(_v) = timeSpec(); break; } _id -= 16; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 1: setDate(*reinterpret_cast< QDate*>(_v)); break; case 2: setTime(*reinterpret_cast< QTime*>(_v)); break; case 3: setMaximumDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setMinimumDateTime(*reinterpret_cast< QDateTime*>(_v)); break; case 5: setMaximumDate(*reinterpret_cast< QDate*>(_v)); break; case 6: setMinimumDate(*reinterpret_cast< QDate*>(_v)); break; case 7: setMaximumTime(*reinterpret_cast< QTime*>(_v)); break; case 8: setMinimumTime(*reinterpret_cast< QTime*>(_v)); break; case 9: setCurrentSection(*reinterpret_cast< Section*>(_v)); break; case 11: setDisplayFormat(*reinterpret_cast< QString*>(_v)); break; case 12: setCalendarPopup(*reinterpret_cast< bool*>(_v)); break; case 13: setCurrentSectionIndex(*reinterpret_cast< int*>(_v)); break; case 15: setTimeSpec(*reinterpret_cast< Qt::TimeSpec*>(_v)); break; } _id -= 16; } else if (_c == QMetaObject::ResetProperty) { switch (_id) { case 3: clearMaximumDateTime(); break; case 4: clearMinimumDateTime(); break; case 5: clearMaximumDate(); break; case 6: clearMinimumDate(); break; case 7: clearMaximumTime(); break; case 8: clearMinimumTime(); break; } _id -= 16; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 16; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 16; } #endif // QT_NO_PROPERTIES return _id; }
void Validity::setNow() { setDateTime(a1time::now()); setMyTime(time()); }
RDateTime& RDateTime::operator = (const RDateTime &other) { setDateTime(other); return *this; }
void ArduRCT_RealTimeClock::setDate(uint16_t year, uint8_t month, uint8_t day) { setDateTime(year, month, day, 0xFF, 0xFF, 0xFF); }