-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
50 lines (41 loc) · 1.13 KB
/
mainwindow.cpp
File metadata and controls
50 lines (41 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "appcore.h"
#include "logger.h"
#include "defines.h"
MainWindow::MainWindow(QWidget *parent, AppCore * core) :
QMainWindow(parent), ui(new Ui::MainWindow), _core(core)
{
ui->setupUi(this);
ui->logListView->hide();
window()->adjustSize();
ui->lblAbout->setText(QString(tr("Update manager. Version: %1.")+" By PavelK.ru").arg(VERSION));
connect(&Logger::instance(), &Logger::newMsg, this, &MainWindow::onNewMsg);
connect(_core, &AppCore::progress, this, &MainWindow::onProgressChanged);
connect(_core, &AppCore::statusChanged, this, &MainWindow::onNewStatus);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_logBtnShow_clicked()
{
if ( !ui->logListView->isHidden() ) {
ui->logListView->hide();
} else {
ui->logListView->show();
}
}
void MainWindow::onNewMsg(QString msg)
{
ui->logListView->insertItem(0, msg);
}
void MainWindow::onProgressChanged(int pr)
{
ui->progress->setValue(pr);
}
void MainWindow::onNewStatus(QString st, int mode)
{
Q_UNUSED(mode);
ui->lblCurrentAction->setText(st);
}