当前位置: 首页>>代码示例>>C++>>正文


C++ DataFieldFileReader::GetItem方法代码示例

本文整理汇总了C++中DataFieldFileReader::GetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldFileReader::GetItem方法的具体用法?C++ DataFieldFileReader::GetItem怎么用?C++ DataFieldFileReader::GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataFieldFileReader的用法示例。


在下文中一共展示了DataFieldFileReader::GetItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:55,代码来源:dlgStartup.cpp

示例2: 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;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:45,代码来源:dlgStartup.cpp


注:本文中的DataFieldFileReader::GetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。