mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
improved manual install process
This commit is contained in:
parent
ae5f29c884
commit
f0bf6eb808
@ -164,6 +164,10 @@ void MainWindow::switchToStartTab()
|
||||
ui->startGameButton->setEnabled(true);
|
||||
ui->startGameButton->setChecked(true);
|
||||
ui->tabListWidget->setCurrentIndex(TabRows::START);
|
||||
|
||||
auto* startGameTabWidget = qobject_cast<StartGameTab*>(ui->tabListWidget->widget(TabRows::START));
|
||||
if(startGameTabWidget)
|
||||
startGameTabWidget->refreshState();
|
||||
}
|
||||
|
||||
void MainWindow::switchToModsTab()
|
||||
@ -247,6 +251,9 @@ void MainWindow::dropEvent(QDropEvent* event)
|
||||
|
||||
void MainWindow::manualInstallFile(QString filePath)
|
||||
{
|
||||
if(filePath.endsWith(".zip", Qt::CaseInsensitive) || filePath.endsWith(".exe", Qt::CaseInsensitive))
|
||||
switchToModsTab();
|
||||
|
||||
QString fileName = QFileInfo{filePath}.fileName();
|
||||
if(filePath.endsWith(".zip", Qt::CaseInsensitive))
|
||||
getModView()->downloadFile(fileName.toLower()
|
||||
@ -279,7 +286,7 @@ void MainWindow::manualInstallFile(QString filePath)
|
||||
}
|
||||
}
|
||||
else
|
||||
getModView()->downloadFile(fileName, QUrl::fromLocalFile(filePath), fileName);
|
||||
getModView()->installFiles(QStringList{filePath});
|
||||
}
|
||||
|
||||
ETranslationStatus MainWindow::getTranslationStatus()
|
||||
|
@ -788,6 +788,8 @@ void CModListView::installFiles(QStringList files)
|
||||
|
||||
if(!exe.empty())
|
||||
{
|
||||
ui->progressWidget->setVisible(true);
|
||||
ui->pushButton->setEnabled(false);
|
||||
ui->progressBar->setFormat(tr("Installing chronicles"));
|
||||
|
||||
float prog = 0.0;
|
||||
@ -807,6 +809,9 @@ void CModListView::installFiles(QStringList files)
|
||||
|
||||
if(futureExtract.get())
|
||||
{
|
||||
hideProgressBar();
|
||||
ui->pushButton->setEnabled(true);
|
||||
ui->progressWidget->setVisible(false);
|
||||
//update
|
||||
modStateModel->reloadLocalState();
|
||||
modModel->reloadRepositories();
|
||||
|
@ -54,7 +54,6 @@ class CModListView : public QWidget
|
||||
|
||||
void installMods(QStringList archives);
|
||||
void installMaps(QStringList maps);
|
||||
void installFiles(QStringList mods);
|
||||
|
||||
QString genChangelogText(const ModState & mod);
|
||||
QString genModInfoText(const ModState & mod);
|
||||
@ -113,6 +112,7 @@ public:
|
||||
bool isModInstalled(const QString & modName);
|
||||
|
||||
void downloadFile(QString file, QUrl url, QString description, qint64 sizeBytes = 0);
|
||||
void installFiles(QStringList mods);
|
||||
|
||||
public slots:
|
||||
void enableModByName(QString modName);
|
||||
|
@ -33,8 +33,6 @@ class StartGameTab : public QWidget
|
||||
|
||||
MainWindow * getMainWindow();
|
||||
|
||||
void refreshState();
|
||||
|
||||
void refreshUpdateStatus(EGameUpdateStatus status);
|
||||
void refreshTranslation(ETranslationStatus status);
|
||||
void refreshMods();
|
||||
@ -45,6 +43,8 @@ public:
|
||||
explicit StartGameTab(QWidget * parent = nullptr);
|
||||
~StartGameTab();
|
||||
|
||||
void refreshState();
|
||||
|
||||
private slots:
|
||||
void on_buttonGameStart_clicked();
|
||||
void on_buttonOpenChangelog_clicked();
|
||||
|
Loading…
Reference in New Issue
Block a user