void Dashboard::setPlayer(const Player *player){ this->player = player; connect(player, SIGNAL(state_changed()), this, SLOT(refresh())); connect(player, SIGNAL(kingdom_changed()), this, SLOT(updateAvatar())); updateAvatar(); }
void Dashboard::setPlayer(const ClientPlayer *player){ connect(player, SIGNAL(state_changed()), this, SLOT(refresh())); connect(player, SIGNAL(kingdom_changed()), this, SLOT(updateAvatar())); connect(player, SIGNAL(general_changed()), this, SLOT(updateAvatar())); connect(player, SIGNAL(action_taken()), this, SLOT(setActionState())); mark_item->setDocument(player->getMarkDoc()); updateAvatar(); }
void OverlayEditorScene::updateSelected() { if (qgpiSelected == qgpiAvatar) updateAvatar(); else if (qgpiSelected == qgpiName) updateUserName(); else if (qgpiSelected == qgpiAvatar) updateAvatar(); else if (qgpiSelected == qgpiMuted) updateMuted(); }
/** Constructor */ MsgItem::MsgItem(FeedHolder *parent, uint32_t feedId, std::string msgId, bool isHome) :QWidget(NULL), mParent(parent), mFeedId(feedId), mMsgId(msgId), mIsHome(isHome) { /* Invoke the Qt Designer generated object setup routine */ setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); /* general ones */ connect( expandButton, SIGNAL( clicked( void ) ), this, SLOT( toggle ( void ) ) ); connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); //connect( gotoButton, SIGNAL( clicked( void ) ), this, SLOT( gotoHome ( void ) ) ); /* specific ones */ connect( playButton, SIGNAL( clicked( void ) ), this, SLOT( playMedia ( void ) ) ); connect( deleteButton, SIGNAL( clicked( void ) ), this, SLOT( deleteMsg ( void ) ) ); connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyMsg ( void ) ) ); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&))); small(); updateItemStatic(); updateItem(); updateAvatar(QString::fromStdString(mPeerId)); }
/** Constructor */ ChatMsgItem::ChatMsgItem(FeedHolder *parent, uint32_t feedId, std::string peerId, std::string message, bool isHome) :QWidget(NULL), mParent(parent), mFeedId(feedId), mPeerId(peerId), mIsHome(isHome) { /* Invoke the Qt Designer generated object setup routine */ setupUi(this); messageframe->setVisible(false); sendButton->hide(); cancelButton->hide(); sendButton->setEnabled(false); /* general ones */ connect( clearButton, SIGNAL( clicked( void ) ), this, SLOT( removeItem ( void ) ) ); /* specific ones */ connect( chatButton, SIGNAL( clicked( void ) ), this, SLOT( openChat ( void ) ) ); connect( msgButton, SIGNAL( clicked( void ) ), this, SLOT( sendMsg ( void ) ) ); connect( quickmsgButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) ); connect( cancelButton, SIGNAL( clicked( ) ), this, SLOT( togglequickmessage() ) ); connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMessage() ) ); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&))); updateItemStatic(); updateItem(); updateAvatar(QString::fromStdString(mPeerId)); insertChat(message); }
void AccountView::updateAccountInfoDisplay() { if (seafApplet->accountManager()->hasAccount()) { const Account account = seafApplet->accountManager()->currentAccount(); if (!account.accountInfo.name.isEmpty()) { mEmail->setText(account.accountInfo.name); } else { mEmail->setText(account.username); } // mServerAddr->setOpenExternalLinks(true); mServerAddr->setToolTip(tr("click to open the website")); QString host = account.serverUrl.host(); QString href = account.serverUrl.toString(); QString text = QString("<a style=" "\"color:#A4A4A4; text-decoration: none;\" " "href=\"%1\">%2</a>").arg(href).arg(host); mServerAddr->setText(account.isPro() ? QString("%1 <small>%2<small>").arg(text).arg(tr("pro version")) : text); } else { mEmail->setText(tr("No account")); mServerAddr->setText(QString()); } updateAvatar(); }
void OverlayEditorScene::resync() { QRadialGradient gradient(0, 0, 10 * uiZoom); gradient.setSpread(QGradient::ReflectSpread); gradient.setColorAt(0.0f, QColor(255, 255, 255, 64)); gradient.setColorAt(0.2f, QColor(0, 0, 0, 64)); gradient.setColorAt(0.4f, QColor(255, 128, 0, 64)); gradient.setColorAt(0.6f, QColor(0, 0, 0, 64)); gradient.setColorAt(0.8f, QColor(0, 128, 255, 64)); gradient.setColorAt(1.0f, QColor(0, 0, 0, 64)); setBackgroundBrush(gradient); updateMuted(); updateUserName(); updateChannel(); updateAvatar(); moveMuted(); moveUserName(); moveChannel(); moveAvatar(); moveBox(); qgiGroup->setOpacity(os.fUser[tsColor]); qgpiSelected = NULL; qgriSelected->setVisible(false); }
void OverlayEditorScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { QGraphicsScene::mouseReleaseEvent(e); if (e->isAccepted()) return; if (e->button() == Qt::LeftButton) { e->accept(); QRectF rect = qgriSelected->rect(); if (! qgpiSelected || (rect == selectedRect())) { return; } QRectF scaled(rect.x() / (uiSize * uiZoom), rect.y() / (uiSize * uiZoom), rect.width() / (uiSize * uiZoom), rect.height() / (uiSize * uiZoom)); if (qgpiSelected == qgpiMuted) { os.qrfMutedDeafened = scaled; updateMuted(); } else if (qgpiSelected == qgpiAvatar) { os.qrfAvatar = scaled; updateAvatar(); } else if (qgpiSelected == qgpiChannel) { os.qrfChannel = scaled; updateChannel(); } else if (qgpiSelected == qgpiName) { os.qrfUserName = scaled; updateUserName(); } moveBox(); } }
void MainWindow::whenAvatarReceived(const QString &contact, const QByteArray &data, const QString &mimeType) { qDebug() << Q_FUNC_INFO << mimeType; #ifdef CREATE_MEDIA_FILES QDir dir; dir.mkdir("avatars"); QFile avatarFile(QString("avatars/%1.jpg").arg(contact)); avatarFile.open(QIODevice::WriteOnly); avatarFile.write(data); avatarFile.close(); #endif QPixmap avatar = QPixmap::fromImage(QImage::fromData(data)); if (avatar.isNull()) { return; } avatar = avatar.scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmapCache::insert(m_core->contactAvatarToken(contact), avatar); updateAvatar(contact); }
void AvatarButton::setThumbnailMode(bool thumbnailMode) { if (this->thumbnailMode == thumbnailMode) return; this->thumbnailMode = thumbnailMode; setIconSize(getIconSizeHint()); updateAvatar(); }
void AvatarButton::updateCache() { TimeMeasure t("AvatarButton::updateCache()"); QPixmap picture = getSourcePicture(false); avatarCache = paintRoundBorder(picture, false, mouseIsHovered); QPixmap pictureThumbnail = getSourcePicture(true); avatarThumbnailCache = paintRoundBorder(pictureThumbnail, true, mouseIsHovered); updateAvatar(); }
void buddyPicture::saveAvatar(quint16 length) { quint8 uinLength = convertToInt8(buffer->read(1)); length -= 1; QString uin = QString::fromUtf8(buffer->read(uinLength)); length -= uinLength; buffer->read(4); length -= 4; QByteArray hash = buffer->read(16); length -= 16; buffer->read(21); length -= 21; quint16 iconLength = convertToInt16(buffer->read(2)); length -= 2; if ( iconLength ) { QSettings settings(QSettings::NativeFormat, QSettings::UserScope, "qutim/qutim."+m_profile_name+"/ICQ."+m_mine_uin, "contactlist"); settings.beginGroup(uin); settings.setValue("iconhash", hash.toHex()); settings.endGroup(); QString iconPath = settings.fileName().section('/', 0, -3) + "/icqicons"; QDir iconDir(iconPath); if ( !iconDir.exists() ) iconDir.mkpath(iconPath); QFile iconFile(iconPath + "/" + hash.toHex()); if ( iconFile.open(QIODevice::WriteOnly) ) { iconFile.write(buffer->read(iconLength)); } emit updateAvatar(uin, hash); } length -= iconLength; if ( length ) buffer->read(length); }
void VRosterPrivate::checkPhoto(QObject *obj, const QString &photoUrl) { if (photoUrl.contains(QLatin1String("question"))) { setObjectAvatar(obj, QString()); return; } QString currentAvatar = obj->property("avatarUrl").toString(); QString newAvatar = photoUrl; qDebug() << currentAvatar << newAvatar; if (currentAvatar != newAvatar || obj->property("avatar").toString().isEmpty()) { obj->setProperty("avatarUrl", newAvatar); if (fetchAvatars && !avatarsQueue.contains(obj)) { if (avatarsQueue.isEmpty()) QTimer::singleShot(0, this, SLOT(updateAvatar())); avatarsQueue.append(obj); } } }
void AvatarWidget::setId(const std::string &id, bool isGpg) { mId = id; mFlag.isGpg = isGpg; if (mId == rsPeers->getOwnId()) { mFlag.isOwnId = true; setToolTip(tr("Click to change your avatar")); } setPixmap(QPixmap()); if (mId.empty()) { setEnabled(false); } refreshStatus(); updateAvatar(QString::fromStdString(mId)); }
void AvatarWidget::setFrameType(FrameType type) { mFrameType = type; switch (mFrameType) { case NO_FRAME: disconnect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int))); break; case NORMAL_FRAME: disconnect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int))); break; case STATUS_FRAME: connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateStatus(const QString&, int))); break; } refreshStatus(); updateAvatar(QString::fromStdString(mId)); Rshare::refreshStyleSheet(this, false); }
/** Default constructor */ PopupChatDialog::PopupChatDialog(const std::string &id, const QString &name, QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags), dialogId(id), dialogName(name), lastChatTime(0), lastChatName("") { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); newMessages = false; typing = false; m_manualDelete = false; peerStatus = 0; last_status_send_time = 0 ; chatStyle.setStyleFromSettings(ChatStyle::TYPE_PRIVATE); /* Hide or show the frames */ showAvatarFrame(PeerSettings->getShowAvatarFrame(dialogId)); ui.infoframe->setVisible(false); ui.statusmessagelabel->hide(); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont())); connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui.actionSave_Chat_History, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui.actionClearOfflineMessages, SIGNAL(triggered()), this, SLOT(clearOfflineMessages())); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(const QString&, int)), this, SLOT(updateStatus(const QString&, int))); connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&))); connect(ui.chattextEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint))); // Create the status bar resetStatusBar(); ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png"))); ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png"))); ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png"))); ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png"))); ui.emoteiconButton->setIcon(QIcon(QString(":/images/emoticons/kopete/kopete020.png"))); ui.textboldButton->setCheckable(true); ui.textunderlineButton->setCheckable(true); ui.textitalicButton->setCheckable(true); setAcceptDrops(true); ui.chattextEdit->setAcceptDrops(false); QMenu * toolmenu = new QMenu(); toolmenu->addAction(ui.actionClear_Chat_History); toolmenu->addAction(ui.actionDelete_Chat_History); toolmenu->addAction(ui.actionSave_Chat_History); toolmenu->addAction(ui.actionClearOfflineMessages); toolmenu->addAction(ui.actionMessageHistory); //toolmenu->addAction(ui.action_Disable_Emoticons); ui.pushtoolsButton->setMenu(toolmenu); mCurrentColor.setNamedColor(PeerSettings->getPrivateChatColor(dialogId)); mCurrentFont.fromString(PeerSettings->getPrivateChatFont(dialogId)); colorChanged(mCurrentColor); fontChanged(mCurrentFont); updateAvatar() ; updatePeerAvatar(id) ; // load settings processSettings(true); // load style PeerSettings->getStyle(dialogId, "PopupChatDialog", style); // initialize first status StatusInfo peerStatusInfo; // No check of return value. Non existing status info is handled as offline. rsStatus->getStatus(dialogId, peerStatusInfo); updateStatus(QString::fromStdString(dialogId), peerStatusInfo.status); StatusInfo ownStatusInfo; if (rsStatus->getOwnStatus(ownStatusInfo)) { updateStatus(QString::fromStdString(ownStatusInfo.id), ownStatusInfo.status); } // initialize first custom state string QString customStateString = QString::fromUtf8(rsMsgs->getCustomStateString(dialogId).c_str()); updatePeersCustomStateString(QString::fromStdString(dialogId), customStateString); if (Settings->valueFromGroup("Chat", QString::fromUtf8("PrivateChat_History"), true).toBool()) { historyKeeper.init(QString::fromStdString(RsInit::RsProfileConfigDirectory()) + "/chat_" + QString::fromStdString(dialogId) + ".xml"); // get offline chat messages std::list<ChatInfo> offlineChat; std::list<ChatInfo>::iterator offineChatIt; rsMsgs->getPrivateChatQueueCount(false) && rsMsgs->getPrivateChatQueue(false, dialogId, offlineChat); QList<IMHistoryItem> historyItems; int messageCount = Settings->getPrivateChatHistoryCount(); if (messageCount > 0) { historyKeeper.getMessages(historyItems, messageCount); } foreach(IMHistoryItem item, historyItems) { for(offineChatIt = offlineChat.begin(); offineChatIt != offlineChat.end(); offineChatIt++) { /* are they public? */ if ((offineChatIt->chatflags & RS_CHAT_PRIVATE) == 0) { /* this should not happen */ continue; } QDateTime sendTime = QDateTime::fromTime_t(offineChatIt->sendTime); QString message = QString::fromStdWString(offineChatIt->msg); if (IMHistoryKeeper::compareItem(item, false, offineChatIt->rsid, sendTime, message)) { // don't show offline message out of the history break; } } if (offineChatIt == offlineChat.end()) { addChatMsg(item.incoming, item.id, item.name, item.sendTime, item.recvTime, item.messageText, TYPE_HISTORY, false); } } }
void UnitsGroup::addButton( UnitButton*b ){ layOut->addWidget( b, buttons.size()/10, buttons.size()%10 ); buttons.push_back(b); updateAvatar(); }
/** Default constructor */ PopupChatDialog::PopupChatDialog(std::string id, std::string name, QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags), dialogId(id), dialogName(name), lastChatTime(0), lastChatName("") { /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); RshareSettings config; config.loadWidgetInformation(this); loadEmoticons(); last_status_send_time = 0 ; styleHtm = ":/qss/chat/default.htm"; /* Hide Avatar frame */ showAvatarFrame(false); connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool))); connect(ui.actionAvatar, SIGNAL(triggered()),this, SLOT(getAvatar())); connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) )); connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) )); connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile())); connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.textitalicButton, SIGNAL(clicked()), this, SLOT(setFont())); connect(ui.fontButton, SIGNAL(clicked()), this, SLOT(getFont())); connect(ui.colorButton, SIGNAL(clicked()), this, SLOT(setColor())); connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); connect(ui.styleButton, SIGNAL(clicked()), SLOT(changeStyle())); connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &))); // Create the status bar resetStatusBar() ; ui.textBrowser->setOpenExternalLinks ( false ); ui.textBrowser->setOpenLinks ( false ); QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ; setWindowTitle(title); //set the default avatar //ui.avatarlabel->setPixmap(QPixmap(":/images/retrosharelogo1.png")); setWindowIcon(QIcon(QString(":/images/rstray3.png"))); ui.textboldButton->setIcon(QIcon(QString(":/images/edit-bold.png"))); ui.textunderlineButton->setIcon(QIcon(QString(":/images/edit-underline.png"))); ui.textitalicButton->setIcon(QIcon(QString(":/images/edit-italic.png"))); ui.fontButton->setIcon(QIcon(QString(":/images/fonts.png"))); ui.emoteiconButton->setIcon(QIcon(QString(":/images/emoticons/kopete/kopete020.png"))); ui.styleButton->setIcon(QIcon(QString(":/images/looknfeel.png"))); ui.textboldButton->setCheckable(true); ui.textunderlineButton->setCheckable(true); ui.textitalicButton->setCheckable(true); setAcceptDrops(true); ui.chattextEdit->setAcceptDrops(false); /*Disabled style Button when will switch chat style RetroShare will crash need to be fix */ //ui.styleButton->setEnabled(false); /*QMenu * fontmenu = new QMenu(); fontmenu->addAction(ui.actionBold); fontmenu->addAction(ui.actionUnderline); fontmenu->addAction(ui.actionItalic); fontmenu->addAction(ui.actionStrike); ui.fontButton->setMenu(fontmenu);*/ mCurrentColor = Qt::black; mCurrentFont = QFont("Comic Sans MS", 10); colorChanged(mCurrentColor); setFont(); updateAvatar() ; updatePeerAvatar(id) ; }
void ChatDlg::updateAvatar(const Jid& j) { if (j.compare(jid(), false)) updateAvatar(); }
void AvatarWidget::setDefaultAvatar(const QString &avatar) { defaultAvatar = avatar; updateAvatar(QString::fromStdString(mId)); }
void AvatarWidget::updateOwnAvatar() { if (mFlag.isOwnId) { updateAvatar(QString::fromStdString(mId)); } }
/** 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 }