mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-19 12:24:53 -04:00
Replaced deprecated QDateTime::toTime_t by QDateTime::toSecsSinceEpoch
This commit is contained in:
parent
0d37db307c
commit
6251f36e3e
8 changed files with 22 additions and 6 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "FeedReaderFeedItem.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
FeedReaderFeedNotify::FeedReaderFeedNotify(RsFeedReader *feedReader, FeedReaderNotify *notify, QObject *parent) :
|
||||
FeedNotify(parent), mFeedReader(feedReader), mNotify(notify)
|
||||
|
@ -135,7 +136,7 @@ FeedItem *FeedReaderFeedNotify::testFeedItem(FeedHolder */*parent*/)
|
|||
FeedMsgInfo msgInfo;
|
||||
msgInfo.title = tr("Test message").toUtf8().constData();
|
||||
msgInfo.description = tr("This is a test message.").toUtf8().constData();
|
||||
msgInfo.pubDate = QDateTime::currentDateTime().toTime_t();
|
||||
msgInfo.pubDate = DateTime::DateTimeToTime_t(QDateTime::currentDateTime());
|
||||
|
||||
//TODO: parent?
|
||||
return new FeedReaderFeedItem(mFeedReader, mNotify, feedInfo, msgInfo);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "util/RsQtVersion.h"
|
||||
#include "util/RsFile.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include "retroshare/rsdisc.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
|
@ -434,7 +435,7 @@ public:
|
|||
|
||||
//Get Last Access on File
|
||||
if (file.exists())
|
||||
qi64LastDL = file.lastModified().toTime_t();
|
||||
qi64LastDL = DateTime::DateTimeToTime_t(file.lastModified());
|
||||
}
|
||||
return QVariant(qi64LastDL) ;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include "guiexprelement.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#define STR_FIELDS_MIN_WFACTOR 20.0
|
||||
#define SIZE_FIELDS_MIN_WFACTOR 8.0
|
||||
#define DATE_FIELDS_MIN_WFACTOR 10.0
|
||||
|
@ -607,7 +609,7 @@ uint64_t ExprParamElement::getIntValueFromField(QString fieldName, bool isToFiel
|
|||
#else
|
||||
QDateTime time = dateEdit->date().startOfDay();
|
||||
#endif
|
||||
val = (uint64_t)time.toTime_t();
|
||||
val = (uint64_t) DateTime::DateTimeToTime_t(time);
|
||||
break;
|
||||
}
|
||||
case SizeSearch:
|
||||
|
|
|
@ -435,7 +435,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
|
|||
else
|
||||
{
|
||||
item->setText(GTW_COLUMN_LAST_POST, itemInfo.lastpost.toString(Qt::ISODate).replace("T"," "));
|
||||
item->setData(GTW_COLUMN_LAST_POST, ROLE_SORT, itemInfo.lastpost.toTime_t());
|
||||
item->setData(GTW_COLUMN_LAST_POST, ROLE_SORT, (qint64) DateTime::DateTimeToTime_t(itemInfo.lastpost));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void SecurityIpItem::updateItemStatic()
|
|||
}
|
||||
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
ui->timeLabel->setText(DateTime::formatLongDateTime(currentTime.toTime_t()));
|
||||
ui->timeLabel->setText(DateTime::formatLongDateTime(currentTime));
|
||||
}
|
||||
|
||||
void SecurityIpItem::updateItem()
|
||||
|
|
|
@ -153,7 +153,7 @@ void SecurityItem::updateItemStatic()
|
|||
titleLabel->setText(title);
|
||||
|
||||
QDateTime currentTime = QDateTime::currentDateTime();
|
||||
timeLabel->setText(DateTime::formatLongDateTime(currentTime.toTime_t()));
|
||||
timeLabel->setText(DateTime::formatLongDateTime(currentTime));
|
||||
|
||||
if (mIsHome)
|
||||
{
|
||||
|
|
|
@ -87,3 +87,12 @@ QDateTime DateTime::DateTimeFromTime_t(time_t timeValue)
|
|||
return QDateTime::fromTime_t(timeValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
time_t DateTime::DateTimeToTime_t(const QDateTime& dateTime)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (6, 0, 0)
|
||||
return dateTime.toSecsSinceEpoch();
|
||||
#else
|
||||
return dateTime.toTime_t();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -52,6 +52,9 @@ public:
|
|||
|
||||
/* Convert time_t to QDateTime */
|
||||
static QDateTime DateTimeFromTime_t(time_t timeValue);
|
||||
|
||||
/* Convert QDateTime to time_t */
|
||||
static time_t DateTimeToTime_t(const QDateTime& dateTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue