本文整理汇总了C++中DataFieldFileReader::GetNumFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldFileReader::GetNumFiles方法的具体用法?C++ DataFieldFileReader::GetNumFiles怎么用?C++ DataFieldFileReader::GetNumFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldFileReader
的用法示例。
在下文中一共展示了DataFieldFileReader::GetNumFiles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogFormat
bool
dlgStartupShowModal()
{
LogFormat("Startup dialog");
logo = new LogoView();
wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
Layout::landscape ? _T("IDR_XML_STARTUP_L") :
_T("IDR_XML_STARTUP"));
assert(wf != NULL);
WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
assert(wp != NULL);
DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
assert(dfe != NULL);
dfe->ScanDirectoryTop(_T("*.prf"));
if (dfe->GetNumFiles() <= 1) {
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
unsigned best_index = 0;
uint64_t best_timestamp = 0;
unsigned length = dfe->size();
for (unsigned i = 0; i < length; ++i) {
const TCHAR *path = dfe->GetItem(i);
uint64_t timestamp = File::GetLastModification(path);
if (timestamp > best_timestamp) {
best_timestamp = timestamp;
best_index = i;
}
}
dfe->Set(best_index);
wp->RefreshDisplay();
if (wf->ShowModal() != mrOK) {
delete wf;
delete logo;
return false;
}
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
示例2: LogStartUp
bool
dlgStartupShowModal()
{
LogStartUp(_T("Startup dialog"));
logo = new LogoView();
wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
Layout::landscape ? _T("IDR_XML_STARTUP_L") :
_T("IDR_XML_STARTUP"));
assert(wf != NULL);
WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
assert(wp != NULL);
DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
assert(dfe != NULL);
((WndButton *)wf->FindByName(_T("cmdClose")))
->SetOnClickNotify(OnCloseClicked);
((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);
dfe->ScanDirectoryTop(_T("*.prf"));
dfe->Lookup(startProfileFile);
wp->RefreshDisplay();
if (dfe->GetNumFiles() <= 2) {
delete wf;
delete logo;
return true;
}
if (wf->ShowModal() != mrOK) {
delete wf;
delete logo;
return false;
}
const TCHAR *path = dfe->GetPathFile();
if (!string_is_empty(path)) {
_tcscpy(startProfileFile, path);
/* When a profile from a secondary data path is used, this path
becomes the primary data path */
TCHAR temp[MAX_PATH];
SetPrimaryDataPath(DirName(path, temp));
}
delete wf;
delete logo;
return true;
}
示例3: LogStartUp
bool
dlgStartupShowModal()
{
LogStartUp(_T("Startup dialog"));
logo = new LogoView();
wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
Layout::landscape ? _T("IDR_XML_STARTUP_L") :
_T("IDR_XML_STARTUP"));
assert(wf != NULL);
WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
assert(wp != NULL);
DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
assert(dfe != NULL);
((WndButton *)wf->FindByName(_T("cmdClose")))
->SetOnClickNotify(OnCloseClicked);
((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);
dfe->SetNotNullable();
dfe->ScanDirectoryTop(_T("*.prf"));
dfe->Lookup(Profile::GetPath());
wp->RefreshDisplay();
if (dfe->GetNumFiles() <= 1) {
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
if (wf->ShowModal() != mrOK) {
delete wf;
delete logo;
return false;
}
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
示例4: dialog
bool
dlgStartupShowModal()
{
LogFormat("Startup dialog");
/* scan all profile files */
DataFieldFileReader *dfe = new DataFieldFileReader();
dfe->ScanDirectoryTop(_T("*.prf"));
/* skip this dialog if there is only one (or none) */
if (dfe->GetNumFiles() <= 1) {
SelectProfile(dfe->GetPathFile());
delete dfe;
return true;
}
/* preselect the most recently used profile */
unsigned best_index = 0;
uint64_t best_timestamp = 0;
unsigned length = dfe->size();
for (unsigned i = 0; i < length; ++i) {
const TCHAR *path = dfe->GetItem(i);
uint64_t timestamp = File::GetLastModification(path);
if (timestamp > best_timestamp) {
best_timestamp = timestamp;
best_index = i;
}
}
dfe->Set(best_index);
/* show the dialog */
const DialogLook &look = UIGlobals::GetDialogLook();
WidgetDialog dialog(look);
TwoWidgets widget(new LogoQuitWidget(look.button, dialog),
new StartupWidget(look, dialog, dfe));
dialog.CreateFull(UIGlobals::GetMainWindow(), _T(""), &widget);
const int result = dialog.ShowModal();
dialog.StealWidget();
return result == mrOK;
}
示例5: dlgStartupShowModal
void dlgStartupShowModal(void){
WndProperty* wp;
StartupStore(TEXT("Startup dialog\n"));
if (!InfoBoxLayout::landscape) {
wf = dlgLoadFromXML(CallBackTable,
TEXT("dlgStartup_L.xml"),
XCSoarInterface::main_window,
TEXT("IDR_XML_STARTUP_L"));
} else {
wf = dlgLoadFromXML(CallBackTable,
TEXT("dlgStartup.xml"),
XCSoarInterface::main_window,
TEXT("IDR_XML_STARTUP"));
}
if (!wf) return;
wSplash = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmSplash"));
((WndButton *)wf->FindByName(TEXT("cmdClose")))
->SetOnClickNotify(OnCloseClicked);
TCHAR temp[MAX_PATH];
_stprintf(temp,TEXT("XCSoar: Version %s"), XCSoar_Version);
wf->SetCaption(temp);
wp = ((WndProperty *)wf->FindByName(TEXT("prpDisclaimer")));
if (wp)
wp->SetText(TEXT("Pilot assumes complete\r\nresponsibility to operate\r\nthe aircraft safely.\r\nMaintain effective lookout.\r\n"));
wp = ((WndProperty *)wf->FindByName(TEXT("prpProfile")));
if (wp) {
DataFieldFileReader* dfe;
dfe = (DataFieldFileReader*)wp->GetDataField();
if (is_altair())
dfe->ScanDirectoryTop(TEXT("config/*.prf"));
else
dfe->ScanDirectoryTop(TEXT("*.prf"));
dfe->Lookup(startProfileFile);
wp->RefreshDisplay();
if (dfe->GetNumFiles()<=2) {
delete wf;
wf = NULL;
return;
}
}
wf->ShowModal();
wp = (WndProperty*)wf->FindByName(TEXT("prpProfile"));
if (wp) {
DataFieldFileReader* dfe;
dfe = (DataFieldFileReader*)wp->GetDataField();
if (_tcslen(dfe->GetPathFile())>0) {
_tcscpy(startProfileFile,dfe->GetPathFile());
}
}
delete wf;
wf = NULL;
}