Skip to content

Commit 429ff3a

Browse files
committed
Plugins: Add ftp server
1 parent 66ea6ba commit 429ff3a

65 files changed

Lines changed: 1470 additions & 243 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Authors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ See: https://github.com/KangLin/RabbitRemoteControl/graphs/contributors
4444
- [OPTIONAL] FFMPEG: [https://ffmpeg.org/](https://ffmpeg.org/) Multimedia capabilities required
4545
- [OPTIONAL] qtkeychain: [https://github.com/KangLin/qtkeychain](https://github.com/KangLin/qtkeychain)
4646
- [OPTIONAL] libcurl: [https://curl.se](https://curl.se)
47+
- [OPTIONAL] QFtpServer: https://github.com/sashoalm/QFtpServer

Authors_zh_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@
4646
- [可选] FFMPEG: [https://ffmpeg.org/](https://ffmpeg.org/) 多媒体功能需要
4747
- [可选] qtkeychain: [https://github.com/KangLin/qtkeychain](https://github.com/KangLin/qtkeychain)
4848
- [可选] libcurl: [https://curl.se](https://curl.se)
49+
- [可选] QFtpServer: https://github.com/sashoalm/QFtpServer

Plugins/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ if(WITH_QTERMWIDGET)
9696
endif()
9797
endif()
9898

99+
## Server
100+
option(BUILD_FTP_SERVER "Build ftp server" ON)
101+
if(BUILD_FTP_SERVER)
102+
add_subdirectory(FtpServer)
103+
endif()
104+
99105
message(STATUS "BUILD_RABBITVNC: ${BUILD_RABBITVNC}")
100106
message(STATUS "BUILD_TigerVNC: ${BUILD_TigerVNC}")
101107
message(STATUS "BUILD_LibVNCServer: ${BUILD_LibVNCServer}")
@@ -108,3 +114,5 @@ message(STATUS "BUILD_TERMINAL_TELNET: ${BUILD_TERMINAL_TELNET}")
108114
message(STATUS "BUILD_TERMINAL_SSH: ${BUILD_TERMINAL_SSH}")
109115
message(STATUS "BUILD_FILE_TRANSFER: ${BUILD_FILE_TRANSFER}")
110116
message(STATUS "BUILD_WEB_BROWSER: ${BUILD_WEB_BROWSER}; Qt${QT_VERSION_MAJOR}WebEngineWidgets: ${Qt${QT_VERSION_MAJOR}WebEngineWidgets_FOUND}")
117+
118+
message(STATUS "BUILD_FTP_SERVER: ${BUILD_FTP_SERVER}")
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <QLoggingCategory>
2+
#include "BackendFtpServer.h"
3+
4+
static Q_LOGGING_CATEGORY(log, "FtpServer.Backend")
5+
CBackendFtpServer::CBackendFtpServer(COperate *pOperate) : CBackend(pOperate)
6+
{
7+
qDebug(log) << Q_FUNC_INFO;
8+
}
9+
10+
CBackendFtpServer::~CBackendFtpServer()
11+
{
12+
qDebug(log) << Q_FUNC_INFO;
13+
}
14+
15+
int CBackendFtpServer::Start()
16+
{
17+
qDebug(log) << Q_FUNC_INFO;
18+
return 0;
19+
}
20+
21+
int CBackendFtpServer::Stop()
22+
{
23+
qDebug(log) << Q_FUNC_INFO;
24+
return 0;
25+
}
26+
27+
CBackend::OnInitReturnValue CBackendFtpServer::OnInit()
28+
{
29+
qDebug(log) << Q_FUNC_INFO;
30+
return OnInitReturnValue::NotUseOnProcess;
31+
}
32+
33+
int CBackendFtpServer::OnClean()
34+
{
35+
qDebug(log) << Q_FUNC_INFO;
36+
return 0;
37+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright Copyright (c) Kang Lin studio, All Rights Reserved
2+
// Author: Kang Lin <kl222@126.com>
3+
4+
#pragma once
5+
6+
#include "Backend.h"
7+
8+
class CBackendFtpServer : public CBackend
9+
{
10+
Q_OBJECT
11+
12+
public:
13+
explicit CBackendFtpServer(COperate *pOperate = nullptr);
14+
~CBackendFtpServer();
15+
16+
public:
17+
virtual int Start() override;
18+
virtual int Stop() override;
19+
20+
protected:
21+
virtual OnInitReturnValue OnInit() override;
22+
virtual int OnClean() override;
23+
};

Plugins/FtpServer/CMakeLists.txt

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Author: Kang Lin <kl222@126.com>
2+
3+
project(FtpServer
4+
DESCRIPTION "Ftp service plugin"
5+
)
6+
7+
find_package(QFtpServerLib)
8+
if(NOT QFtpServerLib_FOUND)
9+
return()
10+
endif()
11+
12+
SET(FtpServer_PRIVATE_LIBS Plugin)
13+
SET(SOURCE_FILES
14+
PluginFtpServer.cpp
15+
OperateFtpServer.cpp
16+
BackendFtpServer.cpp
17+
FrmSettings.cpp
18+
ParameterFtpServer.cpp
19+
)
20+
21+
SET(HEADER_FILES
22+
PluginFtpServer.h
23+
OperateFtpServer.h
24+
BackendFtpServer.h
25+
FrmSettings.h
26+
ParameterFtpServer.h
27+
)
28+
29+
SET(RCC_FILES FrmSettings.ui)
30+
if(WITH_GUI)
31+
32+
endif()
33+
34+
ADD_PLUGIN_TARGET(NAME PluginService${PROJECT_NAME}
35+
ISPLUGIN
36+
SOURCE_FILES ${SOURCE_FILES} ${HEADER_FILES} ${RCC_FILES}
37+
PRIVATE_LIBS ${FtpServer_PRIVATE_LIBS}
38+
PRIVATE_INCLUDE_DIRS ${FtpServer_INCLUDE_DIR} ${WinPR_INCLUDE_DIR}
39+
PRIVATE_DEFINITIONS FtpServer_VERSION_MAJOR=${FtpServer_MAJOR}
40+
PRIVATE_OPTIONS ${FtpServer_OPTIONS}
41+
INSTALL_DIR ${PLUGIN_PATH}
42+
OUTPUT_DIR ${CMAKE_BINARY_DIR}/${PLUGIN_PATH}
43+
INSTALL_RPATH ${INSTALL_RPATH}
44+
VERSION ${RabbitRemoteControl_VERSION}
45+
)

Plugins/FtpServer/FrmSettings.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "FrmSettings.h"
2+
#include "ui_FrmSettings.h"
3+
4+
CFrmSettings::CFrmSettings(QWidget *parent)
5+
: QWidget(parent)
6+
, ui(new Ui::CFrmSettings)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
CFrmSettings::~CFrmSettings()
12+
{
13+
delete ui;
14+
}
15+
16+
void CFrmSettings::on_pbCancel_clicked()
17+
{
18+
19+
}
20+
21+
22+
void CFrmSettings::on_pbApply_clicked()
23+
{
24+
25+
}
26+
27+
28+
void CFrmSettings::on_pbStart_clicked()
29+
{
30+
31+
}
32+

Plugins/FtpServer/FrmSettings.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright Copyright (c) Kang Lin studio, All Rights Reserved
2+
// Author: Kang Lin <kl222@126.com>
3+
4+
#pragma once
5+
6+
#include <QWidget>
7+
8+
namespace Ui {
9+
class CFrmSettings;
10+
}
11+
12+
class CFrmSettings : public QWidget
13+
{
14+
Q_OBJECT
15+
16+
public:
17+
explicit CFrmSettings(QWidget *parent = nullptr);
18+
~CFrmSettings();
19+
20+
private slots:
21+
void on_pbCancel_clicked();
22+
23+
void on_pbApply_clicked();
24+
25+
void on_pbStart_clicked();
26+
27+
private:
28+
Ui::CFrmSettings *ui;
29+
};

Plugins/FtpServer/FrmSettings.ui

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>CFrmSettings</class>
4+
<widget class="QWidget" name="CFrmSettings">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<property name="toolTip">
17+
<string>Apply parameters</string>
18+
</property>
19+
<property name="statusTip">
20+
<string>Apply parameters</string>
21+
</property>
22+
<layout class="QGridLayout" name="gridLayout">
23+
<item row="4" column="0">
24+
<layout class="QHBoxLayout" name="horizontalLayout_6">
25+
<item>
26+
<widget class="QCheckBox" name="cbAnonmousLogin">
27+
<property name="text">
28+
<string>Aollow anonymous login</string>
29+
</property>
30+
</widget>
31+
</item>
32+
<item>
33+
<widget class="QCheckBox" name="cbReadOnly">
34+
<property name="text">
35+
<string>Read-only</string>
36+
</property>
37+
</widget>
38+
</item>
39+
</layout>
40+
</item>
41+
<item row="1" column="0">
42+
<layout class="QHBoxLayout" name="horizontalLayout_3">
43+
<item>
44+
<widget class="QLabel" name="label_2">
45+
<property name="text">
46+
<string>User:</string>
47+
</property>
48+
</widget>
49+
</item>
50+
<item>
51+
<widget class="QLineEdit" name="leUser"/>
52+
</item>
53+
</layout>
54+
</item>
55+
<item row="2" column="0">
56+
<layout class="QHBoxLayout" name="horizontalLayout_2">
57+
<item>
58+
<widget class="QLabel" name="label_3">
59+
<property name="text">
60+
<string>Password:</string>
61+
</property>
62+
</widget>
63+
</item>
64+
<item>
65+
<widget class="QLineEdit" name="lePassword"/>
66+
</item>
67+
</layout>
68+
</item>
69+
<item row="6" column="0">
70+
<layout class="QHBoxLayout" name="horizontalLayout_5">
71+
<item>
72+
<spacer name="horizontalSpacer_2">
73+
<property name="orientation">
74+
<enum>Qt::Orientation::Horizontal</enum>
75+
</property>
76+
<property name="sizeHint" stdset="0">
77+
<size>
78+
<width>40</width>
79+
<height>20</height>
80+
</size>
81+
</property>
82+
</spacer>
83+
</item>
84+
<item>
85+
<widget class="QPushButton" name="pbStart">
86+
<property name="toolTip">
87+
<string>Start server</string>
88+
</property>
89+
<property name="statusTip">
90+
<string>Start server</string>
91+
</property>
92+
<property name="text">
93+
<string>Start</string>
94+
</property>
95+
</widget>
96+
</item>
97+
<item>
98+
<widget class="QPushButton" name="pbApply">
99+
<property name="text">
100+
<string>Apply</string>
101+
</property>
102+
</widget>
103+
</item>
104+
<item>
105+
<widget class="QPushButton" name="pbCancel">
106+
<property name="text">
107+
<string>Cancel</string>
108+
</property>
109+
</widget>
110+
</item>
111+
</layout>
112+
</item>
113+
<item row="3" column="0">
114+
<layout class="QHBoxLayout" name="horizontalLayout_4">
115+
<item>
116+
<widget class="QLabel" name="label_4">
117+
<property name="text">
118+
<string>Root directory:</string>
119+
</property>
120+
</widget>
121+
</item>
122+
<item>
123+
<widget class="QLineEdit" name="leRoot"/>
124+
</item>
125+
<item>
126+
<widget class="QPushButton" name="pbRoot">
127+
<property name="text">
128+
<string>Browser</string>
129+
</property>
130+
</widget>
131+
</item>
132+
</layout>
133+
</item>
134+
<item row="0" column="0">
135+
<layout class="QHBoxLayout" name="horizontalLayout">
136+
<item>
137+
<widget class="QLabel" name="label">
138+
<property name="text">
139+
<string>Port:</string>
140+
</property>
141+
</widget>
142+
</item>
143+
<item>
144+
<widget class="QSpinBox" name="sbPort">
145+
<property name="sizePolicy">
146+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
147+
<horstretch>0</horstretch>
148+
<verstretch>0</verstretch>
149+
</sizepolicy>
150+
</property>
151+
<property name="maximum">
152+
<number>65536</number>
153+
</property>
154+
</widget>
155+
</item>
156+
</layout>
157+
</item>
158+
<item row="5" column="0">
159+
<spacer name="verticalSpacer">
160+
<property name="orientation">
161+
<enum>Qt::Orientation::Vertical</enum>
162+
</property>
163+
<property name="sizeHint" stdset="0">
164+
<size>
165+
<width>20</width>
166+
<height>40</height>
167+
</size>
168+
</property>
169+
</spacer>
170+
</item>
171+
</layout>
172+
</widget>
173+
<resources/>
174+
<connections/>
175+
</ui>

0 commit comments

Comments
 (0)