diff options
-rw-r--r-- | src/gui/buddylistview.cpp | 14 | ||||
-rw-r--r-- | src/gui/buddylistview.h | 18 | ||||
-rw-r--r-- | src/gui/gui.cpp | 31 | ||||
-rw-r--r-- | src/gui/gui.h | 5 | ||||
-rw-r--r-- | src/gui/messageformview.cpp | 8 | ||||
-rw-r--r-- | src/gui/messageformview.h | 7 |
6 files changed, 64 insertions, 19 deletions
diff --git a/src/gui/buddylistview.cpp b/src/gui/buddylistview.cpp index a094f47..083c8b0 100644 --- a/src/gui/buddylistview.cpp +++ b/src/gui/buddylistview.cpp @@ -124,13 +124,14 @@ BuddyListViewItem::BuddyListViewItem(Q3ListViewItem *parent, t_buddy *_buddy) : { set_icon(); buddy->attach(this); + QObject::connect(this, SIGNAL(update_signal()), this, SLOT(update_slot())); } BuddyListViewItem::~BuddyListViewItem() { buddy->detach(this); } -void BuddyListViewItem::update(void) { +void BuddyListViewItem::update_slot(void) { // This method is called directly from the core, so lock the GUI ui->lock(); set_icon(); @@ -142,6 +143,10 @@ void BuddyListViewItem::update(void) { ui->unlock(); } +void BuddyListViewItem::update(void) { + emit update_signal(); +} + void BuddyListViewItem::subject_destroyed(void) { delete this; } @@ -209,6 +214,7 @@ BLViewUserItem::BLViewUserItem(Q3ListView *parent, t_presence_epa *_presence_epa { set_icon(); presence_epa->attach(this); + QObject::connect(this, SIGNAL(update_signal()), this, SLOT(update_slot())); } BLViewUserItem::~BLViewUserItem() { @@ -226,7 +232,7 @@ void BLViewUserItem::paintCell(QPainter *painter, const QColorGroup &cg, painter->restore(); } -void BLViewUserItem::update(void) { +void BLViewUserItem::update_slot(void) { // This method is called directly from the core, so lock the GUI ui->lock(); set_icon(); @@ -238,6 +244,10 @@ void BLViewUserItem::update(void) { ui->unlock(); } +void BLViewUserItem::update(void) { + emit update_signal(); +} + void BLViewUserItem::subject_destroyed(void) { delete this; } diff --git a/src/gui/buddylistview.h b/src/gui/buddylistview.h index eb796fe..ef1b4cc 100644 --- a/src/gui/buddylistview.h +++ b/src/gui/buddylistview.h @@ -42,7 +42,8 @@ public: }; // List view item representing a buddy. -class BuddyListViewItem : public AbstractBLVItem, public patterns::t_observer { +class BuddyListViewItem : public QObject, public AbstractBLVItem, public patterns::t_observer { + Q_OBJECT private: t_buddy *buddy; @@ -57,10 +58,17 @@ public: virtual void subject_destroyed(void); t_buddy *get_buddy(void); + +signals: + void update_signal(); + +private slots: + void update_slot(); }; // List view item representing a user -class BLViewUserItem : public AbstractBLVItem, public patterns::t_observer { +class BLViewUserItem : public QObject, public AbstractBLVItem, public patterns::t_observer { + Q_OBJECT private: t_presence_epa *presence_epa; @@ -77,6 +85,12 @@ public: virtual void subject_destroyed(void); t_presence_epa *get_presence_epa(void); + +signals: + void update_signal(); + +private slots: + void update_slot(); }; #endif diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index c8723b6..e9c060d 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -650,6 +650,9 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N MEMMAN_NEW(mainWindow); qApp->setMainWidget(mainWindow); + connect(this, SIGNAL(update_reg_status()), mainWindow, SLOT(updateRegStatus())); + connect(this, SIGNAL(update_mwi()), mainWindow, SLOT(updateMwi())); + connect(this, SIGNAL(update_state()), mainWindow, SLOT(updateState())); } t_gui::~t_gui() { @@ -1130,7 +1133,7 @@ void t_gui::cb_provisional_resp_invite(int line, const t_response *r) { if (line >= NUM_USER_LINES) return; lock(); - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -1375,7 +1378,7 @@ void t_gui::cb_invalid_reg_resp(t_user *user_config, const t_response *r, const mainWindow->display(s); mainWindow->display(reason.c_str()); - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1393,7 +1396,7 @@ void t_gui::cb_register_success(t_user *user_config, const t_response *r, unsign mainWindow->display(s); } - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1410,7 +1413,7 @@ void t_gui::cb_register_failed(t_user *user_config, const t_response *r, bool fi mainWindow->display(s); } - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1425,7 +1428,7 @@ void t_gui::cb_register_stun_failed(t_user *user_config, bool first_failure) { mainWindow->display(s); } - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1440,7 +1443,7 @@ void t_gui::cb_deregister_success(t_user *user_config, const t_response *r) { .arg(r->reason.c_str()); mainWindow->display(s); - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1455,7 +1458,7 @@ void t_gui::cb_deregister_failed(t_user *user_config, const t_response *r) { .arg(r->reason.c_str()); mainWindow->display(s); - mainWindow->updateRegStatus(); + emit update_reg_status(); unlock(); } @@ -1756,13 +1759,13 @@ void t_gui::cb_dtmf_supported(int line) { if (line >= NUM_USER_LINES) return; lock(); - mainWindow->updateState(); + emit update_state(); unlock(); } void t_gui::cb_line_state_changed(void) { lock(); - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -1825,7 +1828,7 @@ void t_gui::cb_refer_failed(int line, const t_response *r) { mainWindow->display(s); // The refer state has changed, so update the main window. - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -1841,7 +1844,7 @@ void t_gui::cb_refer_result_success(int line) { mainWindow->display(s); // The refer state has changed, so update the main window. - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -1857,7 +1860,7 @@ void t_gui::cb_refer_result_failed(int line) { mainWindow->display(s); // The refer state has changed, so update the main window. - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -1876,7 +1879,7 @@ void t_gui::cb_refer_result_inprog(int line) { mainWindow->display(s); // The refer state has changed, so update the main window. - mainWindow->updateState(); + emit update_state(); unlock(); } @@ -2382,7 +2385,7 @@ void t_gui::cb_zrtp_sas_confirmation_reset(int line) { void t_gui::cb_update_mwi(void) { lock(); - mainWindow->updateMwi(); + emit update_mwi(); unlock(); } diff --git a/src/gui/gui.h b/src/gui/gui.h index 9cb92cd..1e7027d 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -384,6 +384,11 @@ public: * @param url [in] URL to open. */ void open_url_in_browser(const QString &url); + +signals: + void update_reg_status(); + void update_mwi(); + void update_state(); private slots: /** diff --git a/src/gui/messageformview.cpp b/src/gui/messageformview.cpp index b869520..31a073c 100644 --- a/src/gui/messageformview.cpp +++ b/src/gui/messageformview.cpp @@ -29,6 +29,8 @@ MessageFormView::MessageFormView(QWidget *parent, im::t_msg_session *s) : _msgSession = s; _msgSession->attach(this); _destructing = false; + + connect(this, SIGNAL(update_signal()), this, SLOT(update_slot())); } MessageFormView::~MessageFormView() @@ -54,7 +56,7 @@ void MessageFormView::updatePartyInfo(void) } } -void MessageFormView::update(void) { +void MessageFormView::update_slot(void) { // Called directly from core, so lock GUI ui->lock(); @@ -144,6 +146,10 @@ void MessageFormView::update(void) { ui->unlock(); } +void MessageFormView::update(void) { + emit update_signal(); +} + void MessageFormView::subject_destroyed() { _msgSession = NULL; diff --git a/src/gui/messageformview.h b/src/gui/messageformview.h index 951cb51..64c62c3 100644 --- a/src/gui/messageformview.h +++ b/src/gui/messageformview.h @@ -26,6 +26,7 @@ class MessageFormView : public MessageForm, patterns::t_observer { + Q_OBJECT private: bool _destructing; /**< Indicates if object is being destructed. */ public: @@ -38,6 +39,12 @@ public: virtual void subject_destroyed(void); virtual void show(void); + +signals: + void update_signal(); + +private slots: + void update_slot(); }; #endif |