From 123041a684b2fb83d6276f03b023e2a48da588db Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 10 Apr 2016 18:55:05 -0400 Subject: [PATCH 1/8] skip circle vetting when sending message posts with no author --- libretroshare/src/gxs/rsgxsnetservice.cc | 108 ++++++++++------------- 1 file changed, 46 insertions(+), 62 deletions(-) diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index 5947efee0..617b2d593 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -4570,92 +4570,76 @@ void RsGxsNetService::locked_pushMsgRespFromList(std::list& itemL, c bool RsGxsNetService::canSendMsgIds(std::vector& msgMetas, const RsGxsGrpMetaData& grpMeta, const RsPeerId& sslId,RsGxsCircleId& should_encrypt_id) { #ifdef NXS_NET_DEBUG_4 - GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendMsgIds() CIRCLE VETTING" << std::endl; + GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << "RsGxsNetService::canSendMsgIds() CIRCLE VETTING" << std::endl; #endif - // first do the simple checks - uint8_t circleType = grpMeta.mCircleType; + // first do the simple checks + uint8_t circleType = grpMeta.mCircleType; - if(circleType == GXS_CIRCLE_TYPE_LOCAL) - { + if(circleType == GXS_CIRCLE_TYPE_LOCAL) + { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: LOCAL => returning false" << std::endl; #endif return false; - } + } - if(circleType == GXS_CIRCLE_TYPE_PUBLIC) - { + if(circleType == GXS_CIRCLE_TYPE_PUBLIC) + { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: PUBLIC => returning true" << std::endl; #endif return true; - } + } - const RsGxsCircleId& circleId = grpMeta.mCircleId; + const RsGxsCircleId& circleId = grpMeta.mCircleId; - if(circleType == GXS_CIRCLE_TYPE_EXTERNAL) - { + if(circleType == GXS_CIRCLE_TYPE_EXTERNAL) + { #ifdef NXS_NET_DEBUG_4 GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: EXTERNAL => returning true. Msgs ids list will be encrypted." << std::endl; #endif should_encrypt_id = circleId ; - - // For each message ID, check that the author is in the circle. If not, do not send the message, which means, remove it from the list. - - if(mCircles->isLoaded(circleId)) - { - for(uint32_t i=0;iisRecipient(circleId, msgMetas[i]->mAuthorId)) - { + + // For each message ID, check that the author is in the circle. If not, do not send the message, which means, remove it from the list. + // Unsigned messages are still transmitted. This is because in some groups (channels) the posts are not signed. Whether an unsigned post + // is allowed at this point is anyway already vetted by the RsGxsGenExchange service. + + // Messages that stay in the list will be sent. As a consequence true is always returned. + // Messages put in vetting list will be dealt with later + + std::vector toVet; + + for(uint32_t i=0;imAuthorId.isNull() ) // keep the message in this case + ++i ; + else + { + if(mCircles->isLoaded(circleId) && mCircles->isRecipient(circleId, msgMetas[i]->mAuthorId)) + { + ++i ; + continue ; + } + + MsgIdCircleVet mic(msgMetas[i]->mMsgId, msgMetas[i]->mAuthorId); + toVet.push_back(mic); #ifdef NXS_NET_DEBUG_4 - GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " deleting MsgMeta entry for msg ID " << msgMetas[i]->mMsgId << " signed by " << msgMetas[i]->mAuthorId << " who is not in group circle " << circleId << std::endl; + GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " deleting MsgMeta entry for msg ID " << msgMetas[i]->mMsgId << " signed by " << msgMetas[i]->mAuthorId << " who is not in group circle " << circleId << std::endl; #endif - delete msgMetas[i] ; - msgMetas[i] = msgMetas[msgMetas.size()-1] ; - msgMetas.pop_back() ; - } - else - ++i ; - - return true ; - } - -#ifdef TO_BE_REMOVED_OLD_VETTING_FOR_EXTERNAL_CIRCLES -#ifdef NXS_NET_DEBUG_4 - GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle type: EXTERNAL. Circle Id: " << circleId << std::endl; -#endif - if(mCircles->isLoaded(circleId)) - { - const RsPgpId& pgpId = mPgpUtils->getPGPId(sslId); - bool res = mCircles->canSend(circleId, pgpId); -#ifdef NXS_NET_DEBUG_4 - GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Answer from circle::canSend(): " << res << std::endl; -#endif - return res ; - } -#endif + delete msgMetas[i] ; + msgMetas[i] = msgMetas[msgMetas.size()-1] ; + msgMetas.pop_back() ; + } #ifdef NXS_NET_DEBUG_4 - GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle info not loaded. Putting in vetting list and returning false." << std::endl; + GXSNETDEBUG_PG(sslId,grpMeta.mGroupId) << " Circle info not loaded. Putting in vetting list and returning false." << std::endl; #endif - std::vector toVet; - std::vector::const_iterator vit = msgMetas.begin(); + if(!toVet.empty()) + mPendingCircleVets.push_back(new MsgCircleIdsRequestVetting(mCircles, mPgpUtils, toVet, grpMeta.mGroupId, sslId, grpMeta.mCircleId)); - for(; vit != msgMetas.end(); ++vit) - { - const RsGxsMsgMetaData* const& meta = *vit; - - MsgIdCircleVet mic(meta->mMsgId, meta->mAuthorId); - toVet.push_back(mic); - } - - if(!toVet.empty()) - mPendingCircleVets.push_back(new MsgCircleIdsRequestVetting(mCircles, mPgpUtils, toVet, grpMeta.mGroupId, sslId, grpMeta.mCircleId)); - - return false; - } + return true ; + } if(circleType == GXS_CIRCLE_TYPE_YOUREYESONLY) { @@ -4721,7 +4705,7 @@ bool RsGxsNetService::canSendMsgIds(std::vector& msgMetas, co } } - return true; + return false; } /** inherited methods **/ From c5873f32166e9bf193c1eb8dd7c2e5c977f11aaa Mon Sep 17 00:00:00 2001 From: Phenom Date: Sun, 10 Apr 2016 16:42:15 +0200 Subject: [PATCH 2/8] Move Chat notify button from search bar to tool bar. As search bar is hidden by default. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 28 +++--- retroshare-gui/src/gui/chat/ChatWidget.ui | 108 ++++++++++----------- 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 5874e8243..ea6469052 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -218,7 +218,7 @@ void ChatWidget::setDefaultExtraFileFlags(TransferRequestFlags fl) void ChatWidget::addChatHorizontalWidget(QWidget *w) { - ui->vl_Plugins->addWidget(w) ; + ui->pluginsVLayout->addWidget(w) ; update() ; } @@ -234,8 +234,8 @@ void ChatWidget::addTitleBarWidget(QWidget *w) void ChatWidget::hideChatText(bool hidden) { - ui->frame_ChatText->setHidden(hidden); ; - ui->searchframe->setVisible(ui->actionSearch_History->isChecked() && !hidden); ; + ui->chatTextFrame->setHidden(hidden); ; + ui->searchFrame->setVisible(ui->actionSearch_History->isChecked() && !hidden); ; } RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser() @@ -400,12 +400,12 @@ void ChatWidget::processSettings(bool load) // load settings // state of splitter - ui->chatsplitter->restoreState(Settings->value("ChatSplitter").toByteArray()); + ui->chatVSplitter->restoreState(Settings->value("ChatSplitter").toByteArray()); } else { // save settings // state of splitter - Settings->setValue("ChatSplitter", ui->chatsplitter->saveState()); + Settings->setValue("ChatSplitter", ui->chatVSplitter->saveState()); } Settings->endGroup(); @@ -835,7 +835,7 @@ void ChatWidget::on_notifyButton_clicked() QIcon icoLobby=(ui->notifyButton->icon()); notify->makeSubMenu(menu, icoLobby, title, chatId.toLobbyId()); - menu->exec(ui->notifyButton->mapToGlobal(ui->notifyButton->geometry().bottomLeft())); + menu->exec(ui->notifyButton->mapToGlobal(QPoint(0,ui->notifyButton->geometry().height()))); } @@ -1031,7 +1031,7 @@ void ChatWidget::chatCharFormatChanged() void ChatWidget::resetStatusBar() { ui->typingLabel->clear(); - ui->typingpixmapLabel->clear(); + ui->typingPixmapLabel->clear(); typing = false; @@ -1430,11 +1430,11 @@ void ChatWidget::messageHistory() void ChatWidget::searchHistory() { if(ui->actionSearch_History->isChecked()){ - ui->searchframe->show(); - }else { - ui->searchframe->hide(); - } - + ui->searchFrame->show(); + }else { + ui->searchFrame->hide(); + } + } void ChatWidget::addExtraFile() @@ -1660,8 +1660,8 @@ void ChatWidget::updatePeersCustomStateString(const QString& /*peer_id*/, const void ChatWidget::updateStatusString(const QString &statusMask, const QString &statusString, bool permanent) { - ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toUtf8()))); // displays info for 5 secs. - ui->typingpixmapLabel->setPixmap(QPixmap(":images/typing.png") ); + ui->typingLabel->setText(QString(statusMask).arg(tr(statusString.toUtf8()))); // displays info for 5 secs. + ui->typingPixmapLabel->setPixmap(QPixmap(":images/typing.png") ); if (statusString == "is typing...") { typing = true; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index c2f4e2504..5ccfacae3 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -10,7 +10,7 @@ 323 - + 0 @@ -27,12 +27,12 @@ 2 - + 2 - + 20 @@ -45,7 +45,7 @@ QFrame::Raised - + 0 @@ -130,7 +130,7 @@ QFrame::Box - + 6 @@ -207,7 +207,7 @@ border-image: url(:/images/closepressed.png) - + Qt::Vertical @@ -235,14 +235,14 @@ border-image: url(:/images/closepressed.png) - + 0 - + - + 18 @@ -280,7 +280,7 @@ border-image: url(:/images/closepressed.png) - + Qt::Horizontal @@ -308,7 +308,7 @@ border-image: url(:/images/closepressed.png) 30 - + Type a message here @@ -325,7 +325,7 @@ border-image: url(:/images/closepressed.png) QFrame::Sunken - + 2 @@ -521,7 +521,7 @@ border-image: url(:/images/closepressed.png) QFrame::Plain - + 2 @@ -538,7 +538,39 @@ border-image: url(:/images/closepressed.png) - + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + + :/images/chat_red24.png:/images/chat_red24.png + + + + 24 + 24 + + + + true + + + + + Qt::Horizontal @@ -571,12 +603,12 @@ border-image: url(:/images/closepressed.png) - + - + QLayout::SetMaximumSize @@ -600,7 +632,7 @@ border-image: url(:/images/closepressed.png) QFrame::Sunken - + 2 @@ -670,7 +702,7 @@ border-image: url(:/images/closepressed.png) - + Qt::Horizontal @@ -690,7 +722,7 @@ border-image: url(:/images/closepressed.png) QFrame::Plain - + 2 @@ -707,14 +739,14 @@ border-image: url(:/images/closepressed.png) - + QFrame::StyledPanel QFrame::Raised - + 0 @@ -771,38 +803,6 @@ border-image: url(:/images/closepressed.png) - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - - :/images/chat_red24.png:/images/chat_red24.png - - - - 24 - 24 - - - - true - - - @@ -1099,8 +1099,8 @@ border-image: url(:/images/closepressed.png) - + From 42a2b37abb3063f80a3fad8f61bbf038652c78be Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 13 Apr 2016 19:21:18 +0200 Subject: [PATCH 3/8] Move SearchBar to Tool Bar and remove Show/Hide action. As asked by Cyril in PR#346 --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 17 - retroshare-gui/src/gui/chat/ChatWidget.h | 2 - retroshare-gui/src/gui/chat/ChatWidget.ui | 315 ++++++++---------- retroshare-gui/src/gui/settings/ChatPage.cpp | 2 - .../src/gui/settings/rsharesettings.cpp | 10 - .../src/gui/settings/rsharesettings.h | 3 - 6 files changed, 140 insertions(+), 209 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index ea6469052..2bc545362 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -107,7 +107,6 @@ ChatWidget::ChatWidget(QWidget *parent) : connect(ui->actionMoveToCursor, SIGNAL(triggered()), this, SLOT(toogle_MoveToCursor())); connect(ui->actionSearchWithoutLimit, SIGNAL(triggered()), this, SLOT(toogle_SeachWithoutLimit())); connect(ui->searchButton, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuSearchButton(QPoint))); - connect(ui->actionSearch_History, SIGNAL(triggered()), this, SLOT(searchHistory())); notify=NULL; ui->notifyButton->setVisible(false); @@ -146,9 +145,6 @@ ChatWidget::ChatWidget(QWidget *parent) : ui->infoFrame->setVisible(false); ui->statusMessageLabel->hide(); - ui->actionSearch_History->setChecked(Settings->getChatSearchShowBarByDefault()); - searchHistory(); - setAcceptDrops(true); ui->chatTextEdit->setAcceptDrops(false); ui->hashBox->setDropWidget(this); @@ -165,7 +161,6 @@ ChatWidget::ChatWidget(QWidget *parent) : menu->addAction(ui->actionDeleteChatHistory); menu->addAction(ui->actionSaveChatHistory); menu->addAction(ui->actionMessageHistory); - menu->addAction(ui->actionSearch_History); ui->pushtoolsButton->setMenu(menu); ui->textBrowser->installEventFilter(this); @@ -235,7 +230,6 @@ void ChatWidget::addTitleBarWidget(QWidget *w) void ChatWidget::hideChatText(bool hidden) { ui->chatTextFrame->setHidden(hidden); ; - ui->searchFrame->setVisible(ui->actionSearch_History->isChecked() && !hidden); ; } RSButtonOnText* ChatWidget::getNewButtonOnTextBrowser() @@ -316,7 +310,6 @@ void ChatWidget::init(const ChatId &chat_id, const QString &title) messageCount = Settings->getPublicChatHistoryCount(); ui->titleBarFrame->setVisible(false); - ui->actionSearch_History->setVisible(false); } if (rsHistory->getEnable(hist_chat_type)) @@ -1427,16 +1420,6 @@ void ChatWidget::messageHistory() imBrowser.exec(); } -void ChatWidget::searchHistory() -{ - if(ui->actionSearch_History->isChecked()){ - ui->searchFrame->show(); - }else { - ui->searchFrame->hide(); - } - -} - void ChatWidget::addExtraFile() { QStringList files; diff --git a/retroshare-gui/src/gui/chat/ChatWidget.h b/retroshare-gui/src/gui/chat/ChatWidget.h index 1aa2d9e4a..af4dab505 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.h +++ b/retroshare-gui/src/gui/chat/ChatWidget.h @@ -132,8 +132,6 @@ private slots: void deleteChatHistory(); void messageHistory(); void resetStatusBar() ; - void searchHistory(); - signals: void infoChanged(ChatWidget*); diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index 5ccfacae3..4ac16a057 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -569,6 +569,146 @@ border-image: url(:/images/closepressed.png) + + + + + 0 + 0 + + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + + :/images/highlight.png:/images/highlight.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + + + + 14 + 28 + + + + + 14 + 28 + + + + Qt::NoFocus + + + + :/images/arrow-left.png:/images/arrow-left.png + + + true + + + + + + + + 14 + 28 + + + + + 14 + 28 + + + + Qt::NoFocus + + + + :/images/arrow-right.png:/images/arrow-right.png + + + true + + + + + + + + 0 + 0 + + + + + 28 + 28 + + + + + 28 + 28 + + + + Qt::NoFocus + + + Qt::CustomContextMenu + + + + :/images/find.png:/images/find.png + + + + 24 + 24 + + + + true + + + true + + + @@ -738,170 +878,6 @@ border-image: url(:/images/closepressed.png) - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - Qt::CustomContextMenu - - - - :/images/find.png:/images/find.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - 14 - 28 - - - - - 14 - 28 - - - - Qt::NoFocus - - - - :/images/arrow-right.png:/images/arrow-right.png - - - true - - - - - - - - - - - 14 - 28 - - - - - 14 - 28 - - - - Qt::NoFocus - - - - :/images/arrow-left.png:/images/arrow-left.png - - - true - - - - - - - - 0 - 0 - - - - - 28 - 28 - - - - - 28 - 28 - - - - Qt::NoFocus - - - - :/images/highlight.png:/images/highlight.png - - - - 24 - 24 - - - - true - - - true - - - - - - @@ -1033,17 +1009,6 @@ border-image: url(:/images/closepressed.png) Choose color - - - true - - - Display Search Box - - - Search Box - - Quote diff --git a/retroshare-gui/src/gui/settings/ChatPage.cpp b/retroshare-gui/src/gui/settings/ChatPage.cpp index da7168f7d..3c515be49 100644 --- a/retroshare-gui/src/gui/settings/ChatPage.cpp +++ b/retroshare-gui/src/gui/settings/ChatPage.cpp @@ -130,7 +130,6 @@ ChatPage::save(QString &/*errmsg*/) Settings->setChatSendMessageWithCtrlReturn(ui.sendMessageWithCtrlReturn->isChecked()); - Settings->setChatSearchShowBarByDefault(ui.cbSearch_ShowBar->isChecked()); Settings->setChatSearchCharToStartSearch(ui.sbSearch_CharToStart->value()); Settings->setChatSearchCaseSensitively(ui.cbSearch_CaseSensitively->isChecked()); Settings->setChatSearchWholeWords(ui.cbSearch_WholeWords->isChecked()); @@ -238,7 +237,6 @@ ChatPage::load() ui.sendMessageWithCtrlReturn->setChecked(Settings->getChatSendMessageWithCtrlReturn()); - ui.cbSearch_ShowBar->setChecked(Settings->getChatSearchShowBarByDefault()); ui.sbSearch_CharToStart->setValue(Settings->getChatSearchCharToStartSearch()); ui.cbSearch_CaseSensitively->setChecked(Settings->getChatSearchCaseSensitively()); ui.cbSearch_WholeWords->setChecked(Settings->getChatSearchWholeWords()); diff --git a/retroshare-gui/src/gui/settings/rsharesettings.cpp b/retroshare-gui/src/gui/settings/rsharesettings.cpp index 0dfc713f9..8c7220186 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.cpp +++ b/retroshare-gui/src/gui/settings/rsharesettings.cpp @@ -512,16 +512,6 @@ void RshareSettings::setChatSendMessageWithCtrlReturn(bool bValue) setValueToGroup("Chat", "SendMessageWithCtrlReturn", bValue); } -bool RshareSettings::getChatSearchShowBarByDefault() -{ - return valueFromGroup("Chat", "SearchShowBarByDefault", false).toBool(); -} - -void RshareSettings::setChatSearchShowBarByDefault(bool bValue) -{ - setValueToGroup("Chat", "SearchShowBarByDefault", bValue); -} - void RshareSettings::setChatSearchCharToStartSearch(int iValue) { setValueToGroup("Chat", "SearchCharToStartSearch", iValue); diff --git a/retroshare-gui/src/gui/settings/rsharesettings.h b/retroshare-gui/src/gui/settings/rsharesettings.h index 52963ce92..2f344b3a9 100644 --- a/retroshare-gui/src/gui/settings/rsharesettings.h +++ b/retroshare-gui/src/gui/settings/rsharesettings.h @@ -209,9 +209,6 @@ public: bool getChatSendMessageWithCtrlReturn(); void setChatSendMessageWithCtrlReturn(bool bValue); - bool getChatSearchShowBarByDefault(); - void setChatSearchShowBarByDefault(bool bValue); - void setChatSearchCharToStartSearch(int iValue); int getChatSearchCharToStartSearch(); From 718d6f9b19bcafcd0949f8291ef9ba8f71c12253 Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 13 Apr 2016 20:26:36 +0200 Subject: [PATCH 4/8] Resize Chat Tool Bar Button for Hight DPI screen. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 43 +++++++++++++++++++--- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index 2bc545362..c2052365d 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -62,6 +62,8 @@ #include +#define FMM 2//fontMetricsMultiplicator + /***** * #define CHAT_DEBUG 1 *****/ @@ -71,6 +73,10 @@ ChatWidget::ChatWidget(QWidget *parent) : { ui->setupUi(this); + int iconHeight = FMM*QFontMetricsF(font()).height() ; + QSize iconSize = QSize(iconHeight,iconHeight); + QSize buttonSize = QSize(iconSize + QSize(FMM,FMM)); + newMessages = false; typing = false; peerStatus = 0; @@ -82,6 +88,29 @@ ChatWidget::ChatWidget(QWidget *parent) : lastStatusSendTime = 0 ; + //Resize Tool buttons + ui->emoteiconButton->setFixedSize(buttonSize); + ui->emoteiconButton->setIconSize(iconSize); + ui->fontButton->setFixedSize(buttonSize); + ui->fontButton->setIconSize(iconSize); + ui->attachPictureButton->setFixedSize(buttonSize); + ui->attachPictureButton->setIconSize(iconSize); + ui->addFileButton->setFixedSize(buttonSize); + ui->addFileButton->setIconSize(iconSize); + ui->pushtoolsButton->setFixedSize(buttonSize); + ui->pushtoolsButton->setIconSize(iconSize); + ui->notifyButton->setFixedSize(buttonSize); + ui->notifyButton->setIconSize(iconSize); + ui->markButton->setFixedSize(buttonSize); + ui->markButton->setIconSize(iconSize); + ui->leSearch->setFixedHeight(iconHeight); + ui->searchBefore->setFixedHeight(iconHeight); + ui->searchAfter->setFixedHeight(iconHeight); + ui->searchButton->setFixedSize(buttonSize); + ui->searchButton->setIconSize(iconSize); + ui->sendButton->setFixedHeight(iconHeight); + + //Initialize search iCharToStartSearch=Settings->getChatSearchCharToStartSearch(); bFindCaseSensitively=Settings->getChatSearchCaseSensitively(); bFindWholeWords=Settings->getChatSearchWholeWords(); @@ -90,7 +119,6 @@ ChatWidget::ChatWidget(QWidget *parent) : uiMaxSearchLimitColor=Settings->getChatSearchMaxSearchLimitColor(); cFoundColor=Settings->getChatSearchFoundColor(); - ui->actionSearchWithoutLimit->setText(tr("Don't stop to color after")+" "+QString::number(uiMaxSearchLimitColor)+" "+tr("items found (need more CPU)")); ui->leSearch->setVisible(false); @@ -102,6 +130,7 @@ ChatWidget::ChatWidget(QWidget *parent) : ui->searchButton->setChecked(false); ui->searchButton->setToolTip(tr("Find
Ctrl+F")); ui->leSearch->installEventFilter(this); + connect(ui->actionFindCaseSensitively, SIGNAL(triggered()), this, SLOT(toogle_FindCaseSensitively())); connect(ui->actionFindWholeWords, SIGNAL(triggered()), this, SLOT(toogle_FindWholeWords())); connect(ui->actionMoveToCursor, SIGNAL(triggered()), this, SLOT(toogle_MoveToCursor())); @@ -113,11 +142,11 @@ ChatWidget::ChatWidget(QWidget *parent) : ui->markButton->setToolTip(tr("Mark this selected text
Ctrl+M")); - connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat())); - connect(ui->addFileButton, SIGNAL(clicked()), this , SLOT(addExtraFile())); - - connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); connect(ui->emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget())); + connect(ui->attachPictureButton, SIGNAL(clicked()), this, SLOT(addExtraPicture())); + connect(ui->addFileButton, SIGNAL(clicked()), this , SLOT(addExtraFile())); + connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendChat())); + connect(ui->actionSaveChatHistory, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui->actionClearChatHistory, SIGNAL(triggered()), this, SLOT(clearChatHistory())); connect(ui->actionDeleteChatHistory, SIGNAL(triggered()), this, SLOT(deleteChatHistory())); @@ -219,6 +248,10 @@ void ChatWidget::addChatHorizontalWidget(QWidget *w) void ChatWidget::addChatBarWidget(QWidget *w) { + int iconHeight = FMM*QFontMetricsF(font()).height() ; + QSize iconSize = QSize(iconHeight,iconHeight); + QSize buttonSize = QSize(iconSize + QSize(FMM,FMM)); + w->setFixedSize(buttonSize); ui->pluginButtonFrame->layout()->addWidget(w) ; } From 45f77def2baf30f567cf233c0dc6bda60d2c451b Mon Sep 17 00:00:00 2001 From: Phenom Date: Wed, 13 Apr 2016 20:42:12 +0200 Subject: [PATCH 5/8] Change Lobby Send button tooltip. --- retroshare-gui/src/gui/chat/ChatWidget.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/chat/ChatWidget.cpp b/retroshare-gui/src/gui/chat/ChatWidget.cpp index c2052365d..d3613a3c5 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.cpp +++ b/retroshare-gui/src/gui/chat/ChatWidget.cpp @@ -1102,15 +1102,21 @@ void ChatWidget::updateLenOfChatTextEdit() break; } - bool msgToLarge = false; + int charRemains = 0; if (maxMessageSize > 0) { - msgToLarge = (msg.length() >= maxMessageSize); + charRemains = maxMessageSize - msg.length(); } - ui->sendButton->setEnabled(!msgToLarge); - text = tr("%1This message consists of %2 characters.").arg(msgToLarge ? tr("Warning:")+" " : "").arg(msg.length()); + ui->sendButton->setEnabled(charRemains>=0); + if (charRemains>0) + text = tr("It remains %1 characters\nafter HTML conversion.").arg(charRemains); + else if(charRemains<0) + text = tr("Warning: This message is too big of %1 characters\nafter HTML conversion.").arg((0-charRemains)); + else + text = ""; + ui->sendButton->setToolTip(text); - ui->chatTextEdit->setToolTip(msgToLarge?text:""); + ui->chatTextEdit->setToolTip(text); } void ChatWidget::sendChat() From 971f8e0c1271bbdca498c9f615719ec538437566 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 13 Apr 2016 18:41:49 -0400 Subject: [PATCH 6/8] fixed potential crash due to not updating mPendingDataIterator after deleting map entry --- retroshare-gui/src/gui/gxs/GxsIdDetails.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp index 8fa66df62..7458e0406 100644 --- a/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp +++ b/retroshare-gui/src/gui/gxs/GxsIdDetails.cpp @@ -262,7 +262,11 @@ bool GxsIdDetails::process(const RsGxsId &id, GxsIdDetailsCallbackFunction callb if(it != mInstance->mPendingData.end()) { mInstance->connectObject_locked(object, false); - mInstance->mPendingData.erase(it) ; + + if(mInstance->mPendingDataIterator == it) + mInstance->mPendingDataIterator = mInstance->mPendingData.erase(it) ; + else + mInstance->mPendingData.erase(it) ; } /* Connect signal "destroy" */ From ba1a1b2a61c842cdf7416fe69a218b331d86abdb Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 14 Apr 2016 23:09:59 -0400 Subject: [PATCH 7/8] fixed auto-subscribed of circles when some IDs are unknown --- libretroshare/src/services/p3gxscircles.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 460cdbaab..17cf3efd9 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -37,6 +37,7 @@ /**** * #define DEBUG_CIRCLES 1 ****/ +#define DEBUG_CIRCLES 1 RsGxsCircles *rsGxsCircles = NULL; @@ -119,9 +120,8 @@ p3GxsCircles::p3GxsCircles(RsGeneralDataService *gds, RsNetworkExchangeService * RsTickEvent::schedule_now(CIRCLE_EVENT_LOADIDS); // Dummy Circles. -// RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD); - mDummyIdToken = 0; - + // RsTickEvent::schedule_in(CIRCLE_EVENT_DUMMYSTART, CIRCLE_DUMMY_STARTPERIOD); + mDummyIdToken = 0; } @@ -1114,12 +1114,12 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token) isUnprocessedPeers = false; } - + // we can check for self inclusion in the circle right away, since own ids are always loaded. + // that allows to subscribe/unsubscribe uncomplete circles + checkCircleCacheForAutoSubscribe(cache); if (isComplete) { - checkCircleCacheForAutoSubscribe(cache); - /* move straight into the cache */ mCircleCache.store(id, cache); mCircleCache.resize(); @@ -1266,8 +1266,11 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId) /* We need to AutoSubscribe if the Circle is relevent to us */ + bool p3GxsCircles::checkCircleCacheForAutoSubscribe(RsGxsCircleCache &cache) { +#warning we should also check for items in mLoadingCache in this method. + #ifdef DEBUG_CIRCLES std::cerr << "p3GxsCircles::checkCircleCacheForAutoSubscribe() : "<< cache.mCircleId << std::endl; #endif From 048192ee9c13821eaaff07c9272c4da312e27a1c Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 14 Apr 2016 23:47:42 -0400 Subject: [PATCH 8/8] added mOriginator to CircleCache entry and auto-ask for unknown GXS ids to the friend who supplied the circle group --- libretroshare/src/gxs/rsgenexchange.cc | 4 ++-- libretroshare/src/services/p3gxscircles.cc | 4 +++- libretroshare/src/services/p3gxscircles.h | 2 ++ retroshare-gui/src/gui/Identity/IdDialog.cpp | 12 ++---------- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index c1e2dd116..468792b18 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -2840,8 +2840,8 @@ void RsGenExchange::processRecvdGroups() // now check if group already existss if(std::find(existingGrpIds.begin(), existingGrpIds.end(), grp->grpId) == existingGrpIds.end()) { - if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY) - meta->mOriginator = grp->PeerId(); + //if(meta->mCircleType == GXS_CIRCLE_TYPE_YOUREYESONLY) + meta->mOriginator = grp->PeerId(); meta->mSubscribeFlags = GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED; diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 17cf3efd9..d70e4cd3e 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -37,7 +37,6 @@ /**** * #define DEBUG_CIRCLES 1 ****/ -#define DEBUG_CIRCLES 1 RsGxsCircles *rsGxsCircles = NULL; @@ -978,6 +977,7 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token) RsGxsCircleCache &cache = it->second; cache.loadBaseCircle(group); + cache.mOriginator = item->meta.mOriginator ; delete item; @@ -1043,6 +1043,8 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token) #endif std::list peers; + peers.push_back(cache.mOriginator) ; + mIdentities->requestKey(*pit, peers); /* store in to_process queue. */ diff --git a/libretroshare/src/services/p3gxscircles.h b/libretroshare/src/services/p3gxscircles.h index 2ad9934b6..f17f7dc12 100644 --- a/libretroshare/src/services/p3gxscircles.h +++ b/libretroshare/src/services/p3gxscircles.h @@ -156,6 +156,8 @@ class RsGxsCircleCache std::set mAllowedAnonPeers; std::map > mAllowedSignedPeers; + + RsPeerId mOriginator ; // peer who sent the data, in case we need to ask for ids }; diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 22c8571e5..bcf87ef8b 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -882,9 +882,6 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, item->setToolTip(RSID_COL_IDTYPE, tooltip) ; } -#ifdef ID_DEBUG - std::cerr << "Setting item image : " << pixmap.width() << " x " << pixmap.height() << std::endl; -#endif QPixmap pixmap ; if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG")) @@ -1119,7 +1116,7 @@ void IdDialog::insertIdDetails(uint32_t token) pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ; #ifdef ID_DEBUG - std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl; + std::cerr << "Setting header frame image : " << pixmap.width() << " x " << pixmap.height() << std::endl; #endif ui->avlabel->setPixmap(pixmap); @@ -1263,7 +1260,7 @@ void IdDialog::modifyReputation() rsReputations->setOwnOpinion(id,op) ; #ifdef ID_DEBUG - std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << mod; + std::cerr << "IdDialog::modifyReputation() ID: " << id << " Mod: " << op; std::cerr << std::endl; #endif @@ -1281,11 +1278,6 @@ void IdDialog::modifyReputation() } #endif -#ifdef ID_DEBUG - std::cerr << "IdDialog::modifyReputation() queuingRequest(), token: " << token; - std::cerr << std::endl; -#endif - // trigger refresh when finished. // basic / anstype are not needed. requestIdDetails();