- connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString)));
- connect(coreConnection(), SIGNAL(progressValueChanged(int)), ui.progressBar, SLOT(setValue(int)));
- connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int)));
- connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int)));
+ connect(coreConnection(), SIGNAL(progressTextChanged(QString)), ui.messageLabel, SLOT(setText(QString)));
+ connect(coreConnection(), SIGNAL(progressValueChanged(int)), ui.progressBar, SLOT(setValue(int)));
+ connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), ui.progressBar, SLOT(setRange(int, int)));
+ connect(coreConnection(), SIGNAL(progressRangeChanged(int, int)), this, SLOT(progressRangeChanged(int, int)));
+
+ connect(coreConnection(), SIGNAL(stateChanged(CoreConnection::ConnectionState)), SLOT(connectionStateChanged(CoreConnection::ConnectionState)));
+ connect(coreConnection(), SIGNAL(connectionError(QString)), ui.messageLabel, SLOT(setText(QString)));
+ connect(coreConnection(), SIGNAL(lagUpdated(int)), SLOT(updateLag(int)));
+}
+
+
+void CoreConnectionStatusWidget::update()
+{
+ CoreConnection *conn = coreConnection();
+ if (conn->progressMaximum() >= 0) {
+ ui.progressBar->setMinimum(conn->progressMinimum());
+ ui.progressBar->setMaximum(conn->progressMaximum());
+ ui.progressBar->setValue(conn->progressValue());
+ ui.progressBar->show();
+ }
+ else
+ ui.progressBar->hide();
+
+ ui.messageLabel->setText(conn->progressText());