Merge pull request #2747 from csoler/v0.6-BugFixing_30

2 important fixes
This commit is contained in:
csoler 2023-06-29 14:23:36 +02:00 committed by GitHub
commit bb533eefc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 21 deletions

View File

@ -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 );
});
}

View File

@ -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<QAction*>(sender());
RSTreeView *tree = dynamic_cast<RSTreeView*>(action->data().value<QWidget*>());
QModelIndexList sel = tree->selectionModel()->selection().indexes();
if(sel.empty())
return;
QModelIndex s = action->data().toModelIndex();
ChannelPostFileInfo file;
if(!static_cast<RsGxsChannelPostFilesModel*>(tree->model())->getFileData(sel.front(),file))
if(!static_cast<const RsGxsChannelPostFilesModel*>(s.model())->getFileData(s,file))
return;
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString()));

View File

@ -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:

View File

@ -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

View File

@ -14,7 +14,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -443,7 +443,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Streaming &lt;/span&gt;causes the transfer to request 1MB file chunks in increasing order, facilitating preview while downloading. &lt;span style=&quot; font-weight:600;&quot;&gt;Random&lt;/span&gt; is purely random and favors swarming behavior. &lt;span style=&quot; font-weight:600;&quot;&gt;Progressive&lt;/span&gt; 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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Streaming &lt;/span&gt;causes the transfer to request 1MB file chunks in increasing order, facilitating preview while downloading. &lt;span style=&quot; font-weight:600;&quot;&gt;Random&lt;/span&gt; is purely random and favors swarming behavior (although not recommended on Windows systems). &lt;span style=&quot; font-weight:600;&quot;&gt;Progressive&lt;/span&gt; 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.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">