Skip to content

Commit

Permalink
fix example (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax authored Jun 26, 2023
1 parent 214ebd7 commit 2be5507
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qt/pubnub_qt_gui_sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ extern "C" {
void pubnub_qt_gui_sample::resetPubnub()
{
d_pb_publish.reset(new pubnub_qt(d_pubkey->text(), d_keysub->text()));
d_pb_publish->set_uuid(d_userId->text());
connect(d_pb_publish.data(), SIGNAL(outcome(pubnub_res)), this, SLOT(onPublish(pubnub_res)));

d_pb_subscribe.reset(new pubnub_qt(d_pubkey->text(), d_keysub->text()));
d_pb_subscribe->set_uuid(d_userId->text());
connect(d_pb_subscribe.data(), SIGNAL(outcome(pubnub_res)), this, SLOT(onSubscribe(pubnub_res)));
d_pb_subscribe->subscribe(d_channel->text());
}
Expand All @@ -33,6 +35,9 @@ pubnub_qt_gui_sample::pubnub_qt_gui_sample()
d_channel = new QLineEdit("hello_world");
connect(d_channel, SIGNAL(returnPressed()), this, SLOT(channelChanged()));

d_userId = new QLineEdit("user_id");
connect(d_userId, SIGNAL(returnPressed()), this, SLOT(userIdChanged()));

d_message = new QLineEdit("{\"text\": \"Pubnub-Qt\"}");
connect(d_message, SIGNAL(returnPressed()), this, SLOT(messageChanged()));

Expand Down Expand Up @@ -105,6 +110,11 @@ void pubnub_qt_gui_sample::keysubChanged()
resetPubnub();
}

void pubnub_qt_gui_sample::userIdChanged()
{
qDebug() << "userIdChanged()";
resetPubnub();
}

void pubnub_qt_gui_sample::channelChanged()
{
Expand Down
2 changes: 2 additions & 0 deletions qt/pubnub_qt_gui_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ private slots:

void pubkeyChanged();
void keysubChanged();;
void userIdChanged();
void messageChanged();
void channelChanged();

private:
QLineEdit *d_channel;
QLineEdit *d_pubkey;
QLineEdit *d_keysub;
QLineEdit *d_userId;

QLineEdit *d_message;
QTextEdit *d_console;
Expand Down

0 comments on commit 2be5507

Please sign in to comment.