mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-12 22:14:35 +00:00
Backport one more deprecation fix
This commit is contained in:
parent
548c165ae0
commit
67b829bf09
@ -15,6 +15,9 @@
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDateTime>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
#include <QTimer>
|
||||
|
||||
#include <string>
|
||||
@ -38,7 +41,11 @@ public:
|
||||
setOrganizationDomain("lyx.org");
|
||||
setApplicationName(toqstr(app));
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QRandomGenerator(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
#else
|
||||
qsrand(QDateTime::currentDateTime().toTime_t());
|
||||
#endif
|
||||
}
|
||||
int execute()
|
||||
{
|
||||
|
@ -507,7 +507,11 @@ time_t FileName::lastModified() const
|
||||
// been touched between the object creation and now, we refresh the file
|
||||
// information.
|
||||
d->refresh();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
return d->fi.lastModified().toSecsSinceEpoch();
|
||||
#else
|
||||
return d->fi.lastModified().toTime_t();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,11 +43,20 @@ string const formatted_time(time_t t, string const & fmt)
|
||||
docstring formatted_datetime(time_t t, string const & fmt)
|
||||
{
|
||||
QString qres;
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
if (fmt.empty())
|
||||
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
|
||||
QLocale::ShortFormat);
|
||||
else
|
||||
qres = QLocale().toString(QDateTime::fromSecsSinceEpoch(t),
|
||||
toqstr(fmt));
|
||||
#else
|
||||
if (fmt.empty())
|
||||
qres = QLocale().toString(QDateTime::fromTime_t(t),
|
||||
QLocale::ShortFormat);
|
||||
else
|
||||
qres = QLocale().toString(QDateTime::fromTime_t(t), toqstr(fmt));
|
||||
#endif
|
||||
return qstring_to_ucs4(qres);
|
||||
}
|
||||
|
||||
@ -70,7 +79,11 @@ time_t from_asctime_utc(string t)
|
||||
return static_cast<time_t>(-1);
|
||||
}
|
||||
loc_dt.setTimeSpec(Qt::UTC);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
|
||||
return loc_dt.toSecsSinceEpoch();
|
||||
#else
|
||||
return loc_dt.toTime_t();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace support
|
||||
|
Loading…
Reference in New Issue
Block a user