diff options
author | Lubos Dolezel <lubos@dolezel.info> | 2015-06-04 13:45:19 +0200 |
---|---|---|
committer | Lubos Dolezel <lubos@dolezel.info> | 2015-06-04 13:45:19 +0200 |
commit | 004fb9b00fe7e1e5c7c3febe4401cac46a9521a2 (patch) | |
tree | 1a69747985e892c42265d5960a87e6de871879f9 | |
parent | 119f68fad29c1eac0aac637c5c052b47ab5e57c4 (diff) | |
download | twinkle-004fb9b00fe7e1e5c7c3febe4401cac46a9521a2.tar twinkle-004fb9b00fe7e1e5c7c3febe4401cac46a9521a2.tar.gz twinkle-004fb9b00fe7e1e5c7c3febe4401cac46a9521a2.tar.lz twinkle-004fb9b00fe7e1e5c7c3febe4401cac46a9521a2.tar.xz twinkle-004fb9b00fe7e1e5c7c3febe4401cac46a9521a2.zip |
Fix QPixmap use outside of main thread
-rw-r--r-- | src/gui/gui.cpp | 53 | ||||
-rw-r--r-- | src/gui/gui.h | 1 |
2 files changed, 29 insertions, 25 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 788fa60..1399f4b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1503,32 +1503,35 @@ void t_gui::cb_fetch_reg_result(t_user *user_config, const t_response *r) { unlock(); } +void t_gui::do_cb_register_inprog(t_user *user_config, t_register_type register_type) +{ + QString s; + + switch(register_type) { + case REG_REGISTER: + // Do not report registration refreshments + if (phone->get_is_registered(user_config)) break; + mainWindow->statRegLabel->setPixmap( + QPixmap(":/icons/images/gear.png")); + break; + case REG_DEREGISTER: + case REG_DEREGISTER_ALL: + mainWindow->statRegLabel->setPixmap( + QPixmap(":/icons/images/gear.png")); + break; + case REG_QUERY: + emit mw_display_header(); + s = user_config->get_profile_name().c_str(); + s += qApp->translate("GUI", ": fetching registrations..."); + emit mw_display(s); + break; + } +} + void t_gui::cb_register_inprog(t_user *user_config, t_register_type register_type) { - QString s; - - lock(); - - switch(register_type) { - case REG_REGISTER: - // Do not report registration refreshments - if (phone->get_is_registered(user_config)) break; - mainWindow->statRegLabel->setPixmap( - QPixmap(":/icons/images/gear.png")); - break; - case REG_DEREGISTER: - case REG_DEREGISTER_ALL: - mainWindow->statRegLabel->setPixmap( - QPixmap(":/icons/images/gear.png")); - break; - case REG_QUERY: - emit mw_display_header(); - s = user_config->get_profile_name().c_str(); - s += qApp->translate("GUI", ": fetching registrations..."); - emit mw_display(s); - break; - } - - unlock(); + QMetaObject::invokeMethod(this, "do_cb_register_inprog", Qt::QueuedConnection, + Q_ARG(t_user*, user_config), Q_ARG(t_register_type, register_type)); + } void t_gui::cb_redirecting_request(t_user *user_config, int line, const t_contact_param &contact) { diff --git a/src/gui/gui.h b/src/gui/gui.h index 1634a6e..7282d57 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -408,6 +408,7 @@ private slots: const string &display, t_method method); bool do_cb_ask_credentials(t_user *user_config, const string &realm, string &username, string &password); + void do_cb_register_inprog(t_user *user_config, t_register_type register_type); }; #endif |