添加下载数据库分析
This commit is contained in:
parent
2724d791c5
commit
adade11fb6
MultiplethreadDownload
733
MultiplethreadDownload/process.csv
Normal file
733
MultiplethreadDownload/process.csv
Normal file
@ -0,0 +1,733 @@
|
||||
24598,24598
|
||||
32768,32768
|
||||
15365933,46447
|
||||
15376852,57366
|
||||
7685710,66949
|
||||
23036595,77901
|
||||
15379590,77901
|
||||
23039333,80639
|
||||
35506,83377
|
||||
23040702,84746
|
||||
23063887,107931
|
||||
15387760,116101
|
||||
58901,139496
|
||||
78090,158685
|
||||
82319,162914
|
||||
86548,167143
|
||||
102400,182995
|
||||
15404177,199412
|
||||
15447393,242628
|
||||
23087227,265968
|
||||
23104143,282884
|
||||
123545,304029
|
||||
143626,324110
|
||||
164771,345255
|
||||
7737567,397112
|
||||
23159985,452954
|
||||
23168443,461412
|
||||
189081,485722
|
||||
217221,513862
|
||||
278528,575169
|
||||
294912,591553
|
||||
311296,607937
|
||||
327680,624321
|
||||
15512929,689857
|
||||
15569475,746403
|
||||
7758712,767548
|
||||
23233447,832552
|
||||
23261986,861091
|
||||
23294621,893726
|
||||
360448,926494
|
||||
376832,942878
|
||||
393216,959262
|
||||
409600,975646
|
||||
15585726,991897
|
||||
15614398,1020569
|
||||
15630782,1036953
|
||||
15647166,1053337
|
||||
7824115,1118740
|
||||
7872735,1167360
|
||||
475136,1232896
|
||||
540672,1298432
|
||||
606208,1363968
|
||||
671744,1429504
|
||||
15663550,1445888
|
||||
15679934,1462272
|
||||
7889119,1478656
|
||||
23306909,1490944
|
||||
23323293,1507328
|
||||
15696318,1523712
|
||||
15712702,1540096
|
||||
15778238,1605632
|
||||
15794622,1622016
|
||||
15811006,1638400
|
||||
23376541,1691648
|
||||
23392925,1708032
|
||||
23425693,1740800
|
||||
737280,1806336
|
||||
802816,1871872
|
||||
933888,2002944
|
||||
1036288,2105344
|
||||
1069056,2138112
|
||||
1101824,2170880
|
||||
7893348,2175109
|
||||
7921887,2203648
|
||||
7938271,2220032
|
||||
15827390,2236416
|
||||
15843774,2252800
|
||||
15860158,2269184
|
||||
7971039,2301952
|
||||
15876542,2318336
|
||||
15892926,2334720
|
||||
15909310,2351104
|
||||
23442077,2367488
|
||||
15925694,2383872
|
||||
23458461,2400256
|
||||
15942078,2416640
|
||||
15958462,2433024
|
||||
1167360,2498560
|
||||
1232896,2564096
|
||||
1347584,2678784
|
||||
1363968,2695168
|
||||
1396736,2727936
|
||||
1445888,2777088
|
||||
7987423,2793472
|
||||
23491229,2826240
|
||||
1478656,2859008
|
||||
1544192,2924544
|
||||
1658880,3039232
|
||||
1708032,3088384
|
||||
16023998,3153920
|
||||
1724416,3170304
|
||||
1773568,3219456
|
||||
1806336,3252224
|
||||
1822720,3268608
|
||||
1884160,3330048
|
||||
1966080,3411968
|
||||
2027520,3473408
|
||||
2277376,3723264
|
||||
16040382,3739648
|
||||
8003807,3756032
|
||||
16056766,3772416
|
||||
16126398,3842048
|
||||
23540381,3891200
|
||||
2293760,3907584
|
||||
2326528,3940352
|
||||
23605917,4005888
|
||||
23622301,4022272
|
||||
23638685,4038656
|
||||
2342912,4055040
|
||||
8052959,4104192
|
||||
16183742,4161536
|
||||
16224702,4202496
|
||||
8069343,4218880
|
||||
8085727,4235264
|
||||
8102111,4251648
|
||||
2392064,4300800
|
||||
2998272,4907008
|
||||
3063808,4972544
|
||||
3194880,5103616
|
||||
3268608,5177344
|
||||
3321856,5230592
|
||||
3334144,5242880
|
||||
3465216,5373952
|
||||
3530752,5439488
|
||||
3596288,5505024
|
||||
3661824,5570560
|
||||
3727360,5636096
|
||||
3743744,5652480
|
||||
3809280,5718016
|
||||
16290238,5783552
|
||||
16323006,5816320
|
||||
3825664,5832704
|
||||
3858432,5865472
|
||||
3891200,5898240
|
||||
3923968,5931008
|
||||
3940352,5947392
|
||||
8118495,5963776
|
||||
4005888,6029312
|
||||
4186112,6209536
|
||||
16388542,6275072
|
||||
4251648,6340608
|
||||
23671453,6373376
|
||||
16454078,6438912
|
||||
16519614,6504448
|
||||
4317184,6569984
|
||||
16552382,6602752
|
||||
4464640,6750208
|
||||
16617918,6815744
|
||||
16650686,6848512
|
||||
4530176,6914048
|
||||
4661248,7045120
|
||||
4743168,7127040
|
||||
4808704,7192576
|
||||
4907008,7290880
|
||||
4972544,7356416
|
||||
5038080,7421952
|
||||
5070848,7454720
|
||||
5103616,7487488
|
||||
5120000,7503872
|
||||
5185536,7569408
|
||||
5300224,7684096
|
||||
5406720,7790592
|
||||
23736989,7856128
|
||||
23753373,7872512
|
||||
16716222,7938048
|
||||
16896446,8118272
|
||||
16929214,8151040
|
||||
23769757,8167424
|
||||
16961982,8200192
|
||||
17027518,8265728
|
||||
17093054,8331264
|
||||
17142206,8380416
|
||||
17207742,8445952
|
||||
17240510,8478720
|
||||
17256894,8495104
|
||||
23835293,8560640
|
||||
23851677,8577024
|
||||
5455872,8626176
|
||||
5488640,8658944
|
||||
17322430,8724480
|
||||
17453502,8855552
|
||||
8184031,8921088
|
||||
8315103,9052160
|
||||
8380639,9117696
|
||||
17498558,9162752
|
||||
17519038,9183232
|
||||
17584574,9248768
|
||||
17633726,9297920
|
||||
17650110,9314304
|
||||
17666494,9330688
|
||||
17682878,9347072
|
||||
17699262,9363456
|
||||
23868061,9379840
|
||||
23917213,9428992
|
||||
23933597,9445376
|
||||
17764798,9510912
|
||||
17830334,9576448
|
||||
17863102,9609216
|
||||
5558272,9678848
|
||||
5607424,9728000
|
||||
5750784,9871360
|
||||
6012928,10133504
|
||||
6160384,10280960
|
||||
6176768,10297344
|
||||
6189056,10309632
|
||||
6246400,10366976
|
||||
6258688,10379264
|
||||
6311936,10432512
|
||||
8413407,10465280
|
||||
6320128,10473472
|
||||
6328320,10481664
|
||||
6348800,10502144
|
||||
6737920,10891264
|
||||
6770688,10924032
|
||||
17928638,10989568
|
||||
23999133,11055104
|
||||
24015517,11071488
|
||||
6787072,11087872
|
||||
6914048,11214848
|
||||
8429791,11231232
|
||||
6946816,11264000
|
||||
6979584,11296768
|
||||
7012352,11329536
|
||||
7045120,11362304
|
||||
7110656,11427840
|
||||
7176192,11493376
|
||||
7307264,11624448
|
||||
7340032,11657216
|
||||
7372800,11689984
|
||||
17994174,11755520
|
||||
18026942,11788288
|
||||
24060573,11833344
|
||||
8446175,11849728
|
||||
8495327,11898880
|
||||
18092478,11964416
|
||||
18158014,12029952
|
||||
18272702,12144640
|
||||
18289086,12161024
|
||||
24076957,12177408
|
||||
24109725,12210176
|
||||
18338238,12259328
|
||||
7389184,12275712
|
||||
7405568,12292096
|
||||
7421952,12308480
|
||||
7438336,12324864
|
||||
18371006,12357632
|
||||
24126109,12374016
|
||||
24142493,12390400
|
||||
18387390,12406784
|
||||
18420158,12439552
|
||||
8511711,12455936
|
||||
18485694,12521472
|
||||
18551230,12587008
|
||||
24158877,12603392
|
||||
7454720,12619776
|
||||
7520256,12685312
|
||||
7536640,12701696
|
||||
24191645,12734464
|
||||
7585792,12783616
|
||||
7622656,12820480
|
||||
18583998,12853248
|
||||
24240797,12902400
|
||||
24257181,12918784
|
||||
18600382,12935168
|
||||
18665918,13000704
|
||||
7639040,13017088
|
||||
7676127,13054175
|
||||
8577247,13119711
|
||||
8593631,13136095
|
||||
18698686,13168863
|
||||
18747838,13218015
|
||||
8610015,13234399
|
||||
8626399,13250783
|
||||
18764222,13267167
|
||||
18780606,13283551
|
||||
18813374,13316319
|
||||
24273565,13332703
|
||||
18862526,13381855
|
||||
24306333,13414623
|
||||
18928062,13480159
|
||||
19042750,13594847
|
||||
19059134,13611231
|
||||
19075518,13627615
|
||||
19091902,13643999
|
||||
19108286,13660383
|
||||
19124670,13676767
|
||||
24322717,13693151
|
||||
19141054,13709535
|
||||
24339101,13725919
|
||||
24388253,13775071
|
||||
8691935,13840607
|
||||
8724703,13873375
|
||||
19206590,13938911
|
||||
19337662,14069983
|
||||
8790239,14135519
|
||||
8806623,14151903
|
||||
24437405,14201055
|
||||
19370430,14233823
|
||||
19386814,14250207
|
||||
24470173,14282975
|
||||
19419582,14315743
|
||||
24486557,14332127
|
||||
19452350,14364895
|
||||
24502941,14381279
|
||||
19517886,14446815
|
||||
19534270,14463199
|
||||
19599806,14528735
|
||||
19665342,14594271
|
||||
19730878,14659807
|
||||
19743166,14672095
|
||||
19747262,14676191
|
||||
24568477,14741727
|
||||
19763646,14758111
|
||||
24601245,14790879
|
||||
19812798,14840031
|
||||
8872159,14905567
|
||||
8888543,14921951
|
||||
24617629,14938335
|
||||
19829182,14954719
|
||||
19845566,14971103
|
||||
19911102,15036639
|
||||
24634013,15053023
|
||||
24650397,15069407
|
||||
19976638,15134943
|
||||
20042174,15200479
|
||||
20074942,15233247
|
||||
20140478,15298783
|
||||
20206014,15364319
|
||||
8921311,15397087
|
||||
24666781,15413471
|
||||
24699549,15446239
|
||||
8986847,15511775
|
||||
9003231,15528159
|
||||
20271550,15593695
|
||||
20287934,15610079
|
||||
9019615,15626463
|
||||
24765085,15691999
|
||||
24781469,15708383
|
||||
20304318,15724767
|
||||
20320702,15741151
|
||||
20369854,15790303
|
||||
20402622,15823071
|
||||
9035999,15839455
|
||||
20419006,15855839
|
||||
20484542,15921375
|
||||
20664766,16101599
|
||||
20697534,16134367
|
||||
20763070,16199903
|
||||
20812222,16249055
|
||||
24847005,16314591
|
||||
24912541,16380127
|
||||
24928925,16396511
|
||||
9085151,16445663
|
||||
20877758,16511199
|
||||
21008830,16642271
|
||||
21025214,16658655
|
||||
9101535,16675039
|
||||
24978077,16724191
|
||||
24994461,16740575
|
||||
25027229,16773343
|
||||
25043613,16789727
|
||||
21074366,16838879
|
||||
21123518,16888031
|
||||
25059997,16904415
|
||||
21139902,16920799
|
||||
21156286,16937183
|
||||
21172670,16953567
|
||||
21189054,16969951
|
||||
21205438,16986335
|
||||
21270974,17051871
|
||||
21303742,17084639
|
||||
9150687,17133791
|
||||
9167071,17150175
|
||||
21320126,17166559
|
||||
9183455,17182943
|
||||
21336510,17199327
|
||||
21352894,17215711
|
||||
21369278,17232095
|
||||
21385662,17248479
|
||||
21418430,17281247
|
||||
21451198,17314015
|
||||
25125533,17379551
|
||||
25141917,17395935
|
||||
21516734,17461471
|
||||
21582270,17527007
|
||||
25158301,17543391
|
||||
25191069,17576159
|
||||
21647806,17641695
|
||||
21713342,17707231
|
||||
21729726,17723615
|
||||
21795262,17789151
|
||||
21860798,17854687
|
||||
9248991,17920223
|
||||
25240221,17969375
|
||||
21926334,18034911
|
||||
21991870,18100447
|
||||
22008254,18116831
|
||||
9314527,18182367
|
||||
22073790,18247903
|
||||
22090174,18264287
|
||||
25305757,18329823
|
||||
25354909,18378975
|
||||
22155710,18444511
|
||||
22221246,18510047
|
||||
22286782,18575583
|
||||
22335934,18624735
|
||||
22368702,18657503
|
||||
9330911,18673887
|
||||
22385086,18690271
|
||||
25420445,18755807
|
||||
25436829,18772191
|
||||
9347295,18788575
|
||||
9380063,18821343
|
||||
22450622,18886879
|
||||
25502365,18952415
|
||||
25535133,18985183
|
||||
22499774,19034335
|
||||
22565310,19099871
|
||||
22696382,19230943
|
||||
22761918,19296479
|
||||
25551517,19312863
|
||||
22778302,19329247
|
||||
22909374,19460319
|
||||
23028381,19579326
|
||||
25617053,19644862
|
||||
9445599,19710398
|
||||
9511135,19775934
|
||||
9527519,19792318
|
||||
9576671,19841470
|
||||
25682589,19907006
|
||||
25748125,19972542
|
||||
25928349,20152766
|
||||
25977501,20201918
|
||||
9642207,20267454
|
||||
9658591,20283838
|
||||
26043037,20349374
|
||||
26075805,20382142
|
||||
26141341,20447678
|
||||
26174109,20480446
|
||||
26190493,20496830
|
||||
26256029,20562366
|
||||
26305181,20611518
|
||||
26337949,20644286
|
||||
26354333,20660670
|
||||
26387101,20693438
|
||||
26403485,20709822
|
||||
26419869,20726206
|
||||
9674975,20742590
|
||||
9740511,20808126
|
||||
9822431,20890046
|
||||
9887967,20955582
|
||||
26485405,21021118
|
||||
26550941,21086654
|
||||
26665629,21201342
|
||||
26682013,21217726
|
||||
26698397,21234110
|
||||
26714781,21250494
|
||||
26731165,21266878
|
||||
26747549,21283262
|
||||
26780317,21316030
|
||||
9920735,21348798
|
||||
26796701,21365182
|
||||
9986271,21430718
|
||||
10002655,21447102
|
||||
26862237,21512638
|
||||
26927773,21578174
|
||||
26960541,21610942
|
||||
10035423,21643710
|
||||
10068191,21676478
|
||||
27026077,21742014
|
||||
27091613,21807550
|
||||
27157149,21873086
|
||||
27222685,21938622
|
||||
27255453,21971390
|
||||
10117343,22020542
|
||||
27304605,22069694
|
||||
27353757,22118846
|
||||
27419293,22184382
|
||||
27435677,22200766
|
||||
27533981,22299070
|
||||
27550365,22315454
|
||||
27566749,22331838
|
||||
27599517,22364606
|
||||
27665053,22430142
|
||||
27681437,22446526
|
||||
10182879,22512062
|
||||
10248415,22577598
|
||||
10281183,22610366
|
||||
10330335,22659518
|
||||
27746973,22725054
|
||||
27812509,22790590
|
||||
27878045,22856126
|
||||
27927197,22905278
|
||||
27992733,22970814
|
||||
28025501,23003582
|
||||
28091037,23069118
|
||||
28123805,23101886
|
||||
28140189,23118270
|
||||
28172957,23151038
|
||||
10395871,23216574
|
||||
28189341,23232958
|
||||
10461407,23298494
|
||||
28254877,23364030
|
||||
28304029,23413182
|
||||
28320413,23429566
|
||||
28369565,23478718
|
||||
10510559,23527870
|
||||
28385949,23544254
|
||||
28402333,23560638
|
||||
28418717,23577022
|
||||
28435101,23593406
|
||||
28451485,23609790
|
||||
28467869,23626174
|
||||
28533405,23691710
|
||||
28598941,23757246
|
||||
28615325,23773630
|
||||
28631709,23790014
|
||||
28664477,23822782
|
||||
28680861,23839166
|
||||
28697245,23855550
|
||||
10576095,23921086
|
||||
10658015,24003006
|
||||
10690783,24035774
|
||||
10707167,24052158
|
||||
28762781,24117694
|
||||
28779165,24134078
|
||||
10723551,24150462
|
||||
10756319,24183230
|
||||
10772703,24199614
|
||||
28795549,24215998
|
||||
28861085,24281534
|
||||
28926621,24347070
|
||||
28959389,24379838
|
||||
28975773,24396222
|
||||
28992157,24412606
|
||||
29008541,24428990
|
||||
29024925,24445374
|
||||
29041309,24461758
|
||||
29074077,24494526
|
||||
29139613,24560062
|
||||
29221533,24641982
|
||||
29237917,24658366
|
||||
29254301,24674750
|
||||
29270685,24691134
|
||||
29319837,24740286
|
||||
29336221,24756670
|
||||
29352605,24773054
|
||||
10838239,24838590
|
||||
29368989,24854974
|
||||
29401757,24887742
|
||||
10887391,24936894
|
||||
10920159,24969662
|
||||
10936543,24986046
|
||||
10952927,25002430
|
||||
10985695,25035198
|
||||
11018463,25067966
|
||||
29467293,25133502
|
||||
29729437,25395646
|
||||
29762205,25428414
|
||||
29778589,25444798
|
||||
11083999,25510334
|
||||
11133151,25559486
|
||||
29844125,25625022
|
||||
29909661,25690558
|
||||
29975197,25756094
|
||||
30007965,25788862
|
||||
11149535,25805246
|
||||
30040733,25838014
|
||||
30106269,25903550
|
||||
30139037,25936318
|
||||
30204573,26001854
|
||||
30286493,26083774
|
||||
30302877,26100158
|
||||
30319261,26116542
|
||||
30384797,26182078
|
||||
30483101,26280382
|
||||
11215071,26345918
|
||||
11247839,26378686
|
||||
11264223,26395070
|
||||
11280607,26411454
|
||||
30499485,26427838
|
||||
30565021,26493374
|
||||
11296991,26509758
|
||||
30581405,26526142
|
||||
30646941,26591678
|
||||
30704510,26649247
|
||||
11305183,26657439
|
||||
11378911,26731167
|
||||
11428063,26780319
|
||||
11477215,26829471
|
||||
11493599,26845855
|
||||
11559135,26911391
|
||||
11575519,26927775
|
||||
11608287,26960543
|
||||
11641055,26993311
|
||||
11657439,27009695
|
||||
11690207,27042463
|
||||
11722975,27075231
|
||||
11755743,27107999
|
||||
11788511,27140767
|
||||
11837663,27189919
|
||||
11903199,27255455
|
||||
11919583,27271839
|
||||
11985119,27337375
|
||||
12050655,27402911
|
||||
12099807,27452063
|
||||
12116191,27468447
|
||||
12132575,27484831
|
||||
12148959,27501215
|
||||
12181727,27533983
|
||||
12214495,27566751
|
||||
12247263,27599519
|
||||
12263647,27615903
|
||||
12280031,27632287
|
||||
12296415,27648671
|
||||
12312799,27665055
|
||||
12329183,27681439
|
||||
12378335,27730591
|
||||
12443871,27796127
|
||||
12509407,27861663
|
||||
12525791,27878047
|
||||
12542175,27894431
|
||||
12558559,27910815
|
||||
12574943,27927199
|
||||
12607711,27959967
|
||||
12624095,27976351
|
||||
12640479,27992735
|
||||
12656863,28009119
|
||||
12706015,28058271
|
||||
12722399,28074655
|
||||
12771551,28123807
|
||||
12837087,28189343
|
||||
12902623,28254879
|
||||
12919007,28271263
|
||||
12935391,28287647
|
||||
12951775,28304031
|
||||
13017311,28369567
|
||||
13033695,28385951
|
||||
13050079,28402335
|
||||
13066463,28418719
|
||||
13082847,28435103
|
||||
13099231,28451487
|
||||
13164767,28517023
|
||||
13230303,28582559
|
||||
13263071,28615327
|
||||
13295839,28648095
|
||||
13312223,28664479
|
||||
13328607,28680863
|
||||
13361375,28713631
|
||||
13377759,28730015
|
||||
13394143,28746399
|
||||
13426911,28779167
|
||||
13443295,28795551
|
||||
13459679,28811935
|
||||
13476063,28828319
|
||||
13492447,28844703
|
||||
13525215,28877471
|
||||
13541599,28893855
|
||||
13574367,28926623
|
||||
13639903,28992159
|
||||
13672671,29024927
|
||||
13721823,29074079
|
||||
13738207,29090463
|
||||
13803743,29155999
|
||||
13820127,29172383
|
||||
13836511,29188767
|
||||
13852895,29205151
|
||||
13869279,29221535
|
||||
13885663,29237919
|
||||
13918431,29270687
|
||||
13934815,29287071
|
||||
14000351,29352607
|
||||
14016735,29368991
|
||||
14049503,29401759
|
||||
14098655,29450911
|
||||
14115039,29467295
|
||||
14147807,29500063
|
||||
14164191,29516447
|
||||
14180575,29532831
|
||||
14213343,29565599
|
||||
14229727,29581983
|
||||
14262495,29614751
|
||||
14278879,29631135
|
||||
14295263,29647519
|
||||
14360799,29713055
|
||||
14377183,29729439
|
||||
14393567,29745823
|
||||
14409951,29762207
|
||||
14426335,29778591
|
||||
14491871,29844127
|
||||
14508255,29860511
|
||||
14541023,29893279
|
||||
14573791,29926047
|
||||
14590175,29942431
|
||||
14655711,30007967
|
||||
14672095,30024351
|
||||
14688479,30040735
|
||||
14721247,30073503
|
||||
14737631,30089887
|
||||
14754015,30106271
|
||||
14770399,30122655
|
||||
14786783,30139039
|
||||
14803167,30155423
|
||||
14868703,30220959
|
||||
14934239,30286495
|
||||
14950623,30302879
|
||||
14967007,30319263
|
||||
15016159,30368415
|
||||
15032543,30384799
|
||||
15081695,30433951
|
||||
15114463,30466719
|
||||
15147231,30499487
|
||||
15179999,30532255
|
||||
15196383,30548639
|
||||
15212767,30565023
|
||||
15229151,30581407
|
||||
15245535,30597791
|
||||
15278303,30630559
|
||||
15294687,30646943
|
||||
15311071,30663327
|
||||
15327455,30679711
|
||||
15343839,30696095
|
||||
15352254,30704510
|
|
@ -22,7 +22,7 @@ Widget::Widget(QWidget *parent)
|
||||
ui->setupUi(this);
|
||||
|
||||
// 设置URL链接验证器
|
||||
QRegExp regex(R"(http[s]://.+)");
|
||||
QRegExp regex(R"(https?:\/\/.+)");
|
||||
auto *validator = new QRegExpValidator(regex, nullptr);
|
||||
ui->urlInput->setValidator(validator);
|
||||
|
||||
@ -81,6 +81,7 @@ qint64 Widget::getFileSize(const QString& url)
|
||||
&& reply->hasRawHeader(QString("Content-Length").toLocal8Bit())) {
|
||||
fileSize = reply->header(QNetworkRequest::ContentLengthHeader).toUInt();
|
||||
}
|
||||
qDebug() << "文件大小为:" << fileSize;
|
||||
reply->deleteLater();
|
||||
return fileSize;
|
||||
}
|
||||
@ -137,6 +138,7 @@ void Widget::multiDownload(const QString &url, qint64 fileSize, const QString &f
|
||||
}
|
||||
file.resize(fileSize);
|
||||
|
||||
qDebug() << "开始下载文件";
|
||||
// 任务等分
|
||||
qint64 segmentSize = fileSize / threadCount;
|
||||
QVector<QPair<qint64, qint64>> vec(threadCount);
|
||||
@ -158,14 +160,17 @@ void Widget::multiDownload(const QString &url, qint64 fileSize, const QString &f
|
||||
QNetworkReply *reply = mgr.get(request);
|
||||
qint64 writePos = pair.first;
|
||||
QMutex lock;
|
||||
qDebug() << "开始下载数据:" << QString(" %1~%2 ").arg(pair.first).arg(pair.second);
|
||||
qDebug() << "开始下载数据:" << QString(" %1~%2 -> writePos Start %3")
|
||||
.arg(pair.first).arg(pair.second).arg(writePos);
|
||||
connect(reply, &QNetworkReply::readyRead, [&lock, &writePos, &file, &bytesReceived, reply](){
|
||||
QByteArray data = reply->readAll();
|
||||
lock.lock();
|
||||
qDebug() << "调整文件的数据指针:" << writePos;
|
||||
// qDebug() << "调整文件的数据指针:" << writePos;
|
||||
file.seek(writePos);
|
||||
file.write(data);
|
||||
bytesReceived += data.size();
|
||||
qDebug() << QString("%1, %2, %3")
|
||||
.arg(writePos).arg(bytesReceived).arg(data.size());
|
||||
lock.unlock();
|
||||
writePos += data.size();
|
||||
});
|
||||
@ -209,6 +214,7 @@ void Widget::on_downloadBtn_clicked()
|
||||
}
|
||||
|
||||
ui->downloadBtn->setEnabled(false);
|
||||
ui->downProgressBar->setValue(0);
|
||||
qint64 fileSize = getFileSize(url);
|
||||
QString sizeText = fileSize == 0 ? "未知大小" : Utils::sizeFormat(fileSize);
|
||||
ui->filesizeLabel->setText(sizeText);
|
||||
|
@ -25,6 +25,9 @@
|
||||
<property name="windowTitle">
|
||||
<string>多线程下载文件Demo</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">font-family: "Microsoft Yahei";</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
@ -111,6 +114,11 @@
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QCheckBox" name="dwnFinishedOpenChbox">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Microsoft Yahei</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>下载完成是否打开</string>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user