Command Line Connections, and a few fixes here and there

This commit is contained in:
Justin Hammond 2020-06-02 21:22:31 +08:00
parent fafd196c0b
commit 8a3b527bda
16 changed files with 205 additions and 60 deletions

View file

@ -6,6 +6,10 @@ unix {
} }
!macx: QMAKE_CXXFLAGS += -Wno-deprecated-copy !macx: QMAKE_CXXFLAGS += -Wno-deprecated-copy
} }
emscripten: {
QMAKE_CXXFLAGS += -Wno-deprecated-copy
QMAKE_LFLAGS += -g --source-map-base "http://localhost:8000/"
}
unix { unix {
CONFIG-= no-pkg-config CONFIG-= no-pkg-config
@ -39,7 +43,11 @@ unix {
message(" OpenZWave Database Path: $$OZW_DATABASE_PATH") message(" OpenZWave Database Path: $$OZW_DATABASE_PATH")
message(" ") message(" ")
INCLUDEPATH+=$$OZW_INCLUDE_PATH INCLUDEPATH+=$$OZW_INCLUDE_PATH
LIBS+=$$OZW_LIBS !emscripten {
LIBS+=$$OZW_LIBS
} else {
message(" Not Adding libopenzwave to LIBS")
}
} else { } else {
exists( $$top_srcdir/../open-zwave/cpp/src/) { exists( $$top_srcdir/../open-zwave/cpp/src/) {
message("Found OZW in $$absolute_path($$top_srcdir/../open-zwave/)") message("Found OZW in $$absolute_path($$top_srcdir/../open-zwave/)")
@ -56,7 +64,11 @@ unix {
message(" OpenZWave Database Path: $$OZW_DATABASE_PATH") message(" OpenZWave Database Path: $$OZW_DATABASE_PATH")
message(" ") message(" ")
INCLUDEPATH+=$$OZW_INCLUDE_PATH INCLUDEPATH+=$$OZW_INCLUDE_PATH
LIBS+=$$OZW_LIBS !emscripten {
LIBS+=$$OZW_LIBS
} else {
message(" Not Adding libopenzwave to LIBS")
}
} else { } else {
packagesExist("libopenzwave") { packagesExist("libopenzwave") {
PKGCONFIG += libopenzwave PKGCONFIG += libopenzwave
@ -72,7 +84,7 @@ unix {
error("Can't find OpenZWave Library and Headers"); error("Can't find OpenZWave Library and Headers");
} }
} }
} }
!isEmpty(QTOZW_LIB_PATH) { !isEmpty(QTOZW_LIB_PATH) {
!exists($$QTOZW_LIB_PATH/qt-openzwave/libqt-openzwave.so): error("Can't find libqt-openzwave.so") !exists($$QTOZW_LIB_PATH/qt-openzwave/libqt-openzwave.so): error("Can't find libqt-openzwave.so")

View file

@ -4,6 +4,7 @@
#include "eventwindow.h" #include "eventwindow.h"
#include "ui_eventwindow.h" #include "ui_eventwindow.h"
#include "util.h"
EventWindow::EventWindow(QWidget *parent) : EventWindow::EventWindow(QWidget *parent) :
@ -11,10 +12,12 @@ EventWindow::EventWindow(QWidget *parent) :
ui(new Ui::EventWindow) ui(new Ui::EventWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->eventTable->verticalHeader()->hide();
ui->eventTable->horizontalHeader()->setStretchLastSection(true); ui->eventTable->horizontalHeader()->setStretchLastSection(true);
ui->eventTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Time")); ui->eventTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Time"));
ui->eventTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Message")); ui->eventTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Message"));
ui->eventTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); ui->eventTable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
ui->eventTable->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
} }

View file

@ -11,7 +11,7 @@ LogWindow::LogWindow(QWidget *parent) :
this->ui->logview->verticalHeader()->hide(); this->ui->logview->verticalHeader()->hide();
this->ui->logview->horizontalHeader()->setStretchLastSection(true); this->ui->logview->horizontalHeader()->setStretchLastSection(true);
this->ui->logview->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); this->ui->logview->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
// this->ui->val_system_tbl->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); this->ui->logview->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
// this->ui->logview->resizeColumnsToContents(); // this->ui->logview->resizeColumnsToContents();

View file

@ -2,12 +2,29 @@
<ui version="4.0"> <ui version="4.0">
<class>LogWindow</class> <class>LogWindow</class>
<widget class="QWidget" name="LogWindow"> <widget class="QWidget" name="LogWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>280</width>
<height>216</height>
</rect>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>OZW Log</string> <string>OZW Log</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTableView" name="logview"> <widget class="QTableView" name="logview">
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">QTableWidget::item { padding: 0px }
QHeaderView::section:horizontal {margin-right: 2; border: 1px solid}</string>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
</property> </property>

View file

@ -41,7 +41,7 @@ int main(int argc, char *argv[])
#if 1 #if 1
QLoggingCategory::setFilterRules("*.debug=false\n" QLoggingCategory::setFilterRules("*.debug=false\n"
"qt.remoteobjects.debug=false\n" "qt.remoteobjects.debug=true\n"
"qt.remoteobjects.warning=true\n" "qt.remoteobjects.warning=true\n"
"ozw.*.debug=true\n" "ozw.*.debug=true\n"
"ozw.library.debug=false\n" "ozw.library.debug=false\n"
@ -56,7 +56,46 @@ int main(int argc, char *argv[])
QCoreApplication::setApplicationVersion(DEF2STR(APP_VERSION)); QCoreApplication::setApplicationVersion(DEF2STR(APP_VERSION));
QApplication a(argc, argv); QApplication a(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription("OpenZWave Admin GUI");
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption serialPort(QStringList() << "s" << "serial-port",
"AutoStart connecting to the Specified Serial Port of the USB Stick",
"serialPort"
);
parser.addOption(serialPort);
QCommandLineOption remoteHost(QStringList() << "host",
"AutoStart connecting to the Specified Remote Host/Port (1983 is default port)",
"host:port"
);
parser.addOption(remoteHost);
QCommandLineOption remoteKey(QStringList() << "password",
"Remote Host Password (optional)",
"password"
);
parser.addOption(remoteKey);
parser.process(a);
MainWindow w; MainWindow w;
w.show(); w.show();
if (parser.isSet(serialPort)) {
w.connectToLocal(parser.value(serialPort));
} else if (parser.isSet(remoteHost)) {
QString key;
if (parser.isSet(remoteKey)) {
key = parser.value(remoteKey);
}
QUrl server = QUrl::fromUserInput(parser.value(remoteHost), "");
server.setScheme("ws");
w.connectToRemote(server, key);
}
return a.exec(); return a.exec();
} }

View file

@ -193,7 +193,6 @@ void MainWindow::openDefaultWindows() {
} }
void MainWindow::OpenConnection() { void MainWindow::OpenConnection() {
this->connected(true);
Startup su(this); Startup su(this);
su.setModal(true); su.setModal(true);
@ -201,33 +200,17 @@ void MainWindow::OpenConnection() {
if (ret == QDialog::Accepted) { if (ret == QDialog::Accepted) {
if (su.getremote() == true) { if (su.getremote() == true) {
qCDebug(ozwadmin) << "Doing Remote Connection:" << su.getremoteHost() << su.getremotePort();
QUrl server; QUrl server;
server.setHost(su.getremoteHost()); server.setHost(su.getremoteHost());
server.setPort(su.getremotePort()); server.setPort(su.getremotePort());
server.setScheme("ws"); server.setScheme("ws");
qCDebug(ozwadmin) << "Connecting to " << server; connectToRemote(server, su.getauthKey());
startupprogress *sup = new startupprogress(true, this);
sup->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
sup->setQTOZWManager(OZWCore::get()->getQTOZWManager());
sup->show();
OZWCore::get()->getQTOZWManager()->setClientAuth(su.getauthKey());
OZWCore::get()->getQTOZWManager()->initilizeReplica(server);
OZWCore::get()->settings.setValue("connection/remotehost", su.getremoteHost());
OZWCore::get()->settings.setValue("connection/remoteport", su.getremotePort());
OZWCore::get()->settings.setValue("connection/authKey", su.getauthKey());
return; return;
} }
else else
{ {
qCDebug(ozwadmin) << "Doing Local Connection: " << su.getserialPort() << su.getstartServer();
startupprogress *sup = new startupprogress(false, this);
sup->setQTOZWManager(OZWCore::get()->getQTOZWManager());
sup->show();
OZWCore::get()->getQTOZWManager()->initilizeSource(OZWCore::get()->settings.value("StartServer").toBool());
OZWCore::get()->getQTOZWManager()->open(su.getserialPort());
OZWCore::get()->settings.setValue("connection/serialport", su.getserialPort());
OZWCore::get()->settings.setValue("connection/startserver", su.getstartServer()); OZWCore::get()->settings.setValue("connection/startserver", su.getstartServer());
connectToLocal(su.getserialPort());
return; return;
} }
} else { } else {
@ -236,6 +219,29 @@ void MainWindow::OpenConnection() {
} }
} }
void MainWindow::connectToLocal(QString serial) {
this->connected(true);
OZWCore::get()->settings.setValue("connection/serialport", serial);
qCDebug(ozwadmin) << "Doing Local Connection: " << serial << OZWCore::get()->settings.value("StartServer").toBool();
startupprogress *sup = new startupprogress(false, this);
sup->show();
OZWCore::get()->getQTOZWManager()->initilizeSource(OZWCore::get()->settings.value("connection/startserver").toBool());
OZWCore::get()->getQTOZWManager()->open(serial);
}
void MainWindow::connectToRemote(QUrl server, QString key) {
this->connected(true);
OZWCore::get()->settings.setValue("connection/remotehost", server);
OZWCore::get()->settings.setValue("connection/authKey", key);
qCDebug(ozwadmin) << "Doing Remote Connection:" << server;
startupprogress *sup = new startupprogress(true, this);
sup->setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
sup->show();
OZWCore::get()->getQTOZWManager()->setClientAuth(key);
OZWCore::get()->getQTOZWManager()->initilizeReplica(server);
}
void MainWindow::CloseConnection() { void MainWindow::CloseConnection() {
if (OZWCore::get()->getQTOZWManager()->getConnectionType() == QTOZWManager::connectionType::Local) { if (OZWCore::get()->getQTOZWManager()->getConnectionType() == QTOZWManager::connectionType::Local) {
OZWCore::get()->getQTOZWManager()->close(); OZWCore::get()->getQTOZWManager()->close();
@ -325,13 +331,13 @@ void MainWindow::setStatusBarMsg(QString Msg) {
} }
void MainWindow::remoteConnectionStatus(QTOZWManager::connectionStatus status, QAbstractSocket::SocketError error) { void MainWindow::remoteConnectionStatus(QTOZWManager::connectionStatus status, QAbstractSocket::SocketError error) {
Q_UNUSED(error); qCDebug(ozwadmin) << "Remote Connection Status: " << status << error;
if (status == QTOZWManager::connectionStatus::ConnectionErrorState) { if (status == QTOZWManager::connectionStatus::ConnectionErrorState) {
openCriticalDialog("Connection Error", "Connection Error"); QString errorstr("Connection Error: %1");
openCriticalDialog("Connection Error", errorstr.arg(SockErrorToString(error)));
CloseConnection(); CloseConnection();
} else if (status == QTOZWManager::connectionStatus::VersionMisMatchError) { } else if (status == QTOZWManager::connectionStatus::VersionMisMatchError) {
openCriticalDialog("Version MisMatch", "The ozwdaemon version is not compatible with this version of ozw-admin"); openCriticalDialog("Version MisMatch", "The ozwdaemon version is not compatible with this version of ozw-admin");
CloseConnection(); CloseConnection();
} }
} }

View file

@ -41,6 +41,8 @@ class MainWindow : public QMainWindow
public: public:
explicit MainWindow(QWidget *parent = nullptr); explicit MainWindow(QWidget *parent = nullptr);
~MainWindow(); ~MainWindow();
void connectToLocal(QString serial);
void connectToRemote(QUrl server, QString key);
public slots: public slots:
void OpenConnection(); void OpenConnection();
void CloseConnection(); void CloseConnection();

View file

@ -78,4 +78,9 @@ void nodeTableWidget::rightClickMenu(QPoint pos)
void nodeTableWidget::resizeContents() { void nodeTableWidget::resizeContents() {
this->ui->nodeList->resizeColumnsToContents(); this->ui->nodeList->resizeColumnsToContents();
if (!this->ui->nodeList->selectionModel()->hasSelection()) {
if (this->ui->nodeList->model()->rowCount() > 0) {
this->ui->nodeList->selectRow(0);
}
}
} }

View file

@ -5,7 +5,7 @@
#------------------------------------------------- #-------------------------------------------------
QT += core gui widgets xml remoteobjects websockets svg QT += core gui widgets xml remoteobjects websockets svg
#CONFIG += silent CONFIG += silent
TARGET = ../ozwadmin TARGET = ../ozwadmin
TEMPLATE = app TEMPLATE = app
@ -90,7 +90,6 @@ windows {
INCLUDEPATH += ../devicedb-lib ../ozwadmin-widgets INCLUDEPATH += ../devicedb-lib ../ozwadmin-widgets
macx: { macx: {
LIBS += -framework IOKit -framework CoreFoundation LIBS += -framework IOKit -framework CoreFoundation
BUNDLE.files = $$OZW_LIB_PATH/libopenzwave-1.6.dylib $$QTOZW_LIB_PATH/libqt-openzwave.1.dylib $$QTOZW_LIB_PATH/../qt-openzwavedatabase/libqt-openzwavedatabase.1.dylib BUNDLE.files = $$OZW_LIB_PATH/libopenzwave-1.6.dylib $$QTOZW_LIB_PATH/libqt-openzwave.1.dylib $$QTOZW_LIB_PATH/../qt-openzwavedatabase/libqt-openzwavedatabase.1.dylib

View file

@ -19,6 +19,7 @@ OZWCore *OZWCore::get() {
void OZWCore::initilize() { void OZWCore::initilize() {
#ifndef Q_OS_WASM
QStringList PossibleDBPaths; QStringList PossibleDBPaths;
PossibleDBPaths << settings.value("openzwave/ConfigPath", QDir::toNativeSeparators("../../../config/")).toString().append("/"); PossibleDBPaths << settings.value("openzwave/ConfigPath", QDir::toNativeSeparators("../../../config/")).toString().append("/");
PossibleDBPaths << QStandardPaths::standardLocations(QStandardPaths::AppDataLocation); PossibleDBPaths << QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
@ -97,7 +98,10 @@ void OZWCore::initilize() {
qCInfo(ozwadmin) << "UserPath is Set from Settings" << m_userpath.absolutePath(); qCInfo(ozwadmin) << "UserPath is Set from Settings" << m_userpath.absolutePath();
settings.setValue("openzwave/UserPath", m_userpath.absolutePath()); settings.setValue("openzwave/UserPath", m_userpath.absolutePath());
} }
#else
m_configpath = ".";
m_userpath = ".";
#endif
this->m_openzwave = new QTOpenZwave(this, m_configpath, m_userpath); this->m_openzwave = new QTOpenZwave(this, m_configpath, m_userpath);
this->m_qtozwmanager = this->m_openzwave->GetManager(); this->m_qtozwmanager = this->m_openzwave->GetManager();
} }

View file

@ -1,10 +1,12 @@
#include <QMessageBox> #include <QMessageBox>
#include <QIntValidator> #include <QIntValidator>
#include <QSettings> #include <QSettings>
#include <QUrl>
#include <QDebug>
#include "startup.h" #include "startup.h"
#include "ui_startup.h" #include "ui_startup.h"
#include "ozwcore.h"
Startup::Startup(QWidget *parent) : Startup::Startup(QWidget *parent) :
QDialog(parent), QDialog(parent),
@ -17,18 +19,19 @@ Startup::Startup(QWidget *parent) :
ui->remoteport->setMaximumWidth(w+8); ui->remoteport->setMaximumWidth(w+8);
QObject::connect(ui->startlocal, &QPushButton::clicked, this, &Startup::localPressed); QObject::connect(ui->startlocal, &QPushButton::clicked, this, &Startup::localPressed);
QObject::connect(ui->startremote, &QPushButton::clicked, this, &Startup::remotePressed); QObject::connect(ui->startremote, &QPushButton::clicked, this, &Startup::remotePressed);
QSettings settings;
#if defined(Q_OS_MACOS) #if defined(Q_OS_MACOS)
ui->serialport->setText(settings.value("connection/serialport", "/dev/cu.SLAB_USBtoUART").toString()); ui->serialport->setText(OZWCore::get()->settings.value("connection/serialport", "/dev/cu.SLAB_USBtoUART").toString());
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
ui->serialport->setText(settings.value("connection/serialport", "COM1").toString()); ui->serialport->setText(OZWCore::get()->settings.value("connection/serialport", "COM1").toString());
#else #else
ui->serialport->setText(settings.value("connection/serialport", "/dev/ttyUSB0").toString()); ui->serialport->setText(OZWCore::get()->settings.value("connection/serialport", "/dev/ttyUSB0").toString());
#endif #endif
ui->enableserver->setChecked(settings.value("connection/startserver", true).toBool()); ui->enableserver->setChecked(OZWCore::get()->settings.value("connection/startserver", true).toBool());
ui->remotehost->setText(settings.value("connection/remotehost", "localhost").toString()); QUrl server = QUrl::fromUserInput(OZWCore::get()->settings.value("connection/remotehost", "ws://localhost:1983").toString());
ui->remoteport->setText(settings.value("connection/remoteport", "1983").toString()); qDebug() << server;
ui->authKey->setText(settings.value("connection/authKey", "").toString()); ui->remotehost->setText(server.host());
ui->remoteport->setText(QString::number(server.port()));
ui->authKey->setText(OZWCore::get()->settings.value("connection/authKey", "").toString());
} }
Startup::~Startup() Startup::~Startup()

View file

@ -1,7 +1,9 @@
#include <QObject>
#include "startupprogress.h" #include "startupprogress.h"
#include "ui_startupprogress.h" #include "ui_startupprogress.h"
#include "util.h" #include "util.h"
#include "ozwcore.h"
startupprogress::startupprogress(bool remote, QWidget *parent) : startupprogress::startupprogress(bool remote, QWidget *parent) :
@ -12,6 +14,20 @@ startupprogress::startupprogress(bool remote, QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
ui->label->setText("Starting...."); ui->label->setText("Starting....");
/* connect the signals */
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::manufacturerSpecificDBReady, this, &startupprogress::manufacturerSpecificDBReady);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::ready, this, &startupprogress::ready);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::starting, this, &startupprogress::starting);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::started, this, &startupprogress::started);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::driverReady, this, &startupprogress::driverReady);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::driverAllNodesQueriedSomeDead, this, &startupprogress::driverAllNodesQueriedSomeDead);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::driverAllNodesQueried, this, &startupprogress::driverAllNodesQueried);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::driverAwakeNodesQueried, this, &startupprogress::driverAwakeNodesQueried);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::ozwNotification, this, &startupprogress::ozwNotification);
QObject::connect(OZWCore::get()->getQTOZWManager(), &QTOZWManager::remoteConnectionStatus, this, &startupprogress::remoteConnectionStatus);
QObject::connect(this->ui->cancelbtn, &QPushButton::clicked, this, &startupprogress::clicked);
} }
startupprogress::~startupprogress() startupprogress::~startupprogress()
@ -19,24 +35,6 @@ startupprogress::~startupprogress()
delete ui; delete ui;
} }
void startupprogress::setQTOZWManager(QTOZWManager *qtozw)
{
m_qtozwmanager = qtozw;
/* connect the signals */
QObject::connect(this->m_qtozwmanager, &QTOZWManager::manufacturerSpecificDBReady, this, &startupprogress::manufacturerSpecificDBReady);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::ready, this, &startupprogress::ready);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::starting, this, &startupprogress::starting);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::started, this, &startupprogress::started);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::driverReady, this, &startupprogress::driverReady);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::driverAllNodesQueriedSomeDead, this, &startupprogress::driverAllNodesQueriedSomeDead);
QObject::connect(this->m_qtozwmanager, &QTOZWManager::driverAllNodesQueried, this, &startupprogress::driverAllNodesQueried);
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) { void startupprogress::clicked(bool checked) {
Q_UNUSED(checked); Q_UNUSED(checked);
emit this->cancel(); emit this->cancel();
@ -96,6 +94,7 @@ void startupprogress::driverAwakeNodesQueried() {
this->close(); this->close();
} }
void startupprogress::ozwNotification(quint8 node, NotificationTypes::QTOZW_Notification_Code event) { void startupprogress::ozwNotification(quint8 node, NotificationTypes::QTOZW_Notification_Code event) {
Q_UNUSED(node);
qCDebug(ozwadmin) << event; qCDebug(ozwadmin) << event;
} }

View file

@ -17,7 +17,6 @@ class startupprogress : public QDialog
public: public:
explicit startupprogress(bool remote, QWidget *parent = nullptr); explicit startupprogress(bool remote, QWidget *parent = nullptr);
~startupprogress(); ~startupprogress();
void setQTOZWManager(QTOZWManager *);
Q_SIGNALS: Q_SIGNALS:
void cancel(); void cancel();
@ -42,7 +41,6 @@ private Q_SLOTS:
private: private:
Ui::startupprogress *ui; Ui::startupprogress *ui;
bool m_remote; bool m_remote;
QTOZWManager *m_qtozwmanager;
}; };
#endif // STARTUPPROGRESS_H #endif // STARTUPPROGRESS_H

View file

@ -15,6 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QObject>
#include "util.h" #include "util.h"
const char *nodeBasicStr (qint8 basic) const char *nodeBasicStr (qint8 basic)
@ -31,3 +33,57 @@ const char *nodeBasicStr (qint8 basic)
} }
return "unknown"; return "unknown";
} }
QString SockErrorToString(QAbstractSocket::SocketError error)
{
switch (error) {
case QAbstractSocket::ConnectionRefusedError:
return QObject::tr("Connection Refused");
case QAbstractSocket::RemoteHostClosedError:
return QObject::tr("Remote Host Closed");
case QAbstractSocket::HostNotFoundError:
return QObject::tr("Host Not Found");
case QAbstractSocket::SocketAccessError:
return QObject::tr("Socket Access Error");
case QAbstractSocket::SocketResourceError:
return QObject::tr("Socket Resource Error");
case QAbstractSocket::SocketTimeoutError:
return QObject::tr("Socket Timeout");
case QAbstractSocket::DatagramTooLargeError:
return QObject::tr("Datagram Too Large");
case QAbstractSocket::NetworkError:
return QObject::tr("Network Error");
case QAbstractSocket::AddressInUseError:
return QObject::tr("Address In Use");
case QAbstractSocket::SocketAddressNotAvailableError:
return QObject::tr("Socket Address Not Available");
case QAbstractSocket::UnsupportedSocketOperationError:
return QObject::tr("Unsupported Socket Operation");
case QAbstractSocket::ProxyAuthenticationRequiredError:
return QObject::tr("Proxy Authentication Required");
case QAbstractSocket::SslHandshakeFailedError:
return QObject::tr("SSL Handshake Failed");
case QAbstractSocket::UnfinishedSocketOperationError:
return QObject::tr("Unfinished Socket Operation");
case QAbstractSocket::ProxyConnectionRefusedError:
return QObject::tr("Proxy Connection Refused");
case QAbstractSocket::ProxyConnectionClosedError:
return QObject::tr("Proxy Connection Closed");
case QAbstractSocket::ProxyConnectionTimeoutError:
return QObject::tr("Proxy Connection Timeout");
case QAbstractSocket::ProxyNotFoundError:
return QObject::tr("Proxy Not Found");
case QAbstractSocket::ProxyProtocolError:
return QObject::tr("Proxy Protocol Error");
case QAbstractSocket::OperationError:
return QObject::tr("Operation Error");
case QAbstractSocket::SslInternalError:
return QObject::tr("SSL Internal Error");
case QAbstractSocket::SslInvalidUserDataError:
return QObject::tr("SSL Invalid User/Certificate");
case QAbstractSocket::TemporaryError:
return QObject::tr("Temporary Error");
case QAbstractSocket::UnknownSocketError:
return QObject::tr("Unknown Socket Error");
}
}

View file

@ -20,8 +20,10 @@
#include <QApplication> #include <QApplication>
#include <QCheckBox> #include <QCheckBox>
#include <QLoggingCategory> #include <QLoggingCategory>
#include <QAbstractSocket>
const char *nodeBasicStr (qint8 basic); const char *nodeBasicStr (qint8 basic);
QString SockErrorToString(QAbstractSocket::SocketError error);
Q_DECLARE_LOGGING_CATEGORY(ozwadmin); Q_DECLARE_LOGGING_CATEGORY(ozwadmin);

View file

@ -8,7 +8,7 @@ QT += core gui xml svg remoteobjects widgets
TARGET = ozwadmin-widgets TARGET = ozwadmin-widgets
TEMPLATE = lib TEMPLATE = lib
CONFIG += staticlib CONFIG += staticlib silent
SOURCES += widgets.cpp \ SOURCES += widgets.cpp \