From 463383e25c894f2d4cbca86f459911f9d40dbe16 Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 26 Jun 2023 21:07:48 +0200 Subject: [PATCH 1/3] auto-switch to progressive instead of random when the user doesnt want random FT strategy. Added more info about this. --- retroshare-gui/src/gui/settings/TransferPage.cpp | 4 ++-- retroshare-gui/src/gui/settings/TransferPage.ui | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/settings/TransferPage.cpp b/retroshare-gui/src/gui/settings/TransferPage.cpp index dfd8944a2..915eaa679 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.cpp +++ b/retroshare-gui/src/gui/settings/TransferPage.cpp @@ -217,9 +217,9 @@ void TransferPage::updateDefaultStrategy(int i) case 2: #ifdef WINDOWS_SYS - if(QMessageBox::Yes != QMessageBox::warning(nullptr,tr("Warning"),tr("On Windows systems, randomly writing in the middle of large empty files may hang the software for several seconds. Do you want to use this option anyway?"),QMessageBox::Yes,QMessageBox::No)) + if(QMessageBox::Yes != QMessageBox::warning(nullptr,tr("Warning"),tr("On Windows systems, randomly writing in the middle of large empty files may hang the software for several seconds. Do you want to use this option anyway (otherwise use \"progressive\")?"),QMessageBox::Yes,QMessageBox::No)) { - ui._defaultStrategy_CB->setCurrentIndex(0); + ui._defaultStrategy_CB->setCurrentIndex(1); return; } #endif diff --git a/retroshare-gui/src/gui/settings/TransferPage.ui b/retroshare-gui/src/gui/settings/TransferPage.ui index fc2b17b91..b6d8cd7ff 100644 --- a/retroshare-gui/src/gui/settings/TransferPage.ui +++ b/retroshare-gui/src/gui/settings/TransferPage.ui @@ -14,7 +14,7 @@ - 0 + 1 @@ -443,7 +443,7 @@ p, li { white-space: pre-wrap; } true - <html><head/><body><p><span style=" font-weight:600;">Streaming </span>causes the transfer to request 1MB file chunks in increasing order, facilitating preview while downloading. <span style=" font-weight:600;">Random</span> is purely random and favors swarming behavior. <span style=" font-weight:600;">Progressive</span> is a compromise, selecting the next chunk at random within less than 50MB after the end of the partial file. That allows some randomness while preventing large empty file initialization times.</p></body></html> + <html><head/><body><p><span style=" font-weight:600;">Streaming </span>causes the transfer to request 1MB file chunks in increasing order, facilitating preview while downloading. <span style=" font-weight:600;">Random</span> is purely random and favors swarming behavior (although not recommended on Windows systems). <span style=" font-weight:600;">Progressive</span> is a good compromise, selecting the next chunk at random within less than 50MB after the end of the partial file. That allows some randomness while preventing large empty file initialization times.</p></body></html> From afba23882e384a75f534b6fe08538aa22cd9fb54 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 27 Jun 2023 14:00:04 +0200 Subject: [PATCH 2/3] stop GxsGroupFrameDialog from stealing the focus on summary update --- .../src/gui/gxs/GxsGroupFrameDialog.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index 3b1aad916..ca8521ca5 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -1105,7 +1105,12 @@ void GxsGroupFrameDialog::updateGroupSummary() * Qt::QueuedConnection is important! */ - insertGroupsData(*groupInfo); + // Here we save the focus, and restore it afterwards: there's no need to grab the focus here and + // if we do, it may harm the navitation in forums, channels, boards, etc. + + auto w = QApplication::focusWidget(); + + insertGroupsData(*groupInfo); updateSearchResults(); mStateHelper->setLoading(TOKEN_TYPE_GROUP_SUMMARY, false); @@ -1132,7 +1137,12 @@ void GxsGroupFrameDialog::updateGroupSummary() delete groupInfo; - }, this ); + // Restore the focus. + + if(w) + w->setFocus(); + + }, this ); }); } @@ -1165,7 +1175,7 @@ void GxsGroupFrameDialog::updateGroupStatisticsReal(const RsGxsGroupId &groupId) * Qt::QueuedConnection is important! */ - QTreeWidgetItem *item = ui->groupTreeWidget->getItemFromId(QString::fromStdString(stats.mGrpId.toStdString())); + QTreeWidgetItem *item = ui->groupTreeWidget->getItemFromId(QString::fromStdString(stats.mGrpId.toStdString())); if (!item) return; @@ -1174,7 +1184,7 @@ void GxsGroupFrameDialog::updateGroupStatisticsReal(const RsGxsGroupId &groupId) getUserNotify()->updateIcon(); - }, this ); + }, this ); }); } From a78212274291fbc4a7b01074baba9a513c4ccb0f Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 28 Jun 2023 21:48:07 +0200 Subject: [PATCH 3/3] fixed copy file link in channel post files --- .../GxsChannelPostsWidgetWithModel.cpp | 34 ++++++++++++------- .../GxsChannelPostsWidgetWithModel.h | 1 + 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 35f8df044..a6ce946f5 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -411,7 +411,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder))); connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder))); - connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint))); + connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelPostFilesContextMenu(QPoint))); connect(ui->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint))); connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails())); @@ -1344,13 +1344,26 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou showPostDetails(); } - -void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint /*p*/) +void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint p) { - QMenu contextMnu(this) ; + QModelIndex index = ui->channelFiles_TV->indexAt(p); - QAction *action = contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink())); - action->setData(QVariant::fromValue(sender())); + if(!index.isValid()) + return; + + QMenu contextMnu(this) ; + contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()))->setData(QVariant::fromValue(index)); + contextMnu.exec(QCursor::pos()); +} +void GxsChannelPostsWidgetWithModel::showChannelPostFilesContextMenu(QPoint p) +{ + QModelIndex index = ui->channelPostFiles_TV->indexAt(p); + + if(!index.isValid()) + return; + + QMenu contextMnu(this) ; + contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()))->setData(QVariant::fromValue(index)); contextMnu.exec(QCursor::pos()); } @@ -1358,16 +1371,11 @@ void GxsChannelPostsWidgetWithModel::copyChannelFilesLink() { // Block the popup if no results available QAction *action = dynamic_cast(sender()); - RSTreeView *tree = dynamic_cast(action->data().value()); - - QModelIndexList sel = tree->selectionModel()->selection().indexes(); - - if(sel.empty()) - return; + QModelIndex s = action->data().toModelIndex(); ChannelPostFileInfo file; - if(!static_cast(tree->model())->getFileData(sel.front(),file)) + if(!static_cast(s.model())->getFileData(s,file)) return; RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString())); diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h index c325c722b..9cfcaae21 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.h @@ -166,6 +166,7 @@ public slots: void sortColumnPostFiles(int col,Qt::SortOrder so); void updateCommentsCount(int n); void showChannelFilesContextMenu(QPoint p); + void showChannelPostFilesContextMenu(QPoint p); void copyChannelFilesLink(); private: