aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-05-05 14:07:10 -0700
committerGitHub <noreply@github.com>2023-05-05 14:07:10 -0700
commitb266068644d2caab4f103b0adf7a491b95f52369 (patch)
tree8de677072a75350959e3db64d86105a951f231f4
parent733619ca741336ba9999af43f4eddd9371462325 (diff)
downloadPrismLauncher-b266068644d2caab4f103b0adf7a491b95f52369.tar.gz
PrismLauncher-b266068644d2caab4f103b0adf7a491b95f52369.tar.bz2
PrismLauncher-b266068644d2caab4f103b0adf7a491b95f52369.zip
Apply suggestions from code review
Co-authored-by: flow <flowlnlnln@gmail.com> Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--launcher/java/JavaInstallList.cpp1
-rw-r--r--launcher/net/Download.cpp13
-rw-r--r--launcher/net/NetAction.h4
-rw-r--r--launcher/tasks/ConcurrentTask.cpp6
-rw-r--r--launcher/tasks/Task.h2
-rw-r--r--launcher/ui/dialogs/ProgressDialog.cpp2
-rw-r--r--launcher/ui/widgets/SubTaskProgressBar.h2
7 files changed, 14 insertions, 16 deletions
diff --git a/launcher/java/JavaInstallList.cpp b/launcher/java/JavaInstallList.cpp
index 5f133622..b29af857 100644
--- a/launcher/java/JavaInstallList.cpp
+++ b/launcher/java/JavaInstallList.cpp
@@ -170,7 +170,6 @@ void JavaListLoadTask::executeTask()
m_job.reset(new JavaCheckerJob("Java detection"));
connect(m_job.get(), &Task::finished, this, &JavaListLoadTask::javaCheckerFinished);
connect(m_job.get(), &Task::progress, this, &Task::setProgress);
- // stepProgress?
qDebug() << "Probing the following Java paths: ";
int id = 0;
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp
index bf0e5c26..082f963d 100644
--- a/launcher/net/Download.cpp
+++ b/launcher/net/Download.cpp
@@ -247,19 +247,20 @@ void Download::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
// use milliseconds for speed precision
auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed);
- auto bytes_recived_since = bytesReceived - m_last_progress_bytes;
- auto dl_speed_bps = (double)bytes_recived_since / elapsed_ms.count() * 1000;
+ auto bytes_received_since = bytesReceived - m_last_progress_bytes;
+ auto dl_speed_bps = (double)bytes_received_since / elapsed_ms.count() * 1000;
auto remaing_time_s = (bytesTotal - bytesReceived) / dl_speed_bps;
- // current bytes out of total bytes
+ //: Current amount of bytes downloaded, out of the total amount of bytes in the download
QString dl_progress = tr("%1 / %2").arg(humanReadableFileSize(bytesReceived)).arg(humanReadableFileSize(bytesTotal));
QString dl_speed_str;
if (elapsed_ms.count() > 0) {
- // bytes per second
- dl_speed_str = tr("%1/s (%2)").arg(humanReadableFileSize(dl_speed_bps)).arg(humanReadableDuration(remaing_time_s));
+ //: Download speed, in bytes per second (remaining download time in parenthesis)
+ dl_speed_str = tr("%1 /s (%2)").arg(humanReadableFileSize(dl_speed_bps)).arg(humanReadableDuration(remaing_time_s));
} else {
- dl_speed_str = tr("0 b/s");
+ //: Download speed at 0 bytes per second
+ dl_speed_str = tr("0 B/s");
}
setDetails(dl_progress + "\n" + dl_speed_str);
diff --git a/launcher/net/NetAction.h b/launcher/net/NetAction.h
index df6ed995..a13d115f 100644
--- a/launcher/net/NetAction.h
+++ b/launcher/net/NetAction.h
@@ -44,8 +44,8 @@
#include "QObjectPtr.h"
#include "tasks/Task.h"
-static const QStringList s_units_si {"kb", "MB", "GB", "TB"};
-static const QStringList s_units_kibi {"kiB", "MiB", "Gib", "TiB"};
+static const QStringList s_units_si {"kB", "MB", "GB", "TB"};
+static const QStringList s_units_kibi {"KiB", "MiB", "Gib", "TiB"};
inline QString humanReadableFileSize(double bytes, bool use_si = false, int decimal_points = 1) {
const QStringList units = use_si ? s_units_si : s_units_kibi;
diff --git a/launcher/tasks/ConcurrentTask.cpp b/launcher/tasks/ConcurrentTask.cpp
index dbb4d94d..fae2f3dc 100644
--- a/launcher/tasks/ConcurrentTask.cpp
+++ b/launcher/tasks/ConcurrentTask.cpp
@@ -65,7 +65,7 @@ void ConcurrentTask::addTask(Task::Ptr task)
void ConcurrentTask::executeTask()
{
- // Start One task, startNext hadels starting the up to the m_total_max_size
+ // Start one task, startNext handles starting the up to the m_total_max_size
// while tracking the number currently being done
QMetaObject::invokeMethod(this, &ConcurrentTask::startNext, Qt::QueuedConnection);
}
@@ -293,9 +293,9 @@ void ConcurrentTask::updateState()
.arg(QString::number(m_doing.count()), QString::number(m_done.count()), QString::number(totalSize())));
} else {
setProgress(m_stepProgress, m_stepTotalProgress);
- QString status = tr("Please wait ...");
+ QString status = tr("Please wait...");
if (m_queue.size() > 0) {
- status = tr("Waiting for 1 task to start ...");
+ status = tr("Waiting for a task to start...");
} else if (m_doing.size() > 0) {
status = tr("Executing 1 task:");
} else if (m_done.size() > 0) {
diff --git a/launcher/tasks/Task.h b/launcher/tasks/Task.h
index 04a09187..799ed945 100644
--- a/launcher/tasks/Task.h
+++ b/launcher/tasks/Task.h
@@ -130,7 +130,7 @@ class Task : public QObject, public QRunnable {
void failed(QString reason);
void status(QString status);
void details(QString details);
- void stepProgress(TaskStepProgress const& task_progress); //
+ void stepProgress(TaskStepProgress const& task_progress);
/** Emitted when the canAbort() status has changed.
*/
diff --git a/launcher/ui/dialogs/ProgressDialog.cpp b/launcher/ui/dialogs/ProgressDialog.cpp
index 94feee44..246a0fd4 100644
--- a/launcher/ui/dialogs/ProgressDialog.cpp
+++ b/launcher/ui/dialogs/ProgressDialog.cpp
@@ -45,7 +45,7 @@
#include "ui/widgets/SubTaskProgressBar.h"
-// map a value in a numaric range of an arbatray type to between 0 and INT_MAX
+// map a value in a numeric range of an arbitrary type to between 0 and INT_MAX
// for getting the best precision out of the qt progress bar
template<typename T, std::enable_if_t<std::is_arithmetic_v<T>, bool> = true>
std::tuple<int, int> map_int_zero_max(T current, T range_max, T range_min)
diff --git a/launcher/ui/widgets/SubTaskProgressBar.h b/launcher/ui/widgets/SubTaskProgressBar.h
index 3375a0bc..8f8aeea2 100644
--- a/launcher/ui/widgets/SubTaskProgressBar.h
+++ b/launcher/ui/widgets/SubTaskProgressBar.h
@@ -18,8 +18,6 @@
*/
#pragma once
-#include <qobjectdefs.h>
-#include <qwidget.h>
#include <QWidget>
#include "QObjectPtr.h"