本文整理汇总了C++中Progress::SetTotal方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::SetTotal方法的具体用法?C++ Progress::SetTotal怎么用?C++ Progress::SetTotal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::SetTotal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FinishSave
bool FinishSave(String tmpfile, String outfile)
{
if(IsDeactivationSave()) {
FileMove(tmpfile, outfile);
return true;
}
Progress progress;
int time = GetTickCount();
for(;;) {
progress.SetTotal(10000);
progress.SetText("Saving '" + GetFileName(outfile) + "'");
if(!FileExists(tmpfile))
return false;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
return true;
IdeConsoleFlush();
Sleep(200);
if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) {
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
return false;
if(art && AnySourceFs().ExecuteSaveAs())
outfile = AnySourceFs();
progress.SetPos(0);
}
}
}
示例2: Licenses
void Ide::Licenses()
{
Progress pi;
const Workspace& wspc = IdeWorkspace();
pi.SetTotal(wspc.GetCount());
VectorMap<String, String> license_package;
for(int i = 0; i < wspc.GetCount(); i++) {
String n = wspc[i];
pi.SetText(n);
if(pi.StepCanceled()) return;
String l = LoadFile(SourcePath(n, "Copying"));
if(l.GetCount())
MergeWith(license_package.GetAdd(l), ", ", n);
}
if(license_package.GetCount() == 0) {
Exclamation("No license files ('Copying') have been found.");
return;
}
String qtf;
for(int i = 0; i < license_package.GetCount(); i++) {
bool m = license_package[i].Find(',') >= 0;
qtf << (m ? "Packages [* \1" : "Package [* \1")
<< license_package[i]
<< (m ? "\1] have" : "\1] has")
<< " following licence notice:&"
<< "{{@Y [C1 " << DeQtf(license_package.GetKey(i)) << "]}}&&";
}
ShowQTF(qtf, "Licenses");
}
示例3: Statistics
void Ide::Statistics()
{
Vector< ArrayMap<String, FileStat> > stat;
Progress pi;
const Workspace& wspc = IdeWorkspace();
pi.SetTotal(wspc.GetCount());
Date now = GetSysDate();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& pk = wspc.GetPackage(i);
String n = wspc[i];
pi.SetText(n);
if(pi.StepCanceled()) return;
ArrayMap<String, FileStat>& pfs = stat.Add();
for(int i = 0; i < pk.GetCount(); i++)
if(!pk[i].separator) {
String file = SourcePath(n, pk[i]);
if(FileExists(file)) {
FileStat& fs = pfs.GetAdd(GetFileExt(file));
int d = minmax(now - FileGetTime(file), 0, 9999);
fs.oldest = max(d, fs.oldest);
fs.newest = min(d, fs.newest);
String data = LoadFile(file);
for(const char *s = data; *s; s++)
if(*s == '\n')
fs.lines++;
fs.len += data.GetCount();
fs.days += d;
fs.count++;
}
}
}
String qtf = "[1 ";
ArrayMap<String, FileStat> all;
String tab = "{{45:20:25:20:35:30:30:30:[email protected] [* ";
String hdr = "]:: [= Files:: Lines:: - avg.:: Length:: - avg.:: Oldest:: Newest:: Avg. age]";
for(int i = 0; i < wspc.GetCount(); i++) {
qtf << tab << DeQtf(wspc[i]) << hdr;
sPut(qtf, stat[i], all);
}
qtf << tab << "All packages" << hdr;
sPut(qtf, all, all);
WithStatLayout<TopWindow> dlg;
CtrlLayoutOK(dlg, "Statistics");
dlg.stat = qtf;
dlg.Sizeable().Zoomable();
dlg.Run();
}