diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-08-26 04:21:06 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-08-26 04:21:06 -0400 |
| commit | 2eee72da6815f9d5c643b58c95f633e69da5150a (patch) | |
| tree | a358d98dbe638c2d353d8e0637cd0682acbf74bc /src/downloadlist.cpp | |
| parent | c42e5fb2fec9b20fe6956d8798b85874b2eff73e (diff) | |
moved code for byte sizes and speed to uibase
added scoped classes for QSettings groups and arrays
servers logged on startup
Diffstat (limited to 'src/downloadlist.cpp')
| -rw-r--r-- | src/downloadlist.cpp | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/downloadlist.cpp b/src/downloadlist.cpp index 36bc2b7f..6957f270 100644 --- a/src/downloadlist.cpp +++ b/src/downloadlist.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "downloadlist.h"
#include "downloadmanager.h"
+#include <utility.h>
#include <log.h>
#include <QEvent>
#include <QColor>
@@ -121,7 +122,7 @@ QVariant DownloadList::data(const QModelIndex &index, int role) const return QString("%1").arg(m_Manager->getModID(index.row()));
}
}
- case COL_SIZE: return sizeFormat(m_Manager->getFileSize(index.row()));
+ case COL_SIZE: return MOBase::localizedByteSize(m_Manager->getFileSize(index.row()));
case COL_FILETIME: return m_Manager->getFileTime(index.row());
case COL_STATUS:
switch (m_Manager->getState(index.row())) {
@@ -195,21 +196,3 @@ void DownloadList::update(int row) else
log::error("invalid row {} in download list, update failed", row);
}
-
-QString DownloadList::sizeFormat(quint64 size) const
-{
- qreal calc = size;
- QStringList list;
- list << "MB" << "GB" << "TB";
-
- QStringListIterator i(list);
- QString unit("KB");
-
- calc /= 1024.0;
- while (calc >= 1024.0 && i.hasNext()) {
- unit = i.next();
- calc /= 1024.0;
- }
-
- return QString().setNum(calc, 'f', 2) + " " + unit;
-}
|
