transform: basic trans ui.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -34,3 +34,4 @@ build
|
|||||||
cmake-*
|
cmake-*
|
||||||
.idea
|
.idea
|
||||||
.vs
|
.vs
|
||||||
|
.cache
|
||||||
@@ -150,6 +150,11 @@ void ClientCore::SetRemoteID(const QString& id)
|
|||||||
remoteID_ = id;
|
remoteID_ = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientCore::SetFrameCall(FrameBufferType type, const std::function<void(FrameBuffer*)>& call)
|
||||||
|
{
|
||||||
|
frameCall_[type] = call;
|
||||||
|
}
|
||||||
|
|
||||||
QString ClientCore::GetRemoteID()
|
QString ClientCore::GetRemoteID()
|
||||||
{
|
{
|
||||||
return remoteID_;
|
return remoteID_;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <QMutexLocker>
|
#include <QMutexLocker>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
class ClientCore : public QObject
|
class ClientCore : public QObject
|
||||||
{
|
{
|
||||||
@@ -47,6 +48,7 @@ public:
|
|||||||
void SetClientsCall(const std::function<void(const InfoClientVec& clients)>& call);
|
void SetClientsCall(const std::function<void(const InfoClientVec& clients)>& call);
|
||||||
void SetPathCall(const std::function<void(const QString& path)>& call);
|
void SetPathCall(const std::function<void(const QString& path)>& call);
|
||||||
void SetFileCall(const std::function<void(const DirFileInfoVec& files)>& call);
|
void SetFileCall(const std::function<void(const DirFileInfoVec& files)>& call);
|
||||||
|
void SetFrameCall(FrameBufferType type, const std::function<void(FrameBuffer*)>& call);
|
||||||
void SetRemoteID(const QString& id);
|
void SetRemoteID(const QString& id);
|
||||||
QString GetRemoteID();
|
QString GetRemoteID();
|
||||||
|
|
||||||
@@ -62,6 +64,8 @@ public:
|
|||||||
std::function<void(const QString& path)> pathCall_;
|
std::function<void(const QString& path)> pathCall_;
|
||||||
std::function<void(const InfoClientVec& clients)> clientsCall_;
|
std::function<void(const InfoClientVec& clients)> clientsCall_;
|
||||||
std::function<void(const DirFileInfoVec& files)> fileCall_;
|
std::function<void(const DirFileInfoVec& files)> fileCall_;
|
||||||
|
|
||||||
|
std::array<std::function<void(FrameBuffer*)>, 256> frameCall_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIENTCORE_H
|
#endif // CLIENTCORE_H
|
||||||
@@ -21,6 +21,7 @@ Control/FileControl.h Control/FileControl.cpp Control/FileControl.ui
|
|||||||
Control/ConnectControl.h Control/ConnectControl.cpp Control/ConnectControl.ui
|
Control/ConnectControl.h Control/ConnectControl.cpp Control/ConnectControl.ui
|
||||||
Control/CompareControl.h Control/CompareControl.cpp Control/CompareControl.ui
|
Control/CompareControl.h Control/CompareControl.cpp Control/CompareControl.ui
|
||||||
GuiUtil/Public.h GuiUtil/Public.cpp
|
GuiUtil/Public.h GuiUtil/Public.cpp
|
||||||
|
Control/Transform.h Control/Transform.cpp Control/Transform.ui
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "GuiUtil/Public.h"
|
#include "GuiUtil/Public.h"
|
||||||
#include "ui_ConnectControl.h"
|
#include "ui_ConnectControl.h"
|
||||||
|
#include "Transform.h"
|
||||||
|
|
||||||
Connecter::Connecter(QWidget* parent) : QWidget(parent), ui(new Ui::Connecter), th_(nullptr)
|
Connecter::Connecter(QWidget* parent) : QWidget(parent), ui(new Ui::Connecter), th_(nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
44
Gui/Control/Transform.cpp
Normal file
44
Gui/Control/Transform.cpp
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#include "Transform.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include "ui_Transform.h"
|
||||||
|
|
||||||
|
TransForm::TransForm(QWidget* parent) : QDialog(parent), ui(new Ui::TransForm)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
TransForm::~TransForm()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransForm::SetTasks(const QVector<TransTask>& tasks)
|
||||||
|
{
|
||||||
|
tasks_ = tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransForm::StartExecTask()
|
||||||
|
{
|
||||||
|
for (const auto& task : tasks_) {
|
||||||
|
InfoMsg infoReq;
|
||||||
|
if (task.isUpload) {
|
||||||
|
if (!clientCore_->Send<InfoMsg>(infoReq, FBT_CLI_REQ_SEND, task.remoteId)) {
|
||||||
|
QMessageBox::information(this, tr("Error"), tr("Send info request failed."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransForm::StopExecTask()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransForm::SetClientCore(ClientCore* clientCore)
|
||||||
|
{
|
||||||
|
clientCore_ = clientCore;
|
||||||
|
}
|
||||||
49
Gui/Control/Transform.h
Normal file
49
Gui/Control/Transform.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
#ifndef TRANSFORM_H
|
||||||
|
#define TRANSFORM_H
|
||||||
|
|
||||||
|
#include <ClientCore.h>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class TransForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TransTask {
|
||||||
|
bool isUpload{false};
|
||||||
|
QString localId;
|
||||||
|
QString localPath;
|
||||||
|
QString remoteId;
|
||||||
|
QString remotePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TaskState {
|
||||||
|
STATE_READY = 0,
|
||||||
|
STATE_RUNNING,
|
||||||
|
STATE_FAILED,
|
||||||
|
STATE_FINISH,
|
||||||
|
};
|
||||||
|
|
||||||
|
class TransForm : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TransForm(QWidget* parent = nullptr);
|
||||||
|
~TransForm();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void SetClientCore(ClientCore* clientCore);
|
||||||
|
void SetTasks(const QVector<TransTask>& tasks);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void StartExecTask();
|
||||||
|
void StopExecTask();
|
||||||
|
|
||||||
|
private:
|
||||||
|
TaskState curState_{TaskState::STATE_READY};
|
||||||
|
QVector<TransTask> tasks_;
|
||||||
|
ClientCore* clientCore_;
|
||||||
|
Ui::TransForm* ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TRANSFORM_H
|
||||||
126
Gui/Control/Transform.ui
Normal file
126
Gui/Control/Transform.ui
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>TransForm</class>
|
||||||
|
<widget class="QDialog" name="TransForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>363</width>
|
||||||
|
<height>284</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>From:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edFrom"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="pedFrom"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>To:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edTo">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPlainTextEdit" name="pedTo"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="progressBar">
|
||||||
|
<property name="value">
|
||||||
|
<number>24</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Task:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="edTask"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnCancel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -18,7 +18,15 @@ enum FrameBufferType : uint16_t {
|
|||||||
FBT_CLI_ASK_DIRFILE,
|
FBT_CLI_ASK_DIRFILE,
|
||||||
FBT_CLI_ANS_DIRFILE,
|
FBT_CLI_ANS_DIRFILE,
|
||||||
FBT_CLI_ASK_HOME,
|
FBT_CLI_ASK_HOME,
|
||||||
FBT_CLI_ANS_HOME
|
FBT_CLI_ANS_HOME,
|
||||||
|
FBT_CLI_REQ_SEND,
|
||||||
|
FBT_CLI_ANSREQ_SUCCESS,
|
||||||
|
FBT_CLI_ANSREQ_FAILED,
|
||||||
|
FBT_CLI_REQ_RECV,
|
||||||
|
FBT_CLI_ANSRECV_SUCCESS,
|
||||||
|
FBT_CLI_ANSRECV_FAILED,
|
||||||
|
FBT_CLI_FILETRANS,
|
||||||
|
FBT_CLI_TRANS_DONE
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrameBuffer {
|
struct FrameBuffer {
|
||||||
|
|||||||
Reference in New Issue
Block a user