예제 #1
0
	QMap<QString, QVariant> EntryBase::GetClientInfo (const QString& var) const
	{
		auto res = Variant2ClientInfo_ [var];

		if (Variant2SecsDiff_.contains (var))
		{
			auto now = QDateTime::currentDateTimeUtc ();
			now.setTimeSpec (Qt::LocalTime);
			const auto& secsDiff = Variant2SecsDiff_.value (var);
			res ["client_time"] = now
					.addSecs (secsDiff.Diff_)
					.addSecs (secsDiff.Tzo_);
			res ["client_tzo"] = secsDiff.Tzo_;
		}

		const auto& version = Variant2Version_ [var];
		if (version.name ().isEmpty ())
			return res;

		res ["client_remote_name"] = version.name ();
		if (!version.version ().isEmpty ())
			res ["client_version"] = version.version ();
		if (!version.os ().isEmpty ())
			res ["client_os"] = version.os ();
		if (res ["client_name"].toString ().isEmpty ())
			res ["client_name"] = version.name ();

		return res;
	}
예제 #2
0
파일: validity.cpp 프로젝트: bizonix/xca
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());
}
예제 #3
0
파일: validity.cpp 프로젝트: bizonix/xca
Validity::Validity( QWidget* parent )
    : QDateTimeEdit( parent )
{
	endDate = false;
	setTimeSpec(Qt::UTC);
	setNow();
	hideTime(false);
	connect(this, SIGNAL(timeChanged(const QTime &)),
		this, SLOT(setMyTime(const QTime &)));
	updateFormatString();
}
예제 #4
0
void KDDateTime::setTimeZone(const QString &timeZone)
{
    d->mTimeZone = timeZone;

    // Just in case someone cares: set the time spec in QDateTime accordingly.
    // We can't do this the other way round, there's no public API for the offset-from-utc case.
    if (timeZone == QLatin1String("Z"))
        setTimeSpec(Qt::UTC);
    else if (timeZone.isEmpty())
        setTimeSpec(Qt::LocalTime);
    else {
        setTimeSpec(Qt::OffsetFromUTC);
        const int pos = timeZone.indexOf(QLatin1Char(':'));
        if ( pos > 0 ) {
            const int hours = timeZone.left(pos).toInt();
            const int minutes = timeZone.mid(pos+1).toInt();
            const int offset = hours * 3600 + minutes * 60;
            setUtcOffset(offset);
        }
    }
}
예제 #5
0
파일: validity.cpp 프로젝트: LiTianjue/xca
Validity::Validity( QWidget* parent )
    : QDateTimeEdit( parent )
{
	endDate = false;
	formatDate = tr("yyyy-MM-dd hh:mm");
#if QT_VERSION >= 0x040400
	setTimeSpec(Qt::UTC);
#endif
	setNow();
	hideTime(false);
	connect(this, SIGNAL(timeChanged(const QTime &)),
		this, SLOT(setMyTime(const QTime &)));
}
예제 #6
0
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;
}