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,6 +1105,11 @@ void GxsGroupFrameDialog::updateGroupSummary()
* Qt::QueuedConnection is important! * Qt::QueuedConnection is important!
*/ */
// 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); insertGroupsData(*groupInfo);
updateSearchResults(); updateSearchResults();
@ -1132,6 +1137,11 @@ void GxsGroupFrameDialog::updateGroupSummary()
delete groupInfo; delete groupInfo;
// Restore the focus.
if(w)
w->setFocus();
}, 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->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->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->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails())); connect(ui->postsTree->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(showPostDetails()));
@ -1344,13 +1344,26 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
showPostDetails(); 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())); if(!index.isValid())
action->setData(QVariant::fromValue(sender())); 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()); contextMnu.exec(QCursor::pos());
} }
@ -1358,16 +1371,11 @@ void GxsChannelPostsWidgetWithModel::copyChannelFilesLink()
{ {
// Block the popup if no results available // Block the popup if no results available
QAction *action = dynamic_cast<QAction*>(sender()); 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; ChannelPostFileInfo file;
if(!static_cast<RsGxsChannelPostFilesModel*>(tree->model())->getFileData(sel.front(),file)) if(!static_cast<const RsGxsChannelPostFilesModel*>(s.model())->getFileData(s,file))
return; return;
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString())); 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 sortColumnPostFiles(int col,Qt::SortOrder so);
void updateCommentsCount(int n); void updateCommentsCount(int n);
void showChannelFilesContextMenu(QPoint p); void showChannelFilesContextMenu(QPoint p);
void showChannelPostFilesContextMenu(QPoint p);
void copyChannelFilesLink(); void copyChannelFilesLink();
private: private:

View file

@ -217,9 +217,9 @@ void TransferPage::updateDefaultStrategy(int i)
case 2: case 2:
#ifdef WINDOWS_SYS #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; return;
} }
#endif #endif

View file

@ -14,7 +14,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -443,7 +443,7 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="toolTip"> <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> </property>
<item> <item>
<property name="text"> <property name="text">