diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index c5585ea32ad..e5b9cfb05c4 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -114,6 +114,7 @@ #define QT_NO_SYSTEMLOCALE #define QT_FEATURE_systemsemaphore -1 #define QT_FEATURE_temporaryfile 1 +#define QT_FEATURE_textdate 1 #define QT_NO_THREAD #define QT_FEATURE_timezone -1 #define QT_FEATURE_topleveldomain -1 diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 49e7173de02..341b525b884 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -171,7 +171,7 @@ static ParsedDate getDateFromJulianDay(qint64 julianDay) static const char monthDays[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static const char qt_shortMonthNames[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; @@ -200,7 +200,7 @@ static int fromShortMonthName(const QStringRef &monthName) } return -1; } -#endif // QT_NO_TEXTDATE +#endif // textdate #ifndef QT_NO_DATESTRING struct ParsedRfcDateTime { @@ -613,7 +613,7 @@ int QDate::weekNumber(int *yearNumber) const return week; } -#if QT_DEPRECATED_SINCE(5, 11) && !defined(QT_NO_TEXTDATE) +#if QT_DEPRECATED_SINCE(5, 11) && QT_CONFIG(textdate) /*! \since 4.5 \deprecated @@ -775,11 +775,11 @@ QString QDate::longDayName(int weekday, MonthNameType type) } return QString(); } -#endif // QT_NO_TEXTDATE && deprecated +#endif // textdate && deprecated #ifndef QT_NO_DATESTRING -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) static QString toStringTextDate(QDate date) { const ParsedDate pd = getDateFromJulianDay(date.toJulianDay()); @@ -789,7 +789,7 @@ static QString toStringTextDate(QDate date) + QString::number(pd.day) + sp + QString::number(pd.year); } -#endif // QT_NO_TEXTDATE +#endif // textdate static QString toStringIsoDate(qint64 jd) { @@ -865,7 +865,7 @@ QString QDate::toString(Qt::DateFormat format) const case Qt::RFC2822Date: return QLocale::c().toString(*this, QStringViewLiteral("dd MMM yyyy")); default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: return toStringTextDate(*this); #endif @@ -1234,7 +1234,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) case Qt::RFC2822Date: return rfcDateImpl(string).date; default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -1255,7 +1255,7 @@ QDate QDate::fromString(const QString& string, Qt::DateFormat format) return QDate(year, month, parts.at(2).toInt()); } -#endif // QT_NO_TEXTDATE +#endif // textdate case Qt::ISODate: { // Semi-strict parsing, must be long enough and have non-numeric separators if (string.size() < 10 || string.at(4).isDigit() || string.at(7).isDigit() @@ -3848,7 +3848,7 @@ QString QDateTime::toString(Qt::DateFormat format) const return buf; } default: -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) case Qt::TextDate: { const QPair p = getDateTime(d); buf = p.first.toString(Qt::TextDate); @@ -4827,7 +4827,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) date = date.addDays(1); return QDateTime(date, time, spec, offset); } -#if !defined(QT_NO_TEXTDATE) +#if QT_CONFIG(textdate) case Qt::TextDate: { QVector parts = string.splitRef(QLatin1Char(' '), QString::SkipEmptyParts); @@ -4936,7 +4936,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) return QDateTime(date, time, Qt::UTC); } } -#endif //QT_NO_TEXTDATE +#endif // textdate } return QDateTime(); diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 5a7b75db620..399fba44131 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -81,7 +81,7 @@ class Q_CORE_EXPORT QDate int daysInYear() const; int weekNumber(int *yearNum = nullptr) const; -#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE +#if QT_DEPRECATED_SINCE(5, 10) && QT_CONFIG(textdate) QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") static QString shortMonthName(int month, MonthNameType type = DateFormat); QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") @@ -90,7 +90,7 @@ class Q_CORE_EXPORT QDate static QString longMonthName(int month, MonthNameType type = DateFormat); QT_DEPRECATED_X("Use QLocale::dayName or QLocale::standaloneDayName") static QString longDayName(int weekday, MonthNameType type = DateFormat); -#endif // QT_NO_TEXTDATE && deprecated +#endif // textdate && deprecated #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; #if QT_STRINGVIEW_LEVEL < 2 diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index d03518e70d2..2007cd597b0 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -612,7 +612,7 @@ int QDateTimeParser::sectionSize(int sectionIndex) const int QDateTimeParser::sectionMaxSize(Section s, int count) const { -#ifndef QT_NO_TEXTDATE +#if QT_CONFIG(textdate) int mcount = 12; #endif @@ -636,14 +636,14 @@ int QDateTimeParser::sectionMaxSize(Section s, int count) const case DaySection: return 2; case DayOfWeekSectionShort: case DayOfWeekSectionLong: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else mcount = 7; Q_FALLTHROUGH(); #endif case MonthSection: -#ifdef QT_NO_TEXTDATE +#if !QT_CONFIG(textdate) return 2; #else if (count <= 2)