mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-19 00:42:14 -07:00
Convert lastLoaded timestamp into proper QDateTime for correct comparison.
This commit is contained in:
parent
090cc8c144
commit
1237d9b480
1 changed files with 5 additions and 6 deletions
|
|
@ -67,10 +67,6 @@ QList<DeckPreviewWidget *> &VisualDeckStorageSortWidget::filterFiles(QList<DeckP
|
||||||
{
|
{
|
||||||
// Sort the widgets list based on the current sort order
|
// Sort the widgets list based on the current sort order
|
||||||
std::sort(widgets.begin(), widgets.end(), [this](DeckPreviewWidget *widget1, DeckPreviewWidget *widget2) {
|
std::sort(widgets.begin(), widgets.end(), [this](DeckPreviewWidget *widget1, DeckPreviewWidget *widget2) {
|
||||||
if (!widget1 || !widget2) {
|
|
||||||
return false; // Handle null pointers gracefully
|
|
||||||
}
|
|
||||||
|
|
||||||
QFileInfo info1(widget1->filePath);
|
QFileInfo info1(widget1->filePath);
|
||||||
QFileInfo info2(widget2->filePath);
|
QFileInfo info2(widget2->filePath);
|
||||||
|
|
||||||
|
|
@ -81,8 +77,11 @@ QList<DeckPreviewWidget *> &VisualDeckStorageSortWidget::filterFiles(QList<DeckP
|
||||||
return info1.fileName().toLower() < info2.fileName().toLower();
|
return info1.fileName().toLower() < info2.fileName().toLower();
|
||||||
case ByLastModified:
|
case ByLastModified:
|
||||||
return info1.lastModified() > info2.lastModified();
|
return info1.lastModified() > info2.lastModified();
|
||||||
case ByLastLoaded:
|
case ByLastLoaded: {
|
||||||
return widget1->deckLoader->getLastLoadedTimestamp() > widget2->deckLoader->getLastLoadedTimestamp();
|
QDateTime time1 = QDateTime::fromString(widget1->deckLoader->getLastLoadedTimestamp());
|
||||||
|
QDateTime time2 = QDateTime::fromString(widget2->deckLoader->getLastLoadedTimestamp());
|
||||||
|
return time1 > time2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; // Default case, no sorting applied
|
return false; // Default case, no sorting applied
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue