Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sudn0
qtcpp_demo
提交
a1894671
qtcpp_demo
项目概览
sudn0
/
qtcpp_demo
与 Fork 源项目一致
Fork自
colorEagleStdio / qtcpp_demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
qtcpp_demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a1894671
编写于
12月 24, 2021
作者:
M
manjaro-xfce
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fopen Test Files Will broke the entire progress.
上级
92be51a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
42 deletion
+55
-42
fileLoadControl/dialogfileloadctrl.cpp
fileLoadControl/dialogfileloadctrl.cpp
+40
-32
fileLoadControl/dialogfileloadctrl.h
fileLoadControl/dialogfileloadctrl.h
+1
-1
fileLoadControl/fileLoadControl_zh_CN.qm
fileLoadControl/fileLoadControl_zh_CN.qm
+0
-0
fileLoadControl/fileLoadControl_zh_CN.ts
fileLoadControl/fileLoadControl_zh_CN.ts
+14
-9
未找到文件。
fileLoadControl/dialogfileloadctrl.cpp
浏览文件 @
a1894671
...
...
@@ -52,8 +52,12 @@ void DialogFileLoadCtrl::cleanFile()
break
;
qint64
tmf
=
m_cache_files
.
begin
()
->
first
;
QMap
<
QString
,
QFileInfo
>
&
mp
=
m_cache_files
[
tmf
];
QMap
<
QString
,
qint64
>
&
ms
=
m_cache_sizes
[
tmf
];
if
(
!
mp
.
size
())
{
m_cache_files
.
erase
(
tmf
);
m_cache_sizes
.
erase
(
tmf
);
}
else
{
QString
fm
=
mp
.
begin
().
key
();
...
...
@@ -90,8 +94,12 @@ void DialogFileLoadCtrl::cleanFile()
slot_msg
(
msg
);
}
mp
.
remove
(
fm
);
ms
.
remove
(
fm
);
if
(
!
mp
.
size
())
{
m_cache_files
.
erase
(
tmf
);
m_cache_sizes
.
erase
(
tmf
);
}
}
if
(
++
cm
%
10
==
0
)
...
...
@@ -118,29 +126,34 @@ void DialogFileLoadCtrl::updateMap()
foreach
(
QFileInfo
i
,
lst
)
{
QString
fm
=
i
.
absoluteFilePath
();
QFile
ft
(
fm
);
if
(
ft
.
open
(
QIODevice
::
ReadOnly
))
long
long
sz
=
i
.
size
();
qint64
tm
=
i
.
fileTime
(
QFile
::
FileBirthTime
).
toMSecsSinceEpoch
();
//Judge Whether this file need to be copied.
bool
NeedTrans
=
false
;
//1. Type
QString
strExt
=
i
.
suffix
().
toUpper
().
trimmed
();
if
(
strExt
.
length
()
<
1
)
strExt
=
":"
;
if
(
FMUpper
.
contains
(
strExt
)
||
FMUpper
.
isEmpty
())
{
ft
.
close
();
unsigned
long
long
sz
=
i
.
size
();
qint64
tm
=
i
.
fileTime
(
QFile
::
FileBirthTime
).
toMSecsSinceEpoch
();
//新文件
if
(
!
m_cache_files
[
tm
].
contains
(
fm
))
//判断大小
if
(
i
.
size
()
>=
bfMin
&&
i
.
size
()
<=
bfMax
)
{
//判断类型
QString
strExt
=
i
.
suffix
().
toUpper
().
trimmed
();
if
(
strExt
.
length
()
<
1
)
strExt
=
":"
;
if
(
FMUpper
.
contains
(
strExt
)
||
FMUpper
.
isEmpty
())
TransFile
(
i
);
}
m_cache_files
[
tm
][
fm
]
=
i
;
m_total_size
+=
sz
;
++
m_total_files
;
//2. Size Range
if
(
sz
>=
bfMin
&&
sz
<=
bfMax
)
{
//3.First Descovered
if
(
!
m_cache_files
[
tm
].
contains
(
fm
))
NeedTrans
=
true
;
//4.Size Changed
else
if
(
m_cache_sizes
[
tm
][
fm
]
!=
sz
)
NeedTrans
=
true
;
}
}
if
(
NeedTrans
)
TransFile
(
i
);
m_cache_files
[
tm
][
fm
]
=
i
;
m_cache_sizes
[
tm
][
fm
]
=
sz
;
m_total_size
+=
sz
;
++
m_total_files
;
}
QString
msg
=
tr
(
"Enuming %1 Files %2 Bytes."
).
arg
(
m_total_files
).
arg
(
m_total_size
);
...
...
@@ -175,12 +188,12 @@ void DialogFileLoadCtrl::TransFile(QFileInfo ifile)
QString
msg
;
std
::
atomic
<
bool
>
bOk
(
false
);
std
::
thread
t
([
&
]()
->
void
{
if
(
true
==
QFile
::
copy
(
ifile
.
absoluteFilePath
(),
dstFile
))
msg
=
tr
(
"Succ Copy %1 to %2."
).
arg
(
ifile
.
absoluteFilePath
()).
arg
(
dstFile
);
else
msg
=
tr
(
"Fail Copy %1 to %2."
).
arg
(
ifile
.
absoluteFilePath
()).
arg
(
dstFile
);
bOk
=
true
;
});
if
(
true
==
QFile
::
copy
(
ifile
.
absoluteFilePath
(),
dstFile
))
msg
=
tr
(
"Succ Copy %1 to %2."
).
arg
(
ifile
.
absoluteFilePath
()).
arg
(
dstFile
);
else
msg
=
tr
(
"Busy File %1 with %2 Bytes."
).
arg
(
ifile
.
absoluteFilePath
()).
arg
(
ifile
.
size
()
);
bOk
=
true
;
});
//Hold and wait
slot_next_prg
(
0
);
quint8
trc
=
0
;
...
...
@@ -304,11 +317,6 @@ void DialogFileLoadCtrl::saveSettings()
}
void
DialogFileLoadCtrl
::
on_doubleSpinBox_maxSz_valueChanged
(
double
/*arg1*/
)
{
saveSettings
();
}
void
DialogFileLoadCtrl
::
on_checkBox_watch_clicked
()
{
saveSettings
();
...
...
fileLoadControl/dialogfileloadctrl.h
浏览文件 @
a1894671
...
...
@@ -31,7 +31,6 @@ private slots:
void
slot_next_prg
(
int
v
);
void
on_pushButton_br_src_clicked
();
void
on_pushButton_br_dst_clicked
();
void
on_doubleSpinBox_maxSz_valueChanged
(
double
arg1
);
void
on_checkBox_watch_clicked
();
private:
...
...
@@ -42,6 +41,7 @@ private:
QStandardItemModel
*
m_pMsgMd
=
0
;
int
m_nTimer
=
-
1
;
std
::
map
<
qint64
,
QMap
<
QString
,
QFileInfo
>
>
m_cache_files
;
std
::
map
<
qint64
,
QMap
<
QString
,
qint64
>
>
m_cache_sizes
;
qint64
m_total_size
=
0
;
qint64
m_total_files
=
0
;
};
...
...
fileLoadControl/fileLoadControl_zh_CN.qm
浏览文件 @
a1894671
无法预览此类型文件
fileLoadControl/fileLoadControl_zh_CN.ts
浏览文件 @
a1894671
...
...
@@ -80,42 +80,47 @@
<
translation
>
完成
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
89
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
93
"
/>
<
source
>
Fail
Deleting
%
1
.
<
/source
>
<
translation
>
删除文件失败
:
%
1
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
64
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
194
"
/>
<
source
>
Busy
File
%
1
with
%
2
Bytes
.
<
/source
>
<
oldsource
>
Busy
File
%
1
Bytes
.
<
/oldsource
>
<
translation
>
文件尚在繁忙
:
%
1
,
%
2
字节
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
68
"
/>
<
source
>
Force
Deleting
%
1
.
<
/source
>
<
translation
>
强制删除文件
:
%
1
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
8
4
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
8
8
"
/>
<
source
>
Succ
Deleting
%
1
.
<
/source
>
<
translation
>
删除文件成功
:
%
1
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
1
46
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
1
59
"
/>
<
source
>
Enuming
%
1
Files
%
2
Bytes
.
<
/source
>
<
translation
>
当前枚举到
%
1
个文件
,
占用
%
2
字节
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
1
79
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
1
92
"
/>
<
source
>
Succ
Copy
%
1
to
%
2
.
<
/source
>
<
translation
>
备份文件成功
:
%
1
到
%
2
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
181
"
/>
<
source
>
Fail
Copy
%
1
to
%
2
.
<
/source
>
<
translation
>
备份文件失败
:
%
1
到
%
2
.
<
/translation
>
<
translation
type
=
"
vanished
"
>
备份文件失败
:
%
1
到
%
2
.
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
2
39
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
2
52
"
/>
<
source
>
Watching
root
<
/source
>
<
translation
>
配额监视根文件夹
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
2
49
"
/>
<
location
filename
=
"
dialogfileloadctrl.cpp
"
line
=
"
2
62
"
/>
<
source
>
backup
root
<
/source
>
<
translation
>
备份目的根文件夹
<
/translation
>
<
/message
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录