Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
a45f31aa
Commit
a45f31aa
authored
Aug 04, 2021
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting
parent
2175db75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
examples/qtsupport/chatwidget.cpp
examples/qtsupport/chatwidget.cpp
+6
-9
No files found.
examples/qtsupport/chatwidget.cpp
View file @
a45f31aa
...
...
@@ -5,8 +5,8 @@
#include "caf/detail/scope_guard.hpp"
CAF_PUSH_WARNINGS
#include <QMessageBox>
#include <QInputDialog>
#include <QMessageBox>
CAF_POP_WARNINGS
#include "chatwidget.hpp"
...
...
@@ -67,9 +67,7 @@ void ChatWidget::init(actor_system& system) {
}
void
ChatWidget
::
sendChatMessage
()
{
auto
cleanup
=
detail
::
make_scope_guard
([
=
]
{
input
()
->
setText
(
QString
());
});
auto
cleanup
=
detail
::
make_scope_guard
([
=
]
{
input
()
->
setText
(
QString
());
});
QString
line
=
input
()
->
text
();
if
(
line
.
isEmpty
())
{
// Ignore empty lines.
...
...
@@ -115,8 +113,7 @@ void ChatWidget::joinGroup() {
"Please set a name first."
);
return
;
}
auto
gname
=
QInputDialog
::
getText
(
this
,
"Join Group"
,
auto
gname
=
QInputDialog
::
getText
(
this
,
"Join Group"
,
"Please enter a group as <module>:<id>"
,
QLineEdit
::
Normal
,
"remote:chatroom@localhost:4242"
);
...
...
@@ -126,9 +123,9 @@ void ChatWidget::joinGroup() {
return
;
}
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
);
if
(
!
x
)
if
(
!
x
)
QMessageBox
::
critical
(
this
,
"Error"
,
to_string
(
x
.
error
()).
c_str
());
else
self
()
->
send
(
self
(),
join_atom_v
,
std
::
move
(
*
x
));
...
...
@@ -137,6 +134,6 @@ void ChatWidget::joinGroup() {
void
ChatWidget
::
changeName
()
{
auto
name
=
QInputDialog
::
getText
(
this
,
"Change 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
());
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment