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
3393ef6e
Commit
3393ef6e
authored
Nov 02, 2020
by
Hauke Goldhammer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port to 0.18 message types
parent
8f4112be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
examples/qtsupport/chatwidget.cpp
examples/qtsupport/chatwidget.cpp
+5
-5
examples/qtsupport/chatwidget.hpp
examples/qtsupport/chatwidget.hpp
+7
-4
examples/qtsupport/qt_group_chat.cpp
examples/qtsupport/qt_group_chat.cpp
+3
-2
No files found.
examples/qtsupport/chatwidget.cpp
View file @
3393ef6e
...
...
@@ -81,10 +81,10 @@ void ChatWidget::sendChatMessage() {
print
(
"*** error: "
+
QString
::
fromUtf8
(
to_string
(
x
.
error
()).
c_str
()));
else
self
()
->
send
(
self
(),
atom
(
"join"
)
,
std
::
move
(
*
x
));
self
()
->
send
(
self
(),
join_atom_v
,
std
::
move
(
*
x
));
},
[
=
](
set_name_atom
atm
,
string
&
name
)
{
send_as
(
as_actor
(),
as_actor
(),
atm
,
std
::
move
(
name
));
[
=
](
set_name_atom
,
string
&
name
)
{
send_as
(
as_actor
(),
as_actor
(),
set_name_atom_v
,
std
::
move
(
name
));
}
});
if
(
!
res
)
...
...
@@ -130,12 +130,12 @@ void ChatWidget::joinGroup() {
if
(
!
x
)
QMessageBox
::
critical
(
this
,
"Error"
,
to_string
(
x
.
error
()).
c_str
());
else
self
()
->
send
(
self
(),
join_atom
::
value
,
std
::
move
(
*
x
));
self
()
->
send
(
self
(),
join_atom
_v
,
std
::
move
(
*
x
));
}
void
ChatWidget
::
changeName
()
{
auto
name
=
QInputDialog
::
getText
(
this
,
"Change Name"
,
"Please enter a new name"
);
if
(
!
name
.
isEmpty
())
send_as
(
as_actor
(),
as_actor
(),
atom
(
"setName"
)
,
name
.
toUtf8
().
constData
());
send_as
(
as_actor
(),
as_actor
(),
set_name_atom_v
,
name
.
toUtf8
().
constData
());
}
examples/qtsupport/chatwidget.hpp
View file @
3393ef6e
...
...
@@ -11,6 +11,13 @@ CAF_PUSH_WARNINGS
#include <QTextEdit>
CAF_POP_WARNINGS
CAF_BEGIN_TYPE_ID_BLOCK
(
qt_support
,
first_custom_type_id
)
CAF_ADD_ATOM
(
qt_support
,
set_name_atom
)
CAF_ADD_ATOM
(
qt_support
,
quit_atom
)
CAF_END_TYPE_ID_BLOCK
(
qt_support
)
class
ChatWidget
:
public
caf
::
mixin
::
actor_widget
<
QWidget
>
{
private:
// -- Qt boilerplate code ----------------------------------------------------
...
...
@@ -22,10 +29,6 @@ public:
using
super
=
caf
::
mixin
::
actor_widget
<
QWidget
>
;
using
set_name_atom
=
caf
::
atom_constant
<
caf
::
atom
(
"setName"
)
>
;
using
quit_atom
=
caf
::
atom_constant
<
caf
::
atom
(
"quit"
)
>
;
ChatWidget
(
QWidget
*
parent
=
nullptr
,
Qt
::
WindowFlags
f
=
0
);
~
ChatWidget
();
...
...
examples/qtsupport/qt_group_chat.cpp
View file @
3393ef6e
...
...
@@ -40,6 +40,7 @@ public:
.
add
(
group_id
,
"group,g"
,
"join group (format: <module>:<id>"
);
parse
(
argc
,
argv
);
load
<
io
::
middleman
>
();
io
::
middleman
::
init_global_meta_objects
();
}
};
...
...
@@ -74,9 +75,9 @@ int main(int argc, char** argv) {
helper
.
chatwidget
->
init
(
system
);
auto
client
=
helper
.
chatwidget
->
as_actor
();
if
(
!
name
.
empty
())
send_as
(
client
,
client
,
atom
(
"setName"
)
,
move
(
name
));
send_as
(
client
,
client
,
set_name_atom_v
,
move
(
name
));
if
(
grp
)
send_as
(
client
,
client
,
atom
(
"join"
)
,
std
::
move
(
grp
));
send_as
(
client
,
client
,
join_atom_v
,
std
::
move
(
grp
));
mw
.
show
();
return
app
.
exec
();
}
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