Commit a45f31aa authored by Dominik Charousset's avatar Dominik Charousset

Fix formatting

parent 2175db75
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include "caf/detail/scope_guard.hpp" #include "caf/detail/scope_guard.hpp"
CAF_PUSH_WARNINGS CAF_PUSH_WARNINGS
#include <QMessageBox>
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox>
CAF_POP_WARNINGS CAF_POP_WARNINGS
#include "chatwidget.hpp" #include "chatwidget.hpp"
...@@ -67,9 +67,7 @@ void ChatWidget::init(actor_system& system) { ...@@ -67,9 +67,7 @@ void ChatWidget::init(actor_system& system) {
} }
void ChatWidget::sendChatMessage() { void ChatWidget::sendChatMessage() {
auto cleanup = detail::make_scope_guard([=] { auto cleanup = detail::make_scope_guard([=] { input()->setText(QString()); });
input()->setText(QString());
});
QString line = input()->text(); QString line = input()->text();
if (line.isEmpty()) { if (line.isEmpty()) {
// Ignore empty lines. // Ignore empty lines.
...@@ -115,8 +113,7 @@ void ChatWidget::joinGroup() { ...@@ -115,8 +113,7 @@ void ChatWidget::joinGroup() {
"Please set a name first."); "Please set a name first.");
return; return;
} }
auto gname = QInputDialog::getText(this, auto gname = QInputDialog::getText(this, "Join Group",
"Join Group",
"Please enter a group as <module>:<id>", "Please enter a group as <module>:<id>",
QLineEdit::Normal, QLineEdit::Normal,
"remote:chatroom@localhost:4242"); "remote:chatroom@localhost:4242");
...@@ -126,9 +123,9 @@ void ChatWidget::joinGroup() { ...@@ -126,9 +123,9 @@ void ChatWidget::joinGroup() {
return; return;
} }
string mod = gname.left(pos).toUtf8().constData(); string mod = gname.left(pos).toUtf8().constData();
string gid = QStringView{gname}.mid(pos+1).toUtf8().constData(); string gid = QStringView{gname}.mid(pos + 1).toUtf8().constData();
auto x = system().groups().get(mod, gid); auto x = system().groups().get(mod, gid);
if (! x) if (!x)
QMessageBox::critical(this, "Error", to_string(x.error()).c_str()); QMessageBox::critical(this, "Error", to_string(x.error()).c_str());
else else
self()->send(self(), join_atom_v, std::move(*x)); self()->send(self(), join_atom_v, std::move(*x));
...@@ -137,6 +134,6 @@ void ChatWidget::joinGroup() { ...@@ -137,6 +134,6 @@ void ChatWidget::joinGroup() {
void ChatWidget::changeName() { void ChatWidget::changeName() {
auto name = QInputDialog::getText(this, "Change Name", auto name = QInputDialog::getText(this, "Change Name",
"Please enter a new name"); "Please enter a new name");
if (! name.isEmpty()) if (!name.isEmpty())
send_as(as_actor(), as_actor(), set_name_atom_v, name.toUtf8().constData()); send_as(as_actor(), as_actor(), set_name_atom_v, name.toUtf8().constData());
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment