update retry netjob dialog
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
5cf7466e4c
commit
7a200a337f
@ -559,6 +559,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
||||
|
||||
m_settings->registerSetting("NumberOfConcurrentTasks", 10);
|
||||
m_settings->registerSetting("NumberOfConcurrentDownloads", 6);
|
||||
m_settings->registerSetting("NumberOfManualRetries", 1);
|
||||
|
||||
QString defaultMonospace;
|
||||
int defaultSize = 11;
|
||||
|
@ -58,7 +58,6 @@ auto ApiDownload::makeFile(QUrl url, QString path, Options options) -> Download:
|
||||
|
||||
void ApiDownload::init()
|
||||
{
|
||||
qDebug() << "Setting up api download";
|
||||
auto api_headers = new ApiHeaderProxy();
|
||||
addHeaderProxy(api_headers);
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ Upload::Ptr ApiUpload::makeByteArray(QUrl url, std::shared_ptr<QByteArray> outpu
|
||||
|
||||
void ApiUpload::init()
|
||||
{
|
||||
qDebug() << "Setting up api upload";
|
||||
auto api_headers = new ApiHeaderProxy();
|
||||
addHeaderProxy(api_headers);
|
||||
}
|
||||
|
@ -144,6 +144,8 @@ void NetJob::updateState()
|
||||
void NetJob::emitFailed(QString reason)
|
||||
{
|
||||
#if defined(LAUNCHER_APPLICATION)
|
||||
if (m_ask_retry || m_manual_try < APPLICATION->settings()->get("NumberOfManualRetries").toInt()) {
|
||||
m_manual_try++;
|
||||
auto response = CustomMessageBox::selectable(nullptr, "Confirm retry",
|
||||
"The tasks failed\n"
|
||||
"Failed urls\n" +
|
||||
@ -159,6 +161,12 @@ void NetJob::emitFailed(QString reason)
|
||||
executeNextSubTask();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ConcurrentTask::emitFailed(reason);
|
||||
}
|
||||
|
||||
void NetJob::setAskRetry(bool askRetry)
|
||||
{
|
||||
m_ask_retry = askRetry;
|
||||
}
|
@ -62,6 +62,7 @@ class NetJob : public ConcurrentTask {
|
||||
|
||||
auto getFailedActions() -> QList<Net::NetRequest*>;
|
||||
auto getFailedFiles() -> QList<QString>;
|
||||
void setAskRetry(bool askRetry);
|
||||
|
||||
public slots:
|
||||
// Qt can't handle auto at the start for some reason?
|
||||
@ -78,4 +79,6 @@ class NetJob : public ConcurrentTask {
|
||||
shared_qobject_ptr<QNetworkAccessManager> m_network;
|
||||
|
||||
int m_try = 1;
|
||||
bool m_ask_retry = true;
|
||||
int m_manual_try = 0;
|
||||
};
|
||||
|
@ -191,6 +191,7 @@ void LauncherPage::applySettings()
|
||||
|
||||
s->set("NumberOfConcurrentTasks", ui->numberOfConcurrentTasksSpinBox->value());
|
||||
s->set("NumberOfConcurrentDownloads", ui->numberOfConcurrentDownloadsSpinBox->value());
|
||||
s->set("NumberOfManualRetries", ui->numberOfManualRetriesSpinBox->value());
|
||||
|
||||
// Console settings
|
||||
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
|
||||
@ -245,6 +246,7 @@ void LauncherPage::loadSettings()
|
||||
|
||||
ui->numberOfConcurrentTasksSpinBox->setValue(s->get("NumberOfConcurrentTasks").toInt());
|
||||
ui->numberOfConcurrentDownloadsSpinBox->setValue(s->get("NumberOfConcurrentDownloads").toInt());
|
||||
ui->numberOfManualRetriesSpinBox->setValue(s->get("NumberOfManualRetries").toInt());
|
||||
|
||||
// Console settings
|
||||
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<height>629</height>
|
||||
<height>691</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -233,6 +233,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="numberOfManualRetriesLabel">
|
||||
<property name="text">
|
||||
<string>Number of manual retries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="numberOfManualRetriesSpinBox">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -80,7 +80,7 @@ void VariableSizedImageObject::drawObject(QPainter* painter,
|
||||
{
|
||||
if (!format.hasProperty(ImageData)) {
|
||||
QUrl image_url{ qvariant_cast<QString>(format.property(QTextFormat::ImageName)) };
|
||||
if (m_fetching_images.contains(image_url))
|
||||
if (m_fetching_images.contains(image_url) || image_url.isEmpty())
|
||||
return;
|
||||
|
||||
auto meta = std::make_shared<ImageMetadata>();
|
||||
@ -140,6 +140,7 @@ void VariableSizedImageObject::loadImage(QTextDocument* doc, std::shared_ptr<Ima
|
||||
QString("images/%1").arg(QString(QCryptographicHash::hash(meta->url.toEncoded(), QCryptographicHash::Algorithm::Sha1).toHex())));
|
||||
|
||||
auto job = new NetJob(QString("Load Image: %1").arg(meta->url.fileName()), APPLICATION->network());
|
||||
job->setAskRetry(false);
|
||||
job->addNetAction(Net::ApiDownload::makeCached(meta->url, entry));
|
||||
|
||||
auto full_entry_path = entry->getFullPath();
|
||||
|
Loading…
Reference in New Issue
Block a user