浏览代码

Merge pull request #6034 from kambala-decapitator/launcher-improvement

small Launcher improvements
Ivan Savenko 2 月之前
父节点
当前提交
154645da68

+ 3 - 3
launcher/modManager/cdownloadmanager_moc.cpp

@@ -122,7 +122,7 @@ void CDownloadManager::downloadFinished(QNetworkReply * reply)
 	}
 
 	if(downloadComplete)
-		finished(successful, failed, encounteredErrors);
+		Q_EMIT finished(successful, failed, encounteredErrors);
 
 	file.reply->deleteLater();
 	file.reply = nullptr;
@@ -145,11 +145,11 @@ void CDownloadManager::downloadProgressChanged(qint64 bytesReceived, qint64 byte
 	quint64 received = 0;
 	for(auto & entry : currentDownloads)
 		received += entry.bytesReceived > 0 ? entry.bytesReceived : 0;
-	
+
 	if(received > total)
 		total = received;
 
-	downloadProgress(received, total);
+	Q_EMIT downloadProgress(received, total);
 }
 
 bool CDownloadManager::downloadInProgress(const QUrl & url) const

+ 16 - 16
launcher/modManager/cmodlistview_moc.cpp

@@ -97,7 +97,7 @@ void CModListView::setupModsView()
 	ui->allModsView->setUniformRowHeights(true);
 
 	ui->allModsView->setContextMenuPolicy(Qt::CustomContextMenu);
-	
+
 	connect(ui->allModsView, SIGNAL(customContextMenuRequested(const QPoint &)),
 		this, SLOT(onCustomContextMenu(const QPoint &)));
 
@@ -332,7 +332,7 @@ QString CModListView::genModInfoText(const ModState & mod)
 
 	if((!mod.isInstalled() || mod.isUpdateAvailable()) && !mod.getDownloadSizeFormatted().isEmpty())
 		result += replaceIfNotEmpty(mod.getDownloadSizeFormatted(), lineTemplate.arg(tr("Download size")));
-	
+
 	result += replaceIfNotEmpty(mod.getAuthors(), lineTemplate.arg(tr("Authors")));
 
 	if(!mod.getLicenseName().isEmpty())
@@ -750,7 +750,7 @@ void CModListView::on_uninstallButton_clicked()
 	QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
 
 	doUninstallMod(modName);
-	
+
 	checkManagerErrors();
 }
 
@@ -845,13 +845,13 @@ void CModListView::downloadFinished(QStringList savedFiles, QStringList failedFi
 	enqueuedModDownloads.clear();
 	dlManager->deleteLater();
 	dlManager = nullptr;
-	
+
 	ui->progressBar->setMaximum(0);
 	ui->progressBar->setValue(0);
 
 	if(doInstallFiles)
 		installFiles(savedFiles);
-	
+
 	hideProgressBar();
 }
 
@@ -976,7 +976,7 @@ void CModListView::installFiles(QStringList files)
 		logGlobal->info("Installing chronicles: started");
 		ui->progressBar->setFormat(tr("Installing Heroes Chronicles"));
 		ui->progressWidget->setVisible(true);
-		ui->pushButton->setEnabled(false);
+		ui->abortButton->setEnabled(false);
 
 		float prog = 0.0;
 
@@ -986,17 +986,17 @@ void CModListView::installFiles(QStringList files)
 			ce.installChronicles(exe);
 			return true;
 		});
-		
+
 		while(futureExtract.wait_for(std::chrono::milliseconds(10)) != std::future_status::ready)
 		{
 			extractionProgress(static_cast<int>(prog * 1000.f), 1000);
 			qApp->processEvents();
 		}
-		
+
 		if(futureExtract.get())
 		{
 			hideProgressBar();
-			ui->pushButton->setEnabled(true);
+			ui->abortButton->setEnabled(true);
 			ui->progressWidget->setVisible(false);
 			//update
 			reload("chronicles");
@@ -1062,7 +1062,7 @@ void CModListView::installMods(QStringList archives)
 	}
 
 
-	reload(lastInstalled);	
+	reload(lastInstalled);
 
 	if (!modsToEnable.empty())
 	{
@@ -1228,7 +1228,7 @@ void CModListView::on_refreshButton_clicked()
 	loadRepositories();
 }
 
-void CModListView::on_pushButton_clicked()
+void CModListView::on_abortButton_clicked()
 {
 	delete dlManager;
 	dlManager = nullptr;
@@ -1266,7 +1266,7 @@ void CModListView::loadScreenshots()
 
 	if (!ui->allModsView->currentIndex().isValid())
 		return;
-		
+
 	ui->screenshotsList->clear();
 	QString modName = ui->allModsView->currentIndex().data(ModRoles::ModNameRole).toString();
 	assert(modStateModel->isModExists(modName)); //should be filtered out by check above
@@ -1404,10 +1404,10 @@ void CModListView::on_allModsView_doubleClicked(const QModelIndex &index)
 {
 	if(!index.isValid())
 		return;
-	
+
 	auto modName = index.data(ModRoles::ModNameRole).toString();
 	auto mod = modStateModel->getMod(modName);
-	
+
 	QStringList notInstalledDependencies = this->getModsToInstall(mod.getID());
 	QStringList unavailableDependencies = this->findUnavailableMods(notInstalledDependencies);
 
@@ -1422,14 +1422,14 @@ void CModListView::on_allModsView_doubleClicked(const QModelIndex &index)
 		on_updateButton_clicked();
 		return;
 	}
-	
+
 	if(index.column() == ModFields::NAME)
 	{
 		if(ui->allModsView->isExpanded(index))
 			ui->allModsView->collapse(index);
 		else
 			ui->allModsView->expand(index);
-		
+
 		return;
 	}
 

+ 1 - 1
launcher/modManager/cmodlistview_moc.h

@@ -147,7 +147,7 @@ private slots:
 	void on_updateButton_clicked();
 	void on_uninstallButton_clicked();
 	void on_installButton_clicked();
-	void on_pushButton_clicked();
+	void on_abortButton_clicked();
 	void on_refreshButton_clicked();
 	void on_allModsView_activated(const QModelIndex & index);
 	void on_tabWidget_currentChanged(int index);

+ 1 - 1
launcher/modManager/cmodlistview_moc.ui

@@ -337,7 +337,7 @@ li.checked::marker { content: &quot;\2612&quot;; }
        </widget>
       </item>
       <item>
-       <widget class="QPushButton" name="pushButton">
+       <widget class="QPushButton" name="abortButton">
         <property name="sizePolicy">
          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
           <horstretch>0</horstretch>