forked from gildor2/UEViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressDialog.cpp
More file actions
88 lines (75 loc) · 1.91 KB
/
Copy pathProgressDialog.cpp
File metadata and controls
88 lines (75 loc) · 1.91 KB
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
#include "BaseDialog.h"
#if HAS_UI
#include "ProgressDialog.h"
#include "UnObject.h"
//!! Other possible statistics:
//!! - elapsed time
void UIProgressDialog::Show(const char* title)
{
CloseOnEsc();
ShowDialog(title, 250, 200);
}
void UIProgressDialog::SetDescription(const char* text)
{
DescriptionText = text;
}
bool UIProgressDialog::Progress(const char* package, int index, int total)
{
char buffer[512];
appSprintf(ARRAY_ARG(buffer), "%s %d/%d", DescriptionText, index+1, total);
DescriptionLabel->SetText(buffer);
PackageLabel->SetText(package);
ProgressBar->SetValue((float)(index+1) / total);
return Tick();
}
bool UIProgressDialog::Tick()
{
char buffer[64];
appSprintf(ARRAY_ARG(buffer), "%d MBytes", (int)(GTotalAllocationSize >> 20));
MemoryLabel->SetText(buffer);
appSprintf(ARRAY_ARG(buffer), "%d", UObject::GObjObjects.Num());
ObjectsLabel->SetText(buffer);
return PumpMessageLoop();
}
void UIProgressDialog::InitUI()
{
(*this)
[
NewControl(UIGroup)
[
NewControl(UILabel, "")
.Expose(DescriptionLabel)
+ NewControl(UISpacer)
+ NewControl(UILabel, "")
.Expose(PackageLabel)
+ NewControl(UIProgressBar)
.Expose(ProgressBar)
]
+ NewControl(UIGroup)
[
NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER)
[
NewControl(UILabel, "Memory used:", TA_Right)
+ NewControl(UISpacer)
+ NewControl(UILabel, "")
.Expose(MemoryLabel)
]
+ NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER)
[
NewControl(UILabel, "Objects loaded:", TA_Right)
+ NewControl(UISpacer)
+ NewControl(UILabel, "")
.Expose(ObjectsLabel)
]
]
+ NewControl(UIGroup, GROUP_HORIZONTAL_LAYOUT|GROUP_NO_BORDER)
[
NewControl(UISpacer, -1)
+ NewControl(UIButton, "Cancel")
.SetWidth(100)
.SetCancel()
+ NewControl(UISpacer, -1)
]
];
}
#endif // HAS_UI