本文整理汇总了C++中WindowInfo::ShowNotification方法的典型用法代码示例。如果您正苦于以下问题:C++ WindowInfo::ShowNotification方法的具体用法?C++ WindowInfo::ShowNotification怎么用?C++ WindowInfo::ShowNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowInfo
的用法示例。
在下文中一共展示了WindowInfo::ShowNotification方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Finished
void StressTest::Finished(bool success) {
win->stressTest = nullptr; // make sure we're not double-deleted
if (success) {
int secs = SecsSinceSystemTime(stressStartTime);
AutoFreeW tm(FormatTime(secs));
AutoFreeW s(str::Format(L"Stress test complete, rendered %d files in %s", filesCount, tm));
win->ShowNotification(s, NOS_PERSIST, NG_STRESS_TEST_SUMMARY);
}
CloseWindow(win, exitWhenDone && MayCloseWindow(win));
delete this;
}
示例2: Finished
void StressTest::Finished(bool success)
{
win->stressTest = NULL; // make sure we're not double-deleted
if (success) {
int secs = SecsSinceSystemTime(stressStartTime);
ScopedMem<WCHAR> tm(FormatTime(secs));
ScopedMem<WCHAR> s(str::Format(L"Stress test complete, rendered %d files in %s", filesCount, tm));
win->ShowNotification(s, false, false, NG_STRESS_TEST_SUMMARY);
}
CloseWindow(win, exitWhenDone);
delete this;
}
示例3: Start
void StressTest::Start(const WCHAR* path, const WCHAR* filter, const WCHAR* ranges, int cycles) {
if (file::Exists(path)) {
FilesProvider* filesProvider = new FilesProvider(path);
ParsePageRanges(ranges, pageRanges);
Start(filesProvider, cycles);
} else if (dir::Exists(path)) {
DirFileProvider* dirFileProvider = new DirFileProvider(path, filter);
ParsePageRanges(ranges, fileRanges);
Start(dirFileProvider, cycles);
} else {
// Note: string dev only, don't translate
AutoFreeW s(str::Format(L"Path '%s' doesn't exist", path));
win->ShowNotification(s, NOS_WARNING, NG_STRESS_TEST_SUMMARY);
Finished(false);
}
}
示例4: GoToNextPage
bool StressTest::GoToNextPage()
{
double pageRenderTime = currPageRenderTime.GetTimeInMs();
ScopedMem<WCHAR> s(str::Format(L"Page %d rendered in %d milliseconds", currPage, (int)pageRenderTime));
win->ShowNotification(s, NOS_DEFAULT, NG_STRESS_TEST_BENCHMARK);
++currPage;
while (!IsInRange(pageRanges, currPage) && currPage <= win->ctrl->PageCount()) {
currPage++;
}
if (currPage > win->ctrl->PageCount()) {
if (GoToNextFile())
return true;
Finished(true);
return false;
}
win->ctrl->GoToPage(currPage, false);
currPageRenderTime.Start();
// start text search when we're in the middle of the document, so that
// search thread touches both pages that were already rendered and not yet
// rendered
// TODO: it would be nice to also randomize search starting page but the
// current API doesn't make it easy
if (currPage == pageForSearchStart) {
// use text that is unlikely to be found, so that we search all pages
win::SetText(win->hwndFindBox, L"!z_yt");
FindTextOnThread(win, FIND_FORWARD, true);
}
if (1 == rand() % 3) {
ClientRect rect(win->hwndFrame);
int deltaX = (rand() % 40) - 23;
rect.dx += deltaX;
if (rect.dx < 300)
rect.dx += (abs(deltaX) * 3);
int deltaY = (rand() % 40) - 23;
rect.dy += deltaY;
if (rect.dy < 300)
rect.dy += (abs(deltaY) * 3);
SendMessage(win->hwndFrame, WM_SIZE, 0, MAKELONG(rect.dx, rect.dy));
}
return true;
}
示例5: OpenFile
bool StressTest::OpenFile(const WCHAR *fileName)
{
wprintf(L"%s\n", fileName);
fflush(stdout);
LoadArgs args(fileName);
args.forceReuse = rand() % 3 != 1;
WindowInfo *w = LoadDocument(args);
if (!w)
return false;
if (w == win) { // WindowInfo reused
if (!win->IsDocLoaded())
return false;
} else if (!w->IsDocLoaded()) { // new WindowInfo
CloseWindow(w, false);
return false;
}
// transfer ownership of stressTest object to a new window and close the
// current one
assert(this == win->stressTest);
if (w != win) {
if (win->IsDocLoaded()) {
// try to provoke a crash in RenderCache cleanup code
ClientRect rect(win->hwndFrame);
rect.Inflate(rand() % 10, rand() % 10);
SendMessage(win->hwndFrame, WM_SIZE, 0, MAKELONG(rect.dx, rect.dy));
if (win->AsFixed())
win->cbHandler->RequestRendering(1);
win->RepaintAsync();
}
WindowInfo *toClose = win;
w->stressTest = win->stressTest;
win->stressTest = nullptr;
win = w;
CloseWindow(toClose, false);
}
if (!win->IsDocLoaded())
return false;
win->ctrl->SetDisplayMode(DM_CONTINUOUS);
win->ctrl->SetZoomVirtual(ZOOM_FIT_PAGE);
win->ctrl->GoToFirstPage();
if (win->tocVisible || gGlobalPrefs->showFavorites)
SetSidebarVisibility(win, win->tocVisible, gGlobalPrefs->showFavorites);
currPage = pageRanges.At(0).start;
win->ctrl->GoToPage(currPage, false);
currPageRenderTime.Start();
++filesCount;
pageForSearchStart = (rand() % win->ctrl->PageCount()) + 1;
// search immediately in single page documents
if (1 == pageForSearchStart) {
// use text that is unlikely to be found, so that we search all pages
win::SetText(win->hwndFindBox, L"!z_yt");
FindTextOnThread(win, FIND_FORWARD, true);
}
int secs = SecsSinceSystemTime(stressStartTime);
ScopedMem<WCHAR> tm(FormatTime(secs));
ScopedMem<WCHAR> s(str::Format(L"File %d: %s, time: %s", filesCount, fileName, tm));
win->ShowNotification(s, NOS_PERSIST, NG_STRESS_TEST_SUMMARY);
return true;
}