fix: add progress indicator on Flame mod resolution dialog
This code is super :pofat: omg Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
4232b1cedb
commit
4bfc445cf8
@ -412,12 +412,8 @@ void InstanceImportTask::processFlame()
|
|||||||
"You will need to manually download them and add them to the modpack"),
|
"You will need to manually download them and add them to the modpack"),
|
||||||
text);
|
text);
|
||||||
message_dialog->setModal(true);
|
message_dialog->setModal(true);
|
||||||
message_dialog->show();
|
|
||||||
connect(message_dialog, &QDialog::rejected, [&]() {
|
if (message_dialog->exec()) {
|
||||||
m_modIdResolver.reset();
|
|
||||||
emitFailed("Canceled");
|
|
||||||
});
|
|
||||||
connect(message_dialog, &QDialog::accepted, [&]() {
|
|
||||||
m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network());
|
m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network());
|
||||||
for (const auto &result: m_modIdResolver->getResults().files) {
|
for (const auto &result: m_modIdResolver->getResults().files) {
|
||||||
QString filename = result.fileName;
|
QString filename = result.fileName;
|
||||||
@ -469,7 +465,10 @@ void InstanceImportTask::processFlame()
|
|||||||
});
|
});
|
||||||
setStatus(tr("Downloading mods..."));
|
setStatus(tr("Downloading mods..."));
|
||||||
m_filesNetJob->start();
|
m_filesNetJob->start();
|
||||||
});
|
} else {
|
||||||
|
m_modIdResolver.reset();
|
||||||
|
emitFailed("Canceled");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//TODO extract to function ?
|
//TODO extract to function ?
|
||||||
m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network());
|
m_filesNetJob = new NetJob(tr("Mod download"), APPLICATION->network());
|
||||||
|
@ -10,7 +10,7 @@ Flame::FileResolvingTask::FileResolvingTask(const shared_qobject_ptr<QNetworkAcc
|
|||||||
void Flame::FileResolvingTask::executeTask()
|
void Flame::FileResolvingTask::executeTask()
|
||||||
{
|
{
|
||||||
setStatus(tr("Resolving mod IDs..."));
|
setStatus(tr("Resolving mod IDs..."));
|
||||||
setProgress(0, m_toProcess.files.size());
|
setProgress(0, 3);
|
||||||
m_dljob = new NetJob("Mod id resolver", m_network);
|
m_dljob = new NetJob("Mod id resolver", m_network);
|
||||||
result.reset(new QByteArray());
|
result.reset(new QByteArray());
|
||||||
//build json data to send
|
//build json data to send
|
||||||
@ -29,6 +29,7 @@ void Flame::FileResolvingTask::executeTask()
|
|||||||
|
|
||||||
void Flame::FileResolvingTask::netJobFinished()
|
void Flame::FileResolvingTask::netJobFinished()
|
||||||
{
|
{
|
||||||
|
setProgress(1, 3);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
// job to check modrinth for blocked projects
|
// job to check modrinth for blocked projects
|
||||||
auto job = new NetJob("Modrinth check", m_network);
|
auto job = new NetJob("Modrinth check", m_network);
|
||||||
@ -63,6 +64,7 @@ void Flame::FileResolvingTask::netJobFinished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Flame::FileResolvingTask::modrinthCheckFinished() {
|
void Flame::FileResolvingTask::modrinthCheckFinished() {
|
||||||
|
setProgress(2, 3);
|
||||||
qDebug() << "Finished with blocked mods : " << blockedProjects.size();
|
qDebug() << "Finished with blocked mods : " << blockedProjects.size();
|
||||||
|
|
||||||
for (auto it = blockedProjects.keyBegin(); it != blockedProjects.keyEnd(); it++) {
|
for (auto it = blockedProjects.keyBegin(); it != blockedProjects.keyEnd(); it++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user