1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
|
/* $Id$ */
/** @file
* VBox Qt GUI - UIMessageCenter class implementation.
*/
/*
* Copyright (C) 2006-2019 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* Qt includes: */
#include <QDir>
#include <QFileInfo>
#include <QLocale>
#include <QThread>
#include <QProcess>
#ifdef VBOX_WS_MAC
# include <QPushButton>
#endif
/* GUI includes: */
#include "QIMessageBox.h"
#include "UICommon.h"
#include "UIConverter.h"
#include "UIMessageCenter.h"
#include "UIProgressDialog.h"
#include "UIErrorString.h"
#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
# include "UINetworkManager.h"
# include "UINetworkManagerDialog.h"
#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
#include "UIModalWindowManager.h"
#include "UIExtraDataManager.h"
#include "UIMedium.h"
#ifdef VBOX_OSE
# include "UIDownloaderUserManual.h"
#endif /* VBOX_OSE */
#include "VBoxAboutDlg.h"
#include "UIHostComboEditor.h"
#ifdef VBOX_WS_MAC
# include "VBoxUtils-darwin.h"
#endif
#ifdef VBOX_WS_WIN
# include <Htmlhelp.h>
#endif
/* COM includes: */
#include "CAudioAdapter.h"
#include "CBooleanFormValue.h"
#include "CChoiceFormValue.h"
#include "CCloudClient.h"
#include "CCloudProfile.h"
#include "CCloudProvider.h"
#include "CCloudProviderManager.h"
#include "CDHCPServer.h"
#include "CGraphicsAdapter.h"
#include "CNATEngine.h"
#include "CNATNetwork.h"
#include "CNetworkAdapter.h"
#include "CRangedIntegerFormValue.h"
#include "CSerialPort.h"
#include "CSharedFolder.h"
#include "CSnapshot.h"
#include "CStorageController.h"
#include "CStringFormValue.h"
#include "CConsole.h"
#include "CMachine.h"
#include "CSystemProperties.h"
#include "CVirtualBoxErrorInfo.h"
#include "CMediumAttachment.h"
#include "CMediumFormat.h"
#include "CAppliance.h"
#include "CExtPackManager.h"
#include "CExtPackFile.h"
#include "CHostNetworkInterface.h"
#include "CVFSExplorer.h"
#include "CVirtualSystemDescription.h"
#include "CVirtualSystemDescriptionForm.h"
#ifdef VBOX_WITH_DRAG_AND_DROP
# include "CGuest.h"
# include "CDnDSource.h"
# include "CDnDTarget.h"
#endif /* VBOX_WITH_DRAG_AND_DROP */
/* Other VBox includes: */
#include <iprt/param.h>
#include <iprt/path.h>
#include <iprt/errcore.h>
/* static */
UIMessageCenter *UIMessageCenter::s_pInstance = 0;
UIMessageCenter *UIMessageCenter::instance() { return s_pInstance; }
/* static */
void UIMessageCenter::create()
{
/* Make sure instance is NOT created yet: */
if (s_pInstance)
{
AssertMsgFailed(("UIMessageCenter instance is already created!"));
return;
}
/* Create instance: */
new UIMessageCenter;
/* Prepare instance: */
s_pInstance->prepare();
}
/* static */
void UIMessageCenter::destroy()
{
/* Make sure instance is NOT destroyed yet: */
if (!s_pInstance)
{
AssertMsgFailed(("UIMessageCenter instance is already destroyed!"));
return;
}
/* Cleanup instance: */
s_pInstance->cleanup();
/* Destroy instance: */
delete s_pInstance;
}
void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) const
{
if (fWarningShown && !m_warnings.contains(strWarningName))
m_warnings.append(strWarningName);
else if (!fWarningShown && m_warnings.contains(strWarningName))
m_warnings.removeAll(strWarningName);
}
bool UIMessageCenter::warningShown(const QString &strWarningName) const
{
return m_warnings.contains(strWarningName);
}
int UIMessageCenter::message(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const QString &strDetails,
const char *pcszAutoConfirmId /* = 0*/,
int iButton1 /* = 0*/,
int iButton2 /* = 0*/,
int iButton3 /* = 0*/,
const QString &strButtonText1 /* = QString() */,
const QString &strButtonText2 /* = QString() */,
const QString &strButtonText3 /* = QString() */) const
{
/* If this is NOT a GUI thread: */
if (thread() != QThread::currentThread())
{
/* We have to throw a blocking signal
* to show a message-box in the GUI thread: */
emit sigToShowMessageBox(pParent, enmType,
strMessage, strDetails,
iButton1, iButton2, iButton3,
strButtonText1, strButtonText2, strButtonText3,
QString(pcszAutoConfirmId));
/* Inter-thread communications are not yet implemented: */
return 0;
}
/* In usual case we can chow a message-box directly: */
return showMessageBox(pParent, enmType,
strMessage, strDetails,
iButton1, iButton2, iButton3,
strButtonText1, strButtonText2, strButtonText3,
QString(pcszAutoConfirmId));
}
void UIMessageCenter::error(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const QString &strDetails,
const char *pcszAutoConfirmId /* = 0*/) const
{
message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId,
AlertButton_Ok | AlertButtonOption_Default | AlertButtonOption_Escape);
}
bool UIMessageCenter::errorWithQuestion(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const QString &strDetails,
const char *pcszAutoConfirmId /* = 0*/,
const QString &strOkButtonText /* = QString()*/,
const QString &strCancelButtonText /* = QString()*/) const
{
return (message(pParent, enmType, strMessage, strDetails, pcszAutoConfirmId,
AlertButton_Ok | AlertButtonOption_Default,
AlertButton_Cancel | AlertButtonOption_Escape,
0 /* third button */,
strOkButtonText,
strCancelButtonText,
QString() /* third button */) &
AlertButtonMask) == AlertButton_Ok;
}
void UIMessageCenter::alert(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const char *pcszAutoConfirmId /* = 0*/) const
{
error(pParent, enmType, strMessage, QString(), pcszAutoConfirmId);
}
int UIMessageCenter::question(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const char *pcszAutoConfirmId/* = 0*/,
int iButton1 /* = 0*/,
int iButton2 /* = 0*/,
int iButton3 /* = 0*/,
const QString &strButtonText1 /* = QString()*/,
const QString &strButtonText2 /* = QString()*/,
const QString &strButtonText3 /* = QString()*/) const
{
return message(pParent, enmType, strMessage, QString(), pcszAutoConfirmId,
iButton1, iButton2, iButton3, strButtonText1, strButtonText2, strButtonText3);
}
bool UIMessageCenter::questionBinary(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const char *pcszAutoConfirmId /* = 0*/,
const QString &strOkButtonText /* = QString()*/,
const QString &strCancelButtonText /* = QString()*/,
bool fDefaultFocusForOk /* = true*/) const
{
return fDefaultFocusForOk ?
((question(pParent, enmType, strMessage, pcszAutoConfirmId,
AlertButton_Ok | AlertButtonOption_Default,
AlertButton_Cancel | AlertButtonOption_Escape,
0 /* third button */,
strOkButtonText,
strCancelButtonText,
QString() /* third button */) &
AlertButtonMask) == AlertButton_Ok) :
((question(pParent, enmType, strMessage, pcszAutoConfirmId,
AlertButton_Ok,
AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
0 /* third button */,
strOkButtonText,
strCancelButtonText,
QString() /* third button */) &
AlertButtonMask) == AlertButton_Ok);
}
int UIMessageCenter::questionTrinary(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const char *pcszAutoConfirmId /* = 0*/,
const QString &strChoice1ButtonText /* = QString()*/,
const QString &strChoice2ButtonText /* = QString()*/,
const QString &strCancelButtonText /* = QString()*/) const
{
return question(pParent, enmType, strMessage, pcszAutoConfirmId,
AlertButton_Choice1,
AlertButton_Choice2 | AlertButtonOption_Default,
AlertButton_Cancel | AlertButtonOption_Escape,
strChoice1ButtonText,
strChoice2ButtonText,
strCancelButtonText);
}
int UIMessageCenter::messageWithOption(QWidget *pParent, MessageType enmType,
const QString &strMessage,
const QString &strOptionText,
bool fDefaultOptionValue /* = true */,
int iButton1 /* = 0*/,
int iButton2 /* = 0*/,
int iButton3 /* = 0*/,
const QString &strButtonName1 /* = QString() */,
const QString &strButtonName2 /* = QString() */,
const QString &strButtonName3 /* = QString() */) const
{
/* If no buttons are set, using single 'OK' button: */
if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
iButton1 = AlertButton_Ok | AlertButtonOption_Default;
/* Assign corresponding title and icon: */
QString strTitle;
AlertIconType icon;
switch (enmType)
{
default:
case MessageType_Info:
strTitle = tr("VirtualBox - Information", "msg box title");
icon = AlertIconType_Information;
break;
case MessageType_Question:
strTitle = tr("VirtualBox - Question", "msg box title");
icon = AlertIconType_Question;
break;
case MessageType_Warning:
strTitle = tr("VirtualBox - Warning", "msg box title");
icon = AlertIconType_Warning;
break;
case MessageType_Error:
strTitle = tr("VirtualBox - Error", "msg box title");
icon = AlertIconType_Critical;
break;
case MessageType_Critical:
strTitle = tr("VirtualBox - Critical Error", "msg box title");
icon = AlertIconType_Critical;
break;
case MessageType_GuruMeditation:
strTitle = "VirtualBox - Guru Meditation"; /* don't translate this */
icon = AlertIconType_GuruMeditation;
break;
}
/* Create message-box: */
QWidget *pBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
QPointer<QIMessageBox> pBox = new QIMessageBox(strTitle, strMessage, icon,
iButton1, iButton2, iButton3, pBoxParent);
windowManager().registerNewParent(pBox, pBoxParent);
/* Load option: */
if (!strOptionText.isNull())
{
pBox->setFlagText(strOptionText);
pBox->setFlagChecked(fDefaultOptionValue);
}
/* Configure button-text: */
if (!strButtonName1.isNull())
pBox->setButtonText(0, strButtonName1);
if (!strButtonName2.isNull())
pBox->setButtonText(1, strButtonName2);
if (!strButtonName3.isNull())
pBox->setButtonText(2, strButtonName3);
/* Show box: */
int rc = pBox->exec();
/* Make sure box still valid: */
if (!pBox)
return rc;
/* Save option: */
if (pBox->flagChecked())
rc |= AlertOption_CheckBox;
/* Delete message-box: */
if (pBox)
delete pBox;
return rc;
}
bool UIMessageCenter::showModalProgressDialog(CProgress &progress,
const QString &strTitle,
const QString &strImage /* = "" */,
QWidget *pParent /* = 0*/,
int cMinDuration /* = 2000 */)
{
/* Prepare pixmap: */
QPixmap *pPixmap = NULL;
if (!strImage.isEmpty())
pPixmap = new QPixmap(strImage);
/* Create progress-dialog: */
QWidget *pDlgParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
QPointer<UIProgressDialog> pProgressDlg = new UIProgressDialog(progress, strTitle, pPixmap, cMinDuration, pDlgParent);
windowManager().registerNewParent(pProgressDlg, pDlgParent);
/* Run the dialog with the 350 ms refresh interval. */
pProgressDlg->run(350);
/* Make sure progress-dialog still valid: */
bool fRc;
if (pProgressDlg)
{
/* Delete progress-dialog: */
delete pProgressDlg;
fRc = true;
}
else
fRc = false;
/* Cleanup pixmap: */
if (pPixmap)
delete pPixmap;
return fRc;
}
void UIMessageCenter::warnAboutUnknownOptionType(const QString &strOption)
{
alert(0, MessageType_Error,
tr("Unknown option <b>%1</b>.")
.arg(strOption));
}
void UIMessageCenter::warnAboutUnrelatedOptionType(const QString &strOption)
{
alert(0, MessageType_Error,
tr("<b>%1</b> is an option for the VirtualBox VM runner (VirtualBoxVM) application, not the VirtualBox Manager.")
.arg(strOption));
}
#ifdef RT_OS_LINUX
void UIMessageCenter::warnAboutWrongUSBMounted() const
{
alert(0, MessageType_Warning,
tr("You seem to have the USBFS filesystem mounted at /sys/bus/usb/drivers. "
"We strongly recommend that you change this, as it is a severe mis-configuration of "
"your system which could cause USB devices to fail in unexpected ways."),
"warnAboutWrongUSBMounted");
}
#endif /* RT_OS_LINUX */
void UIMessageCenter::cannotStartSelector() const
{
alert(0, MessageType_Critical,
tr("<p>Cannot start the VirtualBox Manager due to local restrictions.</p>"
"<p>The application will now terminate.</p>"));
}
void UIMessageCenter::cannotStartRuntime() const
{
/* Prepare error string: */
const QString strError = tr("<p>You must specify a machine to start, using the command line.</p><p>%1</p>",
"There will be a usage text passed as argument.");
/* Prepare Usage, it can change in future: */
const QString strTable = QString("<table cellspacing=0 style='white-space:pre'>%1</table>");
const QString strUsage = tr("<tr>"
"<td>Usage: VirtualBoxVM --startvm <name|UUID></td>"
"</tr>"
"<tr>"
"<td>Starts the VirtualBox virtual machine with the given "
"name or unique identifier (UUID).</td>"
"</tr>");
/* Show error: */
alert(0, MessageType_Error, strError.arg(strTable.arg(strUsage)));
}
void UIMessageCenter::showBetaBuildWarning() const
{
alert(0, MessageType_Warning,
tr("You are running a prerelease version of VirtualBox. "
"This version is not suitable for production use."));
}
void UIMessageCenter::showExperimentalBuildWarning() const
{
alert(0, MessageType_Warning,
tr("You are running an EXPERIMENTAL build of VirtualBox. "
"This version is not suitable for production use."));
}
void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const
{
error(0, MessageType_Critical,
tr("<p>Failed to initialize COM because the VirtualBox global "
"configuration directory <b><nobr>%1</nobr></b> is not accessible. "
"Please check the permissions of this directory and of its parent directory.</p>"
"<p>The application will now terminate.</p>")
.arg(strUserHome),
UIErrorString::formatErrorInfo(COMErrorInfo()));
}
void UIMessageCenter::cannotInitCOM(HRESULT rc) const
{
error(0, MessageType_Critical,
tr("<p>Failed to initialize COM or to find the VirtualBox COM server. "
"Most likely, the VirtualBox server is not running or failed to start.</p>"
"<p>The application will now terminate.</p>"),
UIErrorString::formatErrorInfo(COMErrorInfo(), rc));
}
void UIMessageCenter::cannotCreateVirtualBoxClient(const CVirtualBoxClient &client) const
{
error(0, MessageType_Critical,
tr("<p>Failed to create the VirtualBoxClient COM object.</p>"
"<p>The application will now terminate.</p>"),
UIErrorString::formatErrorInfo(client));
}
void UIMessageCenter::cannotAcquireVirtualBox(const CVirtualBoxClient &client) const
{
QString err = tr("<p>Failed to acquire the VirtualBox COM object.</p>"
"<p>The application will now terminate.</p>");
#if defined(VBOX_WS_X11) || defined(VBOX_WS_MAC)
if (client.lastRC() == NS_ERROR_SOCKET_FAIL)
err += tr("<p>The reason for this error are most likely wrong permissions of the IPC "
"daemon socket due to an installation problem. Please check the permissions of "
"<font color=blue>'/tmp'</font> and <font color=blue>'/tmp/.vbox-*-ipc/'</font></p>");
#endif
error(0, MessageType_Critical, err, UIErrorString::formatErrorInfo(client));
}
void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const
{
alert(0, MessageType_Error,
tr("<p>Could not find a language file for the language <b>%1</b> in the directory <b><nobr>%2</nobr></b>.</p>"
"<p>The language will be temporarily reset to the system default language. "
"Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
"VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
.arg(strLangId).arg(strNlsPath));
}
void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const
{
alert(0, MessageType_Error,
tr("<p>Could not load the language file <b><nobr>%1</nobr></b>. "
"<p>The language will be temporarily reset to English (built-in). "
"Please go to the <b>Preferences</b> window which you can open from the <b>File</b> menu of the "
"VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>")
.arg(strLangFile));
}
void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const
{
error(0, MessageType_Error,
tr("There is no virtual machine named <b>%1</b>.")
.arg(strName),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QUuid &uId) const
{
error(0, MessageType_Error,
tr("There is no virtual machine with the identifier <b>%1</b>.")
.arg(uId.toString()),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotOpenSession(const CSession &session) const
{
error(0, MessageType_Error,
tr("Failed to create a new session."),
UIErrorString::formatErrorInfo(session));
}
void UIMessageCenter::cannotOpenSession(const CMachine &machine) const
{
error(0, MessageType_Error,
tr("Failed to open a session for the virtual machine <b>%1</b>.")
.arg(CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotOpenSession(const CProgress &progress, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to open a session for the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) const
{
error(0, MessageType_Error,
tr("Failed to access the disk image file <nobr><b>%1</b></nobr>.")
.arg(medium.location()),
UIErrorString::formatErrorInfo(medium.result()));
}
void UIMessageCenter::cannotOpenURL(const QString &strUrl) const
{
alert(0, MessageType_Error,
tr("Failed to open <tt>%1</tt>. "
"Make sure your desktop environment can properly handle URLs of this type.")
.arg(strUrl));
}
void UIMessageCenter::cannotSetExtraData(const CVirtualBox &vbox, const QString &strKey, const QString &strValue)
{
error(0, MessageType_Error,
tr("Failed to set the global VirtualBox extra data for key <i>%1</i> to value <i>{%2}</i>.")
.arg(strKey, strValue),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotSetExtraData(const CMachine &machine, const QString &strKey, const QString &strValue)
{
error(0, MessageType_Error,
tr("Failed to set the extra data for key <i>%1</i> of machine <i>%2</i> to value <i>{%3}</i>.")
.arg(strKey, CMachine(machine).GetName(), strValue),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::warnAboutInvalidEncryptionPassword(const QString &strPasswordId, QWidget *pParent /* = 0 */)
{
alert(pParent, MessageType_Error,
tr("Encryption password for <nobr>ID = '%1'</nobr> is invalid.")
.arg(strPasswordId));
}
void UIMessageCenter::cannotAcquireMachineParameter(const CMachine &comMachine, QWidget *pParent /* = 0 */) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to acquire machine parameter."), UIErrorString::formatErrorInfo(comMachine));
}
void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const
{
error(0, MessageType_Error,
tr("Failed to open virtual machine located in %1.")
.arg(strMachinePath),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const
{
alert(0, MessageType_Error,
tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.")
.arg(strMachineName, strMachinePath));
}
void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strCollisionName, const QString &strGroupName) const
{
alert(0, MessageType_Error,
tr("<p>You are trying to move machine <nobr><b>%1</b></nobr> "
"to group <nobr><b>%2</b></nobr> which already have sub-group <nobr><b>%1</b></nobr>.</p>"
"<p>Please resolve this name-conflict and try again.</p>")
.arg(strCollisionName, strGroupName));
}
bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const
{
return questionBinary(0, MessageType_Question,
tr("<p>You are trying to move group <nobr><b>%1</b></nobr> "
"to group <nobr><b>%2</b></nobr> which already have another item with the same name.</p>"
"<p>Would you like to automatically rename it?</p>")
.arg(strName, strGroupName),
0 /* auto-confirm id */,
tr("Rename"));
}
void UIMessageCenter::cannotSetGroups(const CMachine &machine) const
{
/* Compose machine name: */
QString strName = CMachine(machine).GetName();
if (strName.isEmpty())
strName = QFileInfo(CMachine(machine).GetSettingsFilePath()).baseName();
/* Show the error: */
error(0, MessageType_Error,
tr("Failed to set groups of the virtual machine <b>%1</b>.")
.arg(strName),
UIErrorString::formatErrorInfo(machine));
}
bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) const
{
return questionBinary(0, MessageType_Question,
tr("<p>You are about to remove following virtual machine items from the machine list:</p>"
"<p><b>%1</b></p><p>Do you wish to proceed?</p>")
.arg(names.join(", ")),
0 /* auto-confirm id */,
tr("Remove") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
int UIMessageCenter::confirmMachineRemoval(const QList<CMachine> &machines) const
{
/* Enumerate the machines: */
int cInacessibleMachineCount = 0;
bool fMachineWithHardDiskPresent = false;
QString strMachineNames;
foreach (const CMachine &machine, machines)
{
/* Prepare machine name: */
QString strMachineName;
if (machine.GetAccessible())
{
/* Just get machine name: */
strMachineName = machine.GetName();
/* Enumerate the attachments: */
const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
foreach (const CMediumAttachment &attachment, attachments)
{
/* Check if the medium is a hard disk: */
if (attachment.GetType() == KDeviceType_HardDisk)
{
/* Check if that hard disk isn't shared.
* If hard disk is shared, it will *never* be deleted: */
QVector<QUuid> usedMachineList = attachment.GetMedium().GetMachineIds();
if (usedMachineList.size() == 1)
{
fMachineWithHardDiskPresent = true;
break;
}
}
}
}
else
{
/* Compose machine name: */
QFileInfo fi(machine.GetSettingsFilePath());
strMachineName = UICommon::hasAllowedExtension(fi.completeSuffix(), VBoxFileExts) ? fi.completeBaseName() : fi.fileName();
/* Increment inacessible machine count: */
++cInacessibleMachineCount;
}
/* Append machine name to the full name string: */
strMachineNames += QString(strMachineNames.isEmpty() ? "<b>%1</b>" : ", <b>%1</b>").arg(strMachineName);
}
/* Prepare message text: */
QString strText = cInacessibleMachineCount == machines.size() ?
tr("<p>You are about to remove following inaccessible virtual machines from the machine list:</p>"
"<p>%1</p>"
"<p>Do you wish to proceed?</p>")
.arg(strMachineNames) :
fMachineWithHardDiskPresent ?
tr("<p>You are about to remove following virtual machines from the machine list:</p>"
"<p>%1</p>"
"<p>Would you like to delete the files containing the virtual machine from your hard disk as well? "
"Doing this will also remove the files containing the machine's virtual hard disks "
"if they are not in use by another machine.</p>")
.arg(strMachineNames) :
tr("<p>You are about to remove following virtual machines from the machine list:</p>"
"<p>%1</p>"
"<p>Would you like to delete the files containing the virtual machine from your hard disk as well?</p>")
.arg(strMachineNames);
/* Prepare message itself: */
return cInacessibleMachineCount == machines.size() ?
message(0, MessageType_Question,
strText, QString(),
0 /* auto-confirm id */,
AlertButton_Ok,
AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
0,
tr("Remove")) :
message(0, MessageType_Question,
strText, QString(),
0 /* auto-confirm id */,
AlertButton_Choice1,
AlertButton_Choice2,
AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
tr("Delete all files"),
tr("Remove only"));
}
void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) const
{
error(0, MessageType_Error,
tr("Failed to remove the virtual machine <b>%1</b>.")
.arg(CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const
{
error(0, MessageType_Error,
tr("Failed to remove the virtual machine <b>%1</b>.")
.arg(CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::warnAboutInaccessibleMedia() const
{
return questionBinary(0, MessageType_Warning,
tr("<p>One or more disk image files are not currently accessible. As a result, you will "
"not be able to operate virtual machines that use these files until "
"they become accessible later.</p>"
"<p>Press <b>Check</b> to open the Virtual Media Manager window and "
"see which files are inaccessible, or press <b>Ignore</b> to "
"ignore this message.</p>"),
"warnAboutInaccessibleMedia",
tr("Check", "inaccessible media message box"), tr("Ignore"));
}
bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Are you sure you want to discard the saved state of "
"the following virtual machines?</p><p><b>%1</b></p>"
"<p>This operation is equivalent to resetting or powering off "
"the machine without doing a proper shutdown of the guest OS.</p>")
.arg(strNames),
0 /* auto-confirm id */,
tr("Discard", "saved state"));
}
bool UIMessageCenter::confirmResetMachine(const QString &strNames) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Do you really want to reset the following virtual machines?</p>"
"<p><b>%1</b></p><p>This will cause any unsaved data "
"in applications running inside it to be lost.</p>")
.arg(strNames),
"confirmResetMachine" /* auto-confirm id */,
tr("Reset", "machine"));
}
bool UIMessageCenter::confirmACPIShutdownMachine(const QString &strNames) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Do you really want to send an ACPI shutdown signal "
"to the following virtual machines?</p><p><b>%1</b></p>")
.arg(strNames),
"confirmACPIShutdownMachine" /* auto-confirm id */,
tr("ACPI Shutdown", "machine"));
}
bool UIMessageCenter::confirmPowerOffMachine(const QString &strNames) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Do you really want to power off the following virtual machines?</p>"
"<p><b>%1</b></p><p>This will cause any unsaved data in applications "
"running inside it to be lost.</p>")
.arg(strNames),
"confirmPowerOffMachine" /* auto-confirm id */,
tr("Power Off", "machine"));
}
void UIMessageCenter::cannotPauseMachine(const CConsole &console) const
{
error(0, MessageType_Error,
tr("Failed to pause the execution of the virtual machine <b>%1</b>.")
.arg(CConsole(console).GetMachine().GetName()),
UIErrorString::formatErrorInfo(console));
}
void UIMessageCenter::cannotResumeMachine(const CConsole &console) const
{
error(0, MessageType_Error,
tr("Failed to resume the execution of the virtual machine <b>%1</b>.")
.arg(CConsole(console).GetMachine().GetName()),
UIErrorString::formatErrorInfo(console));
}
void UIMessageCenter::cannotDiscardSavedState(const CMachine &machine) const
{
error(0, MessageType_Error,
tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")
.arg(machine.GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotSaveMachineState(const CMachine &machine)
{
error(0, MessageType_Error,
tr("Failed to save the state of the virtual machine <b>%1</b>.")
.arg(machine.GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotSaveMachineState(const CProgress &progress, const QString &strMachineName)
{
error(0, MessageType_Error,
tr("Failed to save the state of the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotACPIShutdownMachine(const CConsole &console) const
{
error(0, MessageType_Error,
tr("Failed to send the ACPI Power Button press event to the virtual machine <b>%1</b>.")
.arg(CConsole(console).GetMachine().GetName()),
UIErrorString::formatErrorInfo(console));
}
void UIMessageCenter::cannotPowerDownMachine(const CConsole &console) const
{
error(0, MessageType_Error,
tr("Failed to stop the virtual machine <b>%1</b>.")
.arg(CConsole(console).GetMachine().GetName()),
UIErrorString::formatErrorInfo(console));
}
void UIMessageCenter::cannotPowerDownMachine(const CProgress &progress, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to stop the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::confirmStartMultipleMachines(const QString &strNames) const
{
return questionBinary(0, MessageType_Question,
tr("<p>You are about to start all of the following virtual machines:</p>"
"<p><b>%1</b></p><p>This could take some time and consume a lot of "
"host system resources. Do you wish to proceed?</p>").arg(strNames),
"confirmStartMultipleMachines" /* auto-confirm id */);
}
void UIMessageCenter::cannotMoveMachine(const CMachine &machine, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to move the virtual machine <b>%1</b>.")
.arg(CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotMoveMachine(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to move the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const
{
return fAlsoCreateNewSnapshot ?
messageWithOption(0, MessageType_Question,
tr("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>"
"<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; "
"if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>")
.arg(strSnapshotName),
tr("Create a snapshot of the current machine state"),
!gEDataManager->messagesWithInvertedOption().contains("confirmSnapshotRestoring"),
AlertButton_Ok,
AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
0 /* 3rd button */,
tr("Restore"), tr("Cancel"), QString() /* 3rd button text */) :
message(0, MessageType_Question,
tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>")
.arg(strSnapshotName),
QString() /* details */,
0 /* auto-confirm id */,
AlertButton_Ok,
AlertButton_Cancel | AlertButtonOption_Default | AlertButtonOption_Escape,
0 /* 3rd button */,
tr("Restore"), tr("Cancel"), QString() /* 3rd button text */);
}
bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and storage data spread over "
"several image files that VirtualBox has created together with the snapshot will be merged into one file. "
"This can be a lengthy process, and the information in the snapshot cannot be recovered.</p>"
"</p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>")
.arg(strSnapshotName),
0 /* auto-confirm id */,
tr("Delete") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
bool UIMessageCenter::warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName,
const QString &strTargetImageName,
const QString &strTargetImageMaxSize,
const QString &strTargetFileSystemFree) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Deleting the snapshot %1 will temporarily need more storage space. In the worst case the size of image %2 will grow by %3, "
"however on this filesystem there is only %4 free.</p><p>Running out of storage space during the merge operation can result in "
"corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting "
"the snapshot at your own risk.</p>")
.arg(strSnapshotName, strTargetImageName, strTargetImageMaxSize, strTargetFileSystemFree),
0 /* auto-confirm id */,
tr("Delete") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotTakeSnapshot(const CMachine &machine, const QString &strMachineName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::cannotRestoreSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
.arg(strSnapshotName, strMachineName),
UIErrorString::formatErrorInfo(machine));
return false;
}
bool UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
.arg(strSnapshotName, strMachineName),
UIErrorString::formatErrorInfo(progress));
return false;
}
void UIMessageCenter::cannotRemoveSnapshot(const CMachine &machine, const QString &strSnapshotName, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
.arg(strSnapshotName, strMachineName),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
.arg(strSnapshotName).arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotChangeSnapshot(const CSnapshot &comSnapshot, const QString &strSnapshotName, const QString &strMachineName) const
{
error(0, MessageType_Error,
tr("Failed to change the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")
.arg(strSnapshotName).arg(strMachineName),
UIErrorString::formatErrorInfo(comSnapshot));
}
void UIMessageCenter::cannotFindSnapshotByName(const CMachine &comMachine,
const QString &strName,
QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Can't find snapshot named <b>%1</b>.")
.arg(strName),
UIErrorString::formatErrorInfo(comMachine));
}
void UIMessageCenter::cannotFindSnapshotById(const CMachine &comMachine,
const QUuid &uId,
QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Can't find snapshot with ID=<b>%1</b>.")
.arg(uId.toString()),
UIErrorString::formatErrorInfo(comMachine));
}
void UIMessageCenter::cannotAcquireSnapshotAttributes(const CSnapshot &comSnapshot,
QWidget *pParent /* = 0 */)
{
error(pParent, MessageType_Error,
tr("Can't acquire snapshot attributes."),
UIErrorString::formatErrorInfo(comSnapshot));
}
void UIMessageCenter::cannotSaveSettings(const QString strDetails, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to save the settings."),
strDetails);
}
bool UIMessageCenter::confirmNATNetworkRemoval(const QString &strName, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>Do you want to remove the NAT network <nobr><b>%1</b>?</nobr></p>"
"<p>If this network is in use by one or more virtual "
"machine network adapters these adapters will no longer be "
"usable until you correct their settings by either choosing "
"a different network name or a different adapter attachment "
"type.</p>")
.arg(strName),
0 /* auto-confirm id */,
tr("Remove") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Critical,
tr("Failed to set global VirtualBox properties."),
UIErrorString::formatErrorInfo(properties));
}
void UIMessageCenter::warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent /* = 0*/) const
{
/* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return
* E_NOTIMPL, it means the USB support is intentionally missing
* (as in the OSE version). Don't show the error message in this case. */
COMResult res(object);
if (res.rc() == E_NOTIMPL)
return;
/* Show the error: */
error(pParent, res.isWarning() ? MessageType_Warning : MessageType_Error,
tr("Failed to access the USB subsystem."),
UIErrorString::formatErrorInfo(res),
"warnAboutUnaccessibleUSB");
}
void UIMessageCenter::warnAboutStateChange(QWidget *pParent /* = 0*/) const
{
if (warningShown("warnAboutStateChange"))
return;
setWarningShown("warnAboutStateChange", true);
alert(pParent, MessageType_Warning,
tr("The virtual machine that you are changing has been started. "
"Only certain settings can be changed while a machine is running. "
"All other changes will be lost if you close this window now."));
setWarningShown("warnAboutStateChange", false);
}
bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>The machine settings were changed while you were editing them. "
"You currently have unsaved setting changes.</p>"
"<p>Would you like to reload the changed settings or to keep your own changes?</p>"),
0 /* auto-confirm id */,
tr("Reload settings"), tr("Keep changes"));
}
int UIMessageCenter::confirmRemovingOfLastDVDDevice(QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Info,
tr("<p>Are you sure you want to delete the optical drive?</p>"
"<p>You will not be able to insert any optical disks or ISO images "
"or install the Guest Additions without it!</p>"),
0 /* auto-confirm id */,
tr("&Remove", "medium") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
bool UIMessageCenter::confirmStorageBusChangeWithOpticalRemoval(QWidget *pParent /* = 0 */) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>This controller has optical devices attached. You have requested storage bus "
"change to type which doesn't support optical devices.</p><p>If you proceed optical "
"devices will be removed.</p>"));
}
bool UIMessageCenter::confirmStorageBusChangeWithExcessiveRemoval(QWidget *pParent /* = 0 */) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>This controller has devices attached. You have requested storage bus change to "
"type which supports smaller amount of attached devices.</p><p>If you proceed "
"excessive devices will be removed.</p>"));
}
void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumDeviceType enmType,
const QString &strLocation, const StorageSlot &storageSlot,
QWidget *pParent /* = 0*/)
{
QString strMessage;
switch (enmType)
{
case UIMediumDeviceType_HardDisk:
{
strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
break;
}
case UIMediumDeviceType_DVD:
{
strMessage = tr("Failed to attach the optical drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
break;
}
case UIMediumDeviceType_Floppy:
{
strMessage = tr("Failed to attach the floppy drive (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
break;
}
default:
break;
}
error(pParent, MessageType_Error,
strMessage, UIErrorString::formatErrorInfo(machine));
}
bool UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Error,
tr("The current port forwarding rules are not valid. "
"None of the host or guest port values may be set to zero."));
return false;
}
bool UIMessageCenter::warnAboutIncorrectAddress(QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Error,
tr("The current port forwarding rules are not valid. "
"All of the host or guest address values should be correct or empty."));
return false;
}
bool UIMessageCenter::warnAboutEmptyGuestAddress(QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Error,
tr("The current port forwarding rules are not valid. "
"None of the guest address values may be empty."));
return false;
}
bool UIMessageCenter::warnAboutNameShouldBeUnique(QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Error,
tr("The current port forwarding rules are not valid. "
"Rule names should be unique."));
return false;
}
bool UIMessageCenter::warnAboutRulesConflict(QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Error,
tr("The current port forwarding rules are not valid. "
"Few rules have same host ports and conflicting IP addresses."));
return false;
}
bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>There are unsaved changes in the port forwarding configuration.</p>"
"<p>If you proceed your changes will be discarded.</p>"),
0 /* auto-confirm id */,
QString() /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotChangeMachineAttribute(const CMachine &comMachine, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to change the attribute of the virtual machine <b>%1</b>.")
.arg(comMachine.GetName()),
UIErrorString::formatErrorInfo(comMachine));
}
void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.")
.arg(machine.GetName(), CMachine(machine).GetSettingsFilePath()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotChangeGraphicsAdapterAttribute(const CGraphicsAdapter &comAdapter, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to change graphics adapter attribute."),
UIErrorString::formatErrorInfo(comAdapter));
}
void UIMessageCenter::cannotChangeAudioAdapterAttribute(const CAudioAdapter &comAdapter, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to change audio adapter attribute."),
UIErrorString::formatErrorInfo(comAdapter));
}
void UIMessageCenter::cannotChangeNetworkAdapterAttribute(const CNetworkAdapter &comAdapter, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to change network adapter attribute."),
UIErrorString::formatErrorInfo(comAdapter));
}
void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("<p>Error changing disk image mode from <b>%1</b> to <b>%2</b>.</p>")
.arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
UIErrorString::formatErrorInfo(medium));
}
void UIMessageCenter::cannotMoveMediumStorage(const CMedium &comMedium, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
.arg(strLocationOld, strLocationNew),
UIErrorString::formatErrorInfo(comMedium));
}
void UIMessageCenter::cannotMoveMediumStorage(const CProgress &comProgress, const QString &strLocationOld, const QString &strLocationNew, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to move the storage unit of the disk image <b>%1</b> to <b>%2</b>.")
.arg(strLocationOld, strLocationNew),
UIErrorString::formatErrorInfo(comProgress));
}
void UIMessageCenter::cannotChangeMediumDescription(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("<p>Error changing the description of the disk image <b>%1</b>.</p>")
.arg(strLocation),
UIErrorString::formatErrorInfo(comMedium));
}
bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, bool fInduced, QWidget *pParent /* = 0 */) const
{
/* Prepare the usage: */
QStringList usage;
CVirtualBox vbox = uiCommon().virtualBox();
foreach (const QUuid &uMachineID, medium.curStateMachineIds())
{
CMachine machine = vbox.FindMachine(uMachineID.toString());
if (!vbox.isOk() || machine.isNull())
continue;
usage << machine.GetName();
}
/* Show the question: */
return !fInduced
? questionBinary(pParent, MessageType_Question,
tr("<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>"
"<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>")
.arg(medium.location(), usage.join(", ")),
0 /* auto-confirm id */,
tr("Release", "detach medium"))
: questionBinary(pParent, MessageType_Question,
tr("<p>The changes you requested require this disk to "
"be released from the machines it is attached to.</p>"
"<p>Are you sure you want to release the disk image file <nobr><b>%1</b></nobr>?</p>"
"<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>")
.arg(medium.location(), usage.join(", ")),
0 /* auto-confirm id */,
tr("Release", "detach medium"));
}
bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /* = 0*/) const
{
/* Prepare the message: */
QString strMessage;
switch (medium.type())
{
case UIMediumDeviceType_HardDisk:
{
strMessage = tr("<p>Are you sure you want to remove the virtual hard disk "
"<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
/* Compose capabilities flag: */
qulonglong caps = 0;
QVector<KMediumFormatCapabilities> capabilities;
capabilities = medium.medium().GetMediumFormat().GetCapabilities();
for (int i = 0; i < capabilities.size(); ++i)
caps |= capabilities[i];
/* Check capabilities for additional options: */
if (caps & KMediumFormatCapabilities_File)
{
if (medium.state() == KMediumState_Inaccessible)
strMessage += tr("<p>As this hard disk is inaccessible its image file"
" can not be deleted.</p>");
}
break;
}
case UIMediumDeviceType_DVD:
{
strMessage = tr("<p>Are you sure you want to remove the virtual optical disk "
"<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
strMessage += tr("<p>Note that the storage unit of this medium will not be "
"deleted and that it will be possible to use it later again.</p>");
break;
}
case UIMediumDeviceType_Floppy:
{
strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk "
"<nobr><b>%1</b></nobr> from the list of known disk image files?</p>");
strMessage += tr("<p>Note that the storage unit of this medium will not be "
"deleted and that it will be possible to use it later again.</p>");
break;
}
default:
break;
}
/* Show the question: */
return questionBinary(pParent, MessageType_Question,
strMessage.arg(medium.location()),
0 /* auto-confirm id */,
tr("Remove", "medium") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const
{
return questionTrinary(pParent, MessageType_Question,
tr("<p>Do you want to delete the storage unit of the virtual hard disk "
"<nobr><b>%1</b></nobr>?</p>"
"<p>If you select <b>Delete</b> then the specified storage unit "
"will be permanently deleted. This operation <b>cannot be "
"undone</b>.</p>"
"<p>If you select <b>Keep</b> then the hard disk will be only "
"removed from the list of known hard disks, but the storage unit "
"will be left untouched which makes it possible to add this hard "
"disk to the list later again.</p>")
.arg(strLocation),
0 /* auto-confirm id */,
tr("Delete", "hard disk storage"),
tr("Keep", "hard disk storage"));
}
void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
.arg(strLocation),
UIErrorString::formatErrorInfo(medium));
}
void UIMessageCenter::cannotDeleteHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
.arg(strLocation),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotResizeHardDiskStorage(const CMedium &comMedium, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
.arg(strLocation, strSizeOld, strSizeNew),
UIErrorString::formatErrorInfo(comMedium));
}
void UIMessageCenter::cannotResizeHardDiskStorage(const CProgress &comProgress, const QString &strLocation, const QString &strSizeOld, const QString &strSizeNew, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to resize the storage unit of the hard disk <b>%1</b> from <b>%2</b> to <b>%3</b>.")
.arg(strLocation, strSizeOld, strSizeNew),
UIErrorString::formatErrorInfo(comProgress));
}
void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumDeviceType enmType, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /* = 0*/) const
{
/* Prepare the message: */
QString strMessage;
switch (enmType)
{
case UIMediumDeviceType_HardDisk:
{
strMessage = tr("Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
break;
}
case UIMediumDeviceType_DVD:
{
strMessage = tr("Failed to detach the optical drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
break;
}
case UIMediumDeviceType_Floppy:
{
strMessage = tr("Failed to detach the floppy drive (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
.arg(strLocation, gpConverter->toString(storageSlot), CMachine(machine).GetName());
break;
}
default:
break;
}
/* Show the error: */
error(pParent, MessageType_Error, strMessage, UIErrorString::formatErrorInfo(machine));
}
bool UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /* = 0*/) const
{
/* Compose the message: */
QString strMessage;
switch (medium.type())
{
case UIMediumDeviceType_DVD:
{
if (fMount)
{
strMessage = tr("<p>Unable to insert the virtual optical disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>");
if (fRetry)
strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>");
}
else
{
strMessage = tr("<p>Unable to eject the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
if (fRetry)
strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>");
}
break;
}
case UIMediumDeviceType_Floppy:
{
if (fMount)
{
strMessage = tr("<p>Unable to insert the virtual floppy disk <nobr><b>%1</b></nobr> into the machine <b>%2</b>.</p>");
if (fRetry)
strMessage += tr("<p>Would you like to try to force insertion of this disk?</p>");
}
else
{
strMessage = tr("<p>Unable to eject the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
if (fRetry)
strMessage += tr("<p>Would you like to try to force ejection of this disk?</p>");
}
break;
}
default:
break;
}
/* Show the messsage: */
if (fRetry)
return errorWithQuestion(pParent, MessageType_Question,
strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine),
0 /* Auto Confirm ID */,
tr("Force Unmount"));
error(pParent, MessageType_Error,
strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location(), CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine));
return false;
}
void UIMessageCenter::cannotOpenMedium(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent /* = 0 */) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to open the disk image file <nobr><b>%1</b></nobr>.").arg(strLocation), UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotOpenKnownMedium(const CVirtualBox &comVBox, const QUuid &uMediumId, QWidget *pParent /* = 0 */) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to open the medium with following ID: <nobr><b>%1</b></nobr>.").arg(uMediumId.toString()), UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotAcquireAttachmentParameter(const CMediumAttachment &comAttachment, QWidget *pParent /* = 0 */) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to acquire attachment parameter."), UIErrorString::formatErrorInfo(comAttachment));
}
void UIMessageCenter::cannotAcquireMediumAttribute(const CMedium &comMedium, QWidget *pParent /* = 0 */) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to acquire medium attribute."), UIErrorString::formatErrorInfo(comMedium));
}
void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /* = 0*/) const
{
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to close the disk image file <nobr><b>%1</b></nobr>.").arg(medium.location()), UIErrorString::formatErrorInfo(rc));
}
bool UIMessageCenter::confirmHostOnlyInterfaceRemoval(const QString &strName, QWidget *pParent /* = 0 */) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>Deleting this host-only network will remove "
"the host-only interface this network is based on. Do you want to "
"remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>"
"<p><b>Note:</b> this interface may be in use by one or more "
"virtual network adapters belonging to one of your VMs. "
"After it is removed, these adapters will no longer be usable until "
"you correct their settings by either choosing a different interface "
"name or a different adapter attachment type.</p>")
.arg(strName),
0 /* auto-confirm id */,
tr("Remove") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotAcquireHostNetworkInterfaces(const CHost &comHost, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire host network interfaces."),
UIErrorString::formatErrorInfo(comHost));
}
void UIMessageCenter::cannotFindHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Unable to find the host network interface <b>%1</b>.")
.arg(strInterfaceName),
UIErrorString::formatErrorInfo(comHost));
}
void UIMessageCenter::cannotCreateHostNetworkInterface(const CHost &comHost, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create a host network interface."),
UIErrorString::formatErrorInfo(comHost));
}
void UIMessageCenter::cannotCreateHostNetworkInterface(const CProgress &progress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create a host network interface."),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotRemoveHostNetworkInterface(const CHost &comHost, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to remove the host network interface <b>%1</b>.")
.arg(strInterfaceName),
UIErrorString::formatErrorInfo(comHost));
}
void UIMessageCenter::cannotRemoveHostNetworkInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to remove the host network interface <b>%1</b>.")
.arg(strInterfaceName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotAcquireHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire host network interface parameter."),
UIErrorString::formatErrorInfo(comInterface));
}
void UIMessageCenter::cannotSaveHostNetworkInterfaceParameter(const CHostNetworkInterface &comInterface, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to save host network interface parameter."),
UIErrorString::formatErrorInfo(comInterface));
}
void UIMessageCenter::cannotCreateDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create a DHCP server for the network interface <b>%1</b>.")
.arg(strInterfaceName),
UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotRemoveDHCPServer(const CVirtualBox &comVBox, const QString &strInterfaceName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to remove the DHCP server for the network interface <b>%1</b>.")
.arg(strInterfaceName),
UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotAcquireDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire DHCP server parameter."),
UIErrorString::formatErrorInfo(comServer));
}
void UIMessageCenter::cannotSaveDHCPServerParameter(const CDHCPServer &comServer, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to save DHCP server parameter."),
UIErrorString::formatErrorInfo(comServer));
}
void UIMessageCenter::cannotAcquireCloudProviderManager(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud provider manager."),
UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotAcquireCloudProviderManagerParameter(const CCloudProviderManager &comManager, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud provider manager parameter."),
UIErrorString::formatErrorInfo(comManager));
}
void UIMessageCenter::cannotFindCloudProvider(const CCloudProviderManager &comManager, const QUuid &uId, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to find cloud provider with following uuid: <b>%1</b>.").arg(uId.toString()),
UIErrorString::formatErrorInfo(comManager));
}
void UIMessageCenter::cannotAcquireCloudProviderParameter(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud provider parameter."),
UIErrorString::formatErrorInfo(comProvider));
}
void UIMessageCenter::cannotFindCloudProfile(const CCloudProvider &comProvider, const QString &strName, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to find cloud profile with following name: <b>%1</b>.").arg(strName),
UIErrorString::formatErrorInfo(comProvider));
}
void UIMessageCenter::cannotCreateCloudProfle(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create cloud profile."),
UIErrorString::formatErrorInfo(comProvider));
}
void UIMessageCenter::cannotSaveCloudProfiles(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to save cloud profiles."),
UIErrorString::formatErrorInfo(comProvider));
}
void UIMessageCenter::cannotImportCloudProfiles(const CCloudProvider &comProvider, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to import cloud profiles."),
UIErrorString::formatErrorInfo(comProvider));
}
void UIMessageCenter::cannotAcquireCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud profile parameter."),
UIErrorString::formatErrorInfo(comProfile));
}
void UIMessageCenter::cannotAssignCloudProfileParameter(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign cloud profile parameter."),
UIErrorString::formatErrorInfo(comProfile));
}
void UIMessageCenter::cannotCreateCloudClient(const CCloudProfile &comProfile, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create cloud client."),
UIErrorString::formatErrorInfo(comProfile));
}
void UIMessageCenter::cannotCreateCloudMachine(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create cloud machine."),
UIErrorString::formatErrorInfo(comClient));
}
void UIMessageCenter::cannotCreateCloudMachine(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create cloud machine."),
UIErrorString::formatErrorInfo(comProgress));
}
void UIMessageCenter::cannotAcquireCloudClientParameter(const CCloudClient &comClient, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud client parameter."),
UIErrorString::formatErrorInfo(comClient));
}
void UIMessageCenter::cannotAcquireCloudClientParameter(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to acquire cloud client parameter."),
UIErrorString::formatErrorInfo(comProgress));
}
bool UIMessageCenter::confirmCloudProfileRemoval(const QString &strName, QWidget *pParent /* = 0 */) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>Do you want to remove the cloud profile <nobr><b>%1</b>?</nobr></p>")
.arg(strName),
0 /* auto-confirm id */,
tr("Remove") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
bool UIMessageCenter::confirmCloudProfilesImport(QWidget *pParent /* = 0 */) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>Do you want to import cloud profiles from external files?</p>"
"<p>VirtualBox cloud profiles will be overwritten and their data will be lost.</p>"),
0 /* auto-confirm id */,
tr("Import") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotAssignFormValue(const CBooleanFormValue &comValue, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign form value."),
UIErrorString::formatErrorInfo(comValue));
}
void UIMessageCenter::cannotAssignFormValue(const CStringFormValue &comValue, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign form value."),
UIErrorString::formatErrorInfo(comValue));
}
void UIMessageCenter::cannotAssignFormValue(const CChoiceFormValue &comValue, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign form value."),
UIErrorString::formatErrorInfo(comValue));
}
void UIMessageCenter::cannotAssignFormValue(const CRangedIntegerFormValue &comValue, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign form value."),
UIErrorString::formatErrorInfo(comValue));
}
void UIMessageCenter::cannotAssignFormValue(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to assign form value."),
UIErrorString::formatErrorInfo(comProgress));
}
bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Warning,
tr("You are about to create a new virtual machine without a hard disk. "
"You will not be able to install an operating system on the machine "
"until you add one. In the mean time you will only be able to start the "
"machine using a virtual optical disk or from the network."),
0 /* auto-confirm id */,
tr("Continue", "no hard disk attached"),
tr("Go Back", "no hard disk attached"));
}
void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create a new virtual machine."),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to register the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotCreateClone(const CMachine &machine, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to clone the virtual machine <b>%1</b>.")
.arg(CMachine(machine).GetName()),
UIErrorString::formatErrorInfo(machine));
}
void UIMessageCenter::cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to clone the virtual machine <b>%1</b>.")
.arg(strMachineName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /* = 0*/) const
{
alert(pParent, MessageType_Info,
tr("<p>The hard disk storage unit at location <b>%1</b> already exists. "
"You cannot create a new virtual hard disk that uses this location "
"because it can be already used by another virtual hard disk.</p>"
"<p>Please specify a different location.</p>")
.arg(strLocation));
}
void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(vbox));
}
void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(medium));
}
void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotCreateHardDiskStorageInFAT(const QString &strLocation, QWidget *pParent /* = 0 */) const
{
alert(pParent, MessageType_Info,
tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr> FAT file systems have 4GB file size limit.")
.arg(strLocation));
}
void UIMessageCenter::cannotCreateMediumStorage(const CVirtualBox &comVBox, const QString &strLocation, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotCreateMediumStorage(const CMedium &comMedium, const QString &strLocation, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(comMedium));
}
void UIMessageCenter::cannotCreateMediumStorage(const CProgress &comProgress, const QString &strLocation, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to create the virtual disk image storage <nobr><b>%1</b>.</nobr>")
.arg(strLocation),
UIErrorString::formatErrorInfo(comProgress));
}
void UIMessageCenter::cannotRemoveMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
{
alert(pParent, MessageType_Critical,
tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>"
"<p>Please check that this folder really exists and that you have permissions to remove it.</p>")
.arg(QFileInfo(strFolderName).fileName()));
}
void UIMessageCenter::cannotRewriteMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
{
QFileInfo fi(strFolderName);
alert(pParent, MessageType_Critical,
tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"
"<p>This folder already exists and possibly belongs to another machine.</p>")
.arg(fi.fileName()).arg(fi.absolutePath()));
}
void UIMessageCenter::cannotCreateMachineFolder(const QString &strFolderName, QWidget *pParent /* = 0*/) const
{
QFileInfo fi(strFolderName);
alert(pParent, MessageType_Critical,
tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>"
"<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>")
.arg(fi.fileName()).arg(fi.absolutePath()));
}
void UIMessageCenter::cannotCreateAppliance(const CVirtualBox &comVBox, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual appliance.</p>"),
UIErrorString::formatErrorInfo(comVBox));
}
void UIMessageCenter::cannotCreateVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"),
UIErrorString::formatErrorInfo(comAppliance));
}
void UIMessageCenter::cannotAcquireVirtualSystemDescription(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Critical, tr("<p>Cannot create a virtual system description.</p>"),
UIErrorString::formatErrorInfo(comAppliance));
}
void UIMessageCenter::cannotAddVirtualSystemDescriptionValue(const CVirtualSystemDescription &comDescription,
QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Critical, tr("<p>Cannot add a virtual system description value.</p>"),
UIErrorString::formatErrorInfo(comDescription));
}
void UIMessageCenter::cannotAcquireVirtualSystemDescriptionFormProperty(const CVirtualSystemDescriptionForm &comForm,
QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Critical, tr("<p>Cannot acquire a virtual system description property.</p>"),
UIErrorString::formatErrorInfo(comForm));
}
void UIMessageCenter::cannotImportAppliance(CAppliance &appliance, QWidget *pParent /* = 0*/) const
{
/* Preserve error-info: */
QString strErrorInfo = UIErrorString::formatErrorInfo(appliance);
/* Add the warnings in the case of an early error: */
QString strWarningInfo;
foreach(const QString &strWarning, appliance.GetWarnings())
strWarningInfo += QString("<br />Warning: %1").arg(strWarning);
if (!strWarningInfo.isEmpty())
strWarningInfo = "<br />" + strWarningInfo;
/* Show the error: */
error(pParent, MessageType_Error,
tr("Failed to open/interpret appliance <b>%1</b>.")
.arg(appliance.GetPath()),
strWarningInfo + strErrorInfo);
}
void UIMessageCenter::cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to import appliance <b>%1</b>.")
.arg(strPath),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to check files."),
UIErrorString::formatErrorInfo(comAppliance));
return false;
}
bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to check files."),
UIErrorString::formatErrorInfo(comVFSExplorer));
return false;
}
bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to check files."),
UIErrorString::formatErrorInfo(comProgress));
return false;
}
bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to remove file."),
UIErrorString::formatErrorInfo(comVFSExplorer));
return false;
}
bool UIMessageCenter::cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to remove file."),
UIErrorString::formatErrorInfo(comProgress));
return false;
}
bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Warning,
tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>"
"<p>If you continue the runtime state of the exported machine(s) will be discarded. "
"The other machine(s) will not be changed.</p>",
"This text is never used with n == 0. Feel free to drop the %n where possible, "
"we only included it because of problems with Qt Linguist (but the user can see "
"how many machines are in the list and doesn't need to be told).", machineNames.size())
.arg(machineNames.join(", ")),
0 /* auto-confirm id */,
tr("Continue"));
}
bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to prepare the export of the appliance <b>%1</b>.")
.arg(CAppliance(comAppliance).GetPath()),
UIErrorString::formatErrorInfo(comAppliance));
return false;
}
void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to prepare the export of the appliance <b>%1</b>.")
.arg(strPath),
UIErrorString::formatErrorInfo(machine));
}
bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Failed to export appliance <b>%1</b>.")
.arg(strPath),
UIErrorString::formatErrorInfo(comProgress));
return false;
}
bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */)
{
error(pParent, MessageType_Error,
tr("Bad password or authentication failure."),
UIErrorString::formatErrorInfo(comAppliance));
return false;
}
void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, const QString &strErrorId, const QString &strErrorMsg) const
{
/* Prepare auto-confirm id: */
QByteArray autoConfimId = "showRuntimeError.";
/* Prepare variables: */
CConsole console1 = console;
KMachineState state = console1.GetState();
MessageType enmType;
QString severity;
/// @todo Move to Runtime UI!
/* Preprocessing: */
if (fFatal)
{
/* The machine must be paused on fFatal errors: */
Assert(state == KMachineState_Paused);
if (state != KMachineState_Paused)
console1.Pause();
}
/* Compose type, severity, advance confirm id: */
if (fFatal)
{
enmType = MessageType_Critical;
severity = tr("<nobr>Fatal Error</nobr>", "runtime error info");
autoConfimId += "fatal.";
}
else if (state == KMachineState_Paused)
{
enmType = MessageType_Error;
severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info");
autoConfimId += "error.";
}
else
{
enmType = MessageType_Warning;
severity = tr("<nobr>Warning</nobr>", "runtime error info");
autoConfimId += "warning.";
}
/* Advance auto-confirm id: */
autoConfimId += strErrorId.toUtf8();
/* Format error-details: */
QString formatted("<!--EOM-->");
if (!strErrorMsg.isEmpty())
formatted.prepend(QString("<p>%1.</p>").arg(uiCommon().emphasize(strErrorMsg)));
if (!strErrorId.isEmpty())
formatted += QString("<table bgcolor=#EEEEEE border=0 cellspacing=5 "
"cellpadding=0 width=100%>"
"<tr><td>%1</td><td>%2</td></tr>"
"<tr><td>%3</td><td>%4</td></tr>"
"</table>")
.arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), strErrorId)
.arg(tr("Severity: ", "runtime error info"), severity);
if (!formatted.isEmpty())
formatted = "<qt>" + formatted + "</qt>";
/* Show the error: */
if (enmType == MessageType_Critical)
{
error(0, enmType,
tr("<p>A fatal error has occurred during virtual machine execution! "
"The virtual machine will be powered off. Please copy the following error message "
"using the clipboard to help diagnose the problem:</p>"),
formatted, autoConfimId.data());
}
else if (enmType == MessageType_Error)
{
error(0, enmType,
tr("<p>An error has occurred during virtual machine execution! "
"The error details are shown below. You may try to correct the error "
"and resume the virtual machine execution.</p>"),
formatted, autoConfimId.data());
}
else
{
/** @todo r=bird: This is a very annoying message as it refers to invisible text
* below. User have to expand "Details" to see what actually went wrong.
* Probably a good idea to check strErrorId and see if we can come up with better
* messages here, at least for common stuff like DvdOrFloppyImageInaccesssible... */
error(0, enmType,
tr("<p>The virtual machine execution ran into a non-fatal problem as described below. "
"We suggest that you take appropriate action to prevent the problem from recurring.</p>"),
formatted, autoConfimId.data());
}
/// @todo Move to Runtime UI!
/* Postprocessing: */
if (fFatal)
{
/* Power down after a fFatal error: */
LogRel(("GUI: Powering VM down after a fatal runtime error...\n"));
console1.PowerDown();
}
}
bool UIMessageCenter::remindAboutGuruMeditation(const QString &strLogFolder)
{
return questionBinary(0, MessageType_GuruMeditation,
tr("<p>A critical error has occurred while running the virtual "
"machine and the machine execution has been stopped.</p>"
""
"<p>For help, please see the Community section on "
"<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "
"or your support contract. Please provide the contents of the "
"log file <tt>VBox.log</tt> and the image file <tt>VBox.png</tt>, "
"which you can find in the <nobr><b>%1</b></nobr> directory, "
"as well as a description of what you were doing when this error happened. "
""
"Note that you can also access the above files by selecting <b>Show Log</b> "
"from the <b>Machine</b> menu of the main VirtualBox window.</p>"
""
"<p>Press <b>OK</b> if you want to power off the machine "
"or press <b>Ignore</b> if you want to leave it as is for debugging. "
"Please note that debugging requires special knowledge and tools, "
"so it is recommended to press <b>OK</b> now.</p>")
.arg(strLogFolder),
0 /* auto-confirm id */,
QIMessageBox::tr("OK"),
tr("Ignore"));
}
void UIMessageCenter::warnAboutVBoxSVCUnavailable() const
{
alert(0, MessageType_Critical,
tr("<p>A critical error has occurred while running the virtual "
"machine and the machine execution should be stopped.</p>"
""
"<p>For help, please see the Community section on "
"<a href=https://www.virtualbox.org>https://www.virtualbox.org</a> "
"or your support contract. Please provide the contents of the "
"log file <tt>VBox.log</tt>, "
"which you can find in the virtual machine log directory, "
"as well as a description of what you were doing when this error happened. "
""
"Note that you can also access the above file by selecting <b>Show Log</b> "
"from the <b>Machine</b> menu of the main VirtualBox window.</p>"
""
"<p>Press <b>OK</b> to power off the machine.</p>"),
0 /* auto-confirm id */);
}
bool UIMessageCenter::warnAboutVirtExInactiveFor64BitsGuest(bool fHWVirtExSupported) const
{
if (fHWVirtExSupported)
return questionBinary(0, MessageType_Error,
tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
"Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.</p>"
"<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
0 /* auto-confirm id */,
tr("Close VM"), tr("Continue"));
else
return questionBinary(0, MessageType_Error,
tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
"Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot."),
0 /* auto-confirm id */,
tr("Close VM"), tr("Continue"));
}
bool UIMessageCenter::warnAboutVirtExInactiveForRecommendedGuest(bool fHWVirtExSupported) const
{
if (fHWVirtExSupported)
return questionBinary(0, MessageType_Error,
tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is not operational. "
"Certain guests (e.g. OS/2 and QNX) require this feature.</p>"
"<p>Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.</p>"),
0 /* auto-confirm id */,
tr("Close VM"), tr("Continue"));
else
return questionBinary(0, MessageType_Error,
tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "
"Certain guests (e.g. OS/2 and QNX) require this feature and will fail to boot without it.</p>"),
0 /* auto-confirm id */,
tr("Close VM"), tr("Continue"));
}
bool UIMessageCenter::cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames) const
{
return questionBinary(0, MessageType_Error,
tr("<p>Could not start the machine <b>%1</b> because the following "
"physical network interfaces were not found:</p><p><b>%2</b></p>"
"<p>You can either change the machine's network settings or stop the machine.</p>")
.arg(strMachineName, strIfNames),
0 /* auto-confirm id */,
tr("Change Network Settings"), tr("Close VM"));
}
void UIMessageCenter::cannotStartMachine(const CConsole &console, const QString &strName) const
{
error(0, MessageType_Error,
tr("Failed to start the virtual machine <b>%1</b>.")
.arg(strName),
UIErrorString::formatErrorInfo(console));
}
void UIMessageCenter::cannotStartMachine(const CProgress &progress, const QString &strName) const
{
error(0, MessageType_Error,
tr("Failed to start the virtual machine <b>%1</b>.")
.arg(strName),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::confirmInputCapture(bool &fAutoConfirmed) const
{
int rc = question(0, MessageType_Info,
tr("<p>You have <b>clicked the mouse</b> inside the Virtual Machine display or pressed the <b>host key</b>. "
"This will cause the Virtual Machine to <b>capture</b> the host mouse pointer (only if the mouse pointer "
"integration is not currently supported by the guest OS) and the keyboard, which will make them "
"unavailable to other applications running on your host machine.</p>"
"<p>You can press the <b>host key</b> at any time to <b>uncapture</b> the keyboard and mouse "
"(if it is captured) and return them to normal operation. "
"The currently assigned host key is shown on the status bar at the bottom of the Virtual Machine window, "
"next to the <img src=:/hostkey_16px.png/> icon. "
"This icon, together with the mouse icon placed nearby, indicate the current keyboard and mouse capture state.</p>") +
tr("<p>The host key is currently defined as <b>%1</b>.</p>", "additional message box paragraph")
.arg(UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
"confirmInputCapture",
AlertButton_Ok | AlertButtonOption_Default,
AlertButton_Cancel | AlertButtonOption_Escape,
0,
tr("Capture", "do input capture"));
/* Was the message auto-confirmed? */
fAutoConfirmed = (rc & AlertOption_AutoConfirmed);
/* True if "Ok" was pressed: */
return (rc & AlertButtonMask) == AlertButton_Ok;
}
bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) const
{
return questionBinary(0, MessageType_Info,
tr("<p>The virtual machine window will be now switched to <b>full-screen</b> mode. "
"You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
"<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
"<p>Note that the main menu bar is hidden in full-screen mode. "
"You can access it by pressing <b>Host+Home</b>.</p>")
.arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
"confirmGoingFullscreen",
tr("Switch"));
}
bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) const
{
return questionBinary(0, MessageType_Info,
tr("<p>The virtual machine window will be now switched to <b>Seamless</b> mode. "
"You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
"<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
"<p>Note that the main menu bar is hidden in seamless mode. "
"You can access it by pressing <b>Host+Home</b>.</p>")
.arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
"confirmGoingSeamless",
tr("Switch"));
}
bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) const
{
return questionBinary(0, MessageType_Info,
tr("<p>The virtual machine window will be now switched to <b>Scale</b> mode. "
"You can go back to windowed mode at any time by pressing <b>%1</b>.</p>"
"<p>Note that the <i>Host</i> key is currently defined as <b>%2</b>.</p>"
"<p>Note that the main menu bar is hidden in scaled mode. "
"You can access it by pressing <b>Host+Home</b>.</p>")
.arg(strHotKey, UIHostCombo::toReadableString(gEDataManager->hostKeyCombination())),
"confirmGoingScale",
tr("Switch"));
}
bool UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const
{
return questionBinary(0, MessageType_Warning,
tr("<p>Could not switch the guest display to full-screen mode due to insufficient guest video memory.</p>"
"<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"
"<p>Press <b>Ignore</b> to switch to full-screen mode anyway or press <b>Cancel</b> to cancel the operation.</p>")
.arg(UICommon::formatSize(uMinVRAM)),
0 /* auto-confirm id */,
tr("Ignore"));
}
void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, ULONG /* uHeight */, ULONG /* uBpp */, ULONG64 uMinVRAM) const
{
alert(0, MessageType_Error,
tr("<p>Could not enter seamless mode due to insufficient guest "
"video memory.</p>"
"<p>You should configure the virtual machine to have at "
"least <b>%1</b> of video memory.</p>")
.arg(UICommon::formatSize(uMinVRAM)));
}
bool UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) const
{
return questionBinary(0, MessageType_Warning,
tr("<p>Could not change the guest screen to this host screen due to insufficient guest video memory.</p>"
"<p>You should configure the virtual machine to have at least <b>%1</b> of video memory.</p>"
"<p>Press <b>Ignore</b> to switch the screen anyway or press <b>Cancel</b> to cancel the operation.</p>")
.arg(UICommon::formatSize(uMinVRAM)),
0 /* auto-confirm id */,
tr("Ignore"));
}
void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) const
{
alert(0, MessageType_Error,
tr("<p>Could not change the guest screen to this host screen "
"due to insufficient guest video memory.</p>"
"<p>You should configure the virtual machine to have at "
"least <b>%1</b> of video memory.</p>")
.arg(UICommon::formatSize(uMinVRAM)));
}
void UIMessageCenter::cannotAddDiskEncryptionPassword(const CConsole &console)
{
error(0, MessageType_Error,
tr("Bad password or authentication failure."),
UIErrorString::formatErrorInfo(console));
}
#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
bool UIMessageCenter::confirmCancelingAllNetworkRequests() const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("Do you wish to cancel all current network operations?"));
}
void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available "
"at <a href=\"https://www.virtualbox.org/\">virtualbox.org</a>.</p>"
"<p>You can download this version using the link:</p>"
"<p><a href=%2>%3</a></p>")
.arg(strVersion, strLink, strLink));
}
void UIMessageCenter::showUpdateNotFound() const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
tr("You are already running the most recent version of VirtualBox."));
}
void UIMessageCenter::askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Info,
tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>"
"<p>You should download and install version %3 of this extension pack from Oracle!</p>")
.arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion));
}
bool UIMessageCenter::cannotFindGuestAdditions() const
{
return questionBinary(0, MessageType_Question,
tr("<p>Could not find the <b>VirtualBox Guest Additions</b> disk image file.</p>"
"<p>Do you wish to download this disk image file from the Internet?</p>"),
0 /* auto-confirm id */,
tr("Download"));
}
bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> disk image file "
"from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
.arg(strUrl, QLocale(UICommon::languageId()).toString(uSize)),
0 /* auto-confirm id */,
tr("Download"));
}
void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
"from <nobr><a href=\"%1\">%1</a></nobr> "
"but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
"<p>Please choose another location for that file.</p>")
.arg(strURL, strTarget));
}
bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
"from <nobr><a href=\"%1\">%1</a></nobr> "
"and saved locally as <nobr><b>%2</b>.</nobr></p>"
"<p>Do you wish to register this disk image file and insert it into the virtual optical drive?</p>")
.arg(strUrl, strSrc),
0 /* auto-confirm id */,
tr("Insert", "additions"));
}
void UIMessageCenter::cannotValidateGuestAdditionsSHA256Sum(const QString &strUrl, const QString &strSrc) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
tr("<p>The <b>VirtualBox Guest Additions</b> disk image file has been successfully downloaded "
"from <nobr><a href=\"%1\">%1</a></nobr> "
"and saved locally as <nobr><b>%2</b>, </nobr>"
"but the SHA-256 checksum verification failed.</p>"
"<p>Please do the download, installation and verification manually.</p>")
.arg(strUrl, strSrc));
}
void UIMessageCenter::cannotUpdateGuestAdditions(const CProgress &progress) const
{
error(0, MessageType_Error,
tr("Failed to update Guest Additions. "
"The Guest Additions disk image file will be inserted for user installation."),
UIErrorString::formatErrorInfo(progress));
}
bool UIMessageCenter::cannotFindUserManual(const QString &strMissedLocation) const
{
return questionBinary(0, MessageType_Question,
tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>"
"<p>Do you wish to download this file from the Internet?</p>")
.arg(strMissedLocation),
0 /* auto-confirm id */,
tr("Download"));
}
bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> "
"from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
.arg(strURL, QLocale(UICommon::languageId()).toString(uSize)),
0 /* auto-confirm id */,
tr("Download"));
}
void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
tr("<p>The VirtualBox User Manual has been successfully downloaded "
"from <nobr><a href=\"%1\">%1</a></nobr> "
"but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
"<p>Please choose another location for that file.</p>")
.arg(strURL, strTarget));
}
void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Warning,
tr("<p>The VirtualBox User Manual has been successfully downloaded "
"from <nobr><a href=\"%1\">%1</a></nobr> "
"and saved locally as <nobr><b>%2</b>.</nobr></p>")
.arg(strURL, strTarget));
}
bool UIMessageCenter::warnAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>"
"<p>Do you wish to download latest one from the Internet?</p>")
.arg(strExtPackVersion).arg(strExtPackName),
0 /* auto-confirm id */,
tr("Download"));
}
bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> "
"from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>")
.arg(strExtPackName, strURL, QLocale(UICommon::languageId()).toString(uSize)),
0 /* auto-confirm id */,
tr("Download"));
}
void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
"from <nobr><a href=\"%2\">%2</a></nobr> "
"but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
"<p>Please choose another location for that file.</p>")
.arg(strExtPackName, strFrom, strTo));
}
bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
"from <nobr><a href=\"%2\">%2</a></nobr> "
"and saved locally as <nobr><b>%3</b>.</nobr></p>"
"<p>Do you wish to install this extension pack?</p>")
.arg(strExtPackName, strFrom, strTo),
0 /* auto-confirm id */,
tr("Install", "extension pack"));
}
void UIMessageCenter::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
{
alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,
tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
"from <nobr><a href=\"%2\">%2</a></nobr> "
"and saved locally as <nobr><b>%3</b>, </nobr>"
"but the SHA-256 checksum verification failed.</p>"
"<p>Please do the download, installation and verification manually.</p>")
.arg(strExtPackName, strFrom, strTo));
}
bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("Do you want to delete the downloaded file <nobr><b>%1</b></nobr>?")
.arg(strTo),
0 /* auto-confirm id */,
tr("Delete", "extension pack"));
}
bool UIMessageCenter::proposeDeleteOldExtentionPacks(const QStringList &strFiles) const
{
return questionBinary(windowManager().networkManagerOrMainWindowShown(), MessageType_Question,
tr("Do you want to delete following list of files <nobr><b>%1</b></nobr>?")
.arg(strFiles.join(",")),
0 /* auto-confirm id */,
tr("Delete", "extension pack"));
}
#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
bool UIMessageCenter::confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion,
const QString &strPackDescription, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>You are about to install a VirtualBox extension pack. "
"Extension packs complement the functionality of VirtualBox and can contain system level software "
"that could be potentially harmful to your system. Please review the description below and only proceed "
"if you have obtained the extension pack from a trusted source.</p>"
"<p><table cellpadding=0 cellspacing=5>"
"<tr><td><b>Name: </b></td><td>%1</td></tr>"
"<tr><td><b>Version: </b></td><td>%2</td></tr>"
"<tr><td><b>Description: </b></td><td>%3</td></tr>"
"</table></p>")
.arg(strPackName).arg(strPackVersion).arg(strPackDescription),
0 /* auto-confirm id */,
tr("Install", "extension pack"));
}
bool UIMessageCenter::confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew,
const QString &strPackVersionOld, const QString &strPackDescription,
QWidget *pParent /* = 0*/) const
{
/* Prepare initial message: */
QString strBelehrung = tr("Extension packs complement the functionality of VirtualBox and can contain "
"system level software that could be potentially harmful to your system. "
"Please review the description below and only proceed if you have obtained "
"the extension pack from a trusted source.");
/* Compare versions: */
QByteArray ba1 = strPackVersionNew.toUtf8();
QByteArray ba2 = strPackVersionOld.toUtf8();
int iVerCmp = RTStrVersionCompare(ba1.constData(), ba2.constData());
/* Show the question: */
bool fRc;
if (iVerCmp > 0)
fRc = questionBinary(pParent, MessageType_Question,
tr("<p>An older version of the extension pack is already installed, would you like to upgrade? "
"<p>%1</p>"
"<p><table cellpadding=0 cellspacing=5>"
"<tr><td><b>Name: </b></td><td>%2</td></tr>"
"<tr><td><b>New Version: </b></td><td>%3</td></tr>"
"<tr><td><b>Current Version: </b></td><td>%4</td></tr>"
"<tr><td><b>Description: </b></td><td>%5</td></tr>"
"</table></p>")
.arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
0 /* auto-confirm id */,
tr("&Upgrade"));
else if (iVerCmp < 0)
fRc = questionBinary(pParent, MessageType_Question,
tr("<p>An newer version of the extension pack is already installed, would you like to downgrade? "
"<p>%1</p>"
"<p><table cellpadding=0 cellspacing=5>"
"<tr><td><b>Name: </b></td><td>%2</td></tr>"
"<tr><td><b>New Version: </b></td><td>%3</td></tr>"
"<tr><td><b>Current Version: </b></td><td>%4</td></tr>"
"<tr><td><b>Description: </b></td><td>%5</td></tr>"
"</table></p>")
.arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
0 /* auto-confirm id */,
tr("&Downgrade"));
else
fRc = questionBinary(pParent, MessageType_Question,
tr("<p>The extension pack is already installed with the same version, would you like reinstall it? "
"<p>%1</p>"
"<p><table cellpadding=0 cellspacing=5>"
"<tr><td><b>Name: </b></td><td>%2</td></tr>"
"<tr><td><b>Version: </b></td><td>%3</td></tr>"
"<tr><td><b>Description: </b></td><td>%4</td></tr>"
"</table></p>")
.arg(strBelehrung).arg(strPackName).arg(strPackVersionOld).arg(strPackDescription),
0 /* auto-confirm id */,
tr("&Reinstall"));
return fRc;
}
bool UIMessageCenter::confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("<p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p>"
"<p>Are you sure you want to proceed?</p>")
.arg(strPackName),
0 /* auto-confirm id */,
tr("&Remove") /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
void UIMessageCenter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
UIErrorString::formatErrorInfo(extPackManager));
}
void UIMessageCenter::warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
"<!--EOM-->" + extPackFile.GetWhyUnusable());
}
void UIMessageCenter::cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to install the Extension Pack <b>%1</b>.")
.arg(strFilename),
UIErrorString::formatErrorInfo(extPackFile));
}
void UIMessageCenter::cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to install the Extension Pack <b>%1</b>.")
.arg(strFilename),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to uninstall the Extension Pack <b>%1</b>.")
.arg(strPackName),
UIErrorString::formatErrorInfo(extPackManager));
}
void UIMessageCenter::cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent /* = 0*/) const
{
error(pParent, MessageType_Error,
tr("Failed to uninstall the Extension Pack <b>%1</b>.")
.arg(strPackName),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent /* = 0*/) const
{
alert(pParent, MessageType_Info,
tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.")
.arg(strPackName));
}
#ifdef VBOX_WITH_DRAG_AND_DROP
void UIMessageCenter::cannotDropDataToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Drag and drop operation from host to guest failed."),
UIErrorString::formatErrorInfo(dndTarget));
}
void UIMessageCenter::cannotDropDataToGuest(const CProgress &progress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Drag and drop operation from host to guest failed."),
UIErrorString::formatErrorInfo(progress));
}
void UIMessageCenter::cannotCancelDropToGuest(const CDnDTarget &dndTarget, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Unable to cancel host to guest drag and drop operation."),
UIErrorString::formatErrorInfo(dndTarget));
}
void UIMessageCenter::cannotDropDataToHost(const CDnDSource &dndSource, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Drag and drop operation from guest to host failed."),
UIErrorString::formatErrorInfo(dndSource));
}
void UIMessageCenter::cannotDropDataToHost(const CProgress &progress, QWidget *pParent /* = 0 */) const
{
error(pParent, MessageType_Error,
tr("Drag and drop operation from guest to host failed."),
UIErrorString::formatErrorInfo(progress));
}
#endif /* VBOX_WITH_DRAG_AND_DROP */
void UIMessageCenter::cannotOpenLicenseFile(const QString &strPath, QWidget *pParent /* = 0*/) const
{
alert(pParent, MessageType_Error,
tr("Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.")
.arg(strPath));
}
bool UIMessageCenter::confirmOverridingFile(const QString &strPath, QWidget *pParent /* = 0*/) const
{
return questionBinary(pParent, MessageType_Question,
tr("A file named <b>%1</b> already exists. "
"Are you sure you want to replace it?<br /><br />"
"Replacing it will overwrite its contents.")
.arg(strPath),
0 /* auto-confirm id */,
QString() /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
}
bool UIMessageCenter::confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const
{
/* If it is only one file use the single question versions above: */
if (strPaths.size() == 1)
return confirmOverridingFile(strPaths.at(0), pParent);
else if (strPaths.size() > 1)
return questionBinary(pParent, MessageType_Question,
tr("The following files already exist:<br /><br />%1<br /><br />"
"Are you sure you want to replace them? "
"Replacing them will overwrite their contents.")
.arg(QStringList(strPaths.toList()).join("<br />")),
0 /* auto-confirm id */,
QString() /* ok button text */,
QString() /* cancel button text */,
false /* ok button by default? */);
else
return true;
}
bool UIMessageCenter::confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent /* = 0*/) const
{
QFileInfo fi(strPath);
if (fi.exists())
return confirmOverridingFile(strPath, pParent);
else
return true;
}
bool UIMessageCenter::confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/) const
{
QVector<QString> existingFiles;
foreach(const QString &file, strPaths)
{
QFileInfo fi(file);
if (fi.exists())
existingFiles << fi.absoluteFilePath();
}
/* If it is only one file use the single question versions above: */
if (existingFiles.size() == 1)
return confirmOverridingFileIfExists(existingFiles.at(0), pParent);
else if (existingFiles.size() > 1)
return confirmOverridingFiles(existingFiles, pParent);
else
return true;
}
void UIMessageCenter::sltShowHelpWebDialog()
{
uiCommon().openURL("https://www.virtualbox.org");
}
void UIMessageCenter::sltShowBugTracker()
{
uiCommon().openURL("https://www.virtualbox.org/wiki/Bugtracker");
}
void UIMessageCenter::sltShowForums()
{
uiCommon().openURL("https://forums.virtualbox.org/");
}
void UIMessageCenter::sltShowOracle()
{
uiCommon().openURL("http://www.oracle.com/us/technologies/virtualization/virtualbox/overview/index.html");
}
void UIMessageCenter::sltShowHelpAboutDialog()
{
CVirtualBox vbox = uiCommon().virtualBox();
QString strFullVersion;
if (uiCommon().brandingIsActive())
{
strFullVersion = QString("%1 r%2 - %3").arg(vbox.GetVersion())
.arg(vbox.GetRevision())
.arg(uiCommon().brandingGetKey("Name"));
}
else
{
strFullVersion = QString("%1 r%2").arg(vbox.GetVersion())
.arg(vbox.GetRevision());
}
AssertWrapperOk(vbox);
(new VBoxAboutDlg(windowManager().mainWindowShown(), strFullVersion))->show();
}
void UIMessageCenter::sltShowHelpHelpDialog()
{
#ifndef VBOX_OSE
/* For non-OSE version we just open it: */
sltShowUserManual(uiCommon().helpFile());
#else /* #ifndef VBOX_OSE */
/* For OSE version we have to check if it present first: */
QString strUserManualFileName1 = uiCommon().helpFile();
QString strShortFileName = QFileInfo(strUserManualFileName1).fileName();
QString strUserManualFileName2 = QDir(uiCommon().homeFolder()).absoluteFilePath(strShortFileName);
/* Show if user manual already present: */
if (QFile::exists(strUserManualFileName1))
sltShowUserManual(strUserManualFileName1);
else if (QFile::exists(strUserManualFileName2))
sltShowUserManual(strUserManualFileName2);
/* If downloader is running already: */
else if (UIDownloaderUserManual::current())
{
/* Just show network access manager: */
gNetworkManager->show();
}
/* Else propose to download user manual: */
else if (cannotFindUserManual(strUserManualFileName1))
{
/* Create User Manual downloader: */
UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
/* After downloading finished => show User Manual: */
connect(pDl, &UIDownloaderUserManual::sigDownloadFinished, this, &UIMessageCenter::sltShowUserManual);
/* Start downloading: */
pDl->start();
}
#endif /* #ifdef VBOX_OSE */
}
void UIMessageCenter::sltResetSuppressedMessages()
{
/* Nullify suppressed message list: */
gEDataManager->setSuppressedMessages(QStringList());
}
void UIMessageCenter::sltShowUserManual(const QString &strLocation)
{
#if defined (VBOX_WS_WIN)
HtmlHelp(GetDesktopWindow(), strLocation.utf16(), HH_DISPLAY_TOPIC, NULL);
#elif defined (VBOX_WS_X11)
# ifndef VBOX_OSE
char szViewerPath[RTPATH_MAX];
int rc;
rc = RTPathAppPrivateArch(szViewerPath, sizeof(szViewerPath));
AssertRC(rc);
QProcess::startDetached(QString(szViewerPath) + "/kchmviewer", QStringList(strLocation));
# else /* #ifndef VBOX_OSE */
uiCommon().openURL("file://" + strLocation);
# endif /* #ifdef VBOX_OSE */
#elif defined (VBOX_WS_MAC)
uiCommon().openURL("file://" + strLocation);
#endif
}
void UIMessageCenter::sltShowMessageBox(QWidget *pParent, MessageType enmType,
const QString &strMessage, const QString &strDetails,
int iButton1, int iButton2, int iButton3,
const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
const QString &strAutoConfirmId) const
{
/* Now we can show a message-box directly: */
showMessageBox(pParent, enmType,
strMessage, strDetails,
iButton1, iButton2, iButton3,
strButtonText1, strButtonText2, strButtonText3,
strAutoConfirmId);
}
UIMessageCenter::UIMessageCenter()
{
/* Assign instance: */
s_pInstance = this;
}
UIMessageCenter::~UIMessageCenter()
{
/* Unassign instance: */
s_pInstance = 0;
}
void UIMessageCenter::prepare()
{
/* Register required objects as meta-types: */
qRegisterMetaType<CProgress>();
qRegisterMetaType<CHost>();
qRegisterMetaType<CMachine>();
qRegisterMetaType<CConsole>();
qRegisterMetaType<CHostNetworkInterface>();
qRegisterMetaType<UIMediumDeviceType>();
qRegisterMetaType<StorageSlot>();
/* Prepare interthread connection: */
qRegisterMetaType<MessageType>();
// Won't go until we are supporting C++11 or at least variadic templates everywhere.
// connect(this, &UIMessageCenter::sigToShowMessageBox,
// this, &UIMessageCenter::sltShowMessageBox,
connect(this, SIGNAL(sigToShowMessageBox(QWidget*, MessageType,
const QString&, const QString&,
int, int, int,
const QString&, const QString&, const QString&,
const QString&)),
this, SLOT(sltShowMessageBox(QWidget*, MessageType,
const QString&, const QString&,
int, int, int,
const QString&, const QString&, const QString&,
const QString&)),
Qt::BlockingQueuedConnection);
/* Translations for Main.
* Please make sure they corresponds to the strings coming from Main one-by-one symbol! */
tr("Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND). The service might not be installed on the host computer");
tr("VirtualBox is not currently allowed to access USB devices. You can change this by adding your user to the 'vboxusers' group. Please see the user manual for a more detailed explanation");
tr("VirtualBox is not currently allowed to access USB devices. You can change this by allowing your user to access the 'usbfs' folder and files. Please see the user manual for a more detailed explanation");
tr("The USB Proxy Service has not yet been ported to this host");
tr("Could not load the Host USB Proxy service");
}
void UIMessageCenter::cleanup()
{
/* Nothing for now... */
}
int UIMessageCenter::showMessageBox(QWidget *pParent, MessageType enmType,
const QString &strMessage, const QString &strDetails,
int iButton1, int iButton2, int iButton3,
const QString &strButtonText1, const QString &strButtonText2, const QString &strButtonText3,
const QString &strAutoConfirmId) const
{
/* Choose the 'default' button: */
if (iButton1 == 0 && iButton2 == 0 && iButton3 == 0)
iButton1 = AlertButton_Ok | AlertButtonOption_Default;
/* Check if message-box was auto-confirmed before: */
QStringList confirmedMessageList;
if (!strAutoConfirmId.isEmpty())
{
const QUuid uID = uiCommon().uiType() == UICommon::UIType_RuntimeUI
? uiCommon().managedVMUuid()
: UIExtraDataManager::GlobalID;
confirmedMessageList = gEDataManager->suppressedMessages(uID);
if ( confirmedMessageList.contains(strAutoConfirmId)
|| confirmedMessageList.contains("allMessageBoxes")
|| confirmedMessageList.contains("all") )
{
int iResultCode = AlertOption_AutoConfirmed;
if (iButton1 & AlertButtonOption_Default)
iResultCode |= (iButton1 & AlertButtonMask);
if (iButton2 & AlertButtonOption_Default)
iResultCode |= (iButton2 & AlertButtonMask);
if (iButton3 & AlertButtonOption_Default)
iResultCode |= (iButton3 & AlertButtonMask);
return iResultCode;
}
}
/* Choose title and icon: */
QString title;
AlertIconType icon;
switch (enmType)
{
default:
case MessageType_Info:
title = tr("VirtualBox - Information", "msg box title");
icon = AlertIconType_Information;
break;
case MessageType_Question:
title = tr("VirtualBox - Question", "msg box title");
icon = AlertIconType_Question;
break;
case MessageType_Warning:
title = tr("VirtualBox - Warning", "msg box title");
icon = AlertIconType_Warning;
break;
case MessageType_Error:
title = tr("VirtualBox - Error", "msg box title");
icon = AlertIconType_Critical;
break;
case MessageType_Critical:
title = tr("VirtualBox - Critical Error", "msg box title");
icon = AlertIconType_Critical;
break;
case MessageType_GuruMeditation:
title = "VirtualBox - Guru Meditation"; /* don't translate this */
icon = AlertIconType_GuruMeditation;
break;
}
/* Create message-box: */
QWidget *pMessageBoxParent = windowManager().realParentWindow(pParent ? pParent : windowManager().mainWindowShown());
QPointer<QIMessageBox> pMessageBox = new QIMessageBox(title, strMessage, icon,
iButton1, iButton2, iButton3,
pMessageBoxParent);
windowManager().registerNewParent(pMessageBox, pMessageBoxParent);
/* Prepare auto-confirmation check-box: */
if (!strAutoConfirmId.isEmpty())
{
pMessageBox->setFlagText(tr("Do not show this message again", "msg box flag"));
pMessageBox->setFlagChecked(false);
}
/* Configure details: */
if (!strDetails.isEmpty())
pMessageBox->setDetailsText(strDetails);
/* Configure button-text: */
if (!strButtonText1.isNull())
pMessageBox->setButtonText(0, strButtonText1);
if (!strButtonText2.isNull())
pMessageBox->setButtonText(1, strButtonText2);
if (!strButtonText3.isNull())
pMessageBox->setButtonText(2, strButtonText3);
/* Show message-box: */
int iResultCode = pMessageBox->exec();
/* Make sure message-box still valid: */
if (!pMessageBox)
return iResultCode;
/* Remember auto-confirmation check-box value: */
if (!strAutoConfirmId.isEmpty())
{
if (pMessageBox->flagChecked())
{
confirmedMessageList << strAutoConfirmId;
gEDataManager->setSuppressedMessages(confirmedMessageList);
}
}
/* Delete message-box: */
delete pMessageBox;
/* Return result-code: */
return iResultCode;
}
|