void SimpleQObject::changeContact(const Contact &contact) { if (contact != m_contact) { m_contact = contact; Q_EMIT contactChanged(contact); } }
QTCONTACTS_USE_NAMESPACE QT_BEGIN_NAMESPACE /* ==================== QDeclarativeContactDetail ======================= */ /*! \qmltype ContactDetail \instantiates QDeclarativeContactDetail \brief The ContactDetail element represents a single, complete detail about a contact. \ingroup qml-contacts-main \inqmlmodule QtContacts 5.0 \sa QContactDetail The ContactDetail element is part of the \b{QtContacts} module. */ QDeclarativeContactDetail::QDeclarativeContactDetail(QObject* parent) :QObject(parent) { QDeclarativeContact* c = qobject_cast<QDeclarativeContact*>(parent); if (c) connect(this, SIGNAL(detailChanged()), c, SIGNAL(contactChanged())); }
QT_BEGIN_NAMESPACE_CONTACTS QDeclarativeContactDetail::QDeclarativeContactDetail(QObject* parent) :QObject(parent) { QDeclarativeContact* c = qobject_cast<QDeclarativeContact*>(parent); if (c) connect(this, SIGNAL(detailChanged()), c, SIGNAL(contactChanged())); }
void ContactModel::addContact(QSharedPointer<Contact> contact) { // contacts.push_back(contact); beginInsertRows(QModelIndex(), rowCount(), rowCount()); // contacts << contact; contacts.push_back(contact); endInsertRows(); connect(contact.data(), SIGNAL(contactChanged()),SLOT(drawPins())); emit dataChanged(createIndex(0,0),createIndex(contacts.size(),0)); }
void QDeclarativeContact::setContact(const QContact& contact) { m_id = contact.id(); foreach (QDeclarativeContactDetail *detail, m_details) delete detail; m_details.clear(); m_preferredDetails.clear(); QList<QContactDetail> details(contact.details()); foreach (const QContactDetail &detail, details) { QDeclarativeContactDetail *contactDetail = QDeclarativeContactDetailFactory::createContactDetail(static_cast<QDeclarativeContactDetail::DetailType>(detail.type())); contactDetail->setParent(this); contactDetail->setDetail(detail); connect(contactDetail, SIGNAL(detailChanged()), this, SIGNAL(contactChanged())); m_details.append(contactDetail); }
void CommentsModel::setContact(Vreen::Contact *contact) { if (contact == m_contact.data()) return; if (!m_session.isNull()) { clear(); m_session.data()->deleteLater(); } if (!contact) return; auto session = new Vreen::CommentSession(contact); connect(session, SIGNAL(commentAdded(QVariantMap)), SLOT(addComment(QVariantMap))); connect(session, SIGNAL(commentDeleted(int)), SLOT(deleteComment(int))); session->setPostId(m_postId); m_contact = contact; m_session = session; emit contactChanged(contact); }
void ConversationModel::setContact(ContactUser *contact) { if (contact == m_contact) return; beginResetModel(); messages.clear(); if (m_contact) disconnect(m_contact, 0, this, 0); m_contact = contact; if (m_contact) { connect(m_contact, SIGNAL(incomingChatMessage(ChatMessageData)), this, SLOT(receiveMessage(ChatMessageData))); connect(m_contact, SIGNAL(statusChanged()), this, SLOT(onContactStatusChanged())); } endResetModel(); emit contactChanged(); }
TrayIcon::TrayIcon(MainWindow* parent) : QObject(parent) , MainWindow_(parent) , Icon_(new QSystemTrayIcon(this)) , Menu_(new ContextMenu(0)) , MessageAlert_(new RecentMessagesAlert(new Logic::RecentItemDelegate(this))) , Base_(new QIcon(":/resources/main_window/appicon.ico")) , Unreads_(new QIcon(":/resources/main_window/appicon_unread.ico")) #ifdef _WIN32 , TrayBase_(new QIcon(":/resources/main_window/appicon_tray.ico")) , TrayUnreads_(new QIcon(":/resources/main_window/appicon_tray_unread.ico")) #else , TrayBase_(new QIcon(":/resources/main_window/appicon.ico")) , TrayUnreads_(new QIcon(":/resources/main_window/appicon_unread.ico")) #endif //_WIN32 , TaskBarOverlay_(new QPixmap(":/resources/main_window/appicon_overlay.png")) , HaveUnreads_(false) #ifdef _WIN32 , ptbl(0) #endif //_WIN32 { #ifdef _WIN32 if (QSysInfo().windowsVersion() >= QSysInfo::WV_WINDOWS7) { HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&ptbl)); if (FAILED(hr)) ptbl = 0; } #endif //_WIN32 init(); connect(Ui::GetDispatcher(), SIGNAL(login_complete()), this, SLOT(loggedIn()), Qt::QueuedConnection); connect(MessageAlert_, SIGNAL(messageClicked(QString)), this, SLOT(messageClicked(QString)), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), this, SLOT(clearNotifications(QString)), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(contactChanged(QString)), this, SLOT(updateIcon()), Qt::QueuedConnection); connect(Ui::GetDispatcher(), SIGNAL(myInfo()), this, SLOT(myInfo())); connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(loggedOut()), Qt::QueuedConnection); }
void SkypeContact::OnChange(int prop) { /* Here is the place where you can capture all property changes when they * happen. It's important to know that this method will receive ALL changes * from ALL properties, which means that it's necessary to create a nice and * robust filter inside this method to handle each type of property, * otherwise it can fail by acting incorrectly or even lose some events. * * Another interesting thing is that this method does not receive the new * value of the changed property. It's necessary to get the value from the * Contact class itself, because once this method is called the property is * already changed in the class. */ /* For our Contact class we will ony watch for the following * properties: * * - Contact::P_AVAILABILITY : Changes when the online status is set. * - Contact::P_DISPLAYNAME : Changes when a new Display Name is set. * - Contact::P_SKYPENAME : Changes when the skypename is updated. */ if (prop == Contact::P_AVAILABILITY || prop == Contact::P_DISPLAYNAME || prop == Contact::P_SKYPENAME) { // Let's log that it has changed! SEString skypeName; GetPropSkypename(skypeName); printf("%s: Contact's property changed.\n", skypeName.data()); /* And then notify the other interested objects that some of these * properties have changed. */ ContactRef ref = this->ref(); contactChanged(this, ref); } }
void *Container::processEvent(Event *e) { UserWnd *userWnd; Contact *contact; CommandDef *cmd; Message *msg; switch (e->type()){ case EventMessageReceived: msg = (Message*)(e->param()); if (msg->type() == MessageStatus){ contact = getContacts()->contact(msg->contact()); if (contact) contactChanged(contact); return NULL; } if (CorePlugin::m_plugin->getContainerMode()){ if (isActiveWindow()){ userWnd = m_tabBar->currentWnd(); if (userWnd && (userWnd->id() == msg->contact())) userWnd->markAsRead(); } #ifdef WIN32 if (!isActiveWindow()){ msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd){ if (!initFlash){ HINSTANCE hLib = GetModuleHandleA("user32"); if (hLib != NULL) (DWORD&)FlashWindowEx = (DWORD)GetProcAddress(hLib,"FlashWindowEx"); initFlash = true; } if (FlashWindowEx){ FLASHWINFO fInfo; fInfo.cbSize = sizeof(fInfo); fInfo.dwFlags = 0x0E; fInfo.hwnd = winId(); fInfo.uCount = 0; FlashWindowEx(&fInfo); } } } #endif } case EventMessageRead: msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd){ bool bBold = false; for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){ if ((*it).contact != msg->contact()) continue; bBold = true; break; } m_tabBar->setBold(msg->contact(), bBold); } break; case EventActiveContact: if (!isActiveWindow()) return NULL; userWnd = m_tabBar->currentWnd(); if (userWnd) return (void*)(userWnd->id()); break; case EventContactDeleted: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd) removeUserWnd(userWnd); break; case EventContactChanged: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd){ if (contact->getIgnore()){ removeUserWnd(userWnd); break; } m_tabBar->changeTab(contact->id()); contactChanged(contact); } case EventClientsChanged: setupAccel(); break; case EventContactStatus: contact = (Contact*)(e->param()); userWnd = m_tabBar->wnd(contact->id()); if (userWnd){ unsigned style = 0; string wrkIcons; const char *statusIcon = NULL; contact->contactInfo(style, statusIcon, &wrkIcons); bool bTyping = false; while (!wrkIcons.empty()){ if (getToken(wrkIcons, ',') == "typing"){ bTyping = true; break; } } if (userWnd->m_bTyping != bTyping){ userWnd->m_bTyping = bTyping; if (bTyping){ userWnd->setStatus(i18n("Contact typed message")); }else{ userWnd->setStatus(""); } userWnd = m_tabBar->currentWnd(); if (userWnd && (contact->id() == userWnd->id())) m_status->message(userWnd->status()); } } break; case EventContactClient: contactChanged((Contact*)(e->param())); break; case EventInit: init(); break; case EventCommandExec: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id())){ if (cmd->menu_id == MenuContainerContact){ m_tabBar->raiseTab(cmd->id); return e->param(); } if (cmd->id == CmdClose){ delete userWnd; return e->param(); } if (cmd->id == CmdInfo){ CommandDef c = *cmd; c.menu_id = MenuContact; c.param = (void*)userWnd->id(); Event eExec(EventCommandExec, &c); eExec.process(); return e->param(); } } break; case EventCheckState: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id()) && (cmd->menu_id == MenuContainerContact) && (cmd->id == CmdContainerContacts)){ list<UserWnd*> userWnds = m_tabBar->windows(); CommandDef *cmds = new CommandDef[userWnds.size() + 1]; memset(cmds, 0, sizeof(CommandDef) * (userWnds.size() + 1)); unsigned n = 0; for (list<UserWnd*>::iterator it = userWnds.begin(); it != userWnds.end(); ++it){ cmds[n].id = (*it)->id(); cmds[n].flags = COMMAND_DEFAULT; cmds[n].text_wrk = strdup((*it)->getName().utf8()); cmds[n].icon = (*it)->getIcon(); cmds[n].text = "_"; cmds[n].menu_id = n + 1; if (n < sizeof(accels) / sizeof(const char*)) cmds[n].accel = accels[n]; if (*it == m_tabBar->currentWnd()) cmds[n].flags |= COMMAND_CHECKED; n++; } cmd->param = cmds; cmd->flags |= COMMAND_RECURSIVE; return e->param(); } break; } return NULL; }
void *Container::processEvent(Event *e) { UserWnd *userWnd; Contact *contact; CommandDef *cmd; Message *msg; switch (e->type()){ case EventMessageReceived: msg = (Message*)(e->param()); if (msg->type() == MessageStatus){ contact = getContacts()->contact(msg->contact()); if (contact) contactChanged(contact); return NULL; } if (msg->getFlags() & MESSAGE_NOVIEW) return NULL; if (CorePlugin::m_plugin->getContainerMode()){ if (isActiveWindow() && !isMinimized()){ userWnd = m_tabBar->currentWnd(); if (userWnd && (userWnd->id() == msg->contact())) userWnd->markAsRead(); }else{ msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd) QTimer::singleShot(0, this, SLOT(flash())); } } break; case EventMessageRead: msg = (Message*)(e->param()); userWnd = wnd(msg->contact()); if (userWnd){ bool bBold = false; for (list<msg_id>::iterator it = CorePlugin::m_plugin->unread.begin(); it != CorePlugin::m_plugin->unread.end(); ++it){ if ((*it).contact != msg->contact()) continue; bBold = true; break; } m_tabBar->setBold(msg->contact(), bBold); } break; case EventActiveContact: if (!isActiveWindow()) return NULL; userWnd = m_tabBar->currentWnd(); if (userWnd) return (void*)(userWnd->id()); break; case EventContactDeleted: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd) removeUserWnd(userWnd); break; case EventContactChanged: contact = (Contact*)(e->param()); userWnd = wnd(contact->id()); if (userWnd){ if (contact->getIgnore()){ removeUserWnd(userWnd); break; } m_tabBar->changeTab(contact->id()); contactChanged(contact); } case EventClientsChanged: setupAccel(); break; case EventContactStatus: contact = (Contact*)(e->param()); userWnd = m_tabBar->wnd(contact->id()); if (userWnd){ unsigned style = 0; string wrkIcons; const char *statusIcon = NULL; contact->contactInfo(style, statusIcon, &wrkIcons); bool bTyping = false; while (!wrkIcons.empty()){ if (getToken(wrkIcons, ',') == "typing"){ bTyping = true; break; } } if (userWnd->m_bTyping != bTyping){ userWnd->m_bTyping = bTyping; if (bTyping){ userWnd->setStatus(g_i18n("%1 typed", contact) .arg(contact->getName())); }else{ userWnd->setStatus(""); } userWnd = m_tabBar->currentWnd(); if (userWnd && (contact->id() == userWnd->id())) m_status->message(userWnd->status()); } } break; case EventContactClient: contactChanged((Contact*)(e->param())); break; case EventInit: init(); break; case EventCommandExec: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id())){ if (cmd->menu_id == MenuContainerContact){ m_tabBar->raiseTab(cmd->id); return e->param(); } if (cmd->id == CmdClose){ delete userWnd; return e->param(); } if (cmd->id == CmdInfo){ CommandDef c = *cmd; c.menu_id = MenuContact; c.param = (void*)userWnd->id(); Event eExec(EventCommandExec, &c); eExec.process(); return e->param(); } } break; case EventCheckState: cmd = (CommandDef*)(e->param()); userWnd = m_tabBar->currentWnd(); if (userWnd && ((unsigned)(cmd->param) == userWnd->id()) && (cmd->menu_id == MenuContainerContact) && (cmd->id == CmdContainerContacts)){ list<UserWnd*> userWnds = m_tabBar->windows(); CommandDef *cmds = new CommandDef[userWnds.size() + 1]; memset(cmds, 0, sizeof(CommandDef) * (userWnds.size() + 1)); unsigned n = 0; for (list<UserWnd*>::iterator it = userWnds.begin(); it != userWnds.end(); ++it){ cmds[n].id = (*it)->id(); cmds[n].flags = COMMAND_DEFAULT; cmds[n].text_wrk = strdup((*it)->getName().utf8()); cmds[n].icon = (*it)->getIcon(); cmds[n].text = "_"; cmds[n].menu_id = n + 1; if (n < sizeof(accels) / sizeof(const char*)) cmds[n].accel = accels[n]; if (*it == m_tabBar->currentWnd()) cmds[n].flags |= COMMAND_CHECKED; n++; } cmd->param = cmds; cmd->flags |= COMMAND_RECURSIVE; return e->param(); } break; } return NULL; }
MainPage::MainPage(QWidget* parent) : QWidget(parent) , search_widget_(new SearchWidget(8, false, this)) , contact_dialog_(new ContactDialog(this)) , video_window_(new VideoWindow()) , video_panel_(new CallPanelMain(this)) , pages_(new WidgetsNavigator(this)) , search_contacts_(nullptr) , profile_settings_(new ProfileSettingsWidget(this)) , general_settings_(new GeneralSettingsWidget(this)) , noContactsYetSuggestions_(nullptr) , contact_list_widget_(new ContactList(this, Logic::MembersWidgetRegim::CONTACT_LIST, NULL)) , add_contact_menu_(0) { connect(&Utils::InterConnector::instance(), SIGNAL(showNoContactsYetSuggestions()), this, SLOT(showNoContactsYetSuggestions())); connect(&Utils::InterConnector::instance(), SIGNAL(hideNoContactsYetSuggestions()), this, SLOT(hideNoContactsYetSuggestions())); if (this->objectName().isEmpty()) this->setObjectName(QStringLiteral("main_page")); this->resize(400, 300); this->setProperty("Invisible", QVariant(true)); horizontal_layout_ = new QHBoxLayout(this); horizontal_layout_->setSpacing(0); horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout")); horizontal_layout_->setContentsMargins(0, 0, 0, 0); QMetaObject::connectSlotsByName(this); QHBoxLayout* originalLayout = qobject_cast<QHBoxLayout*>(layout()); QVBoxLayout* contactsLayout = new QVBoxLayout(); contactsLayout->setContentsMargins(0, 0, 0, 0); contactsLayout->setSpacing(0); assert(video_panel_); if (video_panel_) { contactsLayout->addWidget(video_panel_); video_panel_->hide(); } contactsLayout->addWidget(search_widget_); contactsLayout->addWidget(contact_list_widget_); QSpacerItem* contactsLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum); contactsLayout->addSpacerItem(contactsLayoutSpacer); pages_layout_ = new QVBoxLayout(); pages_layout_->setContentsMargins(0, 0, 0, 0); pages_layout_->setSpacing(0); pages_layout_->addWidget(pages_); { auto pc = pages_->count(); pages_->addWidget(contact_dialog_); pages_->addWidget(profile_settings_); pages_->addWidget(general_settings_); if (!pc) pages_->push(contact_dialog_); } originalLayout->addLayout(contactsLayout); originalLayout->addLayout(pages_layout_); QSpacerItem* originalLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum); originalLayout->addSpacerItem(originalLayoutSpacer); originalLayout->setAlignment(Qt::AlignLeft); setFocus(); connect(contact_list_widget_, SIGNAL(itemSelected(QString)), contact_dialog_, SLOT(onContactSelected(QString)), Qt::QueuedConnection); connect(contact_dialog_, SIGNAL(sendMessage(QString)), contact_list_widget_, SLOT(onSendMessage(QString)), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(itemSelected(QString)), this, SLOT(onContactSelected(QString)), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(addContactClicked()), this, SLOT(onAddContactClicked()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsShow(QString)), this, SLOT(onProfileSettingsShow(QString)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsShow(int)), this, SLOT(onGeneralSettingsShow(int)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(makeSearchWidgetVisible(bool)), search_widget_, SLOT(setVisible(bool)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(popPagesToRoot()), pages_, SLOT(poproot()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsDoMessage(QString)), contact_list_widget_, SLOT(select(QString)), Qt::QueuedConnection); connect(search_widget_, SIGNAL(searchBegin()), this, SLOT(searchBegin()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(searchEnd()), this, SLOT(searchEnd()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(search(QString)), Logic::GetSearchModel(), SLOT(searchPatternChanged(QString)), Qt::QueuedConnection); connect(search_widget_, SIGNAL(enterPressed()), contact_list_widget_, SLOT(searchResult()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(upPressed()), contact_list_widget_, SLOT(searchUpPressed()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(downPressed()), contact_list_widget_, SLOT(searchDownPressed()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(nonActiveButtonPressed()), this, SLOT(addButtonClicked()), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(searchEnd()), search_widget_, SLOT(searchCompleted()), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), Logic::GetMessagesModel(), SLOT(contactChanged(QString)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipShowVideoWindow(bool)), this, SLOT(onVoipShowVideoWindow(bool)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncoming(const std::string&, const std::string&)), this, SLOT(onVoipCallIncoming(const std::string&, const std::string&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), this, SLOT(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallCreated(const voip_manager::ContactEx&)), this, SLOT(onVoipCallCreated(const voip_manager::ContactEx&)), Qt::DirectConnection); search_widget_->setVisible(!contact_list_widget_->shouldHideSearch()); }
void Box2DFixture::emitContactChanged(Box2DFixture *other) { emit contactChanged(other); }
QDeclarativeContact::QDeclarativeContact(QObject *parent) :QObject(parent) , m_modified(false) { connect(this, SIGNAL(contactChanged()), SLOT(setModified())); }
MainPage::MainPage(QWidget* parent) : QWidget(parent) , search_widget_(new SearchWidget(false, this)) , contact_dialog_(new ContactDialog(this)) #ifndef STRIP_VOIP , video_window_(nullptr) #else , video_window_(nullptr) #endif //STRIP_VOIP , pages_(new WidgetsNavigator(this)) , search_contacts_(nullptr) , profile_settings_(new ProfileSettingsWidget(this)) , general_settings_(new GeneralSettingsWidget(this)) , live_chats_page_(new LiveChatHome(this)) , themes_settings_(new ThemesSettingsWidget(this)) , noContactsYetSuggestions_(nullptr) , contact_list_widget_(new ContactList(this, Logic::MembersWidgetRegim::CONTACT_LIST, nullptr)) , add_contact_menu_(nullptr) , settings_timer_(new QTimer(this)) , introduceYourselfSuggestions_(nullptr) , needShowIntroduceYourself_(false) , liveChats_(new LiveChats(this)) , login_new_user_(false) , recv_my_info_(false) { connect(&Utils::InterConnector::instance(), &Utils::InterConnector::showPlaceholder, this, &MainPage::showPlaceholder); if (this->objectName().isEmpty()) this->setObjectName(QStringLiteral("main_page")); setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true)); this->resize(400, 300); this->setProperty("Invisible", QVariant(true)); horizontal_layout_ = new QHBoxLayout(this); horizontal_layout_->setSpacing(0); horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout")); horizontal_layout_->setContentsMargins(0, 0, 0, 0); QMetaObject::connectSlotsByName(this); QHBoxLayout* originalLayout = qobject_cast<QHBoxLayout*>(layout()); QVBoxLayout* contactsLayout = new QVBoxLayout(); contactsLayout->setContentsMargins(0, 0, 0, 0); contactsLayout->setSpacing(0); contactsLayout->addWidget(search_widget_); contactsLayout->addWidget(contact_list_widget_); QSpacerItem* contactsLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum); contactsLayout->addSpacerItem(contactsLayoutSpacer); pages_layout_ = new QVBoxLayout(); pages_layout_->setContentsMargins(0, 0, 0, 0); pages_layout_->setSpacing(0); pages_layout_->addWidget(pages_); { auto pc = pages_->count(); pages_->addWidget(contact_dialog_); pages_->addWidget(profile_settings_); pages_->addWidget(general_settings_); pages_->addWidget(live_chats_page_); pages_->addWidget(themes_settings_); if (!pc) pages_->push(contact_dialog_); } originalLayout->addLayout(contactsLayout); originalLayout->addLayout(pages_layout_); QSpacerItem* originalLayoutSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum); originalLayout->addSpacerItem(originalLayoutSpacer); originalLayout->setAlignment(Qt::AlignLeft); setFocus(); connect(contact_list_widget_, SIGNAL(itemSelected(QString)), contact_dialog_, SLOT(onContactSelected(QString)), Qt::QueuedConnection); connect(contact_dialog_, SIGNAL(sendMessage(QString)), contact_list_widget_, SLOT(onSendMessage(QString)), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(itemSelected(QString)), this, SLOT(onContactSelected(QString)), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(addContactClicked()), this, SLOT(onAddContactClicked()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsShow(QString)), this, SLOT(onProfileSettingsShow(QString)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsShow(bool,QString)), this, SLOT(onThemesSettingsShow(bool,QString)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsShow(int)), this, SLOT(onGeneralSettingsShow(int)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(liveChatsShow()), this, SLOT(onLiveChatsShow()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(generalSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(themesSettingsBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(attachPhoneBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(attachUinBack()), pages_, SLOT(pop()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(makeSearchWidgetVisible(bool)), search_widget_, SLOT(setVisible(bool)), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(popPagesToRoot()), this, SLOT(popPagesToRoot()), Qt::QueuedConnection); connect(&Utils::InterConnector::instance(), SIGNAL(profileSettingsDoMessage(QString)), contact_list_widget_, SLOT(select(QString)), Qt::QueuedConnection); connect(search_widget_, SIGNAL(searchBegin()), this, SLOT(searchBegin()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(searchEnd()), this, SLOT(searchEnd()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(search(QString)), Logic::GetSearchModel(), SLOT(searchPatternChanged(QString)), Qt::QueuedConnection); connect(search_widget_, SIGNAL(enterPressed()), contact_list_widget_, SLOT(searchResult()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(upPressed()), contact_list_widget_, SLOT(searchUpPressed()), Qt::QueuedConnection); connect(search_widget_, SIGNAL(downPressed()), contact_list_widget_, SLOT(searchDownPressed()), Qt::QueuedConnection); connect(contact_list_widget_, SIGNAL(searchEnd()), search_widget_, SLOT(searchCompleted()), Qt::QueuedConnection); connect(Logic::GetContactListModel(), SIGNAL(selectedContactChanged(QString)), Logic::GetMessagesModel(), SLOT(contactChanged(QString)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipShowVideoWindow(bool)), this, SLOT(onVoipShowVideoWindow(bool)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncoming(const std::string&, const std::string&)), this, SLOT(onVoipCallIncoming(const std::string&, const std::string&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), this, SLOT(onVoipCallIncomingAccepted(const voip_manager::ContactEx&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection); connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallCreated(const voip_manager::ContactEx&)), this, SLOT(onVoipCallCreated(const voip_manager::ContactEx&)), Qt::DirectConnection); search_widget_->setVisible(!contact_list_widget_->shouldHideSearch()); post_stats_with_settings(); QObject::connect(settings_timer_, SIGNAL(timeout()), this, SLOT(post_stats_with_settings())); settings_timer_->start(Ui::period_for_stats_settings_ms); connect(Ui::GetDispatcher(), &core_dispatcher::myInfo, this, &MainPage::myInfo, Qt::UniqueConnection); connect(Ui::GetDispatcher(), &core_dispatcher::login_new_user, this, &MainPage::loginNewUser, Qt::DirectConnection); add_contact_menu_ = new FlatMenu(search_widget_->searchEditIcon()); Utils::ApplyStyle(add_contact_menu_, "QMenu { background-color: #f2f2f2; border:1px solid #cccccc; } " "QMenu::item { padding-left:40dip; background-color:transparent; color:black; padding-top:6dip; padding-bottom:6dip; padding-right:12dip; } " "QMenu::item:selected { background-color:#e2e2e2; } " "QMenu::icon { padding-left:22dip; }" ); add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newchat_100.png")), QT_TRANSLATE_NOOP("contact_list", "New chat"), contact_list_widget_, SLOT(allClicked())); add_contact_menu_->addAction(QIcon(Utils::parse_image_name(":/resources/dialog_newgroup_100.png")), QT_TRANSLATE_NOOP("contact_list", "Create Groupchat"), this, SLOT(createGroupChat())); add_contact_menu_->setExpandDirection(Qt::AlignLeft); add_contact_menu_->stickToIcon(); Utils::ApplyStyle(search_widget_->searchEditIcon(), "QPushButton::menu-indicator { image:none; } QPushButton:pressed { background-color:transparent; }"); search_widget_->searchEditIcon()->setMenu(add_contact_menu_); }