Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rustdesk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李朝发
rustdesk
Commits
39eb1b72
Commit
39eb1b72
authored
May 14, 2022
by
Kingtous
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opt: add resume btn
parent
d186dd26
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
13 deletions
+126
-13
fs.rs
libs/hbb_common/src/fs.rs
+12
-7
client.rs
src/client.rs
+2
-1
file_trait.rs
src/client/file_trait.rs
+16
-0
file_transfer.css
src/ui/file_transfer.css
+4
-0
file_transfer.tis
src/ui/file_transfer.tis
+26
-4
remote.rs
src/ui/remote.rs
+66
-1
No files found.
libs/hbb_common/src/fs.rs
View file @
39eb1b72
...
...
@@ -200,13 +200,15 @@ pub fn can_enable_overwrite_detection(version: i64) -> bool {
#[derive(Default)]
pub
struct
TransferJob
{
id
:
i32
,
remote
:
String
,
path
:
PathBuf
,
show_hidden
:
bool
,
is_remote
:
bool
,
files
:
Vec
<
FileEntry
>
,
file_num
:
i32
,
pub
id
:
i32
,
pub
remote
:
String
,
pub
path
:
PathBuf
,
pub
show_hidden
:
bool
,
pub
is_remote
:
bool
,
pub
is_last_job
:
bool
,
pub
file_num
:
i32
,
pub
files
:
Vec
<
FileEntry
>
,
file
:
Option
<
File
>
,
total_size
:
u64
,
finished_size
:
u64
,
...
...
@@ -707,6 +709,9 @@ pub async fn handle_read_jobs(
)
->
ResultType
<
()
>
{
let
mut
finished
=
Vec
::
new
();
for
job
in
jobs
.iter_mut
()
{
if
job
.is_last_job
{
continue
;
}
match
job
.read
(
stream
)
.await
{
Err
(
err
)
=>
{
stream
...
...
src/client.rs
View file @
39eb1b72
...
...
@@ -1326,7 +1326,8 @@ pub enum Data {
ToggleClipboardFile
,
NewRDP
,
SetConfirmOverrideFile
((
i32
,
i32
,
bool
,
bool
,
bool
)),
ResumeTransfer
,
AddJob
((
i32
,
String
,
String
,
i32
,
bool
,
bool
)),
ResumeJob
((
i32
,
bool
)),
}
#[derive(Clone)]
...
...
src/client/file_trait.rs
View file @
39eb1b72
...
...
@@ -86,4 +86,20 @@ pub trait FileManager: Interface {
)
{
self
.send
(
Data
::
SendFiles
((
id
,
path
,
to
,
file_num
,
include_hidden
,
is_remote
)));
}
fn
add_job
(
&
mut
self
,
id
:
i32
,
path
:
String
,
to
:
String
,
file_num
:
i32
,
include_hidden
:
bool
,
is_remote
:
bool
,
)
{
self
.send
(
Data
::
AddJob
((
id
,
path
,
to
,
file_num
,
include_hidden
,
is_remote
)));
}
fn
resume_job
(
&
mut
self
,
id
:
i32
,
is_remote
:
bool
){
self
.send
(
Data
::
ResumeJob
((
id
,
is_remote
)));
}
}
src/ui/file_transfer.css
View file @
39eb1b72
...
...
@@ -220,6 +220,10 @@ table.job-table tr.is_remote svg {
transform
:
scale
(
-1
,
1
);
}
table
.job-table
tr
.is_remote
div
.svg_continue
svg
{
transform
:
scale
(
1
,
1
);
}
table
.job-table
tr
td
div
.text
{
width
:
*
;
overflow-x
:
hidden
;
...
...
src/ui/file_transfer.tis
View file @
39eb1b72
...
...
@@ -19,6 +19,7 @@ var svg_refresh = <svg viewBox="0 0 551.13 551.13">
<path d="m482.24 310.01c0 113.97-92.707 206.67-206.67 206.67s-206.67-92.708-206.67-206.67c0-102.21 74.639-187.09 172.23-203.56v65.78l86.114-86.114-86.114-86.115v71.641c-116.65 16.802-206.67 117.14-206.67 238.37 0 132.96 108.16 241.12 241.12 241.12s241.12-108.16 241.12-241.12z"/>
</svg>;
var svg_cancel = <svg .cancel viewBox="0 0 612 612"><polygon points="612 36.004 576.52 0.603 306 270.61 35.478 0.603 0 36.004 270.52 306.01 0 576 35.478 611.4 306 341.41 576.52 611.4 612 576 341.46 306.01"/></svg>;
var svg_continue = <svg .continue t="1652493728825" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="793" ne="0.8429451094012732" width="200" height="200"><path d="M458.69056 948.9408v74.39872c-102.4512-10.22464-196.25472-51.00544-272.1024-113.024l52.2752-52.2752c62.09024 48.87552 137.58464 81.39776 219.8272 90.89536z m562.47296-434.70848c0 263.99744-202.6496 482.9696-460.06784 509.0304v-74.5472c216.6272-25.99424 385.95584-211.73248 385.95584-435.072 0-223.27296-169.32352-409.00096-385.95584-434.9952V5.19168c257.42336 26.07104 460.06784 245.0432 460.06784 509.04064zM166.24128 785.83296l-52.13696 52.14208C50.82112 760.9088 9.51808 665.20576 0 560.67584h73.36448c9.1136 84.41856 42.44992 161.85344 92.8768 225.15712zM113.77664 190.88384l51.65056 51.6608C117.12 303.5392 84.64384 377.56928 74.3424 458.2656H0.95744C12.032 357.632 52.60288 265.53344 113.77664 190.88384zM458.69056 5.12v73.30304c-82.69312 9.55392-158.5664 42.37824-220.8512 91.6992L186.17856 118.4768C262.10304 56.2688 356.06528 15.36 458.69568 5.12z" p-id="794"></path><path d="M652.8 512l-276.48 166.4v-332.8z" p-id="795"></path></svg>;
var svg_computer = <svg .computer viewBox="0 0 480 480">
<g>
<path fill="#2C8CFF" d="m276 395v11.148c0 2.327-1.978 4.15-4.299 3.985-21.145-1.506-42.392-1.509-63.401-0.011-2.322 0.166-4.3-1.657-4.3-3.985v-11.137c0-2.209 1.791-4 4-4h64c2.209 0 4 1.791 4 4zm204-340v288c0 17.65-14.35 32-32 32h-416c-17.65 0-32-14.35-32-32v-288c0-17.65 14.35-32 32-32h416c17.65 0 32 14.35 32 32zm-125.62 386.36c-70.231-21.843-158.71-21.784-228.76 0-4.22 1.31-6.57 5.8-5.26 10.02 1.278 4.085 5.639 6.591 10.02 5.26 66.093-20.58 151.37-21.125 219.24 0 4.22 1.31 8.71-1.04 10.02-5.26s-1.04-8.71-5.26-10.02z"/>
...
...
@@ -100,6 +101,13 @@ class JobTable: Reactor.Component {
refreshDir(is_remote);
}
event click $(svg.continue) (_, me) {
var job = this.jobs[me.parent.parent.parent.index];
var id = job.id;
this.continueJob(id);
this.update();
}
function clearAllJobs() {
this.jobs = [];
this.job_map = {};
...
...
@@ -123,7 +131,9 @@ class JobTable: Reactor.Component {
this.jobs.push({ type: "transfer",
id: id, path: path, to: to,
include_hidden: show_hidden,
is_remote: is_remote });
is_remote: is_remote,
is_last: false
});
this.job_map[id] = this.jobs[this.jobs.length - 1];
handler.send_files(id, path, to, 0, show_hidden, is_remote);
var self = this;
...
...
@@ -134,14 +144,23 @@ class JobTable: Reactor.Component {
var job = { type: "transfer",
id: id, path: path, to: to,
include_hidden: show_hidden,
is_remote: is_remote };
is_remote: is_remote
, is_last: true, file_num: file_num
};
this.jobs.push(job);
this.job_map[id] = this.jobs[this.jobs.length - 1];
jobIdCounter = id + 1;
handler.
send_files
(id, path, to, file_num, show_hidden, is_remote);
handler.
add_job
(id, path, to, file_num, show_hidden, is_remote);
stdout.println(JSON.stringify(job));
}
function continueJob(id) {
var job = this.job_map[id];
if (job == null || !job.is_last){
return;
}
job.is_last = false;
handler.resume_job(job.id, job.is_remote);
}
function addDelDir(path, is_remote) {
var id = jobIdCounter;
jobIdCounter += 1;
...
...
@@ -276,6 +295,9 @@ class JobTable: Reactor.Component {
<div .path>{job.path}</div>
<div id={"s" + job.id}>{this.getStatus(job)}</div>
</div>
<div class="svg_continue" style={job.is_last ? "" : "visibility: hidden"}>
{svg_continue}
</div>
{svg_cancel}
</td></tr>;
}
...
...
@@ -673,7 +695,7 @@ handler.clearAllJobs = function() {
}
handler.addJob = function (id, path, to, file_num, show_hidden, is_remote) {
stdout.println("restore job: " + is_remote);
//
stdout.println("restore job: " + is_remote);
file_transfer.job_table.addJob(id,path,to,file_num,show_hidden,is_remote);
}
...
...
src/ui/remote.rs
View file @
39eb1b72
...
...
@@ -22,7 +22,7 @@ use clipboard::{
use
enigo
::{
self
,
Enigo
,
KeyboardControllable
};
use
hbb_common
::
fs
::{
can_enable_overwrite_detection
,
get_string
,
is_file_exists
,
new_send_confirm
,
DigestCheckResult
,
RemoveJobMeta
,
DigestCheckResult
,
RemoveJobMeta
,
get_job
,
};
use
hbb_common
::
log
::
log
;
use
hbb_common
::{
...
...
@@ -205,6 +205,8 @@ impl sciter::EventHandler for Handler {
fn
set_no_confirm
(
i32
);
fn
cancel_job
(
i32
);
fn
send_files
(
i32
,
String
,
String
,
i32
,
bool
,
bool
);
fn
add_job
(
i32
,
String
,
String
,
i32
,
bool
,
bool
);
fn
resume_job
(
i32
,
bool
);
fn
get_platform
(
bool
);
fn
get_path_sep
(
bool
);
fn
get_icon_path
(
i32
,
String
);
...
...
@@ -1652,6 +1654,69 @@ impl Remote {
}
}
}
Data
::
AddJob
((
id
,
path
,
to
,
file_num
,
include_hidden
,
is_remote
))
=>
{
let
od
=
can_enable_overwrite_detection
(
self
.handler.lc
.read
()
.unwrap
()
.version
);
if
is_remote
{
log
::
debug!
(
"new write waiting job {}, write to {} from remote {}"
,
id
,
to
,
path
);
let
mut
job
=
fs
::
TransferJob
::
new_write
(
id
,
path
.clone
(),
to
,
file_num
,
include_hidden
,
is_remote
,
Vec
::
new
(),
od
,
);
job
.is_last_job
=
true
;
self
.write_jobs
.push
(
job
);
}
else
{
match
fs
::
TransferJob
::
new_read
(
id
,
to
.clone
(),
path
.clone
(),
file_num
,
include_hidden
,
is_remote
,
od
,
)
{
Err
(
err
)
=>
{
self
.handle_job_status
(
id
,
-
1
,
Some
(
err
.to_string
()));
}
Ok
(
mut
job
)
=>
{
log
::
debug!
(
"new read waiting job {}, read {} to remote {}, {} files"
,
id
,
path
,
to
,
job
.files
()
.len
()
);
let
m
=
make_fd
(
job
.id
(),
job
.files
(),
true
);
self
.handler
.call
(
"updateFolderFiles"
,
&
make_args!
(
m
));
job
.is_last_job
=
true
;
self
.read_jobs
.push
(
job
);
self
.timer
=
time
::
interval
(
MILLI1
);
}
}
}
}
Data
::
ResumeJob
((
id
,
is_remote
))
=>
{
if
is_remote
{
if
let
Some
(
job
)
=
get_job
(
id
,
&
mut
self
.write_jobs
)
{
job
.is_last_job
=
false
;
allow_err!
(
peer
.send
(
&
fs
::
new_send
(
id
,
job
.remote
.clone
(),
job
.file_num
,
job
.show_hidden
))
.await
);
}
}
else
{
if
let
Some
(
job
)
=
get_job
(
id
,
&
mut
self
.read_jobs
)
{
job
.is_last_job
=
false
;
allow_err!
(
peer
.send
(
&
fs
::
new_receive
(
id
,
job
.path
.to_string_lossy
()
.to_string
(),
job
.file_num
,
job
.files
.clone
()))
.await
);
}
}
}
Data
::
SetNoConfirm
(
id
)
=>
{
if
let
Some
(
job
)
=
self
.remove_jobs
.get_mut
(
&
id
)
{
job
.no_confirm
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment