fix: 1.console client not register own data type. 2.start by current screen heigh width. 3.set heartbeat to server.
This commit is contained in:
@@ -24,6 +24,7 @@ void Connecter::RunWorker(ClientCore* clientCore)
|
||||
connect(clientCore_, &ClientCore::sigClients, this, &Connecter::HandleClients);
|
||||
|
||||
sockWorker_ = new SocketWorker(clientCore_, nullptr);
|
||||
heatBeat_ = new HeatBeat(clientCore_);
|
||||
clientCore_->moveToThread(sockWorker_);
|
||||
|
||||
connect(clientCore_, &ClientCore::conSuccess, this, [this]() {
|
||||
@@ -50,6 +51,7 @@ void Connecter::RunWorker(ClientCore* clientCore)
|
||||
connect(this, &Connecter::sigDisConnect, clientCore_, &ClientCore::Disconnect);
|
||||
connect(sockWorker_, &QThread::finished, sockWorker_, &QObject::deleteLater);
|
||||
|
||||
heatBeat_->start();
|
||||
sockWorker_->start();
|
||||
}
|
||||
|
||||
@@ -89,6 +91,7 @@ void Connecter::setState(ConnectState cs)
|
||||
ui->btnConnect->setEnabled(false);
|
||||
ui->btnDisconnect->setEnabled(true);
|
||||
RefreshClient();
|
||||
connect(heatBeat_, &HeatBeat::finished, heatBeat_, &QObject::deleteLater);
|
||||
break;
|
||||
case CS_DISCONNECT:
|
||||
ui->btnConnect->setEnabled(true);
|
||||
@@ -139,7 +142,8 @@ void Connecter::InitControl()
|
||||
ui->btnDisconnect->setEnabled(false);
|
||||
ui->edIP->setText("127.0.0.1");
|
||||
ui->edPort->setText("9009");
|
||||
ui->edPort->setFixedWidth(70);
|
||||
// ui->edIP->setMinimumWidth(120);
|
||||
// ui->edPort->setFixedWidth(60);
|
||||
|
||||
connect(ui->btnConnect, &QPushButton::clicked, this, &Connecter::Connect);
|
||||
connect(ui->btnRefresh, &QPushButton::clicked, this, &Connecter::RefreshClient);
|
||||
|
||||
@@ -54,6 +54,7 @@ private:
|
||||
private:
|
||||
QMenu* menu_;
|
||||
SocketWorker* sockWorker_{};
|
||||
HeatBeat* heatBeat_{};
|
||||
QStandardItemModel* model_;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>350</width>
|
||||
<height>276</height>
|
||||
<width>331</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -26,6 +26,30 @@
|
||||
<item>
|
||||
<widget class="QLineEdit" name="edIP"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="elbClient">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
@@ -46,35 +70,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbClient">
|
||||
<property name="text">
|
||||
<string>Client:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="elbClient">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
explicit LogPrint(QWidget* parent = nullptr);
|
||||
~LogPrint();
|
||||
|
||||
public:
|
||||
public slots:
|
||||
void Info(const QString& message);
|
||||
void Warn(const QString& message);
|
||||
void Error(const QString& message);
|
||||
|
||||
Reference in New Issue
Block a user