Enable Remote Connection

This commit is contained in:
Justin Hammond 2020-01-28 23:30:00 +08:00
parent b51a1fc147
commit 001c8002cd
3 changed files with 49 additions and 1 deletions

View file

@ -55,6 +55,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionOpen_Log_Window, SIGNAL(triggered()), this, SLOT(openLogWindow()));
connect(ui->actionOpen_Serial_Port, SIGNAL(triggered()), this, SLOT(OpenSerialPort()));
connect(ui->actionOpen_Remote, SIGNAL(triggered()), this, SLOT(OpenRemote()));
connect(ui->action_Close, SIGNAL(triggered()), this, SLOT(CloseConnection()));
connect(ui->actionDevice_Database, SIGNAL(triggered()), this, SLOT(OpenDeviceDB()));
connect(ui->md_helpwindow, &QPushButton::clicked, this, &MainWindow::openMetaDataWindow);
connect(ui->action_Configuration, SIGNAL(triggered()), this, SLOT(openConfigWindow()));
@ -325,10 +327,36 @@ void MainWindow::QTOZW_Ready() {
this->m_statTimer.start(1000);
}
void MainWindow::OpenRemote() {
bool ok;
QString text = QInputDialog::getText(this, tr("Enter Remote Host"),
tr("Hostname/IP Address:"), QLineEdit::Normal,
"localhost", &ok);
if (!ok)
return;
QUrl server;
server.setHost(text);
server.setPort(1983);
server.setScheme("tcp");
qDebug() << "Connecting to " << server;
this->m_qtozwmanager->initilizeReplica(server);
}
void MainWindow::CloseConnection() {
}
void MainWindow::OpenSerialPort() {
bool ok;
QMessageBox::warning(this, tr("OZW-Admin"),
tr("This is Work In Progress!"),
QMessageBox::Ok);
QString text = QInputDialog::getText(this, tr("Select Serial Port"),
tr("Serial Port:"), QLineEdit::Normal,
this->m_serialport, &ok);

View file

@ -42,6 +42,8 @@ public:
Q_PROPERTY(QString SerialPort MEMBER m_serialport)
public slots:
void OpenSerialPort();
void OpenRemote();
void CloseConnection();
void resizeColumns();
void NodeSelected(QModelIndex,QModelIndex);
void openLogWindow();

View file

@ -907,7 +907,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<width>85</width>
<height>71</height>
</rect>
</property>
@ -1086,6 +1086,8 @@
<bool>false</bool>
</attribute>
<addaction name="actionOpen_Serial_Port"/>
<addaction name="actionOpen_Remote"/>
<addaction name="action_Close"/>
<addaction name="actionOpen_Log_Window"/>
<addaction name="actionDevice_Database"/>
</widget>
@ -1120,6 +1122,22 @@
<string>&amp;Device Database</string>
</property>
</action>
<action name="actionOpen_Remote">
<property name="text">
<string>Open &amp;Remote</string>
</property>
<property name="toolTip">
<string>Open Remote</string>
</property>
</action>
<action name="action_Close">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="toolTip">
<string>Close Local or Remote Connection</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>