diff --git a/ozwadmin-main/mainwindow.cpp b/ozwadmin-main/mainwindow.cpp index 1dcb926..2cf4a15 100644 --- a/ozwadmin-main/mainwindow.cpp +++ b/ozwadmin-main/mainwindow.cpp @@ -342,6 +342,7 @@ void MainWindow::OpenConnection() { server.setScheme("ws"); qCDebug(ozwadmin) << "Connecting to " << server; startupprogress *sup = new startupprogress(true, this); + sup->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); sup->setQTOZWManager(this->m_qtozwmanager); sup->show(); this->m_qtozwmanager->setClientAuth(su.getauthKey()); @@ -363,8 +364,12 @@ void MainWindow::OpenConnection() { this->settings.setValue("connection/startserver", su.getstartServer()); return; } - } - qCDebug(ozwadmin) << "Open Dialog was Canceled" << ret; + } else { + qCDebug(ozwadmin) << "Open Dialog was Canceled" << ret; + this->ui->actionOpen->setEnabled(true); + this->ui->action_Close->setEnabled(false); + + } } void MainWindow::CloseConnection() { diff --git a/ozwadmin-main/startupprogress.cpp b/ozwadmin-main/startupprogress.cpp index b4cbedf..d96b497 100644 --- a/ozwadmin-main/startupprogress.cpp +++ b/ozwadmin-main/startupprogress.cpp @@ -5,9 +5,9 @@ startupprogress::startupprogress(bool remote, QWidget *parent) : - m_remote(remote), QDialog(parent), - ui(new Ui::startupprogress) + ui(new Ui::startupprogress), + m_remote(remote) { ui->setupUi(this); ui->progressBar->setValue(0); @@ -34,16 +34,22 @@ void startupprogress::setQTOZWManager(QTOZWManager *qtozw) QObject::connect(this->m_qtozwmanager, &QTOZWManager::driverAwakeNodesQueried, this, &startupprogress::driverAwakeNodesQueried); QObject::connect(this->m_qtozwmanager, &QTOZWManager::ozwNotification, this, &startupprogress::ozwNotification); QObject::connect(this->m_qtozwmanager, &QTOZWManager::remoteConnectionStatus, this, &startupprogress::remoteConnectionStatus); + QObject::connect(this->ui->cancelbtn, &QPushButton::clicked, this, &startupprogress::clicked); } +void startupprogress::clicked(bool checked) { + Q_UNUSED(checked); + emit this->cancel(); + this->close(); +} void startupprogress::manufacturerSpecificDBReady() { ui->progressBar->setValue(ui->progressBar->value() + 5); ui->label->setText("Manufacturer Specific Database Ready"); } void startupprogress::ready() { - ui->progressBar->setValue(ui->progressBar->value() + 5); ui->label->setText("OpenZWave Ready"); + this->close(); } void startupprogress::starting() { @@ -99,11 +105,11 @@ void startupprogress::remoteConnectionStatus(QTOZWManager::connectionStatus stat QMetaEnum metaEnum = QMetaEnum::fromType(); ui->label->setText(metaEnum.valueToKey(status)); if ((status >= QTOZWManager::connectionStatus::GotManagerData) && (status <= QTOZWManager::connectionStatus::GotLogData)) { - ui->progressBar->setValue(ui->progressBar->value()+5); + ui->progressBar->setValue(ui->progressBar->value()+16); + qCDebug(ozwadmin) << ui->progressBar->value(); } } else { QMetaEnum metaEnum = QMetaEnum::fromType(); ui->label->setText(QString("Error: ").append(metaEnum.valueToKey(error))); - } } diff --git a/ozwadmin-main/startupprogress.h b/ozwadmin-main/startupprogress.h index 67b0c33..7a33aaf 100644 --- a/ozwadmin-main/startupprogress.h +++ b/ozwadmin-main/startupprogress.h @@ -19,6 +19,9 @@ class startupprogress : public QDialog ~startupprogress(); void setQTOZWManager(QTOZWManager *); +Q_SIGNALS: + void cancel(); + public Q_SLOTS: void manufacturerSpecificDBReady(); void ready(); @@ -33,6 +36,8 @@ public Q_SLOTS: void driverAwakeNodesQueried(); void ozwNotification(quint8 node, NotificationTypes::QTOZW_Notification_Code event); void remoteConnectionStatus(QTOZWManager::connectionStatus status, QAbstractSocket::SocketError error); +private Q_SLOTS: + void clicked(bool checked); private: Ui::startupprogress *ui; diff --git a/ozwadmin-main/startupprogress.ui b/ozwadmin-main/startupprogress.ui index ea58f5a..b9e27d3 100644 --- a/ozwadmin-main/startupprogress.ui +++ b/ozwadmin-main/startupprogress.ui @@ -5,6 +5,14 @@ Qt::ApplicationModal + + + 0 + 0 + 119 + 64 + + Progress @@ -14,6 +22,9 @@ TextLabel + + Qt::AlignCenter + @@ -23,6 +34,13 @@ + + + + &Cancel + + +