diff --git a/src/settings.cpp b/src/settings.cpp index 63b7901f..18dbde6a 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -72,6 +72,9 @@ void Settings::LoadIni() if(group != QString()) root[group] = group_obj; + // remove excess baka-mplayer group + root.remove("baka-mplayer"); + // fix input if(root.find("input") != root.end()) { diff --git a/src/ui/updatedialog.cpp b/src/ui/updatedialog.cpp index 88d5324a..ca2e2de7 100644 --- a/src/ui/updatedialog.cpp +++ b/src/ui/updatedialog.cpp @@ -44,6 +44,21 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) : init = false; } } + else if(percent == 0) + { + avgSpeed = 0; + lastSpeed = 0; + lastProgress = 0; + lastTime = 0; + ui->progressBar->setValue(0); + ui->progressBar->setVisible(true); + ui->timeRemainingLabel->setText(QString()); + ui->timeRemainingLabel->setVisible(true); + if(timer != nullptr) + delete timer; + timer = new QTime(); + timer->start(); + } else if(timer) // don't execute this if timer is not defined--this shouldn't happen though.. but it does { avgSpeed = 0.005*lastSpeed + 0.995*avgSpeed; @@ -72,7 +87,7 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) : connect(ui->updateButton, &QPushButton::clicked, [=] { - Prepare(); + ui->plainTextEdit->setPlainText(QString()); baka->update->DownloadUpdate(Util::DownloadFileUrl()); }); #endif @@ -81,10 +96,7 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) : this, SLOT(reject())); if(baka->update->getInfo().empty()) - { - Prepare(); baka->update->CheckForUpdates(); - } else { init = false; @@ -105,18 +117,6 @@ void UpdateDialog::CheckForUpdates(BakaEngine *baka, QWidget *parent) dialog->exec(); } -void UpdateDialog::Prepare() -{ - avgSpeed = 0; - lastSpeed = 0; - lastProgress = 0; - lastTime = 0; - if(timer != nullptr) - delete timer; - timer = new QTime(); - timer->start(); -} - void UpdateDialog::ShowInfo() { auto &info = baka->update->getInfo(); diff --git a/src/ui/updatedialog.h b/src/ui/updatedialog.h index e8fc817f..eca005f9 100644 --- a/src/ui/updatedialog.h +++ b/src/ui/updatedialog.h @@ -22,7 +22,6 @@ class UpdateDialog : public QDialog static void CheckForUpdates(BakaEngine *baka, QWidget *parent = 0); protected slots: - void Prepare(); void ShowInfo(); private: @@ -31,7 +30,7 @@ protected slots: QTime *timer; double avgSpeed = 1, - lastSpeed=0; + lastSpeed = 0; int lastProgress, lastTime, state; diff --git a/src/updatemanager.cpp b/src/updatemanager.cpp index c0eae741..9cee91cd 100644 --- a/src/updatemanager.cpp +++ b/src/updatemanager.cpp @@ -38,7 +38,7 @@ bool UpdateManager::CheckForUpdates() return false; busy = true; emit messageSignal(tr("Checking for updates...")); - + emit progressSignal(0); QNetworkRequest request(Util::VersionFileUrl()); QNetworkReply *reply = manager->get(request); @@ -84,7 +84,7 @@ bool UpdateManager::DownloadUpdate(const QString &url) return false; busy = true; emit messageSignal(tr("Downloading update...")); - + emit progressSignal(0); QNetworkRequest request(url); QString filename = QDir::toNativeSeparators(QString("%0/Baka-MPlayer.zip").arg(QCoreApplication::applicationDirPath())); QFile *file = new QFile(filename);