├── README.md
├── backup.pro
├── backup.pro.user
├── check.h
├── compressor.h
├── decompressor.h
├── image.qrc
├── image
├── add.png
├── backup.png
├── backup1.png
├── clear.png
├── cloud.png
├── delete.png
├── icon.ico
├── icon.png
├── restore.png
├── start.png
└── task.png
├── main.cpp
├── md5.h
├── pack.h
├── server.py
├── task.cpp
├── task.h
├── unpack.h
├── widget.cpp
├── widget.h
├── widget.ui
└── 小组实验报告.docx
/README.md:
--------------------------------------------------------------------------------
1 | # 软件开发综合实验
2 |
3 | 如果Qt打开工程文件不正常的话,请删掉backup.pro.user,重新构建工程。
4 |
--------------------------------------------------------------------------------
/backup.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2020-12-02T19:53:07
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 | QT += network
9 |
10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
11 |
12 | TARGET = backup
13 | TEMPLATE = app
14 |
15 | # The following define makes your compiler emit warnings if you use
16 | # any feature of Qt which has been marked as deprecated (the exact warnings
17 | # depend on your compiler). Please consult the documentation of the
18 | # deprecated API in order to know how to port your code away from it.
19 | DEFINES += QT_DEPRECATED_WARNINGS
20 |
21 | # You can also make your code fail to compile if you use deprecated APIs.
22 | # In order to do so, uncomment the following line.
23 | # You can also select to disable deprecated APIs only up to a certain version of Qt.
24 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
25 |
26 | CONFIG += c++11
27 | RC_ICONS = image/icon.ico
28 |
29 | SOURCES += \
30 | main.cpp \
31 | widget.cpp \
32 | task.cpp
33 |
34 | HEADERS += \
35 | widget.h \
36 | task.h \
37 | compressor.h \
38 | decompressor.h \
39 | md5.h \
40 | check.h \
41 | pack.h \
42 | unpack.h
43 |
44 | msvc {
45 | QMAKE_CFLAGS += /utf-8
46 | QMAKE_CXXFLAGS += /utf-8
47 | }
48 |
49 | FORMS += \
50 | widget.ui
51 | # Default rules for deployment.
52 | qnx: target.path = /tmp/$${TARGET}/bin
53 | else: unix:!android: target.path = /opt/$${TARGET}/bin
54 | !isEmpty(target.path): INSTALLS += target
55 |
56 | RESOURCES += \
57 | image.qrc
58 |
--------------------------------------------------------------------------------
/backup.pro.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | EnvironmentId
7 | {c4c26f2e-216f-439e-ba21-006133600414}
8 |
9 |
10 | ProjectExplorer.Project.ActiveTarget
11 | 0
12 |
13 |
14 | ProjectExplorer.Project.EditorSettings
15 |
16 | true
17 | false
18 | true
19 |
20 | Cpp
21 |
22 | CppGlobal
23 |
24 |
25 |
26 | QmlJS
27 |
28 | QmlJSGlobal
29 |
30 |
31 | 2
32 | UTF-8
33 | false
34 | 4
35 | false
36 | 80
37 | true
38 | true
39 | 1
40 | true
41 | false
42 | 0
43 | true
44 | true
45 | 0
46 | 8
47 | true
48 | 1
49 | true
50 | true
51 | true
52 | false
53 |
54 |
55 |
56 | ProjectExplorer.Project.PluginSettings
57 |
58 |
59 | -fno-delayed-template-parsing
60 |
61 | true
62 | false
63 |
64 |
65 |
66 | true
67 |
68 |
69 |
70 | ProjectExplorer.Project.Target.0
71 |
72 | Desktop Qt 5.11.2 MinGW 32bit
73 | Desktop Qt 5.11.2 MinGW 32bit
74 | qt.qt5.5112.win32_mingw53_kit
75 | 1
76 | 0
77 | 0
78 |
79 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MinGW_32bit-Debug
80 |
81 |
82 | true
83 | qmake
84 |
85 | QtProjectManager.QMakeBuildStep
86 | true
87 |
88 | false
89 | false
90 | false
91 |
92 |
93 | true
94 | Make
95 |
96 | Qt4ProjectManager.MakeStep
97 |
98 | false
99 |
100 |
101 |
102 | 2
103 | Build
104 |
105 | ProjectExplorer.BuildSteps.Build
106 |
107 |
108 |
109 | true
110 | Make
111 |
112 | Qt4ProjectManager.MakeStep
113 |
114 | true
115 | clean
116 |
117 |
118 | 1
119 | Clean
120 |
121 | ProjectExplorer.BuildSteps.Clean
122 |
123 | 2
124 | false
125 |
126 | Debug
127 | Debug
128 | Qt4ProjectManager.Qt4BuildConfiguration
129 | 2
130 | true
131 |
132 |
133 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MinGW_32bit-Release
134 |
135 |
136 | true
137 | qmake
138 |
139 | QtProjectManager.QMakeBuildStep
140 | false
141 |
142 | false
143 | false
144 | true
145 |
146 |
147 | true
148 | Make
149 |
150 | Qt4ProjectManager.MakeStep
151 |
152 | false
153 |
154 |
155 |
156 | 2
157 | Build
158 |
159 | ProjectExplorer.BuildSteps.Build
160 |
161 |
162 |
163 | true
164 | Make
165 |
166 | Qt4ProjectManager.MakeStep
167 |
168 | true
169 | clean
170 |
171 |
172 | 1
173 | Clean
174 |
175 | ProjectExplorer.BuildSteps.Clean
176 |
177 | 2
178 | false
179 |
180 | Release
181 | Release
182 | Qt4ProjectManager.Qt4BuildConfiguration
183 | 0
184 | true
185 |
186 |
187 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MinGW_32bit-Profile
188 |
189 |
190 | true
191 | qmake
192 |
193 | QtProjectManager.QMakeBuildStep
194 | true
195 |
196 | false
197 | true
198 | true
199 |
200 |
201 | true
202 | Make
203 |
204 | Qt4ProjectManager.MakeStep
205 |
206 | false
207 |
208 |
209 |
210 | 2
211 | Build
212 |
213 | ProjectExplorer.BuildSteps.Build
214 |
215 |
216 |
217 | true
218 | Make
219 |
220 | Qt4ProjectManager.MakeStep
221 |
222 | true
223 | clean
224 |
225 |
226 | 1
227 | Clean
228 |
229 | ProjectExplorer.BuildSteps.Clean
230 |
231 | 2
232 | false
233 |
234 | Profile
235 | Profile
236 | Qt4ProjectManager.Qt4BuildConfiguration
237 | 0
238 | true
239 |
240 | 3
241 |
242 |
243 | 0
244 | 部署
245 |
246 | ProjectExplorer.BuildSteps.Deploy
247 |
248 | 1
249 | Deploy Configuration
250 |
251 | ProjectExplorer.DefaultDeployConfiguration
252 |
253 | 1
254 |
255 |
256 | false
257 | false
258 | 1000
259 |
260 | true
261 |
262 | false
263 | false
264 | false
265 | false
266 | true
267 | 0.01
268 | 10
269 | true
270 | 1
271 | 25
272 |
273 | 1
274 | true
275 | false
276 | true
277 | valgrind
278 |
279 | 0
280 | 1
281 | 2
282 | 3
283 | 4
284 | 5
285 | 6
286 | 7
287 | 8
288 | 9
289 | 10
290 | 11
291 | 12
292 | 13
293 | 14
294 |
295 | 2
296 |
297 | backup
298 |
299 | Qt4ProjectManager.Qt4RunConfiguration:D:/CODE/backup/backup/backup.pro
300 | true
301 |
302 | backup.pro
303 |
304 |
305 | 3768
306 | false
307 | true
308 | false
309 | false
310 | true
311 |
312 | 1
313 |
314 |
315 |
316 | ProjectExplorer.Project.Target.1
317 |
318 | Desktop Qt 5.11.2 MSVC2017 64bit
319 | Desktop Qt 5.11.2 MSVC2017 64bit
320 | qt.qt5.5112.win64_msvc2017_64_kit
321 | 1
322 | 0
323 | 0
324 |
325 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MSVC2017_64bit-Debug
326 |
327 |
328 | true
329 | qmake
330 |
331 | QtProjectManager.QMakeBuildStep
332 | true
333 |
334 | false
335 | false
336 | false
337 |
338 |
339 | true
340 | Make
341 |
342 | Qt4ProjectManager.MakeStep
343 |
344 | false
345 |
346 |
347 |
348 | 2
349 | Build
350 |
351 | ProjectExplorer.BuildSteps.Build
352 |
353 |
354 |
355 | true
356 | Make
357 |
358 | Qt4ProjectManager.MakeStep
359 |
360 | true
361 | clean
362 |
363 |
364 | 1
365 | Clean
366 |
367 | ProjectExplorer.BuildSteps.Clean
368 |
369 | 2
370 | false
371 |
372 | Debug
373 | Debug
374 | Qt4ProjectManager.Qt4BuildConfiguration
375 | 2
376 | true
377 |
378 |
379 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MSVC2017_64bit-Release
380 |
381 |
382 | true
383 | qmake
384 |
385 | QtProjectManager.QMakeBuildStep
386 | false
387 |
388 | false
389 | false
390 | true
391 |
392 |
393 | true
394 | Make
395 |
396 | Qt4ProjectManager.MakeStep
397 |
398 | false
399 |
400 |
401 |
402 | 2
403 | Build
404 |
405 | ProjectExplorer.BuildSteps.Build
406 |
407 |
408 |
409 | true
410 | Make
411 |
412 | Qt4ProjectManager.MakeStep
413 |
414 | true
415 | clean
416 |
417 |
418 | 1
419 | Clean
420 |
421 | ProjectExplorer.BuildSteps.Clean
422 |
423 | 2
424 | false
425 |
426 | Release
427 | Release
428 | Qt4ProjectManager.Qt4BuildConfiguration
429 | 0
430 | true
431 |
432 |
433 | D:/CODE/backup/build-backup-Desktop_Qt_5_11_2_MSVC2017_64bit-Profile
434 |
435 |
436 | true
437 | qmake
438 |
439 | QtProjectManager.QMakeBuildStep
440 | true
441 |
442 | false
443 | true
444 | true
445 |
446 |
447 | true
448 | Make
449 |
450 | Qt4ProjectManager.MakeStep
451 |
452 | false
453 |
454 |
455 |
456 | 2
457 | Build
458 |
459 | ProjectExplorer.BuildSteps.Build
460 |
461 |
462 |
463 | true
464 | Make
465 |
466 | Qt4ProjectManager.MakeStep
467 |
468 | true
469 | clean
470 |
471 |
472 | 1
473 | Clean
474 |
475 | ProjectExplorer.BuildSteps.Clean
476 |
477 | 2
478 | false
479 |
480 | Profile
481 | Profile
482 | Qt4ProjectManager.Qt4BuildConfiguration
483 | 0
484 | true
485 |
486 | 3
487 |
488 |
489 | 0
490 | 部署
491 |
492 | ProjectExplorer.BuildSteps.Deploy
493 |
494 | 1
495 | Deploy Configuration
496 |
497 | ProjectExplorer.DefaultDeployConfiguration
498 |
499 | 1
500 |
501 |
502 | false
503 | false
504 | 1000
505 |
506 | true
507 |
508 | false
509 | false
510 | false
511 | false
512 | true
513 | 0.01
514 | 10
515 | true
516 | 1
517 | 25
518 |
519 | 1
520 | true
521 | false
522 | true
523 | valgrind
524 |
525 | 0
526 | 1
527 | 2
528 | 3
529 | 4
530 | 5
531 | 6
532 | 7
533 | 8
534 | 9
535 | 10
536 | 11
537 | 12
538 | 13
539 | 14
540 |
541 | 2
542 |
543 | backup
544 |
545 | Qt4ProjectManager.Qt4RunConfiguration:D:/CODE/backup/backup/backup.pro
546 | true
547 |
548 | backup.pro
549 |
550 |
551 | 3768
552 | false
553 | true
554 | false
555 | false
556 | true
557 |
558 | 1
559 |
560 |
561 |
562 | ProjectExplorer.Project.TargetCount
563 | 2
564 |
565 |
566 | ProjectExplorer.Project.Updater.FileVersion
567 | 18
568 |
569 |
570 | Version
571 | 18
572 |
573 |
574 |
--------------------------------------------------------------------------------
/check.h:
--------------------------------------------------------------------------------
1 | #ifndef CHECK_H
2 | #define CHECK_H
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | class Check {
12 | static QByteArray getMD5ByFilename(QString filename) {
13 | QFile file(filename);
14 | file.open(QIODevice::ReadOnly);
15 | QByteArray md5 = QCryptographicHash::hash(file.readAll(), QCryptographicHash::Md5);
16 | file.close();
17 | return md5.toHex();
18 | }
19 | public:
20 | static QVector> check(QList files, QString directory) {
21 | QVector> result;
22 | if (files.empty()) return result;
23 | auto root = QFileInfo(files[0]).path();
24 | for (const auto& file : files) {
25 | if (!QFileInfo(file).exists()) {
26 | result.push_back(QPair(file, 0));
27 | continue;
28 | }
29 | if (QFileInfo(file).isDir()) {
30 | QDirIterator iter(file, QDirIterator::Subdirectories);
31 | while (iter.hasNext()) {
32 | iter.next();
33 | QFileInfo info = iter.fileInfo();
34 | if (info.fileName() == "." || info.fileName() == "..") continue;
35 | auto relativePath = info.absoluteFilePath().replace(root, "");
36 | auto path = directory + "/" + relativePath;
37 | if (!QFileInfo(path).exists()) {
38 | result.push_back(QPair(info.absoluteFilePath(), 2));
39 | } else if (info.isFile()) {
40 | if (getMD5ByFilename(info.absoluteFilePath()) != getMD5ByFilename(path)) {
41 | result.push_back(QPair(info.absoluteFilePath(), 1));
42 | }
43 | }
44 | }
45 | } else {
46 | auto relativePath = QString(file).replace(root, "");
47 | auto path = directory + "/" + relativePath;
48 | if (!QFileInfo(path).exists()) {
49 | result.push_back(QPair(file, 2));
50 | } else if (getMD5ByFilename(file) != getMD5ByFilename(path)) {
51 | result.push_back(QPair(file, 1));
52 | }
53 | }
54 | }
55 | return result;
56 | }
57 | };
58 |
59 | #endif // CHECK_H
60 |
--------------------------------------------------------------------------------
/compressor.h:
--------------------------------------------------------------------------------
1 | #ifndef COMPRESSOR_H_INCLUDED
2 | #define COMPRESSOR_H_INCLUDED
3 |
4 | #include
5 | #include
6 | #include