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


C++ wxPathOnly函数代码示例

本文整理汇总了C++中wxPathOnly函数的典型用法代码示例。如果您正苦于以下问题:C++ wxPathOnly函数的具体用法?C++ wxPathOnly怎么用?C++ wxPathOnly使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wxPathOnly函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: l_torrent_table

////////////////////////////////////////////////////////
//// private functions to interface with the system ////
////////////////////////////////////////////////////////
void TorrentWrapper::HandleCompleted()
{
	int num_completed = 0;
	{
	ScopedLocker<TorrenthandleInfoMap> l_torrent_table(m_handleInfo_map);
	const TorrenthandleInfoMap& infomap = l_torrent_table.Get();

	TorrenthandleInfoMap::const_iterator it = infomap.begin();
	for ( ; it != infomap.end(); ++it )
	{
		PlasmaResourceInfo info = it->first;
		libtorrent::torrent_handle handle = it->second;
		if ( handle.is_valid() && handle.is_seed() )
		{
			wxString dest_filename = sett().GetCurrentUsedDataDir() +
									 getDataSubdirForType( convertMediaType( info.m_type ) ) +
									 wxFileName::GetPathSeparator() +
									 TowxString( handle.get_torrent_info().file_at( 0 ).path.string() );
			if ( !wxFileExists( dest_filename ) )
			{
				wxString source_path = TowxString( handle.save_path().string() )  +
									   wxFileName::GetPathSeparator() +
									   TowxString( handle.get_torrent_info().file_at( 0 ).path.string() );
				wxString dest_path = wxPathOnly( dest_filename );
				if ( !wxDirExists( dest_path ) )
						wxMkdir( dest_path );
				bool ok = wxCopyFile( source_path, dest_filename );
				if ( !ok )
				{
					wxString msg = wxString::Format( _("File copy from %s to %s failed.\nPlease copy manually and reload maps/mods afterwards"),
								source_path.c_str(), dest_filename.c_str() );
					wxLogError( _T("DL: File copy from %s to %s failed."), source_path.c_str(), dest_filename.c_str() );
					#ifdef __WXMSW__
						UiEvents::StatusData data( msg, 1 );
						UiEvents::GetStatusEventSender( UiEvents::addStatusMessage ).SendEvent( data );
					#else
						customMessageBoxNoModal( SL_MAIN_ICON, msg, _("Copy failed") );
					#endif
					//this basically invalidates the handle for further use
					m_torr->remove_torrent( handle );
				}
				else
				{
					wxRemoveFile( source_path );
					wxLogDebug( _T("DL complete: %s"), info.m_name.c_str() );
					UiEvents::StatusData data( wxString::Format( _("Download completed: %s"), info.m_name.c_str() ), 1 );
					UiEvents::GetStatusEventSender( UiEvents::addStatusMessage ).SendEvent( data );
					num_completed++;
				}
			}
		}
	}
	}
	if ( num_completed > 0 )
	{
		usync().AddReloadEvent();
	}
}
开发者ID:tvo,项目名称:springlobby,代码行数:61,代码来源:torrentwrapper.cpp

示例2: GetCompressedFileName

bool NetDebugReport::Process()
{
    wxDebugReportCompress::Process(); //compress files into zip
    wxString filename = GetCompressedFileName();
    CwdGuard setCwd( wxPathOnly( filename ) );
	wxLogMessage( filename );
	wxStringOutputStream response;
	wxStringOutputStream rheader;
	CURL *curl_handle;
	curl_handle = curl_easy_init();
	struct curl_slist* m_pHeaders = NULL;
	struct curl_httppost*   m_pPostHead = NULL;
	struct curl_httppost*   m_pPostTail = NULL;
	struct curl_forms testform[2];

	// these header lines will overwrite/add to cURL defaults
	m_pHeaders = curl_slist_append(m_pHeaders, "Expect:") ;

	testform[0].option = CURLFORM_FILE;
	//we need to keep these buffers around for curl op duration
	wxCharBuffer filename_buffer = filename.mb_str();
	testform[0].value = (const char*)filename_buffer;
	testform[1].option = CURLFORM_END;
	curl_formadd(&m_pPostHead, &m_pPostTail, CURLFORM_COPYNAME,
						   "file",
						   CURLFORM_ARRAY, testform, CURLFORM_END);
	curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, m_pHeaders);
	curl_easy_setopt(curl_handle, CURLOPT_URL, m_url );
//	curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1L);
	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "SpringLobby");
	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, wxcurl_stream_write);
	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&response);
	curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER, (void *)&rheader);
	curl_easy_setopt(curl_handle, CURLOPT_POST, TRUE);
	curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, m_pPostHead);

	CURLcode ret = curl_easy_perform(curl_handle);

	wxLogError( rheader.GetString()  );

  /* cleanup curl stuff */
	curl_easy_cleanup(curl_handle);
	curl_formfree(m_pPostHead);

	wxString szResponse;
	if(ret == CURLE_OK)
		szResponse = wxT("SUCCESS!\n\n");
	else
		szResponse = wxT("FAILURE!\n\n");
	szResponse += wxFormat(wxT("\nResponse Code: %d\n\n") ) % ret;
	szResponse += rheader.GetString();
	szResponse += wxT("\n\n");
	szResponse += response.GetString();
	szResponse += wxT("\n\n");
	wxLogMessage( szResponse );

	return ret == CURLE_OK;
}
开发者ID:johnjianfang,项目名称:springlobby,代码行数:58,代码来源:crashreport.cpp

示例3: wxSetEnv

bool Springsettings::OnInit()
{
	wxSetEnv( _T("UBUNTU_MENUPROXY"), _T("0") );
    //this triggers the Cli Parser amongst other stuff
    if (!wxApp::OnInit())
        return false;

	SetAppName(_T("SpringSettings"));

	if ( !wxDirExists( GetConfigfileDir() ) )
		wxMkdir( GetConfigfileDir() );

	if (!m_crash_handle_disable) {
	#if wxUSE_ON_FATAL_EXCEPTION
		wxHandleFatalExceptions( true );
	#endif
	#if defined(__WXMSW__) && defined(ENABLE_DEBUG_REPORT)
		//this undocumented function acts as a workaround for the dysfunctional
		// wxUSE_ON_FATAL_EXCEPTION on msw when mingw is used (or any other non SEH-capable compiler )
		SetUnhandledExceptionFilter(filter);
	#endif
	}

    //initialize all loggers
	//TODO non-constant parameters
	wxLogChain* logchain  = 0;
	wxLogWindow* loggerwin = InitializeLoggingTargets( 0, m_log_console, m_log_file_path, m_log_window_show, !m_crash_handle_disable, m_log_verbosity, logchain );
	//this needs to called _before_ mainwindow instance is created

#ifdef __WXMSW__
	wxString path = wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + wxFileName::GetPathSeparator() + _T("locale");
#else
	#if defined(LOCALE_INSTALL_DIR)
		wxString path ( _T(LOCALE_INSTALL_DIR) );
	#else
		// use a dummy name here, we're only interested in the base path
		wxString path = wxStandardPaths::Get().GetLocalizedResourcesDir(_T("noneWH"),wxStandardPaths::ResourceCat_Messages);
		path = path.Left( path.First(_T("noneWH") ) );
	#endif
#endif
	m_translationhelper = new wxTranslationHelper( *( (wxApp*)this ), path );
	m_translationhelper->Load();

    SetSettingsStandAlone( true );

	//unitsync first load, NEEDS to be blocking
	LSL::usync().ReloadUnitSyncLib();

	settings_frame* frame = new settings_frame(NULL,GetAppName());
    SetTopWindow(frame);
    frame->Show();

    if ( loggerwin ) { // we got a logwindow, lets set proper parent win
        loggerwin->GetFrame()->SetParent( frame );
    }

    return true;
}
开发者ID:Mailaender,项目名称:springlobby,代码行数:58,代码来源:main.cpp

示例4: pick

void SpringOptionsTab::OnBrowseSync(wxCommandEvent& /*unused*/)
{
	wxFileDialog pick(this, _("Choose UnitSync library"),
			  wxPathOnly(TowxString(SlPaths::GetUnitSync())),
			  wxFileName::FileName(TowxString(SlPaths::GetUnitSync())).GetFullName(),
			  GetUnitsyncFilter());
	if (pick.ShowModal() == wxID_OK)
		m_sync_edit->SetValue(pick.GetPath());
}
开发者ID:abma,项目名称:springlobby,代码行数:9,代码来源:springoptionstab.cpp

示例5: pick

void DownloadOptionsPanel::OnNewDirectory(wxCommandEvent&)
{
	wxDirDialog pick(this, _("Choose a directory for downloading"),
			 wxPathOnly(TowxString(SlPaths::GetDownloadDir())), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);

	if (pick.ShowModal() == wxID_OK) {
		m_DownloadDirectoryTextCtrl->SetValue(pick.GetPath());
	}
}
开发者ID:OursDesCavernes,项目名称:springlobby,代码行数:9,代码来源:downloadoptionspanel.cpp

示例6: GetMenuHtmlFile

wxString GetMenuHtmlFile(const wxChar*file)
{
#ifdef __WXMSW__
  wxString dataroot(wxPathOnly(wxStandardPaths::Get().GetExecutablePath()));
#else
  const wxChar*dataroot = wxT(PREFIX_DATA);
#endif
  return BuildPath(dataroot, wxT("Menu"), file);
}
开发者ID:gavioto,项目名称:nsis,代码行数:9,代码来源:nsismenu.cpp

示例7: ChooseOutputFile

void ChooseOutputFile(bool force)
{
    wxChar extensionBuf[10];
    wxChar wildBuf[10];
    wxStrcpy(wildBuf, _T("*."));
    wxString path;
    if (!OutputFile.empty())
        path = wxPathOnly(OutputFile);
    else if (!InputFile.empty())
        path = wxPathOnly(InputFile);

    switch (convertMode)
    {
        case TEX_RTF:
        {
            wxStrcpy(extensionBuf, _T("rtf"));
            wxStrcat(wildBuf, _T("rtf"));
            break;
        }
        case TEX_XLP:
        {
            wxStrcpy(extensionBuf, _T("xlp"));
            wxStrcat(wildBuf, _T("xlp"));
            break;
        }
        case TEX_HTML:
        {
            wxStrcpy(extensionBuf, _T("html"));
            wxStrcat(wildBuf, _T("html"));
            break;
        }
    }
#if wxUSE_FILEDLG
    if (force || OutputFile.empty())
    {
        wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile),
                                    extensionBuf, wildBuf);
        if (!s.empty())
            OutputFile = s;
    }
#else
    wxUnusedVar(force);
#endif // wxUSE_FILEDLG
}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:44,代码来源:tex2rtf.cpp

示例8: wxFileName

const wxFileName wxExViMacros::GetFileName()
{
  return wxFileName(
#ifdef wxExUSE_PORTABLE
      wxPathOnly(wxStandardPaths::Get().GetExecutablePath())
#else
      wxStandardPaths::Get().GetUserDataDir()
#endif
      + wxFileName::GetPathSeparator() + "macros.xml");
}
开发者ID:hfvw,项目名称:wxExtension,代码行数:10,代码来源:vimacros.cpp

示例9: wxFileSelector

bool ImageValueEditor::onLeftDClick(const RealPoint&, wxMouseEvent&) {
	String filename = wxFileSelector(_("Open image file"), settings.default_image_dir, _(""), _(""),
		                             _("All images|*.bmp;*.jpg;*.png;*.gif|Windows bitmaps (*.bmp)|*.bmp|JPEG images (*.jpg;*.jpeg)|*.jpg;*.jpeg|PNG images (*.png)|*.png|GIF images (*.gif)|*.gif|TIFF images (*.tif;*.tiff)|*.tif;*.tiff"),
		                             wxFD_OPEN, wxGetTopLevelParent(&editor()));
	if (!filename.empty()) {
		settings.default_image_dir = wxPathOnly(filename);
		sliceImage(wxImage(filename));
	}
	return true;
}
开发者ID:CustomCardsOnline,项目名称:MagicSetEditor,代码行数:10,代码来源:image.cpp

示例10: wxFileSelector

char *WavFileName(void)
{//====================
	static char f_speech[120];
	if(!wxDirExists(wxPathOnly(path_speech)))
	{
		path_speech = wxFileSelector(_T("Speech output file"),
			path_phsource,_T("speech.wav"),_T("*"),_T("*"),wxSAVE);
	}
	strcpy(f_speech,path_speech.mb_str(wxConvLocal));
	return(f_speech);
}
开发者ID:Shqip,项目名称:ar-espeak,代码行数:11,代码来源:transldlg.cpp

示例11: wxFileSelector

void HtmlExportWindow::onOk(wxCommandEvent&) {
	ExportTemplateP exp = list->getSelection<ExportTemplate>();
	// get filename
	String name = wxFileSelector(_TITLE_("save html"),settings.default_export_dir,_(""),_(""),exp->file_type, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
	if (name.empty()) return;
	settings.default_export_dir = wxPathOnly(name);
	// export
	export_set(set, getSelection(), exp, name);
	// Done
	EndModal(wxID_OK);
}
开发者ID:BestRCH,项目名称:magicseteditor,代码行数:11,代码来源:html_export_window.cpp

示例12: m_version

UpdaterApp::UpdaterApp():
	m_version( _T("-1") ),
	m_updater_window( 0 )
{
	SetAppName( _T("springlobby_updater") );

	const std::string filename = STD_STRING(wxPathOnly( wxStandardPaths::Get().GetExecutablePath() ) + wxFileName::GetPathSeparator() + _T("update.log") ).c_str();
	m_logstream_target = new std::ofstream(filename);
	if ( (!m_logstream_target->good()) || (!m_logstream_target->is_open() )) {
		printf("Error opening %s\n", filename.c_str());
	}
}
开发者ID:baracoder,项目名称:springlobby,代码行数:12,代码来源:updaterapp.cpp

示例13: wxPathOnly

const wxString PROJECT::AbsolutePath( const wxString& aFileName ) const
{
    wxFileName fn = aFileName;

    if( !fn.IsAbsolute() )
    {
        wxString pro_dir = wxPathOnly( GetProjectFullName() );
        fn.Normalize( wxPATH_NORM_ALL, pro_dir );
    }

    return fn.GetFullPath();
}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:12,代码来源:project.cpp

示例14: wxPrintf

bool MyApp::OnInit()
{
    for (int i = 1; i < argc; i++)
    {
        wxHtmlHelpData data;
        wxPrintf(wxT("Processing %s...\n"), argv[i]);
        data.SetTempDir(wxPathOnly(argv[i]));
        data.AddBook(argv[i]);
    }

    return false;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:12,代码来源:hhp2cached.cpp

示例15: mis

// {{{ wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &size)
wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, const wxSize &size) {
#ifdef BUILTIN_IMAGES
	const Images::Image *img = Images::GetImage(id);
	if (img == NULL) {
		return wxNullBitmap;
	}

	wxMemoryInputStream mis(img->image, img->size);
	wxImage image(mis, wxBITMAP_TYPE_PNG);
#elif __WXMAC__
	wxString path(wxGetCwd());
	path << wxT("/Dubnium.app/Contents/Resources/") << id << wxT(".png");
	if (!wxFileExists(path)) {
		return wxNullBitmap;
	}

	wxImage image(path, wxBITMAP_TYPE_PNG);
#elif DUBNIUM_DEBUG
	wxString path(wxT(__FILE__));
	path = wxPathOnly(path);
	path << wxT("/../../images/") << id << wxT(".png");

	if (!wxFileExists(path)) {
		/* This is a debug message only, since for built-in IDs like
		 * wxART_DELETE this will just fall through to the wxWidgets
		 * default provider and isn't an error. */
		wxLogDebug(wxT("Requested image ID: %s; NOT FOUND as %s"), id.c_str(), path.c_str());
		return wxNullBitmap;
	}

	wxLogDebug(wxT("Requested image ID: %s; found as %s"), id.c_str(), path.c_str());

	wxImage image(path, wxBITMAP_TYPE_PNG);
#else
	wxString path;
	path << wxT(PREFIX) << wxT("/share/dubnium/") << id << wxT(".png");
	if (!wxFileExists(path)) {
		return wxNullBitmap;
	}

	wxImage image(path, wxBITMAP_TYPE_PNG);
#endif

	/* There seems to be a tendency for wxArtProvider to request images of
	 * size (-1, -1), so we need to avoid trying to rescale for them. */
	if (wxSize(image.GetWidth(), image.GetHeight()) != size && size.GetWidth() > 0 && size.GetHeight() > 0) {
		wxLogDebug(wxT("Requested width: %d; height: %d"), size.GetWidth(), size.GetHeight());
		image.Rescale(size.GetWidth(), size.GetHeight(), wxIMAGE_QUALITY_HIGH);
	}

	return wxBitmap(image);
}
开发者ID:LawnGnome,项目名称:dubnium,代码行数:53,代码来源:ArtProvider.cpp


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