refactor: add Channel::addSystemMessage function (#5500)

This commit is contained in:
pajlada
2024-07-07 22:03:05 +02:00
committed by GitHub
parent 4535823ca8
commit 354079c74c
47 changed files with 443 additions and 588 deletions
+5 -6
View File
@@ -64,8 +64,8 @@ void ImageUploader::logToFile(const QString &originalFilePath,
logReadFile.open(QIODevice::ReadWrite | QIODevice::Text);
if (!isLogFileOkay)
{
channel->addMessage(makeSystemMessage(
QString("Failed to open log file with links at ") + logFileName));
channel->addSystemMessage(
QString("Failed to open log file with links at ") + logFileName);
return;
}
auto logs = logReadFile.readAll();
@@ -197,7 +197,7 @@ void ImageUploader::handleFailedUpload(const NetworkResult &result,
}
}
channel->addMessage(makeSystemMessage(errorMessage));
channel->addSystemMessage(errorMessage);
// NOTE: We abort any future uploads on failure. Should this be handled differently?
while (!this->uploadQueue_.empty())
{
@@ -376,8 +376,7 @@ void ImageUploader::upload(std::queue<RawImageData> images, ChannelPtr channel,
BenchmarkGuard benchmarkGuard("upload");
if (!this->uploadMutex_.tryLock())
{
channel->addMessage(makeSystemMessage(
QString("Please wait until the upload finishes.")));
channel->addSystemMessage("Please wait until the upload finishes.");
return;
}
@@ -386,7 +385,7 @@ void ImageUploader::upload(std::queue<RawImageData> images, ChannelPtr channel,
std::swap(this->uploadQueue_, images);
channel->addMessage(makeSystemMessage("Started upload..."));
channel->addSystemMessage("Started upload...");
this->sendImageUploadRequest(this->uploadQueue_.front(), std::move(channel),
std::move(outputTextEdit));