Skip to content

Commit f8e2d1b

Browse files
committed
Tweaks: UpdateDialog fix and removal of baka-mplayer group in settings
1 parent dcd3c3e commit f8e2d1b

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

src/settings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ void Settings::LoadIni()
7272
if(group != QString())
7373
root[group] = group_obj;
7474

75+
// remove excess baka-mplayer group
76+
root.remove("baka-mplayer");
77+
7578
// fix input
7679
if(root.find("input") != root.end())
7780
{

src/ui/updatedialog.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) :
4444
init = false;
4545
}
4646
}
47+
else if(percent == 0)
48+
{
49+
avgSpeed = 0;
50+
lastSpeed = 0;
51+
lastProgress = 0;
52+
lastTime = 0;
53+
ui->progressBar->setValue(0);
54+
ui->progressBar->setVisible(true);
55+
ui->timeRemainingLabel->setText(QString());
56+
ui->timeRemainingLabel->setVisible(true);
57+
if(timer != nullptr)
58+
delete timer;
59+
timer = new QTime();
60+
timer->start();
61+
}
4762
else if(timer) // don't execute this if timer is not defined--this shouldn't happen though.. but it does
4863
{
4964
avgSpeed = 0.005*lastSpeed + 0.995*avgSpeed;
@@ -72,7 +87,7 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) :
7287
connect(ui->updateButton, &QPushButton::clicked,
7388
[=]
7489
{
75-
Prepare();
90+
ui->plainTextEdit->setPlainText(QString());
7691
baka->update->DownloadUpdate(Util::DownloadFileUrl());
7792
});
7893
#endif
@@ -81,10 +96,7 @@ UpdateDialog::UpdateDialog(BakaEngine *baka, QWidget *parent) :
8196
this, SLOT(reject()));
8297

8398
if(baka->update->getInfo().empty())
84-
{
85-
Prepare();
8699
baka->update->CheckForUpdates();
87-
}
88100
else
89101
{
90102
init = false;
@@ -105,18 +117,6 @@ void UpdateDialog::CheckForUpdates(BakaEngine *baka, QWidget *parent)
105117
dialog->exec();
106118
}
107119

108-
void UpdateDialog::Prepare()
109-
{
110-
avgSpeed = 0;
111-
lastSpeed = 0;
112-
lastProgress = 0;
113-
lastTime = 0;
114-
if(timer != nullptr)
115-
delete timer;
116-
timer = new QTime();
117-
timer->start();
118-
}
119-
120120
void UpdateDialog::ShowInfo()
121121
{
122122
auto &info = baka->update->getInfo();

src/ui/updatedialog.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class UpdateDialog : public QDialog
2222
static void CheckForUpdates(BakaEngine *baka, QWidget *parent = 0);
2323

2424
protected slots:
25-
void Prepare();
2625
void ShowInfo();
2726

2827
private:
@@ -31,7 +30,7 @@ protected slots:
3130

3231
QTime *timer;
3332
double avgSpeed = 1,
34-
lastSpeed=0;
33+
lastSpeed = 0;
3534
int lastProgress,
3635
lastTime,
3736
state;

src/updatemanager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bool UpdateManager::CheckForUpdates()
3838
return false;
3939
busy = true;
4040
emit messageSignal(tr("Checking for updates..."));
41-
41+
emit progressSignal(0);
4242
QNetworkRequest request(Util::VersionFileUrl());
4343
QNetworkReply *reply = manager->get(request);
4444

@@ -84,7 +84,7 @@ bool UpdateManager::DownloadUpdate(const QString &url)
8484
return false;
8585
busy = true;
8686
emit messageSignal(tr("Downloading update..."));
87-
87+
emit progressSignal(0);
8888
QNetworkRequest request(url);
8989
QString filename = QDir::toNativeSeparators(QString("%0/Baka-MPlayer.zip").arg(QCoreApplication::applicationDirPath()));
9090
QFile *file = new QFile(filename);

0 commit comments

Comments
 (0)