/** Constructor */ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags) : RWindow("MessengerWindow", parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME); ui.avatar->setOwnId(); connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage())); connect(NotifyQt::getInstance(), SIGNAL(ownAvatarChanged()), this, SLOT(updateAvatar())); connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage())); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int))); if (expandedPeers != NULL) { for (std::set<std::string>::iterator peerIt = expandedPeers->begin(); peerIt != expandedPeers->end(); peerIt++) { ui.friendList->addPeerToExpand(*peerIt); } delete expandedPeers; expandedPeers = NULL; } if (expandedGroups != NULL) { for (std::set<std::string>::iterator groupIt = expandedGroups->begin(); groupIt != expandedGroups->end(); groupIt++) { ui.friendList->addGroupToExpand(*groupIt); } delete expandedGroups; expandedGroups = NULL; } ui.messagelineEdit->setMinimumWidth(20); /* Initialize friend list */ QToolButton *button = new QToolButton(this); button->setIcon(QIcon(":/images/user/add_user24.png")); button->setToolTip(tr("Add a Friend")); connect(button, SIGNAL(clicked()), this, SLOT(addFriend())); ui.friendList->addToolButton(button); button = new QToolButton(this); button->setIcon(QIcon(":/images/friendsfolder24.png")); button->setToolTip(tr("Share files for your friends")); connect(button, SIGNAL(clicked()), this, SLOT(openShareManager())); ui.friendList->addToolButton(button); // load settings RsAutoUpdatePage::lockAllEvents(); ui.friendList->setShowStatusColumn(false); ui.friendList->setShowLastContactColumn(false); ui.friendList->setShowAvatarColumn(true); ui.friendList->setShowIPColumn(false); ui.friendList->setRootIsDecorated(true); ui.friendList->setShowGroups(false); processSettings(true); ui.friendList->setBigName(true); RsAutoUpdatePage::unlockAllEvents(); // add self nick RsPeerDetails pd; std::string ownId = rsPeers->getOwnId(); if (rsPeers->getPeerDetails(ownId, pd)) { /* calculate only once */ m_nickName = QString::fromUtf8(pd.name.c_str()); } /* Show nick and current state */ StatusInfo statusInfo; rsStatus->getOwnStatus(statusInfo); updateOwnStatus(QString::fromStdString(ownId), statusInfo.status); MainWindow *pMainWindow = MainWindow::getInstance(); if (pMainWindow) { QMenu *pStatusMenu = new QMenu(); pMainWindow->initializeStatusObject(pStatusMenu, true); ui.statusButton->setMenu(pStatusMenu); } loadmystatusmessage(); /* Hide platform specific features */ #ifdef Q_WS_WIN #endif }
/** Constructor */ MessengerWindow::MessengerWindow(QWidget* parent, Qt::WindowFlags flags) : RWindow("MessengerWindow", parent, flags) { /* Invoke the Qt Designer generated object setup routine */ ui.setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); ui.avatar->setFrameType(AvatarWidget::STATUS_FRAME); ui.avatar->setOwnId(); connect(ui.messagelineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(savestatusmessage())); connect(NotifyQt::getInstance(), SIGNAL(ownStatusMessageChanged()), this, SLOT(loadmystatusmessage())); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateOwnStatus(QString,int))); for (std::set<std::string>::iterator peerIt = expandedPeers.begin(); peerIt != expandedPeers.end(); ++peerIt) { ui.friendList->addPeerToExpand(*peerIt); } expandedPeers.clear(); for (std::set<RsNodeGroupId>::iterator groupIt = expandedGroups.begin(); groupIt != expandedGroups.end(); ++groupIt) { ui.friendList->addGroupToExpand(*groupIt); } expandedGroups.clear(); ui.messagelineEdit->setMinimumWidth(20); /* Initialize friend list */ QToolButton *button = new QToolButton(this); button->setIcon(QIcon(":/images/user/add_user24.png")); button->setToolTip(tr("Add a Friend")); connect(button, SIGNAL(clicked()), this, SLOT(addFriend())); ui.friendList->addToolButton(button); button = new QToolButton(this); button->setIcon(QIcon(":/images/friendsfolder24.png")); button->setToolTip(tr("Share files for your friends")); connect(button, SIGNAL(clicked()), this, SLOT(openShareManager())); ui.friendList->addToolButton(button); // load settings RsAutoUpdatePage::lockAllEvents(); ui.friendList->setColumnVisible(FriendList::COLUMN_LAST_CONTACT, false); ui.friendList->setColumnVisible(FriendList::COLUMN_IP, false); ui.friendList->setShowGroups(false); processSettings(true); RsAutoUpdatePage::unlockAllEvents(); // add self nick RsPeerDetails pd; RsPeerId ownId = rsPeers->getOwnId(); if (rsPeers->getPeerDetails(ownId, pd)) { /* calculate only once */ m_nickName = QString::fromUtf8(pd.name.c_str()); } /* Show nick and current state */ StatusInfo statusInfo; rsStatus->getOwnStatus(statusInfo); updateOwnStatus(QString::fromStdString(ownId.toStdString()), statusInfo.status); MainWindow *pMainWindow = MainWindow::getInstance(); if (pMainWindow) { QMenu *pStatusMenu = new QMenu(); pMainWindow->initializeStatusObject(pStatusMenu, true); ui.statusButton->setMenu(pStatusMenu); } loadmystatusmessage(); }