Base: Remove Boost-based filesystem and switch to standard <filesystem>
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
using namespace Gui;
|
||||
using namespace Gui::Dialog;
|
||||
namespace fs = boost::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
/* TRANSLATOR Gui::Dialog::DlgRevertToBackupConfigImp */
|
||||
|
||||
@@ -71,12 +71,22 @@ void DlgRevertToBackupConfigImp::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Replace with more accurate C++20 solution once its usable: https://stackoverflow.com/a/68593141
|
||||
template <typename TP>
|
||||
static std::time_t to_time_t(TP tp)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
auto sctp = time_point_cast<system_clock::duration>(tp - TP::clock::now()
|
||||
+ system_clock::now());
|
||||
return system_clock::to_time_t(sctp);
|
||||
}
|
||||
|
||||
void DlgRevertToBackupConfigImp::showEvent(QShowEvent* event)
|
||||
{
|
||||
ui->listWidget->clear();
|
||||
const auto& backups = Application::Instance->prefPackManager()->configBackups();
|
||||
for (const auto& backup : backups) {
|
||||
auto modification_date = QDateTime::fromSecsSinceEpoch(fs::last_write_time(backup));
|
||||
auto modification_date = QDateTime::fromSecsSinceEpoch(to_time_t(fs::last_write_time(backup)));
|
||||
auto item = new QListWidgetItem(QLocale().toString(modification_date));
|
||||
item->setData(Qt::UserRole, QString::fromStdString(backup.string()));
|
||||
ui->listWidget->addItem(item);
|
||||
|
||||
Reference in New Issue
Block a user