ownid:show own id with color.
This commit is contained in:
@@ -51,6 +51,7 @@ void Connecter::RunWorker(ClientCore* clientCore)
|
|||||||
}
|
}
|
||||||
ui->elbClient->clear();
|
ui->elbClient->clear();
|
||||||
clientCore_->SetRemoteID("");
|
clientCore_->SetRemoteID("");
|
||||||
|
ui->edOwnID->setText("");
|
||||||
qInfo() << QString(tr("Disconnected."));
|
qInfo() << QString(tr("Disconnected."));
|
||||||
});
|
});
|
||||||
connect(clientCore_, &ClientCore::sigOffline, this, [this]() {
|
connect(clientCore_, &ClientCore::sigOffline, this, [this]() {
|
||||||
@@ -78,6 +79,9 @@ void Connecter::HandleClients(const InfoClientVec& clients)
|
|||||||
model_->removeRows(0, ui->listView->model()->rowCount());
|
model_->removeRows(0, ui->listView->model()->rowCount());
|
||||||
for (const auto& client : clients.vec) {
|
for (const auto& client : clients.vec) {
|
||||||
auto* item = new QStandardItem(client.id);
|
auto* item = new QStandardItem(client.id);
|
||||||
|
if (client.id == GlobalData::Ins()->GetLocalID()) {
|
||||||
|
item->setForeground(QColor("red"));
|
||||||
|
}
|
||||||
model_->appendRow(item);
|
model_->appendRow(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,6 +121,7 @@ void Connecter::setState(ConnectState cs)
|
|||||||
ui->btnConnect->setEnabled(false);
|
ui->btnConnect->setEnabled(false);
|
||||||
ui->btnDisconnect->setEnabled(true);
|
ui->btnDisconnect->setEnabled(true);
|
||||||
RefreshClient();
|
RefreshClient();
|
||||||
|
ui->edOwnID->setText(GlobalData::Ins()->GetLocalID());
|
||||||
connect(heatBeat_, &HeatBeat::finished, heatBeat_, &QObject::deleteLater);
|
connect(heatBeat_, &HeatBeat::finished, heatBeat_, &QObject::deleteLater);
|
||||||
break;
|
break;
|
||||||
case CS_DISCONNECT:
|
case CS_DISCONNECT:
|
||||||
@@ -165,6 +170,10 @@ std::string Connecter::getCurClient()
|
|||||||
|
|
||||||
void Connecter::InitControl()
|
void Connecter::InitControl()
|
||||||
{
|
{
|
||||||
|
ui->edOwnID->setReadOnly(true);
|
||||||
|
ui->label->setStyleSheet("color: blue;");
|
||||||
|
ui->edOwnID->setStyleSheet("color: blue;");
|
||||||
|
|
||||||
ui->btnDisconnect->setEnabled(false);
|
ui->btnDisconnect->setEnabled(false);
|
||||||
ui->comboBox->setEditable(true);
|
ui->comboBox->setEditable(true);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>331</width>
|
<width>331</width>
|
||||||
<height>289</height>
|
<height>418</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -60,10 +60,21 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3"/>
|
<widget class="QListView" name="listView"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListView" name="listView"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>OwnID:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edOwnID"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
|||||||
Reference in New Issue
Block a user