diff src/gui/pages/torrents.cc @ 273:f31305b9f60a

*: various code safety changes this also makes the code build on Qt 5.7. I can't test it though because I don't have it working... FAIL!
author Paper <paper@paper.us.eu.org>
date Thu, 18 Apr 2024 16:53:17 -0400
parents 9a04802848c0
children 9a88e1725fd2
line wrap: on
line diff
--- a/src/gui/pages/torrents.cc	Thu Apr 18 16:51:35 2024 -0400
+++ b/src/gui/pages/torrents.cc	Thu Apr 18 16:53:17 2024 -0400
@@ -14,6 +14,7 @@
 #include <QToolBar>
 #include <QTreeView>
 #include <QVBoxLayout>
+#include <QtGlobal>
 
 #include <algorithm>
 #include <fstream>
@@ -256,7 +257,7 @@
 				case TL_TITLE: return Strings::ToQString(item.GetTitle());
 				case TL_EPISODE: return Strings::ToQString(item.GetEpisode());
 				case TL_GROUP: return Strings::ToQString(item.GetGroup());
-				case TL_SIZE: return session.config.locale.GetLocale().formattedDataSize(item.GetSize());
+				case TL_SIZE: return Strings::ToQString(Strings::BytesToHumanReadableSize(item.GetSize()));
 				case TL_RESOLUTION: return Strings::ToQString(item.GetResolution());
 				case TL_SEEDERS: return item.GetSeeders();
 				case TL_LEECHERS: return item.GetLeechers();
@@ -284,7 +285,7 @@
 					const QString d = data(index, Qt::DisplayRole).toString();
 					const QFontMetrics metric = QFontMetrics(QFont());
 
-					return QSize(std::max(metric.horizontalAdvance(d), 100), metric.height());
+					return QSize(std::max(metric.boundingRect(d).width(), 100), metric.height());
 				}
 			}
 			break;