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


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

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


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

示例3: OnDeleteClicked

static void OnDeleteClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){
  (void)ListInfo; (void)Sender;

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file?
	if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
		return;
	}
  } else {
	MessageBoxX(hWndMapWindow, MsgToken(1790),_T(" "), MB_OK|MB_ICONEXCLAMATION); // No task file to delete
	return;
  }

  if (file_index>0) {
    DeleteFile(dfe->GetPathFile());
    // Cannot update dfe list, so we force exit.
    ItemIndex = -1; 
    wf->SetModalResult(mrOK);
    return;
  }
}
开发者ID:eonezhang,项目名称:LK8000,代码行数:34,代码来源:dlgTaskOverview.cpp

示例4: dlgWaypointFilesShowModal

void dlgWaypointFilesShowModal(void){
TCHAR temptext[MAX_PATH];
TCHAR tmp[MAX_PATH];
WndProperty *wp;



  wf = dlgLoadFromXML(CallBackTable, ScreenLandscape ? IDR_XML_FILES_L : IDR_XML_FILES_P);
  if (!wf) return;

  setVariables();
  wf->SetCaption(MsgToken(2340)); 
  wf->ShowModal();


  for (unsigned int i=0 ; i < NO_WP_FILES; i++)
  {
    _tcscpy(temptext,szWaypointFile[i]);
    _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1);
    wp = (WndProperty*)wf->FindByName(tmp);
    if (wp) {
      DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
      _tcscpy(temptext, dfe->GetPathFile());
      if (_tcscmp(temptext,szWaypointFile[i])) {
        _tcscpy(szWaypointFile[i],temptext);
      }
    }
  }


  delete wf;
  wf = NULL;

}
开发者ID:LK8000,项目名称:LK8000,代码行数:34,代码来源:dlgWaypointFiles.cpp

示例5: OnDeleteClicked

static void OnDeleteClicked(WndButton* pWnd){

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  wp->OnLButtonDown((POINT){0,0});

  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file?
	if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
		return;
	}
  } else {
	MessageBoxX(MsgToken(1790),_T(" "), mbOk); // No task file to delete
	return;
  }

  if (file_index>0) {
    lk::filesystem::deleteFile(dfe->GetPathFile());
    // Cannot update dfe list, so we force exit.
    ItemIndex = -1; 
    wf->SetModalResult(mrOK);
    return;
  }
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:33,代码来源:dlgTaskOverview.cpp

示例6: OnSaveClicked

static void OnSaveClicked(WndButton* pWnd){

  int file_index; 
  TCHAR task_name[MAX_PATH];
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*)wp->GetDataField();

  file_index = dfe->GetAsInteger();

  // TODO enhancement: suggest a good new name not already in the list
  _tcscpy(task_name,TEXT("NEW"));
  dlgTextEntryShowModal(task_name, 10); // max length

  if (_tcslen(task_name)>0) {

	_tcscat(task_name, TEXT(LKS_TSK));
	LocalPath(file_name,TEXT(LKD_TASKS));
	_tcscat(file_name,TEXT(DIRSEP));
	_tcscat(file_name,task_name); // 091101

	dfe->Lookup(file_name);
	file_index = dfe->GetAsInteger();

	if (file_index==0) {
		// good, this file is unique..
		dfe->addFile(task_name, file_name);
		dfe->Lookup(file_name);
		wp->RefreshDisplay();
	}

  } else {
	// TODO code: report error, task not saved since no name was given
	return;
  }

  if (file_index>0) {
	// file already exists! ask if want to overwrite
	_stprintf(file_name, TEXT("%s: '%s'"), 
	// LKTOKEN  [email protected]_ = "Task file already exists" 
		gettext(TEXT("[email protected]_")),
		dfe->GetAsString());

		if(MessageBoxX(
			file_name,
			// LKTOKEN  [email protected]_ = "Overwrite?" 
			gettext(TEXT("[email protected]_")),
			mbYesNo) != IdYes) {

			return;
		}
  }

  SaveTask(dfe->GetPathFile());
  UpdateCaption();
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:60,代码来源:dlgTaskOverview.cpp

示例7: OnLoadClicked

static void OnLoadClicked(WndButton* pWnd){ // 091216
  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  wp->OnLButtonDown((POINT){0,0});
  
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
		_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
		if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
			return;
		}
	}
  } else {
	// LKTOKEN  [email protected]_ = "No Task to load" 
	MessageBoxX(gettext(TEXT("[email protected]_")),_T(" "), mbOk);
	return;
  }

  if (file_index>0) {
      LPCTSTR szFileName = dfe->GetPathFile();
      LPCTSTR wextension = _tcsrchr(szFileName, _T('.'));
      if(wextension) {
          bool bOK = false;
          if(_tcsicmp(wextension,_T(LKS_TSK))==0) {
              CTaskFileHelper helper;
              bOK = helper.Load(szFileName);
          } 
#ifdef OLDTASK_COMPAT
          else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) {
              LoadNewTask(szFileName);
              bOK = true;
          } 
#endif          
          else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) {
              bOK = LoadCupTask(szFileName);
          } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) {
              bOK = LoadGpxTask(szFileName);
          }
          if(!bOK) {
              MessageBoxX(gettext(TEXT("[email protected]_")),_T(" "), mbOk);
              return;
          }
          OverviewRefreshTask();
          UpdateFilePointer();
          UpdateCaption();
      }
  }
}
开发者ID:SergioDaSilva82,项目名称:LK8000,代码行数:57,代码来源:dlgTaskOverview.cpp

示例8: OnStartClicked

static void OnStartClicked(WndButton* pWnd) {
  WndProperty* wp;
  wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    ReplayLogger::SetFilename(dfe->GetPathFile());
  }
  ReplayLogger::Start();
}
开发者ID:LK8000,项目名称:LK8000,代码行数:10,代码来源:dlgLoggerReplay.cpp

示例9: OnLoadClicked

static void OnLoadClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ // 091216
  (void)ListInfo; (void)Sender;

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
		_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
		if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
			return;
		}
	}
  } else {
	// LKTOKEN  [email protected]_ = "No Task to load" 
	MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
	return;
  }

  if (file_index>0) {
      LPCTSTR szFileName = dfe->GetPathFile();
      LPCTSTR wextension = _tcsrchr(szFileName, _T('.'));
      if(wextension) {
          bool bOK = false;
          if(_tcsicmp(wextension,_T(LKS_TSK))==0) {
              CTaskFileHelper helper;
              bOK = helper.Load(szFileName);
          } else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) {
              LoadNewTask(szFileName);
              bOK = true;
          } else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) {
              bOK = LoadCupTask(szFileName);
          } else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) {
              bOK = LoadGpxTask(szFileName);
          }
          if(!bOK) {
              MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
              return;
          }
          OverviewRefreshTask();
          UpdateFilePointer();
          UpdateCaption();
      }
  }
}
开发者ID:IvanSantanna,项目名称:LK8000,代码行数:55,代码来源:dlgTaskOverview.cpp

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

示例11:

static void
OnStartClicked(gcc_unused WndButton &Sender)
{
  WndProperty* wp;
  wp = (WndProperty*)wf->FindByName(_T("prpFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    replay->SetFilename(dfe->GetPathFile());
  }
  replay->Start();
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:12,代码来源:dlgLoggerReplay.cpp

示例12:

static void
OnStartClicked(WindowControl * Sender)
{
	(void)Sender;
  WndProperty* wp;
  wp = (WndProperty*)wf->FindByName(_T("prpIGCFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    replay.SetFilename(dfe->GetPathFile());
  }
  replay.Start();
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:13,代码来源:dlgLoggerReplay.cpp

示例13: 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

示例14: OnSaveExistingClicked

static void OnSaveExistingClicked(WindowControl * Sender) {
  (void)Sender;

  int file_index; 
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  if ( CheckClubVersion() ) {
	ClubForbiddenMsg();
	return;
  }

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();


  file_index = dfe->GetAsInteger();

  if (file_index>0) {
	_tcscpy(file_name,dfe->GetAsString());
	if(MessageBoxX(hWndMapWindow, file_name, 
	// LKTOKEN  [email protected]_ = "Overwrite profile?" 
		gettext(TEXT("[email protected]_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

		WriteProfile(dfe->GetPathFile());
	// LKTOKEN  [email protected]_ = "Profile saved!" 
		MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(""), MB_OK|MB_ICONEXCLAMATION);
		return;
	}
  	dfe->Set(0);
  } 

}
开发者ID:JanezKolar,项目名称:LK8000,代码行数:39,代码来源:dlgProfiles.cpp

示例15: OnLoadClicked

static void OnLoadClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ // 091216
  (void)ListInfo; (void)Sender;

  TCHAR file_name[MAX_PATH];

  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;

  HWND hwnd = wp->GetHandle();
  SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
  dfe = (DataFieldFileReader*) wp->GetDataField();

  int file_index = dfe->GetAsInteger();
  if (file_index>0) {
	if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
		// _stprintf(file_name, TEXT("Clear old task and load '%s' ?"), dfe->GetAsString()); REMOVE FIXV2 101229
		_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
		if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
			return;
		}
	}
  } else {
	// LKTOKEN  [email protected]_ = "No Task to load" 
	MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
	return;
  }

  if (file_index>0) {
    LoadNewTask(dfe->GetPathFile());
    OverviewRefreshTask();
    UpdateFilePointer();
    UpdateCaption();
  }
}
开发者ID:miza,项目名称:LK8000,代码行数:37,代码来源:dlgTaskOverview.cpp


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