From 47d89a69594b76a61dcb1674e07b9e37a2520958 Mon Sep 17 00:00:00 2001 From: RetroPooh Date: Mon, 22 Feb 2021 21:43:42 +0300 Subject: [PATCH 01/88] keyring - make accepted keys removing correct; allow multi-select --- retroshare-gui/src/gui/NetworkDialog.cpp | 44 ++++++++++++++---------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 1b02cbc7c..539e103fd 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -83,7 +83,7 @@ NetworkDialog::NetworkDialog(QWidget */*parent*/) ui.connectTreeWidget->setUpdatesEnabled(true); ui.connectTreeWidget->setSortingEnabled(true); ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); + ui.connectTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) ); connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails())); @@ -117,24 +117,11 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) { return; } - QMenu *contextMnu = new QMenu; - - RsPgpId peer_id(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()) ; - - // That's what context menus are made for - RsPeerDetails detail; - if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail. - return ; - - if(peer_id == rsPeers->getGPGOwnId()) - contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated())); - contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails())); contextMnu->addSeparator() ; contextMnu->addAction(QIcon(), tr("Remove unused keys..."), this, SLOT(removeUnusedKeys())); contextMnu->addAction(QIcon(), tr("Remove this key"), this, SLOT(removeSelectedKeys())); - contextMnu->exec(QCursor::pos()); } @@ -177,11 +164,32 @@ void NetworkDialog::removeSelectedKeys() QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes(); if(l.empty()) return; - std::set selected; - selected.insert(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString())); - - removeKeys(selected); + std::set friends; + for (int i = 0; i < l.size(); i++) + { + RsPgpId peer_id = RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l[i].row(), COLUMN_PEERID)).toString().toStdString()); + RsPeerDetails details ; + if(rsPeers->getGPGDetails(peer_id,details)) + { + if(details.accept_connection) + friends.insert(peer_id); + else + selected.insert(peer_id); + } + } + if(!friends.empty()) + { + if ((QMessageBox::question(this, "RetroShare", tr("You have selected %1 accepted peers among others,\n Are you sure you want to un-friend them?").arg(friends.size()), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes)) == QMessageBox::Yes) + { + for(std::set::const_iterator it(friends.begin());it!=friends.end();++it) + rsPeers->removeFriend(*it); + selected.insert(friends.begin(),friends.end()); + } + } + if(!selected.empty()) + removeKeys(selected); + updateDisplay(); } void NetworkDialog::removeKeys(std::set selected) From 234a510d6f3038dac2322c7821967ac0c6d09c63 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 10 Aug 2023 23:28:03 +0200 Subject: [PATCH 02/88] fixed possible crash in channel feed item being deleted during async loading --- .../src/gui/feeds/GxsChannelPostItem.cpp | 38 +++++++++++++++++-- .../src/gui/feeds/GxsChannelPostItem.h | 7 +++- .../src/gui/feeds/GxsForumMsgItem.cpp | 8 +++- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 102dfb637..17036a15e 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -49,6 +49,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate), mGroupMeta(group_meta) { + mLoadingGroup = false; + mLoadingMessage = false; + mLoadingComment = false; + mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded mPost.mMeta.mGroupId = mGroupMeta.mGroupId; @@ -136,6 +140,19 @@ void GxsChannelPostItem::paintEvent(QPaintEvent *e) GxsChannelPostItem::~GxsChannelPostItem() { + auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300); + + while( (mLoadingGroup || mLoadingMessage || mLoadingComment) + && std::chrono::steady_clock::now() < timeout) + { + RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for " + << (mLoadingGroup ? "Group " : "") + << (mLoadingMessage ? "Message " : "") + << (mLoadingComment ? "Comment " : "") + << "loading." << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + delete(ui); } @@ -277,6 +294,7 @@ void GxsChannelPostItem::loadGroup() std::cerr << "GxsChannelGroupItem::loadGroup()"; std::cerr << std::endl; #endif + mLoadingGroup = true; RsThread::async([this]() { @@ -306,6 +324,7 @@ void GxsChannelPostItem::loadGroup() * after a blocking call to RetroShare API complete */ mGroupMeta = group.mMeta; + mLoadingGroup = false; }, this ); }); @@ -316,6 +335,8 @@ void GxsChannelPostItem::loadMessage() std::cerr << "GxsChannelPostItem::loadMessage()"; std::cerr << std::endl; #endif + mLoadingMessage = true; + RsThread::async([this]() { // 1 - get group data @@ -337,7 +358,11 @@ void GxsChannelPostItem::loadMessage() #endif const RsGxsChannelPost& post(posts[0]); - RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this ); + RsQThreadUtils::postToObject( [post,this]() + { + setPost(post); + mLoadingMessage = false; + }, this ); } else if(comments.size() == 1) { @@ -356,7 +381,8 @@ void GxsChannelPostItem::loadMessage() setMessageId(cmt.mMeta.mThreadId); requestMessage(); - }, this ); + mLoadingMessage = false; + }, this ); } else @@ -366,7 +392,11 @@ void GxsChannelPostItem::loadMessage() std::cerr << std::endl; #endif - RsQThreadUtils::postToObject( [this]() { removeItem(); }, this ); + RsQThreadUtils::postToObject( [this]() + { + removeItem(); + mLoadingMessage = false; + }, this ); } }); } @@ -377,6 +407,7 @@ void GxsChannelPostItem::loadComment() std::cerr << "GxsChannelPostItem::loadComment()"; std::cerr << std::endl; #endif + mLoadingComment = true; RsThread::async([this]() { @@ -407,6 +438,7 @@ void GxsChannelPostItem::loadComment() sComButText = tr("Comments ").append("(%1)").arg(comNb); ui->commentButton->setText(sComButText); + mLoadingComment = false; }, this ); }); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 8370b885e..b3e7843c0 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -119,7 +119,12 @@ private: private: bool mInFill; bool mCloseOnRead; - bool mLoaded; + bool mLoaded; + + bool mLoadingMessage; + bool mLoadingGroup; + bool mLoadingComment; + RsGroupMetaData mGroupMeta; RsGxsChannelPost mPost; diff --git a/retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp b/retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp index 81b026d27..f4d091179 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsForumMsgItem.cpp @@ -47,7 +47,13 @@ GxsForumMsgItem::GxsForumMsgItem(FeedHolder *feedHolder, uint32_t feedId, const { mMessage.mMeta.mMsgId = messageId; // useful for uniqueIdentifier() before the post is actually loaded mMessage.mMeta.mGroupId = groupId; - setup(); + + mLoadingGroup = false; + mLoadingMessage = false; + mLoadingSetAsRead = false; + mLoadingParentMessage = false; + + setup(); requestGroup(); requestMessage(); From f6bcfb549a2ba6089a489b48980489a83cc89c85 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 10 Aug 2023 23:41:51 +0200 Subject: [PATCH 03/88] made delete button and delete menu item call the same functions, so as to make the actions identical --- retroshare-gui/src/gui/msgs/MessageWidget.cpp | 7 ++++--- retroshare-gui/src/gui/msgs/MessageWidget.h | 1 + retroshare-gui/src/gui/msgs/MessagesDialog.cpp | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.cpp b/retroshare-gui/src/gui/msgs/MessageWidget.cpp index cd06e9805..0d2e934f2 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.cpp +++ b/retroshare-gui/src/gui/msgs/MessageWidget.cpp @@ -738,7 +738,8 @@ void MessageWidget::remove() return; } - bool deleteReal = false; +#ifdef TO_REMOVE + bool deleteReal = false; if (msgInfo.msgflags & RS_MSG_TRASH) { deleteReal = true; } else { @@ -763,8 +764,8 @@ void MessageWidget::remove() deleteLater(); } } - - emit messageRemoved(); +#endif + emit messageRemovalRequested(currMsgId); } void MessageWidget::print() diff --git a/retroshare-gui/src/gui/msgs/MessageWidget.h b/retroshare-gui/src/gui/msgs/MessageWidget.h index d6465e5cf..53b043720 100644 --- a/retroshare-gui/src/gui/msgs/MessageWidget.h +++ b/retroshare-gui/src/gui/msgs/MessageWidget.h @@ -61,6 +61,7 @@ public: signals: void messageRemoved(); + void messageRemovalRequested(std::string); private slots: void reply(); diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index 1fb55821f..78d81ef20 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -144,7 +144,7 @@ MessagesDialog::MessagesDialog(QWidget *parent) msgWidget = new MessageWidget(true, this); ui.msgLayout->addWidget(msgWidget); - connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved())); + connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage())); connectActions(); @@ -838,7 +838,7 @@ void MessagesDialog::openAsWindow() } msgWidget->activateWindow(); - connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved())); + connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage())); /* window will destroy itself! */ } @@ -858,7 +858,7 @@ void MessagesDialog::openAsTab() ui.tabWidget->addTab(msgWidget,FilesDefs::getIconFromQtResourcePath(IMAGE_MAIL), msgWidget->subject(true)); ui.tabWidget->setCurrentWidget(msgWidget); - connect(msgWidget, SIGNAL(messageRemoved()), this, SLOT(messageRemoved())); + connect(msgWidget, SIGNAL(messageRemovalRequested(std::string)), this, SLOT(removemessage())); /* window will destroy itself! */ } From 4a20e1b4d289bfe3c1a246b3c0495d1a12788d42 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 14 Aug 2023 21:27:46 +0200 Subject: [PATCH 04/88] Fix to hide picture browse button on republish & like view * Fix to hide picture browse button on republish & like view --- retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp | 4 +++- retroshare-gui/src/gui/TheWire/PulseAddDialog.ui | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp index 8877d5cf6..6109e3866 100644 --- a/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp @@ -194,7 +194,7 @@ void PulseAddDialog::setReplyTo(const RsWirePulse &pulse, RsWirePulseSPtr pPulse mReplyToPulse = pulse; mReplyType = replyType; ui.frame_reply->setVisible(true); - ui.pushButton_picture->show(); + ui.pushButton_picture->hide(); ui.topheadshot->hide(); { @@ -223,10 +223,12 @@ void PulseAddDialog::setReplyTo(const RsWirePulse &pulse, RsWirePulseSPtr pPulse if (mReplyType & WIRE_PULSE_TYPE_REPUBLISH) { ui.postButton->setText(tr("Republish Pulse")); ui.pushButton_picture->hide(); + ui.pushButton_Browse->hide(); } else if (mReplyType & WIRE_PULSE_TYPE_LIKE) { ui.postButton->setText(tr("Like Pulse")); ui.pushButton_picture->hide(); + ui.pushButton_Browse->hide(); } } diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui b/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui index c09119a40..bdfda3cc5 100644 --- a/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.ui @@ -140,7 +140,7 @@ - 20 + 9 0 From eeacb4500d24c4891e2835c7dc111b6c55961e1b Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 15 Aug 2023 21:13:53 +0200 Subject: [PATCH 05/88] removed some debug output --- retroshare-gui/src/gui/msgs/MessagesDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index 78d81ef20..de91df5ff 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -95,6 +95,7 @@ #define ROW_SENTBOX 3 #define ROW_TRASHBOX 4 +// #define DEBUG_MESSAGES_DIALOG 1 class MessageSortFilterProxyModel: public QSortFilterProxyModel { @@ -365,15 +366,18 @@ void MessagesDialog::preModelUpdate() if (m.isValid()) { mTmpSavedCurrentId = m.sibling(m.row(), RsMessageModel::COLUMN_THREAD_MSGID).data(RsMessageModel::MsgIdRole).toString(); } - +#ifdef DEBUG_MESSAGES_DIALOG std::cerr << "Pre-change: saving selection for " << mTmpSavedSelectedIds.size() << " indexes" << std::endl; +#endif } void MessagesDialog::postModelUpdate() { // restore selection +#ifdef DEBUG_MESSAGES_DIALOG std::cerr << "Post-change: restoring selection for " << mTmpSavedSelectedIds.size() << " indexes" << std::endl; +#endif QItemSelection sel; foreach(const QString& s,mTmpSavedSelectedIds) From fd9f31987d9516f155e29da0efbdabd88796e927 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 15 Aug 2023 21:14:32 +0200 Subject: [PATCH 06/88] attempt at fixing crash with gtk2 style when the proper environment variable is not set --- retroshare-gui/src/gui/settings/AppearancePage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index 2fb86e5a2..ad48ccabd 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -75,7 +75,8 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags) ui.cmboLanguage->addItem(FilesDefs::getIconFromQtResourcePath(":/images/flags/" + code + ".png"), LanguageSupport::languageName(code), code); } foreach (QString style, QStyleFactory::keys()) { - ui.cmboStyle->addItem(style, style.toLower()); + if(style.toLower() != "gtk2" || (getenv("QT_QPA_PLATFORMTHEME")!=nullptr && !strcmp(getenv("QT_QPA_PLATFORMTHEME"),"gtk2"))) // make sure that if style is gtk2, the system has the correct environment variable set. + ui.cmboStyle->addItem(style, style.toLower()); } QMap styleSheets; From 3a07a268ca9fbfabcc6125dedbbfe312763782b0 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 15 Aug 2023 21:57:42 +0200 Subject: [PATCH 07/88] Added to store last used group filter --- retroshare-gui/src/gui/TheWire/WireDialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.cpp b/retroshare-gui/src/gui/TheWire/WireDialog.cpp index 38ea1b398..6738be68a 100644 --- a/retroshare-gui/src/gui/TheWire/WireDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/WireDialog.cpp @@ -154,9 +154,16 @@ void WireDialog::processSettings(bool load) // state of splitter ui.splitter->restoreState(Settings->value("SplitterWire").toByteArray()); + + // state of filter combobox + int index = Settings->value("ShowGroup", 0).toInt(); + ui.comboBox_groupSet->setCurrentIndex(index); } else { // save settings + // state of filter combobox + Settings->setValue("ShowGroup", ui.comboBox_groupSet->currentIndex()); + // state of splitter Settings->setValue("SplitterWire", ui.splitter->saveState()); } @@ -1064,4 +1071,3 @@ void WireDialog::postGroupsPulses(std::list pulses) } } - From 1b8bee4262ca542c8f7940da5ea10233c4dbcdd1 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 15 Aug 2023 23:12:54 +0200 Subject: [PATCH 08/88] Removed hardcorded stylesheet from PulseReplySeperator * Fixed some dark style issues --- .../src/gui/TheWire/PulseReplySeperator.ui | 5 +--- .../src/gui/qss/stylesheet/Standard_Dark.qss | 26 ++++++++----------- .../src/gui/qss/stylesheet/Standard_Light.qss | 6 +++++ retroshare-gui/src/qss/retroclassic.qss | 6 +++++ 4 files changed, 24 insertions(+), 19 deletions(-) diff --git a/retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui b/retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui index 4a605a219..6564fe5e3 100644 --- a/retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui +++ b/retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui @@ -40,10 +40,7 @@ - QFrame#frame{border: 2px solid #CCCCCC; -background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #EEEEEE, stop: 1 #CCCCCC); -border-radius: 10px} + QFrame::StyledPanel diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss index 7497440c5..ffea0a4d8 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Dark.qss @@ -2436,7 +2436,7 @@ WireGroupItem QFrame#wire_frame QLabel{ background: transparent; } WireGroupItem QFrame#wire_frame:hover { - background-color: #2e8bab; + background-color: #346792; } PulseTopLevel QFrame#frame, @@ -2446,13 +2446,6 @@ PulseReply QFrame#frame { border-radius: 6px; } -PulseAddDialog QTextEdit#textEdit_Pulse { - border: 2px solid #c4cfd6; - border-radius: 6px; - background: white; - color: black; -} - PulseReply #line_replyLine, PulseMessage #line{ color: #c4cfd6; @@ -2462,6 +2455,16 @@ PulseReply QLabel#label_groupName{ color: #5b7083; } +PulseReplySeperator QFrame#frame { + background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #455364, stop: 0.5 #54687A,stop: 0.6 #44586A, stop:1 #455364); + border-radius: 10px; +} + +QLabel#label_masthead{ + border: 2px solid #CCCCCC; + border-radius: 4px; +} + /**** Color definitions ****/ ForumsDialog, GxsForumThreadWidget @@ -2552,10 +2555,3 @@ OpModeStatus[opMode="Minimal"] { [WrongValue="true"] { background-color: #702020; } - -/**** The Wire ****/ - -QLabel#label_masthead{ - border: 2px solid #CCCCCC; - border-radius: 4px; -} diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss index 061ca0518..df6b9d51c 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard_Light.qss @@ -2687,6 +2687,12 @@ PulseReply QLabel#label_groupName{ color: #5b7083; } +PulseReplySeperator QFrame#frame { + border: 2px solid #CCCCCC; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC); + border-radius: 10px} +} + QLabel#label_masthead{ border: 2px solid #CCCCCC; border-radius: 4px; diff --git a/retroshare-gui/src/qss/retroclassic.qss b/retroshare-gui/src/qss/retroclassic.qss index df8802f3a..eea7fdf25 100644 --- a/retroshare-gui/src/qss/retroclassic.qss +++ b/retroshare-gui/src/qss/retroclassic.qss @@ -184,3 +184,9 @@ QLabel#label_masthead{ border: 2px solid #CCCCCC; border-radius: 4px; } + +PulseReplySeperator QFrame#frame { + border: 2px solid #CCCCCC; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEEEEE, stop: 1 #CCCCCC); + border-radius: 10px} +} From 811b3b3658c568729456decb0214ea5222209f4d Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 18 Aug 2023 13:21:28 +0200 Subject: [PATCH 09/88] fixed bug not showing icons/text button on loading --- retroshare-gui/src/gui/settings/AppearancePage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index ad48ccabd..dcfb0350e 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -267,9 +267,9 @@ void AppearancePage::load() index = ui.mainPageButtonType_CB->findData(Settings->getPageButtonLoc()); if (index != 0) { - ui.cmboTollButtonsStyle->hide(); - }else { - ui.cmboTollButtonsStyle->show(); + ui.cmboTollButtonsStyle->show(); + }else { + ui.cmboTollButtonsStyle->hide(); } whileBlocking(ui.mainPageButtonType_CB)->setCurrentIndex(!Settings->getPageButtonLoc()); From 1efed9d436706353fd4b9f25dfd5e42a5bc98a52 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 29 Aug 2023 14:28:18 +0200 Subject: [PATCH 10/88] Fix transparency for channel post thumbnails --- .../src/gui/gxschannels/CreateGxsChannelMsg.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index 05ce9bda6..f00d31539 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -35,6 +35,7 @@ #include "util/rsdir.h" #include "util/qtthreadsutils.h" #include "util/RichTextEdit.h" +#include "util/imageutil.h" #include @@ -610,8 +611,10 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){ QImage tNail(imageBuffer, width, height, QImage::Format_RGB32); QByteArray ba; QBuffer buffer(&ba); + bool has_transparency = ImageUtil::hasAlphaContent(tNail.toImage()); + buffer.open(QIODevice::WriteOnly); - tNail.save(&buffer, "JPG"); + tNail.save(&buffer, has_transparency?"PNG":"JPG"); QPixmap img; img.loadFromData(ba, "PNG"); img = img.scaled(thumbnail_label->width(), thumbnail_label->height(), Qt::KeepAspectRatio, Qt::SmoothTransformation); @@ -797,15 +800,16 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str QByteArray ba; QBuffer buffer(&ba); - RsGxsImage image; + RsGxsImage image; + bool has_transparency = ImageUtil::hasAlphaContent(picture.toImage()); if(!picture.isNull()) { // send chan image buffer.open(QIODevice::WriteOnly); - preview_W->getCroppedScaledPicture().save(&buffer, "JPG"); // writes image into ba in PNG format - image.copy((uint8_t *) ba.data(), ba.size()); + preview_W->getCroppedScaledPicture().save(&buffer, has_transparency?"PNG":"JPG"); // writes image into ba in PNG format + image.copy((uint8_t *) ba.data(), ba.size()); } std::string error_string; From d80951cd53bb89dd0297142edf9baa3af222e8aa Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Aug 2023 23:18:06 +0200 Subject: [PATCH 11/88] added missing comment --- retroshare-gui/src/gui/settings/AppearancePage.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp index dcfb0350e..8ad086ae9 100755 --- a/retroshare-gui/src/gui/settings/AppearancePage.cpp +++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp @@ -74,8 +74,12 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags) foreach (QString code, LanguageSupport::languageCodes()) { ui.cmboLanguage->addItem(FilesDefs::getIconFromQtResourcePath(":/images/flags/" + code + ".png"), LanguageSupport::languageName(code), code); } - foreach (QString style, QStyleFactory::keys()) { - if(style.toLower() != "gtk2" || (getenv("QT_QPA_PLATFORMTHEME")!=nullptr && !strcmp(getenv("QT_QPA_PLATFORMTHEME"),"gtk2"))) // make sure that if style is gtk2, the system has the correct environment variable set. + + // Note: apparently, on some linux systems (e.g. Debian 11), the gtk2 style makes Qt libs crash when the environment variable is not set. + // So we first check that it's here before start. + + foreach (QString style, QStyleFactory::keys()) { + if(style.toLower() != "gtk2" || (getenv("QT_QPA_PLATFORMTHEME")!=nullptr && !strcmp(getenv("QT_QPA_PLATFORMTHEME"),"gtk2"))) ui.cmboStyle->addItem(style, style.toLower()); } From 013786a7b7df627b81254f077db106d6fc882d43 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Aug 2023 23:18:24 +0200 Subject: [PATCH 12/88] disabled external port+address on auto-tor mode --- retroshare-gui/src/gui/settings/ServerPage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp index 3dfe9069d..adb1d655c 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.cpp +++ b/retroshare-gui/src/gui/settings/ServerPage.cpp @@ -107,6 +107,8 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags) ui.hiddenpage_proxyPort_tor->setEnabled(false) ; ui.hiddenpage_localAddress->setEnabled(false) ; ui.hiddenpage_localPort->setEnabled(false) ; + ui.hiddenpage_serviceAddress->setEnabled(false) ; + ui.hiddenpage_servicePort->setEnabled(false) ; ui.testIncoming_PB->hide() ; ui.l_incomingTestResult->hide() ; ui.iconlabel_service_incoming->hide() ; From 0ed32eb5975e4f8c56a5373b9d34b0660a862d1f Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 31 Aug 2023 23:27:18 +0200 Subject: [PATCH 13/88] removed export menu entry (duplicates functionality, and wasnt connected anyway) --- retroshare-gui/src/gui/NetworkDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 216117f67..1dab369e2 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -127,8 +127,8 @@ void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ ) if(!rsPeers->getGPGDetails(peer_id, detail)) // that is not suppose to fail. return ; - if(peer_id == rsPeers->getGPGOwnId()) - contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated())); + //if(peer_id == rsPeers->getGPGOwnId()) + // contextMnu->addAction(QIcon(), tr("Export/create a new node"), this, SLOT(on_actionExportKey_activated())); contextMnu->addAction(QIcon(IMAGE_PEERDETAILS), tr("Profile details..."), this, SLOT(peerdetails())); contextMnu->addSeparator() ; From 8a20ab33b4d5a4390d6a358331ba1f6b5a2f974c Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 4 Sep 2023 21:58:45 +0200 Subject: [PATCH 14/88] fixed bug in ModelIndex creation in channel post view, and implemented arrow key navigation --- .../src/gui/gxs/GxsCommentDialog.cpp | 2 ++ .../gui/gxschannels/GxsChannelPostsModel.cpp | 21 +++++++++++++++- .../gui/gxschannels/GxsChannelPostsModel.h | 1 + .../GxsChannelPostsWidgetWithModel.cpp | 24 +++++++++++++++++++ .../GxsChannelPostsWidgetWithModel.h | 1 + 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index 7b9e28131..4757b036e 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -95,8 +95,10 @@ void GxsCommentDialog::commentClear() } void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const std::set& msg_versions,const RsGxsMessageId& most_recent_msgId,bool use_cache) { +#ifdef DEBUG_COMMENT_DIALOG std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", most recent msg version: " << most_recent_msgId << ")"; std::cerr << std::endl; +#endif mGrpId = grpId; mMostRecentMsgId = most_recent_msgId; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index e9be3e6ed..a42587d85 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -176,6 +176,25 @@ int RsGxsChannelPostsModel::rowCount(const QModelIndex& parent) const return 0; } +int RsGxsChannelPostsModel::columnCount(int row) const +{ + if(mTreeMode == TREE_MODE_GRID) + { + if(row+1 == rowCount()) + { + int r = ((int)mFilteredPosts.size() % (int)mColumns); + + if(r > 0) + return r; + else + return columnCount(); + } + else + return columnCount(); + } + else + return 2; +} int RsGxsChannelPostsModel::columnCount(const QModelIndex &/*parent*/) const { if(mTreeMode == TREE_MODE_GRID) @@ -245,7 +264,7 @@ bool RsGxsChannelPostsModel::convertRefPointerToTabEntry(quintptr ref, uint32_t& QModelIndex RsGxsChannelPostsModel::index(int row, int column, const QModelIndex & parent) const { - if(row < 0 || column < 0 || column >= (int)mColumns) + if(row < 0 || column < 0 || row >= rowCount() || column >= columnCount(row)) return QModelIndex(); quintptr ref = getChildRef(parent.internalId(),(mTreeMode == TREE_MODE_GRID)?(column + row*mColumns):row); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.h index 42dcbb9f7..c447f11a3 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.h @@ -105,6 +105,7 @@ public: QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;} QModelIndex getIndexOfMessage(const RsGxsMessageId& mid) const; + int columnCount(int row) const; // columns in the row of this particular index. std::vector > getPostVersions(const RsGxsMessageId& mid) const; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index a6ce946f5..ea27be6f9 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -504,6 +504,30 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI }, mEventHandlerId, RsEventType::GXS_CHANNELS ); } +void GxsChannelPostsWidgetWithModel::keyPressEvent(QKeyEvent *e) +{ + QModelIndex index = ui->postsTree->selectionModel()->currentIndex(); + + if(index.isValid() && mChannelPostsModel->getMode() == RsGxsChannelPostsModel::TREE_MODE_GRID) + { + int n = mChannelPostsModel->columnCount(index.row())-1; + + if(e->key() == Qt::Key_Left && index.column()==0) + { + ui->postsTree->setCurrentIndex(index.siblingAtColumn(n)); + e->accept(); + return; + } + if(e->key() == Qt::Key_Right && index.column()==n) + { + ui->postsTree->setCurrentIndex(index.siblingAtColumn(0)); + e->accept(); + return; + } + } + + GxsMessageFrameWidget::keyPressEvent(e); +} void GxsChannelPostsWidgetWithModel::resizeEvent(QResizeEvent *e) { GxsMessageFrameWidget::resizeEvent(e); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h index 9cfcaae21..8891b57dd 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h @@ -139,6 +139,7 @@ protected: /* GxsMessageFrameWidget */ virtual void setAllMessagesReadDo(bool read) override; virtual void resizeEvent(QResizeEvent *e) override; + virtual void keyPressEvent(QKeyEvent *e) override; private slots: void showPostDetails(); From 43afcf3f98c41fa578c9bbc2e545c776ce092955 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 5 Sep 2023 21:10:38 +0200 Subject: [PATCH 15/88] Fix to use RGBA32 --- retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index f00d31539..66311d6fa 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -608,7 +608,7 @@ bool CreateGxsChannelMsg::setThumbNail(const std::string& path, int frame){ if(imageBuffer == NULL) return false; - QImage tNail(imageBuffer, width, height, QImage::Format_RGB32); + QImage tNail(imageBuffer, width, height, QImage::Format_RGBA32); QByteArray ba; QBuffer buffer(&ba); bool has_transparency = ImageUtil::hasAlphaContent(tNail.toImage()); From c90fab0136a08071f220b9ea97528bca76aa65ba Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 8 Sep 2023 20:48:54 +0200 Subject: [PATCH 16/88] added help for JSON API page --- retroshare-gui/src/gui/settings/JsonApiPage.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index a824a5fa0..f0767db7c 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -59,7 +59,15 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) ui.listenAddressLineEdit->setValidator(ipValidator); } - +QString JsonApiPage::helpText() const +{ + return tr("

  Webinterface

\ +

Retroshare provides a JSON API allowing other softwares to communicate with its core using token-controlled HTTP requests to http://localhost:[port]. \ + Please refer to the Retroshare documentation for how to use this feature.

\ +

Unless you know what you're doing, you shouldn't need to change anything in this page. \ + The web interface for instance will automatically register its own token to the JSON API which will be visible \ + in the list of authenticated tokens after you enable it.

"); +} void JsonApiPage::enableJsonApi(bool checked) { ui.addTokenPushButton->setEnabled(checked); @@ -107,8 +115,6 @@ void JsonApiPage::load() whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk)); } -QString JsonApiPage::helpText() const { return ""; } - bool JsonApiPage::checkStartJsonApi() { if(!Settings->getJsonApiEnabled()) return false; From d0b4bfdaa1bbe00088f9cbc15a9b4ce7765a253f Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 10 Sep 2023 15:25:13 +0200 Subject: [PATCH 17/88] Fixed Linux compile of FeedReader plugin --- plugins/FeedReader/services/p3FeedReaderThread.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/FeedReader/services/p3FeedReaderThread.cc b/plugins/FeedReader/services/p3FeedReaderThread.cc index 01e449323..845b5c82b 100644 --- a/plugins/FeedReader/services/p3FeedReaderThread.cc +++ b/plugins/FeedReader/services/p3FeedReaderThread.cc @@ -1151,10 +1151,10 @@ RsFeedReaderErrorState p3FeedReaderThread::processMsg(const RsFeedReaderFeed &fe if (isRunning()) { /* process description */ - bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? TRUE : FALSE; + bool processPostedFirstImage = (feed.flag & RS_FEED_FLAG_POSTED_FIRST_IMAGE) ? true : false; if (!msg->attachmentBinary.empty()) { /* use attachment as image */ - processPostedFirstImage = FALSE; + processPostedFirstImage = false; } //long todo; // encoding From d83f0125f33ddbc51022ce6693339321e5874bf9 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 10 Sep 2023 17:49:51 +0200 Subject: [PATCH 18/88] improved UI of webUI and JsonAPI and interaction between these two (unfinished) --- .../src/gui/settings/JsonApiPage.cc | 16 ++- retroshare-gui/src/gui/settings/JsonApiPage.h | 4 + .../src/gui/settings/JsonApiPage.ui | 108 +++++++++++++----- retroshare-gui/src/gui/settings/WebuiPage.cpp | 64 +++++------ retroshare-gui/src/gui/settings/WebuiPage.h | 13 +-- retroshare-gui/src/gui/settings/WebuiPage.ui | 48 ++++++-- .../src/gui/settings/rsettingswin.cpp | 2 - 7 files changed, 169 insertions(+), 86 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index f0767db7c..136b37d56 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -23,6 +23,7 @@ #include "rsharesettings.h" #include "jsonapi/jsonapi.h" #include "util/misc.h" +#include "util/qtthreadsutils.h" #include #include @@ -58,7 +59,16 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) ui.listenAddressLineEdit->setValidator(ipValidator); + mEventHandlerId = 0; + + rsEvents->registerEventsHandler( [this](std::shared_ptr /* event */) + { + std::cerr << "Caught JSONAPI event!" << std::endl; + RsQThreadUtils::postToObject([=]() { load(); }, this ); + }, + mEventHandlerId, RsEventType::JSON_API ); } + QString JsonApiPage::helpText() const { return tr("

  Webinterface

\ @@ -101,9 +111,9 @@ bool JsonApiPage::updateParams() void JsonApiPage::load() { - whileBlocking(ui.portSpinBox)->setValue(Settings->getJsonApiPort()); - whileBlocking(ui.listenAddressLineEdit)->setText(Settings->getJsonApiListenAddress()); - whileBlocking(ui.enableCheckBox)->setChecked(Settings->getJsonApiEnabled()); + whileBlocking(ui.portSpinBox)->setValue(rsJsonApi->listeningPort()); + whileBlocking(ui.listenAddressLineEdit)->setText(QString::fromStdString(rsJsonApi->getBindingAddress())); + whileBlocking(ui.enableCheckBox)->setChecked(rsJsonApi->isRunning()); QStringList newTk; diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.h b/retroshare-gui/src/gui/settings/JsonApiPage.h index 7f69bbd1e..f06340d1a 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.h +++ b/retroshare-gui/src/gui/settings/JsonApiPage.h @@ -20,6 +20,8 @@ #pragma once +#include "retroshare/rsevents.h" + #include "retroshare-gui/configpage.h" #include "gui/common/FilesDefs.h" #include "ui_JsonApiPage.h" @@ -63,4 +65,6 @@ public slots: private: Ui::JsonApiPage ui; /// Qt Designer generated object + RsEventsHandlerId_t mEventHandlerId; }; + diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.ui b/retroshare-gui/src/gui/settings/JsonApiPage.ui index 24b534712..9227a3251 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.ui +++ b/retroshare-gui/src/gui/settings/JsonApiPage.ui @@ -13,7 +13,7 @@ Form - + @@ -25,51 +25,43 @@ JSON API Server - + - - - Enable RetroShare JSON API Server - - - - - + - + - Port: + Enable RetroShare JSON API Server - - - 1024 + + + Qt::Horizontal - - 65535 + + + 40 + 20 + - - 9092 - - + - - - - - + - Listen Address: + Status: - + - 127.0.0.1 + + + + :/images/ledoff1.png @@ -107,16 +99,68 @@ + + + + + + Listen Address: + + + + + + + 127.0.0.1 + + + + + + + + + + + Port: + + + + + + + 1024 + + + 65535 + + + 9092 + + + + + - Authenticated Tokens + Authenticated Tokens: + + + + Registered services: + + + + + +
@@ -142,6 +186,8 @@ - + + + diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index f0006fec3..073d775ae 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -73,22 +73,12 @@ void WebuiPage::selectWebInterfaceDirectory() bool WebuiPage::updateParams(QString &errmsg) { std::cerr << "WebuiPage::save()" << std::endl; - bool ok = true; - bool changed = false; - if(ui.enableWebUI_CB->isChecked() != Settings->getWebinterfaceEnabled()) - changed = true; - if(ui.webInterfaceFiles_LE->text() != Settings->getWebinterfaceFilesDirectory()) - changed = true; - if(changed) - { - // store config - Settings->setWebinterfaceEnabled(ui.enableWebUI_CB->isChecked()); - Settings->setWebinterfaceFilesDirectory(ui.webInterfaceFiles_LE->text()); + // store config + Settings->setWebinterfaceEnabled(ui.enableWebUI_CB->isChecked()); + Settings->setWebinterfaceFilesDirectory(ui.webInterfaceFiles_LE->text()); - rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString()); - } - return ok; + return true; } void WebuiPage::onPasswordValueChanged(QString password) @@ -112,10 +102,20 @@ void WebuiPage::onPasswordValueChanged(QString password) bool WebuiPage::restart() { - return checkStartWebui(); + if(ui.password_LE->text().isNull()) + { + QMessageBox::critical(nullptr,tr("Missing passphrase"),tr("Please set a passphrase to proect the access to the WEB interface.")); + return false; + } + + rsWebUi->setUserPassword(ui.password_LE->text().toStdString()); + rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString()); + rsWebUi->restart(); + + return true; } -void WebuiPage::load() +void WebuiPage::loadParams() { std::cerr << "WebuiPage::load()" << std::endl; whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled()); @@ -138,13 +138,11 @@ QString WebuiPage::helpText() const

Warning: don't expose the webinterface to the internet, because there is no access control and no encryption. If you want to use the webinterface over the internet, use a SSH tunnel or a proxy to secure the connection.

"); } -/*static*/ bool WebuiPage::checkStartWebui() +/*static*/ bool WebuiPage::checkStartWebui() // This is supposed to be called from main(). But normally the parameters below (including the paswd + // for the webUI should be saved in p3webui instead. { - if(!Settings->getWebinterfaceEnabled()) - return false; - - rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString()); - rsWebUi->restart(); + rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString()); + rsWebUi->restart(); return true; } @@ -177,13 +175,6 @@ void WebuiPage::onEnableCBClicked(bool checked) ui.apply_PB->setEnabled(checked); ui.startWebBrowser_PB->setEnabled(checked); QString S; - - Settings->setWebinterfaceEnabled(checked); - - if(checked) - checkStartWebui(); - else - checkShutdownWebui(); } void WebuiPage::onPortValueChanged(int /*value*/) @@ -199,18 +190,19 @@ void WebuiPage::onAllIPCBClicked(bool /*checked*/) } void WebuiPage::onApplyClicked() { - rsWebUi->setUserPassword(ui.password_LE->text().toStdString()); - QString errmsg; updateParams(errmsg); - if(!restart()) + if(ui.enableWebUI_CB->isChecked()) { - QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); - return; + if(!restart()) + { + QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); + return; + } + else + checkShutdownWebui(); } - - emit passwordChanged(); } void WebuiPage::onStartWebBrowserClicked() { showWebui(); } diff --git a/retroshare-gui/src/gui/settings/WebuiPage.h b/retroshare-gui/src/gui/settings/WebuiPage.h index 9ba8886ac..ad20d6afb 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.h +++ b/retroshare-gui/src/gui/settings/WebuiPage.h @@ -42,11 +42,11 @@ public: ~WebuiPage(); /** Loads the settings for this page */ - virtual void load(); + virtual void load() override { loadParams() ; } - virtual QPixmap iconPixmap() const { return FilesDefs::getPixmapFromQtResourcePath(":/icons/settings/webinterface.svg") ; } - virtual QString pageName() const { return tr("Webinterface") ; } - virtual QString helpText() const; + virtual QPixmap iconPixmap() const override { return FilesDefs::getPixmapFromQtResourcePath(":/icons/settings/webinterface.svg") ; } + virtual QString pageName() const override { return tr("Webinterface") ; } + virtual QString helpText() const override ; // call this after start of libretroshare/Retroshare // checks the settings and starts the webinterface if required @@ -67,10 +67,9 @@ public slots: void onApplyClicked(); void onStartWebBrowserClicked(); -signals: - void passwordChanged(); - private: + virtual void loadParams(); + /** Qt Designer generated object */ Ui::WebuiPage ui; diff --git a/retroshare-gui/src/gui/settings/WebuiPage.ui b/retroshare-gui/src/gui/settings/WebuiPage.ui index 5ca37e9b6..e48cd31c5 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.ui +++ b/retroshare-gui/src/gui/settings/WebuiPage.ui @@ -6,8 +6,8 @@ 0 0 - 960 - 717 + 570 + 646 @@ -15,11 +15,45 @@ - - - Enable Retroshare WEB Interface - - + + + + + Enable Retroshare WEB Interface + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + TextLabel + + + + + + + + + + :/images/ledoff1.png + + + + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 46c85ea8e..e52ca1aed 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -180,8 +180,6 @@ SettingsPage::initStackedWidget() #ifdef RS_WEBUI WebuiPage *webui_p = new WebuiPage() ; addPage(new WebuiPage() ); - - QObject::connect(webui_p,SIGNAL(passwordChanged()),jsonapi_p,SLOT(load())); #endif #endif From d5088caac6a70b3a7dbf5cc9bb763b07f8c0131b Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 11 Sep 2023 21:54:54 +0200 Subject: [PATCH 19/88] fix second part for transparency check --- retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index 66311d6fa..bc2f5d960 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -801,7 +801,10 @@ void CreateGxsChannelMsg::sendMessage(const std::string &subject, const std::str QBuffer buffer(&ba); RsGxsImage image; - bool has_transparency = ImageUtil::hasAlphaContent(picture.toImage()); + QPixmap pixmap; + pixmap = preview_W->getCroppedScaledPicture(); + QImage qimg = pixmap.toImage(); + bool has_transparency = ImageUtil::hasAlphaContent(qimg); if(!picture.isNull()) { From c877a6e5c873f0024819c37244020a358ff66d3d Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 11 Sep 2023 22:55:42 +0200 Subject: [PATCH 20/88] improved login of on/off and parameter display in webui/jsonapi config pages --- .../src/gui/settings/JsonApiPage.cc | 16 +++++++++++++- retroshare-gui/src/gui/settings/WebuiPage.cpp | 21 ++++++++++++++++++- retroshare-gui/src/gui/settings/WebuiPage.h | 4 ++++ retroshare-gui/src/gui/settings/WebuiPage.ui | 2 +- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index 136b37d56..4e33c05e6 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -29,6 +29,8 @@ #include #include +#define IMAGE_LEDOFF ":/images/ledoff1.png" +#define IMAGE_LEDON ":/images/ledon1.png" JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) { @@ -122,7 +124,19 @@ void JsonApiPage::load() QString::fromStdString(it.first) + ":" + QString::fromStdString(it.second) ); - whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk)); + whileBlocking(ui.tokensListView)->setModel(new QStringListModel(newTk)); + + QStringList newTk2; + + for(const auto& it : rsJsonApi->getResourceProviders()) + newTk2.push_back( QString::fromStdString(it.get().getName())) ; + + whileBlocking(ui.providersListView)->setModel(new QStringListModel(newTk2)); + + if(rsJsonApi->isRunning()) + ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; + else + ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ; } bool JsonApiPage::checkStartJsonApi() diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index 073d775ae..cccf54369 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -27,6 +27,7 @@ #include #include "util/misc.h" +#include "util/qtthreadsutils.h" #include "retroshare/rswebui.h" #include "retroshare/rsjsonapi.h" @@ -40,6 +41,8 @@ resource_api::ApiServerLocal* WebuiPage::apiServerLocal = 0; #endif resource_api::RsControlModule* WebuiPage::controlModule = 0; +#define IMAGE_LEDOFF ":/images/ledoff1.png" +#define IMAGE_LEDON ":/images/ledon1.png" WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) { @@ -50,6 +53,15 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) connect(ui.password_LE, SIGNAL(textChanged(QString)), this, SLOT(onPasswordValueChanged(QString))); connect(ui.startWebBrowser_PB, SIGNAL(clicked()), this, SLOT(onStartWebBrowserClicked())); connect(ui.webInterfaceFilesDirectory_PB, SIGNAL(clicked()), this, SLOT(selectWebInterfaceDirectory())); + + mEventsHandlerId = 0; + + rsEvents->registerEventsHandler( [this](std::shared_ptr /* event */) + { + std::cerr << "Caught JSONAPI event in webui!" << std::endl; + RsQThreadUtils::postToObject([=]() { load(); }, this ); + }, + mEventsHandlerId, RsEventType::JSON_API ); } WebuiPage::~WebuiPage() @@ -127,6 +139,13 @@ void WebuiPage::loadParams() if(it != smap.end()) whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second)); + + if(rsWebUi->isRunning() && rsJsonApi->isRunning()) + ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; + else + ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ; +#else + ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ; #endif } @@ -172,7 +191,6 @@ QString WebuiPage::helpText() const void WebuiPage::onEnableCBClicked(bool checked) { ui.params_GB->setEnabled(checked); - ui.apply_PB->setEnabled(checked); ui.startWebBrowser_PB->setEnabled(checked); QString S; } @@ -203,6 +221,7 @@ void WebuiPage::onApplyClicked() else checkShutdownWebui(); } + load(); } void WebuiPage::onStartWebBrowserClicked() { showWebui(); } diff --git a/retroshare-gui/src/gui/settings/WebuiPage.h b/retroshare-gui/src/gui/settings/WebuiPage.h index ad20d6afb..391612cf8 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.h +++ b/retroshare-gui/src/gui/settings/WebuiPage.h @@ -20,6 +20,8 @@ #pragma once +#include "retroshare/rsevents.h" + #include "retroshare-gui/configpage.h" #include "gui/common/FilesDefs.h" #include "ui_WebuiPage.h" @@ -82,4 +84,6 @@ private: static resource_api::ApiServerLocal* apiServerLocal; #endif static resource_api::RsControlModule* controlModule; + + RsEventsHandlerId_t mEventsHandlerId; }; diff --git a/retroshare-gui/src/gui/settings/WebuiPage.ui b/retroshare-gui/src/gui/settings/WebuiPage.ui index e48cd31c5..91d59736f 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.ui +++ b/retroshare-gui/src/gui/settings/WebuiPage.ui @@ -39,7 +39,7 @@ - TextLabel + Status: From 5e62af44e57822ac0704eefce73120443c580f9a Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 12 Sep 2023 13:50:43 +0200 Subject: [PATCH 21/88] fixed compilation --- retroshare-gui/src/gui/NetworkDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/NetworkDialog.cpp b/retroshare-gui/src/gui/NetworkDialog.cpp index 8db3e1e85..7c2b3fd14 100644 --- a/retroshare-gui/src/gui/NetworkDialog.cpp +++ b/retroshare-gui/src/gui/NetworkDialog.cpp @@ -170,7 +170,7 @@ void NetworkDialog::removeSelectedKeys() std::set friends; for (int i = 0; i < l.size(); i++) { - RsPgpId peer_id = RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l[i].row(), COLUMN_PEERID)).toString().toStdString()); + RsPgpId peer_id = RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l[i].row(), pgpid_item_model::PGP_ITEM_MODEL_COLUMN_PEERID)).toString().toStdString()); RsPeerDetails details ; if(rsPeers->getGPGDetails(peer_id,details)) { From 5251427cbf4483a6e15f8bfad1967fd26a52091e Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 12 Sep 2023 22:28:54 +0200 Subject: [PATCH 22/88] improved webui and jsonapi config pages --- .../src/gui/settings/JsonApiPage.ui | 64 +++++++++---------- retroshare-gui/src/gui/settings/WebuiPage.cpp | 37 +++++++---- 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.ui b/retroshare-gui/src/gui/settings/JsonApiPage.ui index 9227a3251..f8d31e38f 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.ui +++ b/retroshare-gui/src/gui/settings/JsonApiPage.ui @@ -67,38 +67,6 @@ - - - - - - Token: - - - - - - - <html><head/><body><p>Tokens should spell as &quot;user:password&quot; where both user and password are alphanumeric strings.</p></body></html> - - - - - - - Add - - - - - - - Remove - - - - - @@ -141,6 +109,38 @@ + + + + + + Token: + + + + + + + <html><head/><body><p>Tokens should spell as &quot;user:password&quot; where both user and password are alphanumeric strings.</p></body></html> + + + + + + + Add + + + + + + + Remove + + + + + diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index cccf54369..893fd87e2 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -122,7 +122,10 @@ bool WebuiPage::restart() rsWebUi->setUserPassword(ui.password_LE->text().toStdString()); rsWebUi->setHtmlFilesDirectory(ui.webInterfaceFiles_LE->text().toStdString()); + + setCursor(Qt::WaitCursor) ; rsWebUi->restart(); + setCursor(Qt::ArrowCursor) ; return true; } @@ -140,7 +143,7 @@ void WebuiPage::loadParams() if(it != smap.end()) whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second)); - if(rsWebUi->isRunning() && rsJsonApi->isRunning()) + if(rsWebUi->isRunning()) ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; else ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDOFF)) ; @@ -190,9 +193,23 @@ QString WebuiPage::helpText() const void WebuiPage::onEnableCBClicked(bool checked) { - ui.params_GB->setEnabled(checked); - ui.startWebBrowser_PB->setEnabled(checked); - QString S; + QString errmsg; + updateParams(errmsg); + + ui.params_GB->setEnabled(checked); + ui.startWebBrowser_PB->setEnabled(checked); + ui.apply_PB->setEnabled(checked); + + if(checked) + { + if(!restart()) + { + QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); + return; + } + } + else + checkShutdownWebui(); } void WebuiPage::onPortValueChanged(int /*value*/) @@ -211,16 +228,8 @@ void WebuiPage::onApplyClicked() QString errmsg; updateParams(errmsg); - if(ui.enableWebUI_CB->isChecked()) - { - if(!restart()) - { - QMessageBox::warning(0, tr("failed to start Webinterface"), "Failed to start the webinterface."); - return; - } - else - checkShutdownWebui(); - } + restart(); + load(); } From b606b26dd3c201ab15114bd9f589feaaa1c9a56c Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 15 Sep 2023 20:15:29 +0200 Subject: [PATCH 23/88] fixed double allocation of webui page --- retroshare-gui/src/gui/settings/rsettingswin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index e52ca1aed..1d3d4ecc3 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -178,8 +178,7 @@ SettingsPage::initStackedWidget() JsonApiPage *jsonapi_p = new JsonApiPage() ; addPage(jsonapi_p); #ifdef RS_WEBUI - WebuiPage *webui_p = new WebuiPage() ; - addPage(new WebuiPage() ); + addPage(new WebuiPage()); #endif #endif From 0e0430a222703c7746d2ed0114d7740dc694bbe3 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 19 Sep 2023 15:08:52 +0200 Subject: [PATCH 24/88] added more debug info to comment tree widget --- retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp | 7 +++++-- retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp index 4757b036e..1233b3100 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentDialog.cpp @@ -29,6 +29,8 @@ #include #include +//#define DEBUG_COMMENT_DIALOG 1 + /** Constructor */ GxsCommentDialog::GxsCommentDialog(QWidget *parent, const RsGxsId &default_author, RsGxsCommentService *comment_service) : QWidget(parent), ui(new Ui::GxsCommentDialog) @@ -96,8 +98,9 @@ void GxsCommentDialog::commentClear() void GxsCommentDialog::commentLoad(const RsGxsGroupId &grpId, const std::set& msg_versions,const RsGxsMessageId& most_recent_msgId,bool use_cache) { #ifdef DEBUG_COMMENT_DIALOG - std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", most recent msg version: " << most_recent_msgId << ")"; - std::cerr << std::endl; + std::cerr << "GxsCommentDialog::commentLoad(" << grpId << ", most recent msg version: " << most_recent_msgId << ")" << std::endl; + for(const auto& mid:msg_versions) + std::cerr << " msg version: " << mid << std::endl; #endif mGrpId = grpId; diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index 517543b9a..6a7371384 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -73,6 +73,7 @@ std::map > GxsCommentTreeWidget::mComm QMutex GxsCommentTreeWidget::mCacheMutex; //#define USE_NEW_DELEGATE 1 +//#define DEBUG_GXSCOMMENT_TREEWIDGET 1 // This class allows to draw the item using an appropriate size @@ -508,6 +509,8 @@ void GxsCommentTreeWidget::service_requestComments(const RsGxsGroupId& group_id, /* request comments */ #ifdef DEBUG_GXSCOMMENT_TREEWIDGET std::cerr << "GxsCommentTreeWidget::service_requestComments for group " << group_id << std::endl; + for(const auto& mid:msgIds) + std::cerr << " including message " << mid << std::endl; #endif RsThread::async([this,group_id,msgIds]() From 11c07cd7c3aae4d50a2f488c3148fb6d2b49b7b5 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 19 Sep 2023 15:10:29 +0200 Subject: [PATCH 25/88] moved endResetModel() call to the endof internal data update in RsFriendListModel --- retroshare-gui/src/gui/common/FriendListModel.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index f8740466d..622ae3930 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -1145,8 +1145,6 @@ void RsFriendListModel::updateInternalData() mLocations.clear(); mTopLevel.clear(); - endResetModel(); - auto TL = mTopLevel ; // This allows to fill TL without touching mTopLevel outside of [begin/end]InsertRows(). // create a map of profiles and groups @@ -1282,7 +1280,8 @@ void RsFriendListModel::updateInternalData() endInsertRows(); } - postMods(); + endResetModel(); + postMods(); mLastInternalDataUpdate = time(NULL); } From 034bddf1efa62b60fc66fb27cf3358e5fa9c6413 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 22 Sep 2023 22:50:45 +0200 Subject: [PATCH 26/88] made registered services list non editable --- retroshare-gui/src/gui/settings/JsonApiPage.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index 4e33c05e6..07e75032f 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -60,6 +60,7 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) QRegExpValidator *ipValidator = new QRegExpValidator(ipRegex, this); ui.listenAddressLineEdit->setValidator(ipValidator); + ui.providersListView->setSelectionMode(QAbstractItemView::NoSelection); // prevents edition. mEventHandlerId = 0; From 41069a0fa5b1200c055b0ca38c36415c4a0b0b08 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 23 Sep 2023 17:31:24 +0200 Subject: [PATCH 27/88] added missing removal of event handler in jsonapi and webui settings --- retroshare-gui/src/gui/settings/JsonApiPage.cc | 4 ++++ retroshare-gui/src/gui/settings/JsonApiPage.h | 2 +- retroshare-gui/src/gui/settings/WebuiPage.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index 07e75032f..67e5f22b8 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -72,6 +72,10 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) mEventHandlerId, RsEventType::JSON_API ); } +JsonApiPage::~JsonApiPage() +{ + rsEvents->unregisterEventsHandler(mEventHandlerId); +} QString JsonApiPage::helpText() const { return tr("

  Webinterface

\ diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.h b/retroshare-gui/src/gui/settings/JsonApiPage.h index f06340d1a..ef28a4294 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.h +++ b/retroshare-gui/src/gui/settings/JsonApiPage.h @@ -33,7 +33,7 @@ class JsonApiPage : public ConfigPage public: JsonApiPage(QWidget * parent = nullptr, Qt::WindowFlags flags = 0); - ~JsonApiPage() override = default; + ~JsonApiPage() override ; virtual QPixmap iconPixmap() const override { diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index 893fd87e2..d7ff0b894 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -66,7 +66,7 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) WebuiPage::~WebuiPage() { - + rsEvents->unregisterEventsHandler(mEventsHandlerId); } void WebuiPage::selectWebInterfaceDirectory() From a99f686fd1df1b8e7801fcdd5e6fe8979a9df0cf Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 23 Sep 2023 17:53:12 +0200 Subject: [PATCH 28/88] restricted SPAM/STAR/TAGS to inbox, and made msg summary list refer to current box only --- retroshare-gui/src/gui/msgs/MessageModel.cpp | 4 ++++ retroshare-gui/src/gui/msgs/MessageModel.h | 1 + retroshare-gui/src/gui/msgs/MessagesDialog.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/msgs/MessageModel.cpp b/retroshare-gui/src/gui/msgs/MessageModel.cpp index 09508cad6..6116e42b4 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.cpp +++ b/retroshare-gui/src/gui/msgs/MessageModel.cpp @@ -690,6 +690,10 @@ void RsMessageModel::setCurrentBox(Rs::Msgs::BoxName bn) } } +Rs::Msgs::BoxName RsMessageModel::currentBox() const +{ + return mCurrentBox; +} void RsMessageModel::setQuickViewFilter(QuickViewFilter fn) { if(fn != mQuickViewFilter) diff --git a/retroshare-gui/src/gui/msgs/MessageModel.h b/retroshare-gui/src/gui/msgs/MessageModel.h index fb8c6daa5..d23b21f86 100644 --- a/retroshare-gui/src/gui/msgs/MessageModel.h +++ b/retroshare-gui/src/gui/msgs/MessageModel.h @@ -100,6 +100,7 @@ public: // This method will asynchroneously update the data void setCurrentBox(Rs::Msgs::BoxName bn) ; + Rs::Msgs::BoxName currentBox() const ; void setQuickViewFilter(QuickViewFilter fn) ; void setFilter(FilterType filter_type, const QStringList& strings) ; diff --git a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp index de91df5ff..be9eedf6b 100644 --- a/retroshare-gui/src/gui/msgs/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/msgs/MessagesDialog.cpp @@ -925,9 +925,9 @@ void MessagesDialog::changeBox(int box_row) ui.messageTreeWidget->setPlaceholderText(placeholderText); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_READ,box_row!=ROW_INBOX); - ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row==ROW_OUTBOX); - ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row==ROW_OUTBOX); - ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row==ROW_OUTBOX); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_STAR,box_row!=ROW_INBOX); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_SPAM,box_row!=ROW_INBOX); + ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_TAGS,box_row!=ROW_INBOX); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_MSGID,true); ui.messageTreeWidget->setColumnHidden(RsMessageModel::COLUMN_THREAD_CONTENT,true); } @@ -1296,7 +1296,7 @@ void MessagesDialog::updateMessageSummaryList() /* calculating the new messages */ std::list msgList; - rsMail->getMessageSummaries(Rs::Msgs::BoxName::BOX_ALL,msgList); + rsMail->getMessageSummaries(mMessageModel->currentBox(),msgList); QMap tagCount; From 606baf6f3ed11ed78002d47f33234197850438fa Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 8 Oct 2023 23:49:16 +0200 Subject: [PATCH 29/88] updated webui, libbitdht and libretroshare to latest submodule commit --- .gitmodules | 4 ++-- libbitdht | 2 +- libretroshare | 2 +- retroshare-webui | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index 3c767cf19..84d326387 100644 --- a/.gitmodules +++ b/.gitmodules @@ -30,8 +30,8 @@ branch = master [submodule "libretroshare"] path = libretroshare - url = ../libretroshare + url = https://github.com/RetroShare/libretroshare.git branch = master [submodule "retroshare-webui"] path = retroshare-webui - url = ../RSNewWebUI + url = https://github.com/RetroShare/RSNewWebUI.git diff --git a/libbitdht b/libbitdht index 659423769..2ddc86fb5 160000 --- a/libbitdht +++ b/libbitdht @@ -1 +1 @@ -Subproject commit 659423769541169457c41f71c8a038e2d64ba079 +Subproject commit 2ddc86fb575a61170f4c06a00152e3e7dc74c8f4 diff --git a/libretroshare b/libretroshare index 8c02b54e4..a54563935 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 8c02b54e4d16e38b28e77263a0b1570c50df4c99 +Subproject commit a545639352ceb0350041b2889dd2ae74574a402f diff --git a/retroshare-webui b/retroshare-webui index b0ddb0918..542a8c07b 160000 --- a/retroshare-webui +++ b/retroshare-webui @@ -1 +1 @@ -Subproject commit b0ddb09184e8fff86bd3325e00c6d4b329ae1790 +Subproject commit 542a8c07bd02f9bb9082f7aba5aaaed54e643fc1 From 7a873c3b534adb897fe7a4e7a81f7439fedc87ca Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 12 Oct 2023 20:18:21 +0200 Subject: [PATCH 30/88] fixed compilation on ubuntu 18.04 --- .../src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index ea27be6f9..2e292444e 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -514,13 +514,13 @@ void GxsChannelPostsWidgetWithModel::keyPressEvent(QKeyEvent *e) if(e->key() == Qt::Key_Left && index.column()==0) { - ui->postsTree->setCurrentIndex(index.siblingAtColumn(n)); + ui->postsTree->setCurrentIndex(index.sibling(index.row(),n)); e->accept(); return; } if(e->key() == Qt::Key_Right && index.column()==n) { - ui->postsTree->setCurrentIndex(index.siblingAtColumn(0)); + ui->postsTree->setCurrentIndex(index.sibling(index.row(),0)); e->accept(); return; } From d83709d51997760d237d8c0c426f5b599763b34b Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 12 Oct 2023 20:18:36 +0200 Subject: [PATCH 31/88] fixed implicit type warning --- retroshare-gui/src/gui/msgs/MessageComposer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index 0df2dbd8e..040681095 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -255,7 +255,7 @@ private: QList tagLabels; // needed to send system flags with reply - unsigned msgFlags; + unsigned int msgFlags; RSTreeWidgetItemCompareRole *m_compareRole; QCompleter *m_completer; From d8bca5c56db4f58b8afe486fde87fde97bef1102 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 12 Oct 2023 20:18:53 +0200 Subject: [PATCH 32/88] removed some debug output --- retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp index 517543b9a..4de6e8675 100644 --- a/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp +++ b/retroshare-gui/src/gui/gxs/GxsCommentTreeWidget.cpp @@ -42,6 +42,8 @@ #include +//#define DEBUG_COMMENT_TREE_WIDGET + #define PCITEM_COLUMN_COMMENT 0 #define PCITEM_COLUMN_AUTHOR 1 #define PCITEM_COLUMN_DATE 2 @@ -765,8 +767,10 @@ void GxsCommentTreeWidget::insertComments(const std::vector& comme new_comments.push_back(comment.mMeta.mMsgId); /* convert to a QTreeWidgetItem */ +#ifdef DEBUG_COMMENT_TREE_WIDGET std::cerr << "GxsCommentTreeWidget::service_loadThread() Got Comment: " << comment.mMeta.mMsgId; std::cerr << std::endl; +#endif GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(NULL,GxsIdDetails::ICON_TYPE_AVATAR) ; QString text; From 5db6eb0359a190838b08fd85256bfc36f1c8b66c Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 12 Oct 2023 21:03:00 +0200 Subject: [PATCH 33/88] updated retroshare base dir to latest version of libretroshare --- libretroshare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare b/libretroshare index a54563935..3bb5a2b28 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit a545639352ceb0350041b2889dd2ae74574a402f +Subproject commit 3bb5a2b282949bc170dcff6141424cb095e4bb7b From e9d4cacac520e497a0402d4bb8c31c295c8bd7cd Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 13 Oct 2023 18:55:01 +0200 Subject: [PATCH 34/88] Attempt to fix udp-discovery-cpp submodule ref --- .gitmodules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 3c767cf19..6ae5adcfb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,7 +10,8 @@ [submodule "supportlibs/udp-discovery-cpp"] path = supportlibs/udp-discovery-cpp url = https://github.com/truvorskameikin/udp-discovery-cpp.git - branch = develop + branch = master +# develop branch was removed we were using it at commit f3a3103a6c52e5707629e8d0a7e279a7758fe845 [submodule "supportlibs/rapidjson"] path = supportlibs/rapidjson url = https://github.com/Tencent/rapidjson.git From 9d406ba26f9cad3d23b3e6dd51d062e0924afc60 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 10:34:17 +0200 Subject: [PATCH 35/88] Fix inconsistence in friendserver QMake build option naming --- retroshare.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/retroshare.pri b/retroshare.pri index 9ed316b9a..19dd5434f 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -52,9 +52,9 @@ CONFIG *= retroshare_service no_retroshare_service:CONFIG -= retroshare_service # To disable RetroShare FriendServer append the following assignation to -# qmake command line "CONFIG+=no_rs_friendserver" +# qmake command line "CONFIG+=no_retroshare_friendserver" CONFIG *= retroshare_friendserver -no_rs_friendserver:CONFIG -= retroshare_friendserver +no_retroshare_friendserver:CONFIG -= retroshare_friendserver # To disable SQLCipher support append the following assignation to qmake # command line "CONFIG+=no_sqlcipher" From eab5c4bf4c7dc61ada0f90e3e2f899b6d805e579 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 10:36:19 +0200 Subject: [PATCH 36/88] Updated gui build script according to new friendserver naming --- build_scripts/OBS | 2 +- build_scripts/Windows/build/build.bat | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/OBS b/build_scripts/OBS index df16cb915..31fa63acb 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit df16cb915465d058c75277678799ce4dadeae287 +Subproject commit 31fa63acb6394916ba605aa1a08e86ed47068708 diff --git a/build_scripts/Windows/build/build.bat b/build_scripts/Windows/build/build.bat index 487647568..91ff71382 100644 --- a/build_scripts/Windows/build/build.bat +++ b/build_scripts/Windows/build/build.bat @@ -56,7 +56,7 @@ if "%ParamWebui%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_webui if "%ParamPlugins%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retroshare_plugins if "%ParamUseNativeDialogs%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_use_native_dialogs if "%ParamService%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_retroshare_service -if "%ParamFriendServer%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_rs_friendserver +if "%ParamFriendServer%" NEQ "1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% no_retroshare_friendserver if "%ParamEmbeddedFriendServer%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% rs_efs qmake "%SourcePath%\RetroShare.pro" -r -spec win32-g++ "CONFIG+=%RS_QMAKE_CONFIG%" "EXTERNAL_LIB_DIR=%BuildLibsPath%\libs" From 9b7149f16e54821b634497ae8c8496ee4e55d127 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 11:44:58 +0200 Subject: [PATCH 37/88] Update OBS submodule --- build_scripts/OBS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/OBS b/build_scripts/OBS index 31fa63acb..1a859d239 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit 31fa63acb6394916ba605aa1a08e86ed47068708 +Subproject commit 1a859d2392cd6b148c5a5aa3df36eca3c2e6140a From e67abc36af55609bfb96d7f13c017b43b41afa5d Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 12:23:32 +0200 Subject: [PATCH 38/88] Update OBS submodule --- build_scripts/OBS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/OBS b/build_scripts/OBS index 1a859d239..1de347e99 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit 1a859d2392cd6b148c5a5aa3df36eca3c2e6140a +Subproject commit 1de347e993ed1147bb84cdaf6c0604ff220eb221 From d84b981e9ab41e27e6dc63ddc4e3a6aa38c14c82 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 18:56:04 +0200 Subject: [PATCH 39/88] Update libsam3 submodule --- supportlibs/libsam3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supportlibs/libsam3 b/supportlibs/libsam3 index 8623304b6..2226ef0a2 160000 --- a/supportlibs/libsam3 +++ b/supportlibs/libsam3 @@ -1 +1 @@ -Subproject commit 8623304b62294dafbe477573f321a464fef721dd +Subproject commit 2226ef0a20a001ec0942be6abe5e909c15447d8e From 98c27fcf6d106be7782a16cc55d1ff3a658a9322 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Wed, 18 Oct 2023 18:57:11 +0200 Subject: [PATCH 40/88] Update libretroshare submodule --- libretroshare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare b/libretroshare index 3bb5a2b28..a10087b27 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 3bb5a2b282949bc170dcff6141424cb095e4bb7b +Subproject commit a10087b27a804d0a43745aa39e7515dd691740f3 From d26f7db319084dbdb50a8ca59fa9c4d8a66c7a7d Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 21 Oct 2023 14:35:47 +0200 Subject: [PATCH 41/88] fixed non working expand button in forum feed --- retroshare-gui/src/gui/feeds/GxsForumGroupItem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h index 29b7851f2..bfe24f2a7 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h @@ -47,7 +47,6 @@ public: protected: /* FeedItem */ virtual void doExpand(bool open); - void toggle() override; /* GxsGroupFeedItem */ virtual QString groupName(); @@ -56,6 +55,7 @@ protected: private slots: void subscribeForum(); + void toggle() override; private: void fill(); From 168f36bc2101b5283d05378d356fad317df207fa Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 24 Oct 2023 22:44:40 +0200 Subject: [PATCH 42/88] Added colors for the output --- retroshare-service/src/retroshare-service.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 040a2012d..a8c7ec37d 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -60,7 +60,7 @@ public: bool /*prev_is_bad*/, std::string& password, bool& cancel ) { std::string question1 = title + - "\nPlease enter your PGP password for key:\n " + + "\033[0;32mPlease enter your PGP password for key:\n \033[0m" + question + " :"; password = RsUtil::rs_getpass(question1.c_str()) ; cancel = false ; @@ -182,9 +182,9 @@ int main(int argc, char* argv[]) while(keepRunning) { webui_pass1 = RsUtil::rs_getpass( - "Please register a password for the web interface: " ); + "\033[0;32mPlease register a password for the web interface:\033[0m" ); webui_pass2 = RsUtil::rs_getpass( - "Please enter the same password again : " ); + "\033[0;32mPlease enter the same password again :\033[0m" ); if(webui_pass1 != webui_pass2) { @@ -223,12 +223,12 @@ int main(int argc, char* argv[]) if(locations.size() == 0) { - RsErr() << "No available accounts. You cannot use option -U list" << std::endl; + RsErr() << "\033[1;33mNo available accounts. You cannot use option -U list\033[0m" << std::endl; return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; } std::cout << std::endl << std::endl - << "Available accounts:" << std::endl; + << "\033[0;32mAvailable accounts:\033[0m" << std::endl; int accountCountDigits = static_cast( ceil(log(locations.size())/log(10.0)) ); @@ -244,7 +244,7 @@ int main(int argc, char* argv[]) uint32_t nacc = 0; while(keepRunning && (nacc < 1 || nacc >= locations.size())) { - std::cout << "Please enter account number: "; + std::cout << "\033[0;32mPlease enter account number: \033[0m"; std::cout.flush(); std::string inputStr; From 8814cbd9f279441eb98892e503b2af869507aa39 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 25 Oct 2023 11:54:51 +0200 Subject: [PATCH 43/88] color improvements for accounts display --- retroshare-service/src/retroshare-service.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index a8c7ec37d..afda36771 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -233,18 +233,18 @@ int main(int argc, char* argv[]) int accountCountDigits = static_cast( ceil(log(locations.size())/log(10.0)) ); for( uint32_t i=0; i= locations.size())) { - std::cout << "\033[0;32mPlease enter account number: \033[0m"; + std::cout << "\033[0;32mPlease enter account number:\n \033[0m"; std::cout.flush(); std::string inputStr; From 9f89ac42e739cc733027544710e7d421a4ea5ce6 Mon Sep 17 00:00:00 2001 From: defnax Date: Wed, 25 Oct 2023 12:13:15 +0200 Subject: [PATCH 44/88] Fix spacing --- retroshare-service/src/retroshare-service.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index afda36771..d643fc36f 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -244,7 +244,7 @@ int main(int argc, char* argv[]) uint32_t nacc = 0; while(keepRunning && (nacc < 1 || nacc >= locations.size())) { - std::cout << "\033[0;32mPlease enter account number:\n \033[0m"; + std::cout << "\033[0;32mPlease enter account number:\n\033[0m"; std::cout.flush(); std::string inputStr; From 36282e750de13f88bef50947d5b3ab560263f3ad Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 26 Oct 2023 18:31:37 +0200 Subject: [PATCH 45/88] update output colors --- retroshare-service/src/retroshare-service.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index d643fc36f..76162647c 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -188,12 +188,12 @@ int main(int argc, char* argv[]) if(webui_pass1 != webui_pass2) { - std::cout << "Passwords do not match!" << std::endl; + std::cout << "\033[1;31mPasswords do not match!\033[0m" << std::endl; continue; } if(webui_pass1.empty()) { - std::cout << "Password cannot be empty!" << std::endl; + std::cout << "\033[1;31mPassword cannot be empty!\033[0m" << std::endl; continue; } @@ -223,7 +223,7 @@ int main(int argc, char* argv[]) if(locations.size() == 0) { - RsErr() << "\033[1;33mNo available accounts. You cannot use option -U list\033[0m" << std::endl; + RsErr() << "\033[1;31mNo available accounts. You cannot use option -U list\033[0m" << std::endl; return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; } @@ -234,8 +234,8 @@ int main(int argc, char* argv[]) for( uint32_t i=0; i
- Subscribe to Channel + Subscribe this Channel Subscribe diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp index 43c94a377..23c9c35ac 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp @@ -35,8 +35,9 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate) { setup(); - requestGroup(); + + } GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list& added_moderators,const std::list& removed_moderators,bool isHome, bool autoUpdate): @@ -47,6 +48,29 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co setup(); requestGroup(); + + mEventHandlerId = 0; + rsEvents->registerEventsHandler( [this](std::shared_ptr event) + { + RsQThreadUtils::postToObject([=]() + { + const auto *e = dynamic_cast(event.get()); + + if(!e || e->mForumGroupId != this->groupId()) + return; + + switch(e->mForumEventCode) + { + case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: + case RsForumEventCode::UPDATED_FORUM: + case RsForumEventCode::MODERATOR_LIST_CHANGED: + loadGroup(); + break; + default: + break; + } + }, this ); + }, mEventHandlerId, RsEventType::GXS_FORUMS ); } GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) : @@ -59,7 +83,8 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co GxsForumGroupItem::~GxsForumGroupItem() { - delete(ui); + rsEvents->unregisterEventsHandler(mEventHandlerId); + delete(ui); } void GxsForumGroupItem::setup() diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h index bfe24f2a7..e09a3cb13 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h @@ -22,6 +22,7 @@ #define _GXSFORUMGROUPITEM_H #include +#include #include "gui/gxs/GxsGroupFeedItem.h" namespace Ui { @@ -39,19 +40,19 @@ public: GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate); GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list& added_moderators,const std::list& removed_moderators,bool isHome, bool autoUpdate); GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate); - ~GxsForumGroupItem(); + virtual ~GxsForumGroupItem() override; bool setGroup(const RsGxsForumGroup &group); uint64_t uniqueIdentifier() const override { return hash_64bits("GxsForumGroupItem " + groupId().toStdString()) ; } protected: /* FeedItem */ - virtual void doExpand(bool open); + virtual void doExpand(bool open) override; /* GxsGroupFeedItem */ - virtual QString groupName(); + virtual QString groupName() override; virtual void loadGroup() override; - virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_FORUM; } + virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_FORUM; } private slots: void subscribeForum(); @@ -69,6 +70,8 @@ private: std::list mAddedModerators; std::list mRemovedModerators; + + RsEventsHandlerId_t mEventHandlerId; }; #endif From ab7deede57f81a89c7dc34acee244c1f4dd9299e Mon Sep 17 00:00:00 2001 From: defnax Date: Sun, 29 Oct 2023 18:24:25 +0100 Subject: [PATCH 47/88] clean the color code from the text --- retroshare-service/src/retroshare-service.cc | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 76162647c..9830a56f5 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -60,7 +60,7 @@ public: bool /*prev_is_bad*/, std::string& password, bool& cancel ) { std::string question1 = title + - "\033[0;32mPlease enter your PGP password for key:\n \033[0m" + + "\033[0;32m" "Please enter your PGP password for key:\n " "\033[0m" + question + " :"; password = RsUtil::rs_getpass(question1.c_str()) ; cancel = false ; @@ -182,18 +182,18 @@ int main(int argc, char* argv[]) while(keepRunning) { webui_pass1 = RsUtil::rs_getpass( - "\033[0;32mPlease register a password for the web interface:\033[0m" ); + "\033[0;32m" "Please register a password for the web interface:" "\033[0m" ); webui_pass2 = RsUtil::rs_getpass( - "\033[0;32mPlease enter the same password again :\033[0m" ); + "\033[0;32m" "Please enter the same password again :" "\033[0m" ); if(webui_pass1 != webui_pass2) { - std::cout << "\033[1;31mPasswords do not match!\033[0m" << std::endl; + std::cout << "\033[1;31m" "Passwords do not match!" "\033[0m" << std::endl; continue; } if(webui_pass1.empty()) { - std::cout << "\033[1;31mPassword cannot be empty!\033[0m" << std::endl; + std::cout << "\033[1;31m" "Password cannot be empty!" "\033[0m" << std::endl; continue; } @@ -223,28 +223,28 @@ int main(int argc, char* argv[]) if(locations.size() == 0) { - RsErr() << "\033[1;31mNo available accounts. You cannot use option -U list\033[0m" << std::endl; + RsErr() << "\033[1;31m" "No available accounts. You cannot use option -U list" "\033[0m" << std::endl; return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; } std::cout << std::endl << std::endl - << "\033[0;32mAvailable accounts:\033[0m" << std::endl; + << "\033[0;32m" "Available accounts:" "\033[0m" << std::endl; int accountCountDigits = static_cast( ceil(log(locations.size())/log(10.0)) ); for( uint32_t i=0; i= locations.size())) { - std::cout << "\033[0;32mPlease enter account number:\n\033[0m"; + std::cout << "\033[0;32m" "Please enter account number:\n" "\033[0m"; std::cout.flush(); std::string inputStr; @@ -264,7 +264,7 @@ int main(int argc, char* argv[]) RsPeerId ssl_id(prefUserString); if(ssl_id.isNull()) { - RsErr() << "\033[1;31mInvalid User location id: a hexadecimal ID is expected.\033[0m" + RsErr() << "\033[1;31m" "Invalid User location id: a hexadecimal ID is expected." "\033[0m" << std::endl; return -EINVAL; } @@ -299,7 +299,7 @@ int main(int argc, char* argv[]) if(RsAccounts::isTorAuto()) { - std::cerr << "\033[0;32(II) Hidden service is ready:\033[0m" << std::endl; + std::cerr << "\033[0;32" "(II) Hidden service is ready:" "\033[0m" << std::endl; std::string service_id ; std::string onion_address ; From 55651e73d9d3b073bc4c9f49a4e82a97548127eb Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 29 Oct 2023 20:47:00 +0100 Subject: [PATCH 48/88] made ConnectFriendWizard to accept retroshare links --- .../src/gui/connect/ConnectFriendWizard.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp index 4a7429f27..7ffdcd687 100755 --- a/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp +++ b/retroshare-gui/src/gui/connect/ConnectFriendWizard.cpp @@ -34,6 +34,7 @@ #endif #include "gui/common/FilesDefs.h" +#include "gui/RetroShareLink.h" #include "gui/settings/rsharesettings.h" #include "util/misc.h" #include "ConnectFriendWizard.h" @@ -449,8 +450,9 @@ void ConnectFriendWizard::initializePage(int id) } sockaddr_storage addr ; - +#ifdef DEBUG_FRIENDWIZARD std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl; +#endif if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr)) { @@ -870,7 +872,18 @@ void ConnectFriendWizard::cleanFriendCert() bool certValid = false; QString errorMsg ; QString certDetail; - std::string cert = ui->friendCertEdit->toPlainText().toUtf8().constData(); + + std::string cert ; + RetroShareLink rslink(ui->friendCertEdit->toPlainText()); + + if(rslink.valid() && rslink.type() == RetroShareLink::TYPE_CERTIFICATE) + cert = rslink.radix().toStdString(); + else + cert = ui->friendCertEdit->toPlainText().toUtf8().constData(); + +#ifdef DEBUG_FRIENDWIZARD + std::cerr << "Friend cert:\"" << cert << "\"" << std::endl; +#endif if (cert.empty()) { ui->friendCertCleanLabel->setToolTip(""); @@ -936,7 +949,7 @@ void ConnectFriendWizard::cleanFriendCert() void ConnectFriendWizard::pasteCert() { QClipboard *clipboard = QApplication::clipboard(); - ui->friendCertEdit->setPlainText(clipboard->text()); + ui->friendCertEdit->setPlainText(clipboard->text()); } void ConnectFriendWizard::openCert() From ab61149cb107ee07830b3c5ec62baf5946dd6172 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 29 Oct 2023 21:05:02 +0100 Subject: [PATCH 49/88] fixed missing event handler registration --- .../src/gui/feeds/GxsChannelGroupItem.cpp | 21 +++++++++++-------- .../src/gui/feeds/GxsChannelGroupItem.h | 1 + .../src/gui/feeds/GxsForumGroupItem.cpp | 8 ++++--- .../src/gui/feeds/GxsForumGroupItem.h | 1 + 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp index dc20c3aee..a6213e740 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.cpp @@ -37,9 +37,20 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsChannels, autoUpdate) { setup(); - requestGroup(); + addEventHandler(); +} +GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) : + GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate) +{ + setup(); + setGroup(group); + addEventHandler(); +} + +void GxsChannelGroupItem::addEventHandler() +{ mEventHandlerId = 0; rsEvents->registerEventsHandler( [this](std::shared_ptr event) { @@ -64,14 +75,6 @@ GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId }, mEventHandlerId, RsEventType::GXS_CHANNELS ); } -GxsChannelGroupItem::GxsChannelGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, bool isHome, bool autoUpdate) : - GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsChannels, autoUpdate) -{ - setup(); - - setGroup(group); -} - GxsChannelGroupItem::~GxsChannelGroupItem() { rsEvents->unregisterEventsHandler(mEventHandlerId); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.h b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.h index 8f0a6e332..b0366bc98 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelGroupItem.h @@ -60,6 +60,7 @@ private slots: private: void fill(); void setup(); + void addEventHandler(); private: RsGxsChannelGroup mGroup; diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp index 23c9c35ac..5ad2e92f6 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp @@ -36,8 +36,7 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co { setup(); requestGroup(); - - + addEventHandler(); } GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list& added_moderators,const std::list& removed_moderators,bool isHome, bool autoUpdate): @@ -46,9 +45,12 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co mRemovedModerators(removed_moderators) { setup(); - requestGroup(); + addEventHandler(); +} +void GxsForumGroupItem::addEventHandler() +{ mEventHandlerId = 0; rsEvents->registerEventsHandler( [this](std::shared_ptr event) { diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h index e09a3cb13..d80671e5a 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.h @@ -61,6 +61,7 @@ private slots: private: void fill(); void setup(); + void addEventHandler(); private: RsGxsForumGroup mGroup; From b02acfae4bc700a893933ac1e7eef55ddbb19f4d Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 29 Oct 2023 21:06:09 +0100 Subject: [PATCH 50/88] fixed missing event handler registration --- retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp index 5ad2e92f6..663951a6c 100644 --- a/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsForumGroupItem.cpp @@ -79,8 +79,8 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate) { setup(); - setGroup(group); + addEventHandler(); } GxsForumGroupItem::~GxsForumGroupItem() From c502b0df068419c7d6dd1dc66dbd6e87e5c881db Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 30 Oct 2023 22:43:17 +0100 Subject: [PATCH 51/88] coloring hidden outputs --- retroshare-service/src/retroshare-service.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 9830a56f5..1ae2506da 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -312,13 +312,13 @@ int main(int argc, char* argv[]) RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); RsTor::getProxyServerInfo(proxy_server_address,proxy_server_port) ; - std::cerr << " onion address : " << onion_address << std::endl; - std::cerr << " service_id : " << service_id << std::endl; - std::cerr << " service port : " << service_port << std::endl; - std::cerr << " target port : " << service_target_port << std::endl; - std::cerr << " target address : " << service_target_address << std::endl; + std::cerr << "\033[0;32" " onion address : " "\033[0m" << onion_address << std::endl; + std::cerr << "\033[0;32" " service_id : " "\033[0m" << service_id << std::endl; + std::cerr << "\033[0;32" " service port : " "\033[0m" << service_port << std::endl; + std::cerr << "\033[0;32" " target port : " "\033[0m" << service_target_port << std::endl; + std::cerr << "\033[0;32" " target address : " "\033[0m" << service_target_address << std::endl; - std::cerr << "Setting proxy server to " << service_target_address << ":" << service_target_port << std::endl; + std::cerr << "\033[0;32" "Setting proxy server to " "\033[0m" << service_target_address << ":" << service_target_port << std::endl; rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address, service_target_port); rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address, service_port); From fb78591bafc6684ed154d08c56b76173179dc40c Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 1 Nov 2023 15:52:02 +0100 Subject: [PATCH 52/88] fixed colored output --- retroshare-service/src/retroshare-service.cc | 69 ++++++++++++-------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 1ae2506da..c68a1b80a 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -33,6 +33,7 @@ #include "retroshare/rsiface.h" #include "util/stacktrace.h" +#include "util/rsprint.h" #include "util/argstream.h" #include "util/rskbdinput.h" #include "util/rsdir.h" @@ -48,6 +49,28 @@ static CrashStackTrace gCrashStackTrace; +// We should move these functions to rsprint in libretroshare + +#define COLOR_GREEN 0 +#define COLOR_YELLOW 1 +#define COLOR_BLUE 2 +#define COLOR_PURPLE 3 +#define COLOR_RED 4 + +std::string colored(int color,const std::string& s) +{ + switch(color) + { + case COLOR_GREEN : return "\033[0;32m"+s+"\033[0m"; + case COLOR_YELLOW: return "\033[0;33m"+s+"\033[0m"; + case COLOR_BLUE : return "\033[0;36m"+s+"\033[0m"; + case COLOR_PURPLE: return "\033[0;35m"+s+"\033[0m"; + case COLOR_RED : return "\033[0;31m"+s+"\033[0m"; + default: + return s; + } +} + #ifdef RS_SERVICE_TERMINAL_LOGIN class RsServiceNotify: public NotifyClient { @@ -59,9 +82,7 @@ public: const std::string& title, const std::string& question, bool /*prev_is_bad*/, std::string& password, bool& cancel ) { - std::string question1 = title + - "\033[0;32m" "Please enter your PGP password for key:\n " "\033[0m" + - question + " :"; + std::string question1 = title + colored(COLOR_GREEN,"Please enter your PGP password for key:\n ") + question + " :"; password = RsUtil::rs_getpass(question1.c_str()) ; cancel = false ; @@ -181,19 +202,17 @@ int main(int argc, char* argv[]) while(keepRunning) { - webui_pass1 = RsUtil::rs_getpass( - "\033[0;32m" "Please register a password for the web interface:" "\033[0m" ); - webui_pass2 = RsUtil::rs_getpass( - "\033[0;32m" "Please enter the same password again :" "\033[0m" ); + webui_pass1 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please register a password for the web interface: ")); + webui_pass2 = RsUtil::rs_getpass( colored(COLOR_GREEN,"Please enter the same password again : ")); if(webui_pass1 != webui_pass2) { - std::cout << "\033[1;31m" "Passwords do not match!" "\033[0m" << std::endl; + std::cout << colored(COLOR_RED,"Passwords do not match!") << std::endl; continue; } if(webui_pass1.empty()) { - std::cout << "\033[1;31m" "Password cannot be empty!" "\033[0m" << std::endl; + std::cout << colored(COLOR_RED,"Password cannot be empty!") << std::endl; continue; } @@ -223,28 +242,26 @@ int main(int argc, char* argv[]) if(locations.size() == 0) { - RsErr() << "\033[1;31m" "No available accounts. You cannot use option -U list" "\033[0m" << std::endl; + RsErr() << colored(COLOR_RED,"No available accounts. You cannot use option -U list") << std::endl; return -RsInit::ERR_NO_AVAILABLE_ACCOUNT; } std::cout << std::endl << std::endl - << "\033[0;32m" "Available accounts:" "\033[0m" << std::endl; + << colored(COLOR_GREEN,"Available accounts:") << std::endl; int accountCountDigits = static_cast( ceil(log(locations.size())/log(10.0)) ); for( uint32_t i=0; i= locations.size())) { - std::cout << "\033[0;32m" "Please enter account number:\n" "\033[0m"; + std::cout << colored(COLOR_GREEN,"Please enter account number:\n"); std::cout.flush(); std::string inputStr; @@ -264,7 +281,7 @@ int main(int argc, char* argv[]) RsPeerId ssl_id(prefUserString); if(ssl_id.isNull()) { - RsErr() << "\033[1;31m" "Invalid User location id: a hexadecimal ID is expected." "\033[0m" + RsErr() << colored(COLOR_RED,"Invalid User location id: a hexadecimal ID is expected.") << std::endl; return -EINVAL; } @@ -299,7 +316,7 @@ int main(int argc, char* argv[]) if(RsAccounts::isTorAuto()) { - std::cerr << "\033[0;32" "(II) Hidden service is ready:" "\033[0m" << std::endl; + std::cerr << colored(COLOR_GREEN,"(II) Hidden service is ready:") << std::endl; std::string service_id ; std::string onion_address ; @@ -312,13 +329,13 @@ int main(int argc, char* argv[]) RsTor::getHiddenServiceInfo(service_id,onion_address,service_port,service_target_address,service_target_port); RsTor::getProxyServerInfo(proxy_server_address,proxy_server_port) ; - std::cerr << "\033[0;32" " onion address : " "\033[0m" << onion_address << std::endl; - std::cerr << "\033[0;32" " service_id : " "\033[0m" << service_id << std::endl; - std::cerr << "\033[0;32" " service port : " "\033[0m" << service_port << std::endl; - std::cerr << "\033[0;32" " target port : " "\033[0m" << service_target_port << std::endl; - std::cerr << "\033[0;32" " target address : " "\033[0m" << service_target_address << std::endl; + std::cerr << colored(COLOR_GREEN," onion address : ") << onion_address << std::endl; + std::cerr << colored(COLOR_GREEN," service_id : ") << service_id << std::endl; + std::cerr << colored(COLOR_GREEN," service port : ") << service_port << std::endl; + std::cerr << colored(COLOR_GREEN," target port : ") << service_target_port << std::endl; + std::cerr << colored(COLOR_GREEN," target address : ") << service_target_address << std::endl; - std::cerr << "\033[0;32" "Setting proxy server to " "\033[0m" << service_target_address << ":" << service_target_port << std::endl; + std::cerr << colored(COLOR_GREEN,"Setting proxy server to ") << service_target_address << ":" << service_target_port << std::endl; rsPeers->setLocalAddress(rsPeers->getOwnId(), service_target_address, service_target_port); rsPeers->setHiddenNode(rsPeers->getOwnId(), onion_address, service_port); From 62513a0d23e683bc209ca12b17ea7e0ba9e9f6e9 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 1 Nov 2023 22:08:51 +0100 Subject: [PATCH 53/88] made initialization of webui as early as possible to avoir the need to restart jsonapi --- retroshare-service/src/retroshare-service.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index c68a1b80a..dc543549d 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -219,12 +219,23 @@ int main(int argc, char* argv[]) break; } } +#ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD + if(!webui_pass1.empty()) + { + rsWebUi->setHtmlFilesDirectory(webui_base_directory); + conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi + conf.enableWebUI = true; + + // JsonApi is started below in InitRetroShare(). Not calling restart here avoids multiple restart. + } +#endif #endif /* defined(RS_JSONAPI) && defined(RS_WEBUI) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) */ conf.main_executable_path = argv[0]; int initResult = RsInit::InitRetroShare(conf); + if(initResult != RS_INIT_OK) { RsFatal() << "Retroshare core initalization failed with: " << initResult @@ -344,15 +355,6 @@ int main(int argc, char* argv[]) } #endif // def RS_SERVICE_TERMINAL_LOGIN -#if (defined(RS_JSONAPI) && defined(RS_WEBUI)) && defined(RS_SERVICE_TERMINAL_WEBUI_PASSWORD) - if(rsJsonApi && !webui_pass1.empty()) - { - rsWebUi->setHtmlFilesDirectory(webui_base_directory); - rsWebUi->setUserPassword(webui_pass1); - rsWebUi->restart(); - } -#endif - rsControl->setShutdownCallback([&](int){keepRunning = false;}); while(keepRunning) From 53313670f53dfa0a193f87c082b24ee23c2c8403 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 4 Nov 2023 23:41:49 +0100 Subject: [PATCH 54/88] cleaning up webui/jsonapi interaction code --- retroshare-gui/src/gui/settings/WebuiPage.cpp | 2 ++ retroshare-gui/src/main.cpp | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index d7ff0b894..a14cc022d 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -142,6 +142,8 @@ void WebuiPage::loadParams() if(it != smap.end()) whileBlocking(ui.password_LE)->setText(QString::fromStdString(it->second)); + else + whileBlocking(ui.enableWebUI_CB)->setChecked(false); if(rsWebUi->isRunning()) ui.statusLabelLED->setPixmap(FilesDefs::getPixmapFromQtResourcePath(IMAGE_LEDON)) ; diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index e33fe795d..ff091ccf9 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -22,6 +22,7 @@ #include "util/stacktrace.h" #include "util/argstream.h" +#include "retroshare/rswebui.h" CrashStackTrace gCrashStackTrace; @@ -380,7 +381,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); return 1; } - /* recreate global settings object, now with correct path */ + /* recreate global settings object, now with correct path, specific to the selected node */ RshareSettings::Create(true); Rshare::resetLanguageAndStyle(); @@ -571,13 +572,18 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); notify->enable() ; // enable notification system after GUI creation, to avoid data races in Qt. -#ifdef RS_JSONAPI - JsonApiPage::checkStartJsonApi(); + // Read webui params in settings. We cannot save them to some webui.cfg because cfg needs the node id and + // jsonapi is started before node ID selection in retroshare-service. +#ifdef RS_JSONAPI #ifdef RS_WEBUI - WebuiPage::checkStartWebui(); // normally we should rather save the UI flags internally to p3webui + conf.enableWebUI = Settings->getWebinterfaceEnabled(); + + if(!Settings->getWebinterfaceFilesDirectory().isNull()) + rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString()); +#endif + RsInit::startupWebServices(conf); #endif -#endif // RS_JSONAPI /* dive into the endless loop */ int ti = rshare.exec(); From a64fda1fb813fb2a83180b88869ff6eb2bfcf6a8 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 5 Nov 2023 16:10:42 +0100 Subject: [PATCH 55/88] improved user commandline webui startup user experience --- retroshare-gui/src/gui/settings/JsonApiPage.cc | 13 +++++++++++-- retroshare-service/src/retroshare-service.cc | 12 +++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index 67e5f22b8..fee064093 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -64,9 +64,18 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) mEventHandlerId = 0; - rsEvents->registerEventsHandler( [this](std::shared_ptr /* event */) + rsEvents->registerEventsHandler( [this](std::shared_ptr e) { - std::cerr << "Caught JSONAPI event!" << std::endl; + if(e->mType != RsEventType::JSON_API) + return; + + auto je = dynamic_cast(e.get()); + + if(!je) + return; + + std::cerr << "Caught JSONAPI event! code=" << static_cast(je->mJsonApiEventCode) << std::endl; + RsQThreadUtils::postToObject([=]() { load(); }, this ); }, mEventHandlerId, RsEventType::JSON_API ); diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index dc543549d..010b644e3 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -220,7 +220,7 @@ int main(int argc, char* argv[]) } } #ifdef RS_SERVICE_TERMINAL_WEBUI_PASSWORD - if(!webui_pass1.empty()) + if(askWebUiPassword && !webui_pass1.empty()) { rsWebUi->setHtmlFilesDirectory(webui_base_directory); conf.webUIPasswd = webui_pass1; // cannot be set using rsWebUI methods because it calls the still non-existent rsJsonApi @@ -236,6 +236,11 @@ int main(int argc, char* argv[]) int initResult = RsInit::InitRetroShare(conf); +#ifdef RS_JSONAPI + RsInit::startupWebServices(conf); + rstime::rs_usleep(1000000); // waits for jas->restart to print stuff +#endif + if(initResult != RS_INIT_OK) { RsFatal() << "Retroshare core initalization failed with: " << initResult @@ -269,10 +274,11 @@ int main(int argc, char* argv[]) << colored(COLOR_PURPLE,locations[i].mPgpName + " (" + locations[i].mLocationName + ")" ) << std::endl; - uint32_t nacc = 0; + std::cout << std::endl; + uint32_t nacc = 0; while(keepRunning && (nacc < 1 || nacc >= locations.size())) { - std::cout << colored(COLOR_GREEN,"Please enter account number:\n"); + std::cout << colored(COLOR_GREEN,"Please enter account number: "); std::cout.flush(); std::string inputStr; From befc4736248b817ee86fd71ec78e7d267d33f5a1 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 15 Oct 2023 03:32:26 +0200 Subject: [PATCH 56/88] Fixed download of tor in Windows native build --- build_scripts/Windows/env/tools/prepare-tools.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/Windows/env/tools/prepare-tools.bat b/build_scripts/Windows/env/tools/prepare-tools.bat index c2c1e1bdd..189ac73cd 100644 --- a/build_scripts/Windows/env/tools/prepare-tools.bat +++ b/build_scripts/Windows/env/tools/prepare-tools.bat @@ -176,7 +176,7 @@ mkdir "%EnvTempPath%" call "%ToolsPath%\download-file.bat" "%TorDownloadIndexUrl%" "%EnvTempPath%\index.html" if not exist "%EnvTempPath%\index.html" %cecho% error "Cannot download Tor installation" & goto error -for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B +for /F "tokens=1,2 delims= " %%A in ('%EnvSedExe% -r -n -e"s/.*href=\"^(.*^)^(tor-.*windows-i686.*\.tar\.gz^)\".*/\2 \1\2/p" "%EnvTempPath%\index.html"') do set TorInstall=%%A& set TorDownloadUrl=%%B call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" if "%TorInstall%"=="" %cecho% error "Cannot download Tor installation" & goto error if "%TorDownloadUrl%"=="" %cecho% error "Cannot download Tor installation" & goto error From cd81d69357b0d6e4ba4de32fc636144de68413e9 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 6 Nov 2023 20:40:46 +0100 Subject: [PATCH 57/88] Removed not needed files of tor from Windows installer --- build_scripts/Windows/installer/retroshare-Qt5.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/Windows/installer/retroshare-Qt5.nsi b/build_scripts/Windows/installer/retroshare-Qt5.nsi index 3a7fbf37f..63c81bbcc 100644 --- a/build_scripts/Windows/installer/retroshare-Qt5.nsi +++ b/build_scripts/Windows/installer/retroshare-Qt5.nsi @@ -318,7 +318,7 @@ SectionEnd !ifdef TOR_EXISTS Section /o $(Section_Tor) Section_Tor SetOutPath "$INSTDIR\tor" - File /r "${TORDIR}\*" + File "${TORDIR}\*" SectionEnd !endif From eb7e2ec8e64258b64389521fb7f5400b871fe0ac Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 6 Nov 2023 23:00:06 +0100 Subject: [PATCH 58/88] Enabled ANSI color support in Windows console for retroshare-service --- retroshare-service/src/retroshare-service.cc | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index dc543549d..f73630f5b 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -111,6 +111,33 @@ int main(int argc, char* argv[]) signal(SIGBREAK, signalHandler); #endif // ifdef SIGBREAK +#ifdef WINDOWS_SYS + // Enable ANSI color support in Windows console + { +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x4 +#endif + + HANDLE hStdin = GetStdHandle(STD_OUTPUT_HANDLE); + if (hStdin) { + DWORD consoleMode; + if (GetConsoleMode(hStdin, &consoleMode)) { + if ((consoleMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING) == 0) { + if (SetConsoleMode(hStdin, consoleMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)) { + std::cout << "Enabled ANSI color support in console" << std::endl; + } else { + RsErr() << "Error getting console mode" << std::endl; + } + } + } else { + RsErr() << "Error getting console mode" << std::endl; + } + } else { + RsErr() << "Error getting stdin handle" << std::endl; + } + } +#endif + RsInfo() << "\n" << "+================================================================+\n" "| o---o o |\n" From 97fe92d1e7396087b73707886aec201fb999a437 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 7 Nov 2023 14:05:39 +0100 Subject: [PATCH 59/88] updated master branch of Retroshare/ to latest commits in master branches of OBS and libretroshare --- build_scripts/OBS | 2 +- libretroshare | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/OBS b/build_scripts/OBS index 1de347e99..353596b0e 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit 1de347e993ed1147bb84cdaf6c0604ff220eb221 +Subproject commit 353596b0ee5ea76611eb663b90bf3ab1c9f34ad7 diff --git a/libretroshare b/libretroshare index 3bb5a2b28..c2b26f2c9 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 3bb5a2b282949bc170dcff6141424cb095e4bb7b +Subproject commit c2b26f2c97151d526b5a94baa321110bbcfde8ca From bc125a75bff848fc0c7a8f08b165b0cbeb965cdb Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 10 Nov 2023 20:44:48 +0100 Subject: [PATCH 60/88] Fixed download of msys2 during Windows build --- .../Windows-msys2/env/tools/prepare-msys2.bat | 28 ++++++++++--------- .../Windows-msys2/env/tools/prepare-tools.bat | 2 +- .../env/tools/root/update-msys2.bat | 11 ++------ build_scripts/Windows/env/env-msys2.bat | 3 +- .../Windows/env/tools/prepare-msys2.bat | 25 ++++++++--------- .../Windows/env/tools/prepare-tools.bat | 18 ++++++------ 6 files changed, 42 insertions(+), 45 deletions(-) diff --git a/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat index d07c7a058..eaeba1482 100644 --- a/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat +++ b/build_scripts/Windows-msys2/env/tools/prepare-msys2.bat @@ -16,7 +16,13 @@ if "%~1"=="clean" ( goto exit ) -if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( +set MSYS2Version=20231026 + +set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe +set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% +set MSYS2UnpackPath=%EnvMSYS2Path%\msys64 + +if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" ( if "%~1"=="reinstall" ( choice /M "Found existing MSYS2 version. Do you want to proceed?" if !ERRORLEVEL!==2 goto exit @@ -25,30 +31,26 @@ if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" ( ) ) -if "%MSYS2Architecture%"=="i686" set MSYS2Version=20210705 -if "%MSYS2Architecture%"=="x86_64" set MSYS2Version=20210725 +if exist "%MSYS2UnpackPath%" ( + %cecho% info "Remove previous MSYS2 version" + call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%" +) -set MSYS2Install=msys2-base-%MSYS2Architecture%-%MSYS2Version%.tar.xz -set MSYS2Url=https://repo.msys2.org/distrib/%MSYS2Architecture%/%MSYS2Install% - -%cecho% info "Remove previous MSYS2 version" -call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%" - -%cecho% info "Download installation files" +%cecho% info "Download MSYS2 installation files" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error %cecho% info "Unpack MSYS2" -"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%" +"%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" -set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh +set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh %cecho% info "Initialize MSYS2" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat" +call "%MSYS2UnpackPath%\autorebase.bat" :exit endlocal diff --git a/build_scripts/Windows-msys2/env/tools/prepare-tools.bat b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat index c6b14a787..66f5f9120 100644 --- a/build_scripts/Windows-msys2/env/tools/prepare-tools.bat +++ b/build_scripts/Windows-msys2/env/tools/prepare-tools.bat @@ -34,7 +34,7 @@ if not exist "%EnvToolsPath%\cecho.exe" ( if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error echo Unpack cecho - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" diff --git a/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat index a3d2398cd..ddd5bdd0f 100644 --- a/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat +++ b/build_scripts/Windows-msys2/env/tools/root/update-msys2.bat @@ -2,18 +2,13 @@ setlocal -if exist "%~dp0msys2\msys32" call :update 32 -if exist "%~dp0msys2\msys64" call :update 64 +if not exist "%~dp0msys2\msys64" goto :EOF -goto :EOF +set MSYS2SH=%~dp0msys2\msys64\usr\bin\sh -:update -set MSYS2SH=%~dp0msys2\msys%~1\usr\bin\sh - -echo Update MSYS2 %~1 +echo Update MSYS2 "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -:exit endlocal goto :EOF diff --git a/build_scripts/Windows/env/env-msys2.bat b/build_scripts/Windows/env/env-msys2.bat index fee7e46b9..47dd8d96a 100644 --- a/build_scripts/Windows/env/env-msys2.bat +++ b/build_scripts/Windows/env/env-msys2.bat @@ -22,11 +22,12 @@ if "%GCCArchitecture%"=="x64" ( ) set EnvMSYS2Path=%EnvRootPath%\msys2 +set EnvMSYS2BasePath=%EnvMSYS2Path%\msys64 call "%~dp0tools\prepare-msys2.bat" %1 if errorlevel 1 exit /B %ERRORLEVEL% -set EnvMSYS2SH=%EnvMSYS2Path%\msys64\usr\bin\sh.exe +set EnvMSYS2SH=%EnvMSYS2BasePath%\usr\bin\sh.exe if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc diff --git a/build_scripts/Windows/env/tools/prepare-msys2.bat b/build_scripts/Windows/env/tools/prepare-msys2.bat index 17fe6c36e..25f00ac30 100644 --- a/build_scripts/Windows/env/tools/prepare-msys2.bat +++ b/build_scripts/Windows/env/tools/prepare-msys2.bat @@ -16,15 +16,15 @@ if "%~1"=="clean" ( goto exit ) -set MSYS2Version=20230318 +set MSYS2Version=20231026 set MSYS2Install=msys2-base-x86_64-%MSYS2Version%.sfx.exe set MSYS2Url=https://github.com/msys2/msys2-installer/releases/download/%MSYS2Version:~0,4%-%MSYS2Version:~4,2%-%MSYS2Version:~6,2%/%MSYS2Install% +set MSYS2UnpackPath=%EnvMSYS2Path%\msys64 set CMakeInstall=cmake-3.19.0-win32-x86.zip set CMakeUrl=https://github.com/Kitware/CMake/releases/download/v3.19.0/%CMakeInstall% -set CMakeUnpackPath=%EnvMSYS2Path%\msys64 -if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" ( +if exist "%MSYS2UnpackPath%\usr\bin\pacman.exe" ( if "%~1"=="reinstall" ( choice /M "Found existing MSYS2 version. Do you want to proceed?" if !ERRORLEVEL!==2 goto exit @@ -33,13 +33,12 @@ if exist "%CMakeUnpackPath%\usr\bin\pacman.exe" ( ) ) - -if exist "%CMakeUnpackPath%" ( +if exist "%MSYS2UnpackPath%" ( %cecho% info "Remove previous MSYS2 version" - call "%ToolsPath%\remove-dir.bat" "%CMakeUnpackPath%" + call "%ToolsPath%\remove-dir.bat" "%MSYS2UnpackPath%" ) -%cecho% info "Download installation files" +%cecho% info "Download MSYS2 installation files" if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%" if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error @@ -50,29 +49,29 @@ if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download C "%EnvDownloadPath%\%MSYS2Install%" -y -o"%EnvMSYS2Path%" %cecho% info "Unpack CMake" -"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" +"%EnvSevenZipExe%" x -o"%MSYS2UnpackPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 %cecho% info "Install CMake" set CMakeVersion= -for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF +for /D %%F in (%MSYS2UnpackPath%\cmake*) do set CMakeVersion=%%~nxF if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit %cecho% info "Found CMake version %CMakeVersion%" set FoundProfile= -for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%CMakeUnpackPath%\etc\profile"') do set FoundProfile=%%F +for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYS2UnpackPath%\etc\profile"') do set FoundProfile=%%F if "%FoundProfile%"=="0" ( - echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%CMakeUnpackPath%\etc\profile" + echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYS2UnpackPath%\etc\profile" ) -set MSYS2SH=%CMakeUnpackPath%\usr\bin\sh +set MSYS2SH=%MSYS2UnpackPath%\usr\bin\sh %cecho% info "Initialize MSYS2" "%MSYS2SH%" -lc "yes | pacman --noconfirm -Syuu msys2-keyring" "%MSYS2SH%" -lc "pacman --noconfirm -Sy" "%MSYS2SH%" -lc "pacman --noconfirm -Su" -call "%CMakeUnpackPath%\autorebase.bat" +call "%MSYS2UnpackPath%\autorebase.bat" :exit endlocal diff --git a/build_scripts/Windows/env/tools/prepare-tools.bat b/build_scripts/Windows/env/tools/prepare-tools.bat index 189ac73cd..88549faed 100644 --- a/build_scripts/Windows/env/tools/prepare-tools.bat +++ b/build_scripts/Windows/env/tools/prepare-tools.bat @@ -53,7 +53,7 @@ if not exist "%EnvToolsPath%\cecho.exe" ( if not exist "%EnvDownloadPath%\%cCEhoInstall%" echo Cannot download cecho installation& goto error echo Unpack cecho - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CEchoInstall%" -y -bso0 copy "%EnvTempPath%\cecho.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -69,7 +69,7 @@ if not exist "%EnvToolsPath%\depends.exe" ( if not exist "%EnvDownloadPath%\%DependsInstall%" %cecho% error "Cannot download Dependendy Walker installation" & goto error %cecho% info "Unpack Dependency Walker" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%DependsInstall%" -y -bso0 copy "%EnvTempPath%\*" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -85,7 +85,7 @@ if not exist "%EnvToolsPath%\cut.exe" ( if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error %cecho% info "Unpack Unix Tools" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 copy "%EnvTempPath%\cut.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -101,7 +101,7 @@ if not exist "%EnvToolsPath%\sed.exe" ( if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error %cecho% info "Unpack Unix Tools" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%" -y -bso0 copy "%EnvTempPath%\sed.exe" "%EnvToolsPath%" call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%" @@ -121,7 +121,7 @@ if not exist "%NSISInstallPath%\nsis.exe" ( if not exist "%EnvDownloadPath%\%NSISInstall%" %cecho% error "Cannot download NSIS installation" & goto error %cecho% info "Unpack NSIS" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%NSISInstall%" -y -bso0 if not exist "%NSISInstallPath%" mkdir "%NSISInstallPath%" xcopy /s "%EnvTempPath%" "%NSISInstallPath%" @@ -135,7 +135,7 @@ if not exist "%MinGitInstallPath%\cmd\git.exe" ( if not exist "%EnvDownloadPath%\%MinGitInstall%" %cecho% error "Cannot download MinGit installation" & goto error %cecho% info "Unpack MinGit" - "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" + "%EnvSevenZipExe%" x -o"%MinGitInstallPath%" "%EnvDownloadPath%\%MinGitInstall%" -y -bso0 ) if not exist "%EnvDownloadPath%\%DoxygenInstall%" call "%ToolsPath%\remove-dir.bat" "%DoxygenInstallPath%" @@ -148,7 +148,7 @@ if not exist "%DoxygenInstallPath%\doxygen.exe" ( if not exist "%EnvDownloadPath%\%DoxygenInstall%" %cecho% error "Cannot download doxygen installation" & goto error %cecho% info "Unpack Doxygen" - "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" + "%EnvSevenZipExe%" x -o"%DoxygenInstallPath%" "%EnvDownloadPath%\%DoxygenInstall%" -y -bso0 ) if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%" @@ -163,7 +163,7 @@ if not exist "%CMakeInstallPath%\bin\cmake.exe" ( if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error %cecho% info "Unpack CMake" - "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" + "%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%" -y -bso0 move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%" @@ -189,7 +189,7 @@ if not exist "%EnvTorPath%\Tor\tor.exe" ( if not exist "%EnvDownloadPath%\%TorInstall%" %cecho% error "Cannot download Tor installation" & goto error %cecho% info "Unpack Tor" - "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" + "%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%TorInstall%" | "%EnvSevenZipExe%" x -si -ttar -o"%EnvTorPath%" -y -bso0 ) :exit From 2c8e7d2a51b26a8ca904200a864d1aaf0a18510e Mon Sep 17 00:00:00 2001 From: thunder2 Date: Fri, 10 Nov 2023 20:46:08 +0100 Subject: [PATCH 61/88] Updated OpenSSL to 1.1.1w in Windows native build --- build_scripts/Windows/build-libs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/Windows/build-libs/Makefile b/build_scripts/Windows/build-libs/Makefile index b7efeaa37..0075770cd 100644 --- a/build_scripts/Windows/build-libs/Makefile +++ b/build_scripts/Windows/build-libs/Makefile @@ -1,7 +1,7 @@ ZLIB_VERSION=1.2.11 BZIP2_VERSION=1.0.8 MINIUPNPC_VERSION=2.2.3 -OPENSSL_VERSION=1.1.1p +OPENSSL_VERSION=1.1.1w SPEEX_VERSION=1.2.0 SPEEXDSP_VERSION=1.2.0 LIBXML2_VERSION=2.9.12 From 48da2d195a725987b74d93bf9d630fab3e1edf8b Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 10 Nov 2023 22:42:32 +0100 Subject: [PATCH 62/88] removed some debug output --- retroshare-gui/src/gui/GenCertDialog.cpp | 4 +++- retroshare-gui/src/gui/common/NewFriendList.cpp | 2 ++ retroshare-gui/src/gui/settings/JsonApiPage.cc | 3 ++- retroshare-gui/src/gui/settings/WebuiPage.cpp | 6 +++++- retroshare-gui/src/main.cpp | 5 +++-- retroshare-gui/src/rshare.cpp | 7 ++++++- 6 files changed, 21 insertions(+), 6 deletions(-) diff --git a/retroshare-gui/src/gui/GenCertDialog.cpp b/retroshare-gui/src/gui/GenCertDialog.cpp index b71e324c7..d3b755f0d 100644 --- a/retroshare-gui/src/gui/GenCertDialog.cpp +++ b/retroshare-gui/src/gui/GenCertDialog.cpp @@ -609,7 +609,9 @@ void GenCertDialog::genPerson() QCoreApplication::processEvents(); QAbstractEventDispatcher* ed = QAbstractEventDispatcher::instance(); - std::cout << "Waiting ed->processEvents()" << std::endl; +#ifdef DEBUG_GENCERTDIALOG + std::cout << "Waiting ed->processEvents()" << std::endl; +#endif time_t waitEnd = time(NULL) + 10;//Wait no more than 10 sec to processEvents if (ed->hasPendingEvents()) while(ed->processEvents(QEventLoop::AllEvents) && (time(NULL) < waitEnd)); diff --git a/retroshare-gui/src/gui/common/NewFriendList.cpp b/retroshare-gui/src/gui/common/NewFriendList.cpp index 893433469..bd6faec41 100644 --- a/retroshare-gui/src/gui/common/NewFriendList.cpp +++ b/retroshare-gui/src/gui/common/NewFriendList.cpp @@ -1619,7 +1619,9 @@ bool NewFriendList::isColumnVisible(int col) const } void NewFriendList::setColumnVisible(int col,bool visible) { +#ifdef DEBUG_NEW_FRIEND_LIST std::cerr << "Setting column " << col << " to be visible: " << visible << std::endl; +#endif ui->peerTreeWidget->setColumnHidden(col, !visible); } void NewFriendList::toggleColumnVisible() diff --git a/retroshare-gui/src/gui/settings/JsonApiPage.cc b/retroshare-gui/src/gui/settings/JsonApiPage.cc index fee064093..2b7f25d80 100644 --- a/retroshare-gui/src/gui/settings/JsonApiPage.cc +++ b/retroshare-gui/src/gui/settings/JsonApiPage.cc @@ -73,8 +73,9 @@ JsonApiPage::JsonApiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) if(!je) return; - +#ifdef DEBUG std::cerr << "Caught JSONAPI event! code=" << static_cast(je->mJsonApiEventCode) << std::endl; +#endif RsQThreadUtils::postToObject([=]() { load(); }, this ); }, diff --git a/retroshare-gui/src/gui/settings/WebuiPage.cpp b/retroshare-gui/src/gui/settings/WebuiPage.cpp index a14cc022d..4b36b758c 100644 --- a/retroshare-gui/src/gui/settings/WebuiPage.cpp +++ b/retroshare-gui/src/gui/settings/WebuiPage.cpp @@ -58,7 +58,9 @@ WebuiPage::WebuiPage(QWidget */*parent*/, Qt::WindowFlags /*flags*/) rsEvents->registerEventsHandler( [this](std::shared_ptr /* event */) { +#ifdef DEBUG std::cerr << "Caught JSONAPI event in webui!" << std::endl; +#endif RsQThreadUtils::postToObject([=]() { load(); }, this ); }, mEventsHandlerId, RsEventType::JSON_API ); @@ -132,7 +134,9 @@ bool WebuiPage::restart() void WebuiPage::loadParams() { - std::cerr << "WebuiPage::load()" << std::endl; +#ifdef DEBUG + std::cerr << "WebuiPage::load()" << std::endl; +#endif whileBlocking(ui.enableWebUI_CB)->setChecked(Settings->getWebinterfaceEnabled()); whileBlocking(ui.webInterfaceFiles_LE)->setText(Settings->getWebinterfaceFilesDirectory()); diff --git a/retroshare-gui/src/main.cpp b/retroshare-gui/src/main.cpp index ff091ccf9..13710a28b 100644 --- a/retroshare-gui/src/main.cpp +++ b/retroshare-gui/src/main.cpp @@ -538,8 +538,9 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); // qRegisterMetaType("RsPeerId") ; - +#ifdef DEBUG std::cerr << "connecting signals and slots" << std::endl ; +#endif QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ; QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ; @@ -582,7 +583,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO); if(!Settings->getWebinterfaceFilesDirectory().isNull()) rsWebUi->setHtmlFilesDirectory(Settings->getWebinterfaceFilesDirectory().toStdString()); #endif - RsInit::startupWebServices(conf); + RsInit::startupWebServices(conf,false); #endif /* dive into the endless loop */ diff --git a/retroshare-gui/src/rshare.cpp b/retroshare-gui/src/rshare.cpp index 8fb8fdc58..e5f450f57 100644 --- a/retroshare-gui/src/rshare.cpp +++ b/retroshare-gui/src/rshare.cpp @@ -139,17 +139,22 @@ static bool notifyRunningInstance() // that a new process had been started QLocalSocket localSocket; localSocket.connectToServer(QString(TARGET)); - +#ifdef DEBUG std::cerr << "Rshare::Rshare waitForConnected to other instance." << std::endl; +#endif if( localSocket.waitForConnected(100) ) { +#ifdef DEBUG std::cerr << "Rshare::Rshare Connection etablished. Waiting for disconnection." << std::endl; +#endif localSocket.waitForDisconnected(1000); return true; } else { +#ifdef DEBUG std::cerr << "Rshare::Rshare failed to connect to other instance." << std::endl; +#endif return false; } } From 9db3208f7219d57fa75ec4b0dcdbb69d0bff9a38 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 11 Nov 2023 23:49:55 +0100 Subject: [PATCH 63/88] improved colored output on login --- retroshare-service/src/retroshare-service.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/retroshare-service/src/retroshare-service.cc b/retroshare-service/src/retroshare-service.cc index 010b644e3..8102686f0 100644 --- a/retroshare-service/src/retroshare-service.cc +++ b/retroshare-service/src/retroshare-service.cc @@ -237,7 +237,7 @@ int main(int argc, char* argv[]) int initResult = RsInit::InitRetroShare(conf); #ifdef RS_JSONAPI - RsInit::startupWebServices(conf); + RsInit::startupWebServices(conf,true); rstime::rs_usleep(1000000); // waits for jas->restart to print stuff #endif @@ -263,12 +263,12 @@ int main(int argc, char* argv[]) } std::cout << std::endl << std::endl - << colored(COLOR_GREEN,"Available accounts:") << std::endl; + << colored(COLOR_GREEN,"Available accounts:") << std::endl<( ceil(log(locations.size())/log(10.0)) ); for( uint32_t i=0; i Date: Sun, 12 Nov 2023 11:23:54 +0100 Subject: [PATCH 64/88] updated Retroshare to the latest submodule commits --- libretroshare | 2 +- retroshare-webui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libretroshare b/libretroshare index c2b26f2c9..b85295b6d 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit c2b26f2c97151d526b5a94baa321110bbcfde8ca +Subproject commit b85295b6d3e22fce8f23dd216f7d67d2b4d785ee diff --git a/retroshare-webui b/retroshare-webui index 542a8c07b..ddd8b0b24 160000 --- a/retroshare-webui +++ b/retroshare-webui @@ -1 +1 @@ -Subproject commit 542a8c07bd02f9bb9082f7aba5aaaed54e643fc1 +Subproject commit ddd8b0b241c21940c7addc20c3cce774ff8dc021 From 0e48422d1f9a173c40b3f58539101d7d0363043b Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 12 Nov 2023 12:07:56 +0100 Subject: [PATCH 65/88] updated retroshare to latest libretroshare --- libretroshare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare b/libretroshare index b85295b6d..de2b4bd80 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit b85295b6d3e22fce8f23dd216f7d67d2b4d785ee +Subproject commit de2b4bd80c57ca757b5f878130f98becf710236d From 902f278a19c4f1ff306f6a724c0428231cc2d63e Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:42:56 +0100 Subject: [PATCH 66/88] Fixed led labels --- retroshare-gui/src/gui/settings/ServerPage.ui | 110 +++++++++++------- 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui index 60abc5fd8..93eb82637 100755 --- a/retroshare-gui/src/gui/settings/ServerPage.ui +++ b/retroshare-gui/src/gui/settings/ServerPage.ui @@ -256,11 +256,14 @@ - - - 16 - 16 - + + + 0 + 0 + + + + Qt::LeftToRight @@ -272,6 +275,12 @@ + + + 0 + 0 + + <html><head/><body><p>The bullet turns green as soon as Retroshare manages to get your own IP from the websites listed below, if you enabled that action. Retroshare will also use other means to find out your own IP.</p></body></html> @@ -290,13 +299,29 @@ 6 + + + + + 0 + 0 + + + + Local network + + + - - - 16 - 16 - + + + 0 + 0 + + + + Qt::LeftToRight @@ -306,13 +331,6 @@ - - - - Local network - - - @@ -351,13 +369,29 @@ 6 + + + + + 0 + 0 + + + + UPnP + + + - - - 16 - 16 - + + + 0 + 0 + + + + Qt::LeftToRight @@ -367,13 +401,6 @@ - - - - UPnP - - - @@ -386,11 +413,14 @@ - - - 16 - 16 - + + + 0 + 0 + + + + Qt::LeftToRight @@ -402,6 +432,12 @@ + + + 0 + 0 + + 75 @@ -802,12 +838,6 @@ behind a firewall or a VPN. - - - 16 - 16 - - From 6555cc5792fc15893e2c62c298ed4965fa621f07 Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 17 Nov 2023 14:10:14 +0100 Subject: [PATCH 67/88] attempt to fix bug in closing GxsChannelComment feed item --- .../src/gui/feeds/ChannelsCommentsItem.cpp | 33 ++++++++++++++++++- .../src/gui/feeds/ChannelsCommentsItem.h | 4 +++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp index ecbba96af..527ca8698 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp @@ -53,6 +53,10 @@ ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feed GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate), mGroupMeta(group_meta) { + mLoadingGroup = false; + mLoadingMessage = false; + mLoadingComment = false; + mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded mPost.mMeta.mGroupId = mGroupMeta.mGroupId; @@ -74,6 +78,10 @@ ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feed ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set& older_versions) : GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) // this one should be in GxsFeedItem { + mLoadingGroup = false; + mLoadingMessage = false; + mLoadingComment = false; + mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded QVector v; @@ -114,6 +122,19 @@ void ChannelsCommentsItem::paintEvent(QPaintEvent *e) ChannelsCommentsItem::~ChannelsCommentsItem() { + auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300); + + while( (mLoadingGroup || mLoadingMessage || mLoadingComment) + && std::chrono::steady_clock::now() < timeout) + { + RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for " + << (mLoadingGroup ? "Group " : "") + << (mLoadingMessage ? "Message " : "") + << (mLoadingComment ? "Comment " : "") + << "loading." << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + delete(ui); } @@ -255,6 +276,7 @@ void ChannelsCommentsItem::loadGroup() return; } RsGxsChannelGroup group(groups[0]); + mLoadingGroup = true; RsQThreadUtils::postToObject( [group,this]() { @@ -263,6 +285,7 @@ void ChannelsCommentsItem::loadGroup() * after a blocking call to RetroShare API complete */ mGroupMeta = group.mMeta; + mLoadingGroup = false; }, this ); }); @@ -293,8 +316,9 @@ void ChannelsCommentsItem::loadMessage() std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl; #endif RsGxsChannelPost post(posts[0]); // no reference to temporary here, because we pass this to a thread + mLoadingMessage = true; - RsQThreadUtils::postToObject( [post,this]() { setPost(post); }, this ); + RsQThreadUtils::postToObject( [post,this]() { setPost(post); mLoadingMessage=false; }, this ); } else if(comments.size() == 1) { @@ -302,6 +326,7 @@ void ChannelsCommentsItem::loadMessage() #ifdef DEBUG_ITEM std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl; #endif + mLoadingComment = true; RsQThreadUtils::postToObject( [cmt,this]() { @@ -323,6 +348,7 @@ void ChannelsCommentsItem::loadMessage() //Change this item to be uploaded with thread element. setMessageId(cmt.mMeta.mThreadId); + mLoadingComment=false; requestMessage(); }, this ); @@ -344,6 +370,8 @@ void ChannelsCommentsItem::loadMessage() void ChannelsCommentsItem::loadComment() { +#ifdef DOES_NOTHING + #ifdef DEBUG_ITEM std::cerr << "ChannelsCommentsItem::loadComment()"; std::cerr << std::endl; @@ -369,6 +397,8 @@ void ChannelsCommentsItem::loadComment() int comNb = comments.size(); + mLoadingComment=true; + RsQThreadUtils::postToObject( [comNb]() { QString sComButText = tr("Comment"); @@ -381,6 +411,7 @@ void ChannelsCommentsItem::loadComment() }, this ); }); +#endif } void ChannelsCommentsItem::fill() diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h index 53537d61e..c790e3107 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h @@ -113,6 +113,10 @@ private: bool mCloseOnRead; bool mLoaded; + bool mLoadingGroup; + bool mLoadingMessage; + bool mLoadingComment; + RsGroupMetaData mGroupMeta; RsGxsChannelPost mPost; From 69a84c94a29dfeeec55ee94fc02c008c58f4963e Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Fri, 17 Nov 2023 17:10:18 +0100 Subject: [PATCH 68/88] Cosmetic layout fixes --- retroshare-gui/src/gui/Identity/IdDialog.ui | 553 +++++++++++--------- 1 file changed, 301 insertions(+), 252 deletions(-) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index ff3775aee..7687c321d 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -301,8 +301,8 @@ 0 0 - 456 - 731 + 466 + 738 @@ -573,17 +573,68 @@ border-image: url(:/images/closepressed.png) Identity info - - + + - Owner node ID : + Friend votes: - - + + + + Qt::Horizontal + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + Last used: + + + + + - <html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html> + Auto-Ban all identities signed by the same node + + + Auto-Ban profile + + + + + + + true + + + + + + + true true @@ -600,61 +651,253 @@ border-image: url(:/images/closepressed.png) - + + + + <html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html> + + + true + + + + + + + Your opinion: + + + + + + + + 75 + true + + + + Overall: + + + + + + + Created on : + + + + + + + Identity name : + + + + + + + Identity ID : + + + + + + + <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> + + + true + + + + + + + true + + + + + + + Type: + + + + + + + true + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Owner node ID : + + + + + + + Owner node name : + + + + + + + Ban-option: + + + + + + + <html><head/><body><p><span style=" font-family:'Sans'; font-size:9pt;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">You can change the thresholds and the time of inactivity to delete identities in preferences -&gt; people. </span></p></body></html> + + + + 22 + 22 + + + + + Negative + + + + :/icons/png/thumbs-down.png:/icons/png/thumbs-down.png + + + + + Neutral + + + + :/icons/png/thumbs-neutral.png:/icons/png/thumbs-neutral.png + + + + + Positive + + + + :/icons/png/thumbs-up.png:/icons/png/thumbs-up.png + + + + + 0 - - - - 0 - 0 - - - - - 128 - 128 - - - - - 128 - 128 - - - - QFrame::Box - - - QFrame::Sunken - - - Your Avatar - - - true - - - Qt::AlignCenter - - - - - - - Send Invite - - - - - - - Edit Identity - - + + + + + + 0 + 0 + + + + + 128 + 128 + + + + + 128 + 128 + + + + QFrame::Box + + + QFrame::Sunken + + + Your Avatar + + + true + + + Qt::AlignCenter + + + + + + + Edit Identity + + + + + + + Send Invite + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 128 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 6 + 128 + + + + + @@ -756,200 +999,6 @@ border-image: url(:/images/closepressed.png) - - - - true - - - - - - - Type: - - - - - - - - 75 - true - - - - Overall: - - - - - - - Last used: - - - - - - - Identity ID : - - - - - - - Created on : - - - - - - - Owner node name : - - - - - - - Ban-option: - - - - - - - Your opinion: - - - - - - - <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> - - - true - - - - - - - true - - - - - - - <html><head/><body><p><span style=" font-family:'Sans'; font-size:9pt;">Your own opinion about an identity rules the visibility of that identity for yourself and your friend nodes. Your own opinion is shared among friends and used to compute a reputation score: If your opinion about an identity is neutral, the reputation score is the difference between friend's positive and negative opinions. If not, your own opinion gives the score.</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity. When the overall score is lower than -1, the identity is banned, which prevents all messages and forums/channels authored by this identity to be forwarded, both ways. Some forums also have special anti-spam flags that require a non negative reputation level, making them more sensitive to bad opinions. Banned identities gradually lose their activity and eventually disappear (after 5 days).</span></p><p><span style=" font-family:'Sans'; font-size:9pt;">You can change the thresholds and the time of inactivity to delete identities in preferences -&gt; people. </span></p></body></html> - - - - 22 - 22 - - - - - Negative - - - - :/icons/png/thumbs-down.png:/icons/png/thumbs-down.png - - - - - Neutral - - - - :/icons/png/thumbs-neutral.png:/icons/png/thumbs-neutral.png - - - - - Positive - - - - :/icons/png/thumbs-up.png:/icons/png/thumbs-up.png - - - - - - - - Identity name : - - - - - - - Auto-Ban all identities signed by the same node - - - Auto-Ban profile - - - - - - - true - - - true - - - - - - - true - - - - - - - Friend votes: - - - - - - - true - - - true - - - - - - - Qt::Horizontal - - - - - - - true - - - true - - - From 929c04edd53202534a42238795d83de1d647e3d8 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 18 Nov 2023 23:46:32 +0100 Subject: [PATCH 69/88] fixing channel comment feed item crash --- retroshare-gui/src/gui/NewsFeed.cpp | 2 +- .../src/gui/feeds/ChannelsCommentsItem.cpp | 454 +++++++----------- .../src/gui/feeds/ChannelsCommentsItem.h | 27 +- 3 files changed, 188 insertions(+), 295 deletions(-) diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index c73f834fb..dc0834e71 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -299,7 +299,7 @@ void NewsFeed::handleChannelEvent(std::shared_ptr event) addFeedItem(new GxsChannelPostItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true)); break; case RsChannelEventCode::NEW_COMMENT: - addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId, false, true)); + addFeedItem(new ChannelsCommentsItem(this, NEWSFEED_CHANNELNEWLIST, pe->mChannelGroupId, pe->mChannelMsgId,pe->mChannelThreadId, false, true)); break; case RsChannelEventCode::RECEIVED_PUBLISH_KEY: addFeedItem(new GxsChannelGroupItem(this, NEWSFEED_CHANNELPUBKEYLIST, pe->mChannelGroupId, false, true)); diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp index 527ca8698..46c129ebe 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp @@ -49,54 +49,41 @@ * #define DEBUG_ITEM 1 ****/ -ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group_meta, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set& older_versions) : - GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate), - mGroupMeta(group_meta) -{ - mLoadingGroup = false; - mLoadingMessage = false; - mLoadingComment = false; +// ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group_meta, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set& older_versions) : +// GxsFeedItem(feedHolder, feedId, group_meta.mGroupId, messageId, isHome, rsGxsChannels, autoUpdate), +// mGroupMeta(group_meta) +// { +// mLoadingGroup = false; +// mLoadingMessage = false; +// mLoadingComment = false; +// +// mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded +// mPost.mMeta.mGroupId = mGroupMeta.mGroupId; +// +// QVector v; +// //bool self = false; +// +// for(std::set::const_iterator it(older_versions.begin());it!=older_versions.end();++it) +// v.push_back(*it) ; +// +// if(older_versions.find(messageId) == older_versions.end()) +// v.push_back(messageId); +// +// setMessageVersions(v) ; +// setup(); +// +// // no call to loadGroup() here because we have it already. +// } - mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded - mPost.mMeta.mGroupId = mGroupMeta.mGroupId; +ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &commentId, const RsGxsMessageId &threadId, bool isHome, bool autoUpdate) : + GxsFeedItem(feedHolder, feedId, groupId, commentId, isHome, rsGxsChannels, autoUpdate), // this one should be in GxsFeedItem + mThreadId(threadId) +{ + mLoading= false; QVector v; - //bool self = false; - for(std::set::const_iterator it(older_versions.begin());it!=older_versions.end();++it) - v.push_back(*it) ; - - if(older_versions.find(messageId) == older_versions.end()) - v.push_back(messageId); - - setMessageVersions(v) ; setup(); - - // no call to loadGroup() here because we have it already. -} - -ChannelsCommentsItem::ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate,const std::set& older_versions) : - GxsFeedItem(feedHolder, feedId, groupId, messageId, isHome, rsGxsChannels, autoUpdate) // this one should be in GxsFeedItem -{ - mLoadingGroup = false; - mLoadingMessage = false; - mLoadingComment = false; - - mPost.mMeta.mMsgId = messageId; // useful for uniqueIdentifer() before the post is loaded - - QVector v; - //bool self = false; - - for(std::set::const_iterator it(older_versions.begin());it!=older_versions.end();++it) - v.push_back(*it) ; - - if(older_versions.find(messageId) == older_versions.end()) - v.push_back(messageId); - - setMessageVersions(v) ; - setup(); - - loadGroup(); } void ChannelsCommentsItem::paintEvent(QPaintEvent *e) @@ -107,15 +94,8 @@ void ChannelsCommentsItem::paintEvent(QPaintEvent *e) if(!mLoaded) { mLoaded = true ; - - std::set older_versions; // not so nice. We need to use std::set everywhere - for(auto& m:messageVersions()) - older_versions.insert(m); - - fill(); - requestMessage(); - requestComment(); - } + load(); + } GxsFeedItem::paintEvent(e) ; } @@ -124,14 +104,9 @@ ChannelsCommentsItem::~ChannelsCommentsItem() { auto timeout = std::chrono::steady_clock::now() + std::chrono::milliseconds(300); - while( (mLoadingGroup || mLoadingMessage || mLoadingComment) - && std::chrono::steady_clock::now() < timeout) + while( mLoading && std::chrono::steady_clock::now() < timeout ) { - RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for " - << (mLoadingGroup ? "Group " : "") - << (mLoadingMessage ? "Message " : "") - << (mLoadingComment ? "Comment " : "") - << "loading." << std::endl; + RsDbg() << __PRETTY_FUNCTION__ << " is Waiting for data to load " << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(100)); } @@ -203,21 +178,24 @@ void ChannelsCommentsItem::setup() ui->expandFrame->hide(); } -bool ChannelsCommentsItem::setPost(const RsGxsChannelPost &post, bool doFill) +bool ChannelsCommentsItem::setPost(const RsGxsChannelPost& post, bool doFill) { - if (groupId() != post.mMeta.mGroupId || messageId() != post.mMeta.mMsgId) { - std::cerr << "ChannelsCommentsItem::setPost() - Wrong id, cannot set post"; - std::cerr << std::endl; - return false; - } - mPost = post; - if (doFill) { + if (doFill) fill(); - } - return true; + std::cerr << "end setting post." << std::endl; + return true; +} +bool ChannelsCommentsItem::setMissingPost() +{ + std::cerr << "setting missing post." << std::endl; + + fill(true); + + std::cerr << "end setting missing post." << std::endl; + return true; } QString ChannelsCommentsItem::getTitleLabel() @@ -251,178 +229,150 @@ void ChannelsCommentsItem::loadComments() void ChannelsCommentsItem::loadGroup() { -#ifdef DEBUG_ITEM - std::cerr << "GxsChannelGroupItem::loadGroup()"; - std::cerr << std::endl; -#endif - - RsThread::async([this]() - { - // 1 - get group data - - std::vector groups; - const std::list groupIds = { groupId() }; - - if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group - { - RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; - return; - } - - if (groups.size() != 1) - { - std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items"; - std::cerr << std::endl; - return; - } - RsGxsChannelGroup group(groups[0]); - mLoadingGroup = true; - - RsQThreadUtils::postToObject( [group,this]() - { - /* Here it goes any code you want to be executed on the Qt Gui - * thread, for example to update the data model with new information - * after a blocking call to RetroShare API complete */ - - mGroupMeta = group.mMeta; - mLoadingGroup = false; - - }, this ); - }); +//#ifdef DEBUG_ITEM +// std::cerr << "GxsChannelGroupItem::loadGroup()"; +// std::cerr << std::endl; +//#endif +// if(mLoading) +// return; +// +// mLoading= true; +// +// std::cerr << "Loading group" << std::endl; +// RsThread::async([this]() +// { +// // 1 - get group data +// +// std::vector groups; +// const std::list groupIds = { groupId() }; +// +// if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group +// { +// RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; +// return; +// } +// +// if (groups.size() != 1) +// { +// std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items"; +// std::cerr << std::endl; +// return; +// } +// RsGxsChannelGroup group(groups[0]); +// +// RsQThreadUtils::postToObject( [group,this]() +// { +// /* Here it goes any code you want to be executed on the Qt Gui +// * thread, for example to update the data model with new information +// * after a blocking call to RetroShare API complete */ +// +// mGroupMeta = group.mMeta; +// mLoading= false; +// +// std::cerr << "End loading group" << std::endl; +// }, this ); +// }); } -void ChannelsCommentsItem::loadMessage() +void ChannelsCommentsItem::load() { + // This function loads everything that's needed: + // - the comment text + // - the comment parent message + #ifdef DEBUG_ITEM std::cerr << "ChannelsCommentsItem::loadMessage()"; std::cerr << std::endl; #endif - RsThread::async([this]() + if(mLoading) + return; + + mLoading= true; + std::cerr << "Loading message " << mPost.mMeta.mMsgId << std::endl; + + RsThread::async([this]() { - // 1 - get group data + // 1 - get group meta data + + std::vector groups; + const std::list groupIds = { groupId() }; + + if(!rsGxsChannels->getChannelsInfo(groupIds,groups)) // would be better to call channel Summaries for a single group + { + RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; + return; + } + + if (groups.size() != 1) + { + std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items"; + std::cerr << std::endl; + return; + } + RsGxsChannelGroup group(groups[0]); + + // 2 - get message and comment data std::vector posts; std::vector comments; std::vector votes; - if(! rsGxsChannels->getChannelContent( groupId(), std::set( { messageId() } ),posts,comments,votes)) + if(! rsGxsChannels->getChannelContent( groupId(), std::set( { messageId(),mThreadId } ),posts,comments,votes)) { RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; return; } - if (posts.size() == 1) - { -#ifdef DEBUG_ITEM - std::cerr << (void*)this << ": Obtained post, with msgId = " << posts[0].mMeta.mMsgId << std::endl; -#endif - RsGxsChannelPost post(posts[0]); // no reference to temporary here, because we pass this to a thread - mLoadingMessage = true; + // now that everything is in place, update the UI - RsQThreadUtils::postToObject( [post,this]() { setPost(post); mLoadingMessage=false; }, this ); - } - else if(comments.size() == 1) - { - RsGxsComment cmt(comments[0]); -#ifdef DEBUG_ITEM - std::cerr << (void*)this << ": Obtained comment, setting messageId to threadID = " << cmt.mMeta.mThreadId << std::endl; -#endif - mLoadingComment = true; + RsQThreadUtils::postToObject( [group,posts,comments,this]() + { + /* Here it goes any code you want to be executed on the Qt Gui + * thread, for example to update the data model with new information + * after a blocking call to RetroShare API complete */ - RsQThreadUtils::postToObject( [cmt,this]() - { - uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height()) - / QFontMetricsF(ui->subjectLabel->font()).height()); + mGroupMeta = group.mMeta; - ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS)); + if(comments.size()==1) + { + RsGxsComment cmt(comments[0]); - ui->nameLabel->setId(cmt.mMeta.mAuthorId); - ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs)); + std::cerr << "setting comment." << std::endl; + uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height()) + / QFontMetricsF(ui->subjectLabel->font()).height()); - RsIdentityDetails idDetails ; - rsIdentity->getIdDetails(cmt.mMeta.mAuthorId,idDetails); - QPixmap pixmap ; + ui->commLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(cmt.mComment.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_LINKS)); + ui->nameLabel->setId(cmt.mMeta.mAuthorId); + ui->datetimeLabel->setText(DateTime::formatLongDateTime(cmt.mMeta.mPublishTs)); - if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL)) - pixmap = GxsIdDetails::makeDefaultIcon(cmt.mMeta.mAuthorId,GxsIdDetails::LARGE); - ui->avatarLabel->setPixmap(pixmap); + RsIdentityDetails idDetails ; + rsIdentity->getIdDetails(cmt.mMeta.mAuthorId,idDetails); + QPixmap pixmap ; - //Change this item to be uploaded with thread element. - setMessageId(cmt.mMeta.mThreadId); - mLoadingComment=false; - requestMessage(); + if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL)) + pixmap = GxsIdDetails::makeDefaultIcon(cmt.mMeta.mAuthorId,GxsIdDetails::LARGE); + ui->avatarLabel->setPixmap(pixmap); - }, this ); + //Change this item to be uploaded with thread element. This is really bad practice. - } - else - { -#ifdef DEBUG_ITEM - std::cerr << "ChannelsCommentsItem::loadMessage() Wrong number of Items. Remove It."; - std::cerr << std::endl; -#endif + mLoading=false; + } + else + removeItem(); - RsQThreadUtils::postToObject( [this]() { removeItem(); }, this ); - } - }); - - emit sizeChanged(this); + if (posts.size() == 1) + setPost(posts[0]); + else + setMissingPost(); + + std::cerr << "End loading channel post comment data" << std::endl; + emit sizeChanged(this); + + }, this ); + }); } -void ChannelsCommentsItem::loadComment() +void ChannelsCommentsItem::fill(bool missing_post) { -#ifdef DOES_NOTHING - -#ifdef DEBUG_ITEM - std::cerr << "ChannelsCommentsItem::loadComment()"; - std::cerr << std::endl; -#endif - - RsThread::async([this]() - { - // 1 - get group data - - std::set msgIds; - - for(auto MsgId: messageVersions()) - msgIds.insert(MsgId); - - std::vector posts; - std::vector comments; - - if(! rsGxsChannels->getChannelComments( groupId(),msgIds,comments)) - { - RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; - return; - } - - int comNb = comments.size(); - - mLoadingComment=true; - - RsQThreadUtils::postToObject( [comNb]() - { - QString sComButText = tr("Comment"); - if (comNb == 1) - sComButText = sComButText.append("(1)"); - else if(comNb > 1) - sComButText = tr("Comments ").append("(%1)").arg(comNb); - - //ui->commentButton->setText(sComButText); - - }, this ); - }); -#endif -} - -void ChannelsCommentsItem::fill() -{ - /* fill in */ - -// if (isLoading()) { - // /* Wait for all requests */ - //return; -// } - #ifdef DEBUG_ITEM std::cerr << "ChannelsCommentsItem::fill()"; std::cerr << std::endl; @@ -430,9 +380,6 @@ void ChannelsCommentsItem::fill() mInFill = true; - //QString title; - //float f = QFontMetricsF(font()).height()/14.0 ; - if (!mIsHome) { if (mCloseOnRead && !IS_MSG_NEW(mPost.mMeta.mMsgStatus)) { @@ -443,19 +390,14 @@ void ChannelsCommentsItem::fill() //title += link.toHtml(); //ui->titleLabel->setText(title); - RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName()); - ui->subjectLabel->setText(msgLink.toHtml()); + RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_CHANNEL, mPost.mMeta.mGroupId, mPost.mMeta.mMsgId, messageName()); + + if(missing_post) + ui->subjectLabel->setText("[" + QObject::tr("Missing channel post")+"]"); + else + ui->subjectLabel->setText(msgLink.toHtml()); - if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags)) - { - //ui->unsubscribeButton->setEnabled(true); - } - else - { - //ui->unsubscribeButton->setEnabled(false); - } ui->readButton->hide(); - //ui->titleLabel->hide(); if (IS_MSG_NEW(mPost.mMeta.mMsgStatus)) { mCloseOnRead = true; @@ -463,19 +405,10 @@ void ChannelsCommentsItem::fill() } else { - /* subject */ - //ui->titleLabel->setText(QString::fromUtf8(mPost.mMeta.mMsgName.c_str())); - - //uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height()) - // / QFontMetricsF(ui->subjectLabel->font()).height()); - - // fill first 4 lines of message. (csoler) Disabled the replacement of smileys and links, because the cost is too crazy - //ui->subjectLabel->setText(RsHtml().formatText(NULL, RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), autorized_lines), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - - ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ; - - //QString score = QString::number(post.mTopScore); - // scoreLabel->setText(score); + if(missing_post) + ui->subjectLabel->setText("[" + QObject::tr("Missing channel post")+"]"); + else + ui->subjectLabel->setText(RsStringUtil::CopyLines(QString::fromUtf8(mPost.mMsg.c_str()), 2)) ; /* disable buttons: deletion facility not enabled with cache services yet */ ui->clearButton->setEnabled(false); @@ -498,50 +431,9 @@ void ChannelsCommentsItem::fill() mCloseOnRead = false; } - // differences between Feed or Top of Comment. - if (mFeedHolder) - { - //ui->commentButton->show(); - - // Not yet functional - /*if (mPost.mCommentCount) - { - QString commentText = QString::number(mPost.mCommentCount); - commentText += " "; - commentText += tr("Comments"); - ui->commentButton->setText(commentText); - } - else - { - ui->commentButton->setText(tr("Comment")); - }*/ - - } - else - { - //ui->commentButton->hide(); - } - - // disable voting buttons - if they have already voted. - /*if (post.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK) - { - voteUpButton->setEnabled(false); - voteDownButton->setEnabled(false); - }*/ - - if (wasExpanded() || ui->expandFrame->isVisible()) { - fillExpandFrame(); - } - mInFill = false; } -void ChannelsCommentsItem::fillExpandFrame() -{ - //ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); - -} - QString ChannelsCommentsItem::messageName() { return QString::fromUtf8(mPost.mMeta.mMsgName.c_str()); @@ -605,10 +497,6 @@ void ChannelsCommentsItem::doExpand(bool open) void ChannelsCommentsItem::expandFill(bool first) { GxsFeedItem::expandFill(first); - - if (first) { - fillExpandFrame(); - } } void ChannelsCommentsItem::toggle() diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h index c790e3107..c245cbca7 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.h @@ -42,12 +42,17 @@ public: // It can be used for all apparences of channel posts. But in rder to merge comments from the previous versions of the post, the list of // previous posts should be supplied. It's optional. If not supplied only the comments of the new version will be displayed. - ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId& groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set& older_versions = std::set()); + ChannelsCommentsItem(FeedHolder *feedHolder, + uint32_t feedId, + const RsGxsGroupId& groupId, + const RsGxsMessageId& commentId, + const RsGxsMessageId& threadId, + bool isHome, + bool autoUpdate); // This one is used in channel thread widget. We don't want the group data to reload at every post, so we load it in the hosting // GxsChannelsPostsWidget and pass it to created items. - - ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set& older_versions = std::set()); + // ChannelsCommentsItem(FeedHolder *feedHolder, uint32_t feedId, const RsGroupMetaData& group, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate, const std::set& older_versions = std::set()); virtual ~ChannelsCommentsItem(); @@ -55,6 +60,7 @@ public: bool setGroup(const RsGxsChannelGroup& group, bool doFill = true); bool setPost(const RsGxsChannelPost& post, bool doFill = true); + bool setMissingPost(); QString getTitleLabel(); QString getMsgLabel(); @@ -85,8 +91,8 @@ protected: /* GxsFeedItem */ virtual QString messageName(); - virtual void loadMessage(); - virtual void loadComment(); + virtual void loadMessage() override {} + virtual void loadComment() override {} private slots: /* default stuff */ @@ -104,21 +110,20 @@ signals: void vote(const RsGxsGrpMsgIdPair& msgId, bool up); private: - void setup(); - void fill(); - void fillExpandFrame(); + void load(); + void setup(); + void fill(bool missing_post=false); private: bool mInFill; bool mCloseOnRead; bool mLoaded; - bool mLoadingGroup; - bool mLoadingMessage; - bool mLoadingComment; + bool mLoading; RsGroupMetaData mGroupMeta; RsGxsChannelPost mPost; + RsGxsMessageId mThreadId; /** Qt Designer generated object */ Ui::ChannelsCommentsItem *ui; From 45c701c8e8694acd7cd39d3361395006c7137b7a Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 19 Nov 2023 17:16:48 +0100 Subject: [PATCH 70/88] removed debug output --- .../src/gui/feeds/ChannelsCommentsItem.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp index 46c129ebe..5b0e0b264 100644 --- a/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp +++ b/retroshare-gui/src/gui/feeds/ChannelsCommentsItem.cpp @@ -185,16 +185,11 @@ bool ChannelsCommentsItem::setPost(const RsGxsChannelPost& post, bool doFill) if (doFill) fill(); - std::cerr << "end setting post." << std::endl; return true; } bool ChannelsCommentsItem::setMissingPost() { - std::cerr << "setting missing post." << std::endl; - fill(true); - - std::cerr << "end setting missing post." << std::endl; return true; } @@ -287,7 +282,6 @@ void ChannelsCommentsItem::load() return; mLoading= true; - std::cerr << "Loading message " << mPost.mMeta.mMsgId << std::endl; RsThread::async([this]() { @@ -304,8 +298,7 @@ void ChannelsCommentsItem::load() if (groups.size() != 1) { - std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items"; - std::cerr << std::endl; + std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items" << std::endl; return; } RsGxsChannelGroup group(groups[0]); @@ -336,7 +329,6 @@ void ChannelsCommentsItem::load() { RsGxsComment cmt(comments[0]); - std::cerr << "setting comment." << std::endl; uint32_t autorized_lines = (int)floor( (ui->avatarLabel->height() - ui->button_HL->sizeHint().height()) / QFontMetricsF(ui->subjectLabel->font()).height()); @@ -353,19 +345,20 @@ void ChannelsCommentsItem::load() ui->avatarLabel->setPixmap(pixmap); //Change this item to be uploaded with thread element. This is really bad practice. - - mLoading=false; } else + { + mLoading=false; removeItem(); + } if (posts.size() == 1) setPost(posts[0]); else setMissingPost(); - std::cerr << "End loading channel post comment data" << std::endl; emit sizeChanged(this); + mLoading=false; }, this ); }); From 737eecad9e565da49cb90d672a9a023ed33ae1d0 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 20 Nov 2023 11:29:13 +0100 Subject: [PATCH 71/88] retroshare-service CMake fix icons install path --- retroshare-service/CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/retroshare-service/CMakeLists.txt b/retroshare-service/CMakeLists.txt index 672644369..443ca2227 100644 --- a/retroshare-service/CMakeLists.txt +++ b/retroshare-service/CMakeLists.txt @@ -116,15 +116,17 @@ if(RS_SERVICE_DESKTOP) install( FILES data/retroshare-service_48x48.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps/retroshare-service.png ) + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/48x48/apps/ + RENAME retroshare-service.png) install( FILES data/retroshare-service_128x128.png - DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/retroshare-service.png ) + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/128x128/apps/ + RENAME retroshare-service.png ) install( FILES data/retroshare-service.desktop - DESTINATION ${CMAKE_INSTALL_PREFIX}/data/retroshare-service.desktop ) + DESTINATION ${CMAKE_INSTALL_PREFIX}/data/ ) endif(UNIX AND NOT APPLE) endif(RS_SERVICE_DESKTOP) From 951be8f9a1c6da9e106e6188449d752a30632a60 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 25 Nov 2023 17:25:16 +0100 Subject: [PATCH 72/88] updated to latest commits in submodules --- libretroshare | 2 +- retroshare-webui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libretroshare b/libretroshare index de2b4bd80..bfa91bdef 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit de2b4bd80c57ca757b5f878130f98becf710236d +Subproject commit bfa91bdef24f2339f1db053d155a6ef169027a95 diff --git a/retroshare-webui b/retroshare-webui index ddd8b0b24..dae0c13ef 160000 --- a/retroshare-webui +++ b/retroshare-webui @@ -1 +1 @@ -Subproject commit ddd8b0b241c21940c7addc20c3cce774ff8dc021 +Subproject commit dae0c13ef78aee59a4f1f9e1cdb0127b5e27d256 From 441ba17b53acc837337aac687cb83ffb5669d1be Mon Sep 17 00:00:00 2001 From: thunder2 Date: Sun, 26 Nov 2023 00:19:59 +0100 Subject: [PATCH 73/88] Changed automatic version numbering with "git describe" to split the third part into mini version (leading numbers) and extra version (string after the numbers) --- retroshare.pri | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/retroshare.pri b/retroshare.pri index 19dd5434f..7858f67f6 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -456,13 +456,26 @@ defined in command line") RS_MINOR_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 1) RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 2) - RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, -) + RS_GIT_DESCRIBE_SPLIT = $$split(RS_GIT_DESCRIBE_SPLIT, ) - RS_MINI_VERSION = $$member(RS_GIT_DESCRIBE_SPLIT, 0) - - RS_GIT_DESCRIBE_SPLIT = $$member(RS_GIT_DESCRIBE_SPLIT, 1, -1) - - RS_EXTRA_VERSION = $$join(RS_GIT_DESCRIBE_SPLIT,-,-) + # Split string into mini version (leading numbers) and extra version (string after the numbers) + RS_MINI_VERSION = + RS_EXTRA_VERSION = + for(CHAR, RS_GIT_DESCRIBE_SPLIT) { + isEqual(CHAR, 0) | greaterThan(CHAR, 0):lessThan(CHAR, 9) | isEqual(CHAR, 9) { + # Number + isEmpty(RS_EXTRA_VERSION) { + # Add leading numbers to mini version + RS_MINI_VERSION = $${RS_MINI_VERSION}$${CHAR} + } else { + # Add to extra version + RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR} + } + } else { + # Add to extra version + RS_EXTRA_VERSION = $${RS_EXTRA_VERSION}$${CHAR} + } + } message("RetroShare version\ $${RS_MAJOR_VERSION}.$${RS_MINOR_VERSION}.$${RS_MINI_VERSION}$${RS_EXTRA_VERSION}\ From e0873687a2022ada3ed41e43efee91676c1a56f0 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 26 Nov 2023 09:30:52 +0100 Subject: [PATCH 74/88] Update submodules and gitignore --- .gitignore | 2 +- build_scripts/OBS | 2 +- libretroshare | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b4dfddcac..606e522a3 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ Thumbs.db !supportlibs/libsam3/Makefile # QtCreator cruft -*CMakeLists.txt.user +*CMakeLists.txt.user* # Build artifacts /jsonapi-generator/src/jsonapi-generator diff --git a/build_scripts/OBS b/build_scripts/OBS index 353596b0e..ce70038d0 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit 353596b0ee5ea76611eb663b90bf3ab1c9f34ad7 +Subproject commit ce70038d0ff0110360b1529a8743307c8354e8aa diff --git a/libretroshare b/libretroshare index bfa91bdef..63a6a067d 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit bfa91bdef24f2339f1db053d155a6ef169027a95 +Subproject commit 63a6a067d7198acab21912903b048ca30855c8d9 From c0e564517e8e784eef84d165d800aad3fb63db37 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 26 Nov 2023 09:52:25 +0100 Subject: [PATCH 75/88] Add script to ease tag cleanup for every developers --- build_scripts/git_tag_cleaner.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 build_scripts/git_tag_cleaner.sh diff --git a/build_scripts/git_tag_cleaner.sh b/build_scripts/git_tag_cleaner.sh new file mode 100755 index 000000000..cf7a3ef0c --- /dev/null +++ b/build_scripts/git_tag_cleaner.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +function git_del_tag() +{ + mTag=$1 + + for mRemote in $(git remote); do + echo "Attempting tag $mTag removal from remote $mRemote" + GIT_TERMINAL_PROMPT=0 git push $mRemote :$mTag || true + done + git tag --delete $mTag +} + +for mModule in . build_scripts/OBS/ libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ ; do + pushd $mModule + git_del_tag v0.6.7a + git tag --list | grep untagged | while read mTag; do git_del_tag $mTag ; done + popd +done + From 9ae8c7a196740f99e7d67c53a5497e9d25293f42 Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:07:06 +0100 Subject: [PATCH 76/88] Improved masos compile guide --- build_scripts/OSX/MacOS_X_InstallGuide.md | 62 ++++++++++++++++------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/build_scripts/OSX/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md index 6dafd63c0..0ac7efcfa 100644 --- a/build_scripts/OSX/MacOS_X_InstallGuide.md +++ b/build_scripts/OSX/MacOS_X_InstallGuide.md @@ -30,13 +30,23 @@ In GitHub Desktop -> Clone Repository -> URL Add Repository URL: https://github.com/RetroShare/RetroShare.git and Clone +## ***Get XCode & MacOSX SDK*** + +Install XCode following this guide: [XCode](http://guide.macports.org/#installing.xcode) + +Install XCode command line developer tools: + + $xcode-select --install + +Start XCode to get it updated and to able C compiler to create executables. + +Get Your MacOSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs) + ## ***Choose if you use MacPort or HomeBrew*** ### MacPort Installation -Install MacPort and XCode following this guide: [MacPort and XCode](http://guide.macports.org/#installing.xcode) - -Start XCode to get it updated and to able C compiler to create executables. +Install MacPort following this guide: [MacPort](http://guide.macports.org/#installing.xcode) #### Install libraries @@ -51,18 +61,11 @@ For VOIP Plugin: $ sudo port install opencv $ sudo port install ffmpeg -Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs) ### HOMEBREW Installation Install HomeBrew following this guide: [HomeBrew](http://brew.sh/) -Install XCode command line developer tools: - - $xcode-select --install - -Start XCode to get it updated and to able C compiler to create executables. - #### Install libraries $ brew install openssl @@ -86,7 +89,6 @@ For FeedReader Plugin: $ brew install libxslt -Get Your OSX SDK if missing: [MacOSX-SDKs](https://github.com/phracker/MacOSX-SDKs) ## Last Settings @@ -108,7 +110,7 @@ Edit RetroShare.pro CONFIG += c++14 rs_macos11.1 -and then retroshare.pri +Edit retroshare.pri macx:CONFIG *= rs_macos11.1 rs_macos10.8:CONFIG -= rs_macos11.1 @@ -131,13 +133,18 @@ Edit your retroshare.pri and add to macx-* section alternative via Terminal - $ qmake INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" QMAKE_LIBDIR+="/usr/local/opt/sqlcipher/lib" QMAKE_LIBDIR+="/usr/local/opt/miniupnpc/lib" + $ qmake + INCLUDEPATH+="/usr/local/opt/openssl/include" \ + QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \ + QMAKE_LIBDIR+="/usr/local/opt/sqlcipher/lib" \ + QMAKE_LIBDIR+="/usr/local/opt/miniupnpc/lib" \ + CONFIG+=rs_autologin \ + CONFIG+=rs_use_native_dialogs \ + CONFIG+=release \ + .. -For FeedReader Plugin: - INCLUDEPATH += "/usr/local/opt/libxml2/include/libxml2" - -For building RetroShare with plugins: +With plugins: $ qmake \ INCLUDEPATH+="/usr/local/opt/openssl/include" QMAKE_LIBDIR+="/usr/local/opt/openssl/lib" \ @@ -159,13 +166,30 @@ For building RetroShare with plugins: You can now compile RetroShare into Qt Creator or with Terminal - cd retroshare - qmake; make + $ cd /path/to/retroshare + $ qmake .. + $ make You can change Target and SDK in *./retroshare.pri:82* changing value of QMAKE_MACOSX_DEPLOYMENT_TARGET and QMAKE_MAC_SDK You can find the compiled application at *./retroshare/retroshare-gui/src/retroshare.app* +## Issues + +If you have issues with openssl (Undefined symbols for architecture x86_64) try to add to *~/.profile* file this or via Terminal + + export PATH="/usr/local/opt/openssl/bin:$PATH" + export LDFLAGS="-L/usr/local/opt/openssl/lib" + export CPPFLAGS="-I/usr/local/opt/openssl/include" + export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig" + +For Qt Creator -> QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additional arguments: + + LDFLAGS="-L/usr/local/opt/openssl/lib" + CPPFLAGS="-I/usr/local/opt/openssl/include" + + + ## Copy Plugins $ cp \ From 331cc2e3743056076f436ffefd9195a1b84e068a Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:09:56 +0100 Subject: [PATCH 77/88] added new improved macos package file --- build_scripts/OSX/makeOSXPackage.sh | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 build_scripts/OSX/makeOSXPackage.sh diff --git a/build_scripts/OSX/makeOSXPackage.sh b/build_scripts/OSX/makeOSXPackage.sh new file mode 100644 index 000000000..440760ac4 --- /dev/null +++ b/build_scripts/OSX/makeOSXPackage.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +APP="RetroShare" +RSVERSION="0.6.7a" +QTVERSION="Qt-5.14.1" + +# Install the 7z to create dmg archives. +#brew list p7zip || brew install p7zip + +# Package your app +echo "Packaging retroshare..." +#cd ${project_dir}/build/macOS/clang/x86_64/release/ +cd retroshare-gui/src/ + +# Remove build directories that you don't want to deploy +rm -rf moc +rm -rf obj +rm -rf qrc + +# This automatically creates retroshare.dmg + +echo "Creating dmg archive..." +macdeployqt retroshare.app -dmg + +DATE=`date +"%m-%d-%Y"` +MACVERSION=`sw_vers -productVersion` + +mv $APP.dmg "$APP-$RSVERSION-$DATE-MacOS-$MACVERSION-$QTVERSION.dmg" + +# You can use the appdmg command line app to create your dmg file if +# you want to use a custom background and icon arrangement. I'm still +# working on this for my apps, myself. If you want to do this, you'll +# remove the -dmg option above. +# appdmg json-path YourApp_${TRAVIS_TAG}.dmg + +# Copy other project files +cp "../../libbitdht/src/bitdht/bdboot.txt" "retroshare.app/Contents/Resources/" +cp "../../plugins/FeedReader/lib/libFeedReader.dylib" "retroshare.app/Contents/Resources/" + +# cp "${project_dir}/README.md" "README.md" +# cp "${project_dir}/LICENSE" "LICENSE" +# cp "${project_dir}/Qt License" "Qt License" From ea943369a0475dc10b15553a85769989c2f4713e Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 26 Nov 2023 21:56:37 +0100 Subject: [PATCH 78/88] Update libretroshare submodule --- libretroshare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare b/libretroshare index 63a6a067d..9c53fb6f0 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 63a6a067d7198acab21912903b048ca30855c8d9 +Subproject commit 9c53fb6f03561264b22bdca9aa88753f94dc0363 From 678357ab2a0621f54aab704253d5876626cea4b5 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Sun, 26 Nov 2023 22:53:35 +0100 Subject: [PATCH 79/88] Update libretroshare submodule --- libretroshare | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libretroshare b/libretroshare index 9c53fb6f0..6ef55dd3b 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 9c53fb6f03561264b22bdca9aa88753f94dc0363 +Subproject commit 6ef55dd3b0f7b1d8e56143a50b7ad4fa6859ab74 From 3f40837b1c1043638465d1b55e7cf376b9c3b45d Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 27 Nov 2023 00:06:12 +0100 Subject: [PATCH 80/88] Fix GitlabCI and improve CMake support Do not use mirrors which may be out of sync --- build_scripts/GitlabCI/base.Dockerfile | 19 ++++++++++++------- build_scripts/GitlabCI/gitlabCI.Dockerfile | 8 ++++---- libretroshare | 2 +- retroshare-service/CMakeLists.txt | 4 ++-- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/build_scripts/GitlabCI/base.Dockerfile b/build_scripts/GitlabCI/base.Dockerfile index 13097f58d..014b8fb04 100644 --- a/build_scripts/GitlabCI/base.Dockerfile +++ b/build_scripts/GitlabCI/base.Dockerfile @@ -40,18 +40,23 @@ RUN git clone --depth 1 https://github.com/aetilius/pHash.git && \ rm -rf pHash-build pHash ARG FRESHCLONE=0 -ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git +ARG REPO_URL=https://github.com/RetroShare/RetroShare.git ARG REPO_BRANCH=master ARG REPO_DEPTH="--depth 2000" -RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \ +RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && \ + cd RetroShare && \ git fetch --tags && \ - git submodule update --init --remote --force \ - libbitdht/ libretroshare/ openpgpsdk/ && \ - cd .. + git submodule update --init \ + libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ \ + supportlibs/restbed/ && \ + cd supportlibs/restbed/ && \ + git submodule update --init \ + dependency/asio/ dependency/kashmir/ && \ + cd ../../../ RUN \ mkdir RetroShare-build && cd RetroShare-build && \ cmake -B. -S../RetroShare/retroshare-service \ - -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON && \ - make -j$(nproc) && make install && \ + -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON && \ + make -j$(nproc) -j1 && make install && \ cd .. && rm -rf RetroShare-build diff --git a/build_scripts/GitlabCI/gitlabCI.Dockerfile b/build_scripts/GitlabCI/gitlabCI.Dockerfile index c62c4d198..5ae3f4ed3 100644 --- a/build_scripts/GitlabCI/gitlabCI.Dockerfile +++ b/build_scripts/GitlabCI/gitlabCI.Dockerfile @@ -2,19 +2,19 @@ FROM registry.gitlab.com/retroshare/retroshare:base RUN apt-get update -y && apt-get upgrade -y -ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git +ARG REPO_URL=https://github.com/RetroShare/RetroShare.git ARG REPO_BRANCH=master RUN \ cd RetroShare && git remote add testing $REPO_URL && \ git fetch --tags testing $REPO_BRANCH && \ git reset --hard testing/$REPO_BRANCH && \ - git submodule update --init --remote --force \ - libbitdht/ libretroshare/ openpgpsdk/ && \ + git submodule update --init \ + libbitdht/ libretroshare/ openpgpsdk/ retroshare-webui/ && \ git --no-pager log --max-count 1 RUN \ mkdir RetroShare-build && cd RetroShare-build && \ cmake -B. -S../RetroShare/retroshare-service \ - -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON \ + -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON \ -DRS_WARN_DEPRECATED=OFF -DRS_WARN_LESS=ON && \ make -j$(nproc) && make install && \ cd .. && rm -rf RetroShare-build diff --git a/libretroshare b/libretroshare index 6ef55dd3b..78739f1eb 160000 --- a/libretroshare +++ b/libretroshare @@ -1 +1 @@ -Subproject commit 6ef55dd3b0f7b1d8e56143a50b7ad4fa6859ab74 +Subproject commit 78739f1eb504503b12f107109356624da49e75ef diff --git a/retroshare-service/CMakeLists.txt b/retroshare-service/CMakeLists.txt index 443ca2227..c7560728e 100644 --- a/retroshare-service/CMakeLists.txt +++ b/retroshare-service/CMakeLists.txt @@ -95,7 +95,7 @@ if(EXISTS "${LIBRETROSHARE_DEVEL_DIR}/CMakeLists.txt" ) else() FetchContent_Declare( libretroshare - GIT_REPOSITORY "https://gitlab.com/RetroShare/libretroshare.git" + GIT_REPOSITORY "https://github.com/RetroShare/libretroshare.git" GIT_TAG "origin/master" GIT_SHALLOW TRUE GIT_PROGRESS TRUE @@ -151,7 +151,7 @@ if(RS_WEBUI) else() FetchContent_Declare( webui - GIT_REPOSITORY "https://gitlab.com/RetroShare/RetroShareWebUI.git" + GIT_REPOSITORY "https://github.com/RetroShare/RSNewWebUI.git" GIT_TAG "origin/master" GIT_SHALLOW TRUE GIT_PROGRESS TRUE From 67762c1eb0472891d00fae421ee92a3503abd01e Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 27 Nov 2023 01:33:19 +0100 Subject: [PATCH 81/88] More attempts at fixing GitlabCI See https://forum.gitlab.com/t/docker-dind-stops-working-after-12-1-0-update/28664/11 --- .gitlab-ci.yml | 6 ++++-- build_scripts/GitlabCI/base.Dockerfile | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c91f867a5..45fed1bb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ -image: docker:stable +image: docker:latest services: - - docker:stable-dind + - docker:dind stages: - build @@ -18,6 +18,7 @@ variables: build-ubuntu-test-image: stage: build script: + - docker --version - > docker login "$CI_REGISTRY" --username "$CI_REGISTRY_USER" @@ -35,6 +36,7 @@ build-ubuntu-test-image: test-ubuntu: stage: test script: + - docker --version - > docker login "$CI_REGISTRY" --username "$CI_REGISTRY_USER" diff --git a/build_scripts/GitlabCI/base.Dockerfile b/build_scripts/GitlabCI/base.Dockerfile index 014b8fb04..5fd1bd81d 100644 --- a/build_scripts/GitlabCI/base.Dockerfile +++ b/build_scripts/GitlabCI/base.Dockerfile @@ -58,5 +58,5 @@ RUN \ mkdir RetroShare-build && cd RetroShare-build && \ cmake -B. -S../RetroShare/retroshare-service \ -DRS_FORUM_DEEP_INDEX=ON -DRS_JSON_API=ON -DRS_WEBUI=ON && \ - make -j$(nproc) -j1 && make install && \ + make -j$(nproc) && make install && \ cd .. && rm -rf RetroShare-build From 463a25a0486557b133115147ec25e59ae59e476c Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Tue, 28 Nov 2023 22:47:59 +0100 Subject: [PATCH 82/88] Update OBS submodule --- build_scripts/OBS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/OBS b/build_scripts/OBS index ce70038d0..97a75f2f0 160000 --- a/build_scripts/OBS +++ b/build_scripts/OBS @@ -1 +1 @@ -Subproject commit ce70038d0ff0110360b1529a8743307c8354e8aa +Subproject commit 97a75f2f098babf2f6498f01ff9119aa35ce9a28 From 5ee6f6a2e8da2dec2bb2218256a35b45a1a754c0 Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:36:23 +0100 Subject: [PATCH 83/88] Update XCode part --- build_scripts/OSX/MacOS_X_InstallGuide.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build_scripts/OSX/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md index 0ac7efcfa..2349a4146 100644 --- a/build_scripts/OSX/MacOS_X_InstallGuide.md +++ b/build_scripts/OSX/MacOS_X_InstallGuide.md @@ -34,6 +34,19 @@ In GitHub Desktop -> Clone Repository -> URL Install XCode following this guide: [XCode](http://guide.macports.org/#installing.xcode) +To identify the correct version of Xcode to install, you need to know which OS you are running. Go to the [x] menu -> "About This Mac" and read the macOS version number. + +If you are running the macOS Catalina >= 10.15, you can install Xcode directly from App Store using the instructions below. + +You can find older versions of Xcode at [Apple Developer Downloads](https://developer.apple.com/downloads/). Find the appropriate .xip file for your macOS version + +To install from App Store: + +Select [x] menu - > "App Storeā€¦". +Search for Xcode. Download and install. + +Once Xcode has installed, you must drag the XCode icon into your Applications folder. After you have done this, open Xcode from the Applications folder by double-clicking on the icon and then follow the remaining instructions below. + Install XCode command line developer tools: $xcode-select --install From 31552b111914446d040faceb15c51d80c7488218 Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:32:16 +0100 Subject: [PATCH 84/88] Update MacOS_X_InstallGuide.md --- build_scripts/OSX/MacOS_X_InstallGuide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/OSX/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md index 2349a4146..886372ce4 100644 --- a/build_scripts/OSX/MacOS_X_InstallGuide.md +++ b/build_scripts/OSX/MacOS_X_InstallGuide.md @@ -119,7 +119,7 @@ In QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additiona ## Set your Mac OS SDK version -Edit RetroShare.pro +Edit RetroShare.pro and set your installed sdk version example for 11.1 -> rs_macos11.1 CONFIG += c++14 rs_macos11.1 @@ -137,7 +137,7 @@ Edit retroshare.pri ## Link Include & Libraries -Edit your retroshare.pri and add to macx-* section +When required edit your retroshare.pri macx-* section, check if the Include and Lib path are correct (macx-* section) INCLUDEPATH += "/usr/local/opt/openssl/include" QMAKE_LIBDIR += "/usr/local/opt/openssl/lib" From 6fffb322ae4557f261da5066d6b070c1627e042f Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:26:44 +0100 Subject: [PATCH 85/88] Improved makeOSXPackage.sh file * Added to ship sounds dir * Added CFBundleVersion & CFBundleShortVersionString string * Added to get Git head string for package naming --- build_scripts/OSX/makeOSXPackage.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build_scripts/OSX/makeOSXPackage.sh b/build_scripts/OSX/makeOSXPackage.sh index 440760ac4..0af925693 100644 --- a/build_scripts/OSX/makeOSXPackage.sh +++ b/build_scripts/OSX/makeOSXPackage.sh @@ -17,6 +17,11 @@ rm -rf moc rm -rf obj rm -rf qrc +# This sets the CFBundleVersion & CFBundleShortVersionString string +#/usr/libexec/PlistBuddy -c "Delete :CFBundleGetInfoString" retroshare.app/Contents/Info.plist +/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $RSVERSION" retroshare.app/Contents/Info.plist +/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string $RSVERSION" retroshare.app/Contents/Info.plist + # This automatically creates retroshare.dmg echo "Creating dmg archive..." @@ -24,8 +29,10 @@ macdeployqt retroshare.app -dmg DATE=`date +"%m-%d-%Y"` MACVERSION=`sw_vers -productVersion` +#RSVERSION=`git describe --abbrev=0 --tags` +GITHEAD=`git rev-parse --short HEAD` -mv $APP.dmg "$APP-$RSVERSION-$DATE-MacOS-$MACVERSION-$QTVERSION.dmg" +mv $APP.dmg "$APP-$RSVERSION-$GITHEAD-$DATE-$MACVERSION-$QTVERSION.dmg" # You can use the appdmg command line app to create your dmg file if # you want to use a custom background and icon arrangement. I'm still @@ -36,6 +43,7 @@ mv $APP.dmg "$APP-$RSVERSION-$DATE-MacOS-$MACVERSION-$QTVERSION.dmg" # Copy other project files cp "../../libbitdht/src/bitdht/bdboot.txt" "retroshare.app/Contents/Resources/" cp "../../plugins/FeedReader/lib/libFeedReader.dylib" "retroshare.app/Contents/Resources/" +cp -R "sounds" "retroshare.app/Contents/Resources/sounds" # cp "${project_dir}/README.md" "README.md" # cp "${project_dir}/LICENSE" "LICENSE" From ec35e74400df00a1ae825d8128d46fa6cab32f9a Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Fri, 1 Dec 2023 22:31:01 +0100 Subject: [PATCH 86/88] fix last commit --- build_scripts/OSX/makeOSXPackage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/OSX/makeOSXPackage.sh b/build_scripts/OSX/makeOSXPackage.sh index 0af925693..b599df3c3 100644 --- a/build_scripts/OSX/makeOSXPackage.sh +++ b/build_scripts/OSX/makeOSXPackage.sh @@ -32,7 +32,7 @@ MACVERSION=`sw_vers -productVersion` #RSVERSION=`git describe --abbrev=0 --tags` GITHEAD=`git rev-parse --short HEAD` -mv $APP.dmg "$APP-$RSVERSION-$GITHEAD-$DATE-$MACVERSION-$QTVERSION.dmg" +mv $APP.dmg "$APP-$RSVERSION-$GITHEAD-$DATE-MacOS-$MACVERSION-$QTVERSION.dmg" # You can use the appdmg command line app to create your dmg file if # you want to use a custom background and icon arrangement. I'm still From 493f89643ce499e7c452eadcdd8d60a869ab4982 Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:49:19 +0100 Subject: [PATCH 87/88] Update MacOS_X_InstallGuide.md --- build_scripts/OSX/MacOS_X_InstallGuide.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build_scripts/OSX/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md index 886372ce4..0868500ee 100644 --- a/build_scripts/OSX/MacOS_X_InstallGuide.md +++ b/build_scripts/OSX/MacOS_X_InstallGuide.md @@ -119,11 +119,8 @@ In QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additiona ## Set your Mac OS SDK version -Edit RetroShare.pro and set your installed sdk version example for 11.1 -> rs_macos11.1 - CONFIG += c++14 rs_macos11.1 - -Edit retroshare.pri +Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_macos11.1 ( line 129:) macx:CONFIG *= rs_macos11.1 rs_macos10.8:CONFIG -= rs_macos11.1 From e00e94e87f4b10447eed237f9779e2f682d21bca Mon Sep 17 00:00:00 2001 From: defnax <9952056+defnax@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:46:06 +0100 Subject: [PATCH 88/88] fix for line --- build_scripts/OSX/MacOS_X_InstallGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_scripts/OSX/MacOS_X_InstallGuide.md b/build_scripts/OSX/MacOS_X_InstallGuide.md index 0868500ee..b3dc0e88d 100644 --- a/build_scripts/OSX/MacOS_X_InstallGuide.md +++ b/build_scripts/OSX/MacOS_X_InstallGuide.md @@ -120,7 +120,7 @@ In QtCreator Projects -> Build -> Build Settings -> Build Steps -> Add Additiona ## Set your Mac OS SDK version -Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_macos11.1 ( line 129:) +Edit retroshare.pri and set your installed sdk version example for 11.1 -> rs_macos11.1 (line 135:) macx:CONFIG *= rs_macos11.1 rs_macos10.8:CONFIG -= rs_macos11.1