socket: Unified Soket thread management.
This commit is contained in:
@@ -42,6 +42,11 @@ void CustomTableWidget::setRemoteIDCall(const std::function<QString()>& call)
|
||||
ridCall_ = call;
|
||||
}
|
||||
|
||||
void CustomTableWidget::setOtherSideCall(const std::function<QString()>& call)
|
||||
{
|
||||
otherSideCall_ = call;
|
||||
}
|
||||
|
||||
void CustomTableWidget::dropEvent(QDropEvent* event)
|
||||
{
|
||||
if (!event->mimeData()->hasFormat("application/x-qabstractitemmodeldatalist")) {
|
||||
@@ -51,12 +56,29 @@ void CustomTableWidget::dropEvent(QDropEvent* event)
|
||||
QByteArray encoded = event->mimeData()->data("application/x-qabstractitemmodeldatalist");
|
||||
QDataStream stream(&encoded, QIODevice::ReadOnly);
|
||||
|
||||
QVector<TransTask> tasks;
|
||||
QList<QTableWidgetItem*> draggedItems;
|
||||
while (!stream.atEnd()) {
|
||||
int row, col;
|
||||
QMap<int, QVariant> roleData;
|
||||
stream >> row >> col >> roleData;
|
||||
if (col != 1) {
|
||||
continue;
|
||||
}
|
||||
TransTask task;
|
||||
task.isUpload = isRemote_;
|
||||
task.localId = oidCall_();
|
||||
task.remoteId = ridCall_();
|
||||
if (isRemote_) {
|
||||
task.remotePath = basePathCall_();
|
||||
task.localPath = Util::Join(otherSideCall_(), roleData[Qt::DisplayRole].toString());
|
||||
} else {
|
||||
task.localPath = basePathCall_();
|
||||
task.remotePath = Util::Join(otherSideCall_(), roleData[Qt::DisplayRole].toString());
|
||||
}
|
||||
tasks.push_back(task);
|
||||
}
|
||||
emit sigTasks(tasks);
|
||||
}
|
||||
|
||||
void CustomTableWidget::dragEnterEvent(QDragEnterEvent* event)
|
||||
|
||||
Reference in New Issue
Block a user