aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform/technic
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2023-01-24 16:52:09 -0300
committerflow <flowlnlnln@gmail.com>2023-01-25 16:57:51 -0300
commit29f7ea752fd34bdea64a7c7f2c505982ac39ce0d (patch)
treef3d76dd640ae4f6a241fb0ff4532d938dc1c33bd /launcher/ui/pages/modplatform/technic
parent5186ad95d3cd66da8c844d9c3c0cd95b8b2f0b94 (diff)
downloadPrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.tar.gz
PrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.tar.bz2
PrismLauncher-29f7ea752fd34bdea64a7c7f2c505982ac39ce0d.zip
refactor: make shared_qobject_ptr ctor explicit
This turns issues like creating two shared ptrs from a single raw ptr from popping up at runtime, instead making them a compile error. Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/pages/modplatform/technic')
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicModel.cpp6
-rw-r--r--launcher/ui/pages/modplatform/technic/TechnicPage.cpp8
2 files changed, 7 insertions, 7 deletions
diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
index b2af1ac0..50f0c72d 100644
--- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
+++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp
@@ -112,7 +112,7 @@ void Technic::ListModel::searchWithTerm(const QString& term)
void Technic::ListModel::performSearch()
{
- NetJob *netJob = new NetJob("Technic::Search", APPLICATION->network());
+ auto netJob = makeShared<NetJob>("Technic::Search", APPLICATION->network());
QString searchUrl = "";
if (currentSearchTerm.isEmpty()) {
searchUrl = QString("%1trending?build=%2")
@@ -137,8 +137,8 @@ void Technic::ListModel::performSearch()
netJob->addNetAction(Net::Download::makeByteArray(QUrl(searchUrl), &response));
jobPtr = netJob;
jobPtr->start();
- QObject::connect(netJob, &NetJob::succeeded, this, &ListModel::searchRequestFinished);
- QObject::connect(netJob, &NetJob::failed, this, &ListModel::searchRequestFailed);
+ QObject::connect(netJob.get(), &NetJob::succeeded, this, &ListModel::searchRequestFinished);
+ QObject::connect(netJob.get(), &NetJob::failed, this, &ListModel::searchRequestFailed);
}
void Technic::ListModel::searchRequestFinished()
diff --git a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
index b15af244..859da97e 100644
--- a/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
+++ b/launcher/ui/pages/modplatform/technic/TechnicPage.cpp
@@ -141,10 +141,10 @@ void TechnicPage::suggestCurrent()
return;
}
- NetJob *netJob = new NetJob(QString("Technic::PackMeta(%1)").arg(current.name), APPLICATION->network());
+ auto netJob = makeShared<NetJob>(QString("Technic::PackMeta(%1)").arg(current.name), APPLICATION->network());
QString slug = current.slug;
netJob->addNetAction(Net::Download::makeByteArray(QString("%1modpack/%2?build=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, slug, BuildConfig.TECHNIC_API_BUILD), &response));
- QObject::connect(netJob, &NetJob::succeeded, this, [this, slug]
+ QObject::connect(netJob.get(), &NetJob::succeeded, this, [this, slug]
{
jobPtr.reset();
@@ -247,11 +247,11 @@ void TechnicPage::metadataLoaded()
// version so we can display something quicker
ui->versionSelectionBox->addItem(current.currentVersion);
- auto* netJob = new NetJob(QString("Technic::SolderMeta(%1)").arg(current.name), APPLICATION->network());
+ auto netJob = makeShared<NetJob>(QString("Technic::SolderMeta(%1)").arg(current.name), APPLICATION->network());
auto url = QString("%1/modpack/%2").arg(current.url, current.slug);
netJob->addNetAction(Net::Download::makeByteArray(QUrl(url), &response));
- QObject::connect(netJob, &NetJob::succeeded, this, &TechnicPage::onSolderLoaded);
+ QObject::connect(netJob.get(), &NetJob::succeeded, this, &TechnicPage::onSolderLoaded);
jobPtr = netJob;
jobPtr->start();