Skip to content

Commit

Permalink
fix autoconnect#2
Browse files Browse the repository at this point in the history
  • Loading branch information
khonoka committed Mar 20, 2022
1 parent 359f804 commit f0b7b3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
2 changes: 1 addition & 1 deletion i18n/across_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@
<context>
<name>across::NodeList</name>
<message>
<location filename="../src/view_models/nodelist.cpp" line="337"/>
<location filename="../src/view_models/nodelist.cpp" line="325"/>
<source>Copy [%1] URL to clipboard</source>
<translation>复制 [%1] 链接到剪贴板</translation>
</message>
Expand Down
7 changes: 6 additions & 1 deletion src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,14 @@ QFuture<void> Application::checkAndReconnect() {
for (int i = 0; i < 10; i++) {
wait(200);
if (this->p_acolors->isConnected())
return;
break;
this->p_acolors->reconnect();
}
if (this->p_config->enableAutoConnect()) {
auto status = this->p_acolors->core()->run();
if (!status.ok())
qDebug() << status.error_message().c_str();
}
});
}

Expand Down
12 changes: 0 additions & 12 deletions src/view_models/nodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,6 @@ void NodeList::init(QSharedPointer<across::setting::ConfigTools> config,
});
}

if (p_config->enableAutoConnect()) {
if (!run()) {
p_logger->error("Failed to start current node: {} {}", m_node.id,
m_node.name.toStdString());
}

emit currentGroupIDChanged();
emit currentNodeIDChanged();
emit currentNodeInfoChanged(m_node.toVariantMap());
emit currentNodeChanged(m_node);
}

reloadItems();
}

Expand Down

0 comments on commit f0b7b3c

Please sign in to comment.