Reduce the use of string objects slightly. Add Delete ISO feature.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@610 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a0eb4ad055
commit
38f04809f1
|
@ -19,6 +19,7 @@
|
|||
#include "FileUtil.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <shlobj.h> // for SHGetFolderPath
|
||||
#include <shellapi.h>
|
||||
#include <commdlg.h> // for GetSaveFileName
|
||||
|
@ -29,23 +30,24 @@
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
bool File::Exists(const std::string &filename)
|
||||
bool File::Exists(const char *filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return GetFileAttributes(filename.c_str()) != INVALID_FILE_ATTRIBUTES;
|
||||
return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES;
|
||||
#else
|
||||
struct stat file_info;
|
||||
int result = stat(filename.c_str(), &file_info);
|
||||
int result = stat(filename, &file_info);
|
||||
return result == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool File::IsDirectory(const std::string &filename) {
|
||||
bool File::IsDirectory(const char *filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (GetFileAttributes(filename.c_str()) & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
return (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) != 0;
|
||||
#else
|
||||
struct stat file_info;
|
||||
int result = stat(filename.c_str(), &file_info);
|
||||
int result = stat(filename, &file_info);
|
||||
if (result == 0)
|
||||
return S_ISDIR(file_info.st_mode);
|
||||
else
|
||||
|
@ -53,7 +55,22 @@ bool File::IsDirectory(const std::string &filename) {
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string SanitizePath(const std::string &filename) {
|
||||
bool File::Delete(const char *filename)
|
||||
{
|
||||
if (!File::Exists(filename))
|
||||
return false;
|
||||
if (File::IsDirectory(filename))
|
||||
return false;
|
||||
#ifdef _WIN32
|
||||
DeleteFile(filename);
|
||||
#else
|
||||
unlink(filename);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string SanitizePath(const char *filename)
|
||||
{
|
||||
std::string copy = filename;
|
||||
for (size_t i = 0; i < copy.size(); i++)
|
||||
if (copy[i] == '/')
|
||||
|
@ -61,7 +78,7 @@ std::string SanitizePath(const std::string &filename) {
|
|||
return copy;
|
||||
}
|
||||
|
||||
void File::Launch(const std::string &filename)
|
||||
void File::Launch(const char *filename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::string win_filename = SanitizePath(filename);
|
||||
|
@ -76,7 +93,7 @@ void File::Launch(const std::string &filename)
|
|||
#endif
|
||||
}
|
||||
|
||||
void File::Explore(const std::string &path)
|
||||
void File::Explore(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::string win_path = SanitizePath(path);
|
||||
|
@ -92,27 +109,27 @@ void File::Explore(const std::string &path)
|
|||
}
|
||||
|
||||
// Returns true if successful, or path already exists.
|
||||
bool File::CreateDir(const std::string &path)
|
||||
bool File::CreateDir(const char *path)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (::CreateDirectory(path.c_str(), NULL))
|
||||
if (::CreateDirectory(path, NULL))
|
||||
return true;
|
||||
DWORD error = GetLastError();
|
||||
if (error == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
PanicAlert("%s already exists", path.c_str());
|
||||
PanicAlert("%s already exists", path);
|
||||
return true;
|
||||
}
|
||||
PanicAlert("Error creating directory: %i", error);
|
||||
return false;
|
||||
#else
|
||||
if (mkdir(path.c_str(), 0644) == 0)
|
||||
if (mkdir(path, 0644) == 0)
|
||||
return true;
|
||||
|
||||
int err = errno;
|
||||
|
||||
if (err == EEXIST) {
|
||||
PanicAlert("%s already exists", path.c_str());
|
||||
PanicAlert("%s already exists", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +139,7 @@ bool File::CreateDir(const std::string &path)
|
|||
#endif
|
||||
}
|
||||
|
||||
std::string GetUserDirectory() {
|
||||
std::string File::GetUserDirectory() {
|
||||
#ifdef _WIN32
|
||||
char path[MAX_PATH];
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
|
||||
|
@ -137,3 +154,12 @@ std::string GetUserDirectory() {
|
|||
return dir;
|
||||
#endif
|
||||
}
|
||||
|
||||
u64 File::GetSize(const char *filename)
|
||||
{
|
||||
FILE *f = fopen(filename, "rb");
|
||||
fseek(f, 0, SEEK_END);
|
||||
u64 pos = ftell(f);
|
||||
fclose(f);
|
||||
return pos;
|
||||
}
|
||||
|
|
|
@ -20,14 +20,18 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
static bool Exists(const std::string &filename);
|
||||
static void Launch(const std::string &filename);
|
||||
static void Explore(const std::string &path);
|
||||
static bool IsDirectory(const std::string &filename);
|
||||
static bool CreateDir(const std::string &filename);
|
||||
static bool Exists(const char *filename);
|
||||
static void Launch(const char *filename);
|
||||
static void Explore(const char *path);
|
||||
static bool IsDirectory(const char *filename);
|
||||
static bool CreateDir(const char *filename);
|
||||
static bool Delete(const char *filename);
|
||||
static u64 GetSize(const char *filename);
|
||||
static std::string GetUserDirectory();
|
||||
};
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
|
|||
m_strMemoryCardA = BaseDataPath + "/MemoryCardA.raw";
|
||||
m_strMemoryCardB = BaseDataPath + "/MemoryCardB.raw";
|
||||
m_strSRAM = BaseDataPath + "/SRAM.raw";
|
||||
if (!File::Exists(m_strBios)) {
|
||||
if (!File::Exists(m_strBios.c_str())) {
|
||||
LOG(BOOT, "BIOS file %s not found - using HLE.", m_strBios.c_str());
|
||||
bHLEBios = true;
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ void CEXIMemoryCard::Flush(bool exiting)
|
|||
{
|
||||
std::string dir;
|
||||
SplitPath(m_strFilename, &dir, 0, 0);
|
||||
File::CreateDir(dir);
|
||||
File::CreateDir(dir.c_str());
|
||||
pFile = fopen(m_strFilename.c_str(), "wb");
|
||||
}
|
||||
if (!pFile) //Note - pFile changed inside above if
|
||||
|
|
|
@ -373,7 +373,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
|
|||
break;
|
||||
}
|
||||
case IDM_LOADMAPFILE:
|
||||
if (!File::Exists(mapfile))
|
||||
if (!File::Exists(mapfile.c_str()))
|
||||
{
|
||||
g_symbolDB.Clear();
|
||||
PPCAnalyst::FindFunctions(0x80000000, 0x80400000, &g_symbolDB);
|
||||
|
|
|
@ -462,7 +462,7 @@ void CFrame::OnPluginGFX(wxCommandEvent& WXUNUSED (event))
|
|||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ void CFrame::OnPluginDSP(wxCommandEvent& WXUNUSED (event))
|
|||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -480,14 +480,14 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
|||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str()
|
||||
);
|
||||
}
|
||||
void CFrame::OnPluginWiiMote(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "../resources/Flag_USA.xpm"
|
||||
#endif // USE_XPM_BITMAPS
|
||||
|
||||
/////////////////////////////////
|
||||
int currentColumn ;
|
||||
bool operator < (const CISOFile &one, const CISOFile &other)
|
||||
{
|
||||
|
@ -50,7 +49,6 @@ bool operator < (const CISOFile &one, const CISOFile &other)
|
|||
default: return strcasecmp(one.GetName().c_str(), other.GetName().c_str()) < 0;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////
|
||||
|
||||
BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl)
|
||||
|
||||
|
@ -66,6 +64,7 @@ EVT_MENU(IDM_OPENCONTAININGFOLDER, CGameListCtrl::OnOpenContainingFolder)
|
|||
EVT_MENU(IDM_SETDEFAULTGCM, CGameListCtrl::OnSetDefaultGCM)
|
||||
EVT_MENU(IDM_FILESYSTEMVIEWER, CGameListCtrl::OnFilesystemViewer)
|
||||
EVT_MENU(IDM_COMPRESSGCM, CGameListCtrl::OnCompressGCM)
|
||||
EVT_MENU(IDM_DELETEGCM, CGameListCtrl::OnDeleteGCM)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||
|
@ -465,16 +464,18 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
|
|||
wxLIST_STATE_SELECTED | wxLIST_STATE_FOCUSED);
|
||||
}
|
||||
const CISOFile *selected_iso = GetSelectedISO();
|
||||
if (selected_iso) {
|
||||
if (selected_iso)
|
||||
{
|
||||
std::string unique_id = selected_iso->GetUniqueID();
|
||||
wxMenu popupMenu;
|
||||
std::string menu_text = StringFromFormat("Edit &patch file: %s.ini", unique_id.c_str());
|
||||
popupMenu.Append(IDM_EDITPATCHFILE, wxString::FromAscii(menu_text.c_str())); //Pretty much everything in wxwidgets is a wxString, try to convert to those first!
|
||||
popupMenu.Append(IDM_OPENCONTAININGFOLDER, wxString::FromAscii("Open &containing folder"));
|
||||
popupMenu.Append(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
|
||||
popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
|
||||
popupMenu.Append(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
|
||||
popupMenu.AppendSeparator();
|
||||
popupMenu.Append(IDM_DELETEGCM, wxString::FromAscii("&Delete ISO..."));
|
||||
|
||||
// F|RES: compression doesn't work and will be rewritten ... if it is fixed the gui is ready :D
|
||||
if (selected_iso->IsCompressed())
|
||||
popupMenu.Append(IDM_COMPRESSGCM, wxString::FromAscii("Decompress ISO... (UNTESTED)"));
|
||||
else
|
||||
|
@ -516,7 +517,7 @@ void CGameListCtrl::OnOpenContainingFolder(wxCommandEvent& WXUNUSED (event)) {
|
|||
return;
|
||||
std::string path;
|
||||
SplitPath(iso->GetFileName(), &path, 0, 0);
|
||||
File::Explore(path);
|
||||
File::Explore(path.c_str());
|
||||
}
|
||||
|
||||
void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event)) {
|
||||
|
@ -527,6 +528,16 @@ void CGameListCtrl::OnSetDefaultGCM(wxCommandEvent& WXUNUSED (event)) {
|
|||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
|
||||
void CGameListCtrl::OnDeleteGCM(wxCommandEvent& WXUNUSED (event)) {
|
||||
const CISOFile *iso = GetSelectedISO();
|
||||
if (!iso)
|
||||
return;
|
||||
if (wxMessageBox("Are you sure you want to delete this file?", wxMessageBoxCaptionStr, wxYES_NO) == wxYES)
|
||||
{
|
||||
File::Delete(iso->GetFileName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CGameListCtrl::OnFilesystemViewer(wxCommandEvent& WXUNUSED (event)) {
|
||||
const CISOFile *iso = GetSelectedISO();
|
||||
if (!iso)
|
||||
|
@ -617,7 +628,7 @@ void CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
|
|||
if (!iso)
|
||||
return;
|
||||
std::string filename = "Patches/" + iso->GetUniqueID() + ".ini";
|
||||
if (!File::Exists(filename)) {
|
||||
if (!File::Exists(filename.c_str())) {
|
||||
if (AskYesNo("%s.ini does not exist. Do you want to create it?", iso->GetUniqueID().c_str())) {
|
||||
FILE *f = fopen(filename.c_str(), "w");
|
||||
fprintf(f, "# %s - %s\r\n\r\n", iso->GetUniqueID().c_str(), iso->GetName().c_str());
|
||||
|
@ -628,7 +639,7 @@ void CGameListCtrl::OnEditPatchFile(wxCommandEvent& WXUNUSED (event))
|
|||
return;
|
||||
}
|
||||
}
|
||||
File::Launch(filename);
|
||||
File::Launch(filename.c_str());
|
||||
}
|
||||
|
||||
void CGameListCtrl::OnSelected(wxListEvent& WXUNUSED (event))
|
||||
|
|
|
@ -74,6 +74,7 @@ class CGameListCtrl : public wxListCtrl
|
|||
void OnEditPatchFile(wxCommandEvent& event);
|
||||
void OnOpenContainingFolder(wxCommandEvent& event);
|
||||
void OnSetDefaultGCM(wxCommandEvent& event);
|
||||
void OnDeleteGCM(wxCommandEvent& event);
|
||||
void OnCompressGCM(wxCommandEvent& event);
|
||||
void OnFilesystemViewer(wxCommandEvent& event);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ enum
|
|||
IDM_EDITPATCHFILE,
|
||||
IDM_OPENCONTAININGFOLDER,
|
||||
IDM_SETDEFAULTGCM,
|
||||
IDM_DELETEGCM,
|
||||
IDM_FILESYSTEMVIEWER,
|
||||
IDM_COMPRESSGCM,
|
||||
IDM_PLUGIN_OPTIONS,
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ISOFile.h"
|
||||
|
||||
#include "VolumeCreator.h"
|
||||
|
@ -44,7 +45,8 @@ CISOFile::CISOFile(const std::string& _rFileName)
|
|||
{
|
||||
m_Name = _rFileName;
|
||||
m_Country = pVolume->GetCountry();
|
||||
m_FileSize = pVolume->GetSize();
|
||||
m_FileSize = File::GetSize(_rFileName.c_str());
|
||||
m_VolumeSize = pVolume->GetSize();
|
||||
m_Name = pVolume->GetName();
|
||||
m_UniqueID = pVolume->GetUniqueID();
|
||||
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
|
||||
|
|
|
@ -22,33 +22,23 @@
|
|||
|
||||
class CISOFile
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
CISOFile(const std::string& _rFileName);
|
||||
~CISOFile();
|
||||
|
||||
bool IsValid() const {return(m_Valid);}
|
||||
|
||||
const std::string& GetFileName() const {return(m_FileName);}
|
||||
|
||||
const std::string& GetName() const {return(m_Name);}
|
||||
|
||||
const std::string& GetCompany() const {return(m_Company);}
|
||||
|
||||
const std::string& GetDescription() const {return(m_Description);}
|
||||
|
||||
const std::string& GetUniqueID() const {return(m_UniqueID);}
|
||||
|
||||
DiscIO::IVolume::ECountry GetCountry() const {return(m_Country);}
|
||||
|
||||
bool IsCompressed() const {return(m_BlobCompressed); }
|
||||
|
||||
u64 GetFileSize() const {return(m_FileSize);}
|
||||
|
||||
const wxImage& GetImage() const {return(m_Image);}
|
||||
|
||||
private:
|
||||
bool IsValid() const {return m_Valid;}
|
||||
const std::string& GetFileName() const {return m_FileName;}
|
||||
const std::string& GetName() const {return m_Name;}
|
||||
const std::string& GetCompany() const {return m_Company;}
|
||||
const std::string& GetDescription() const {return m_Description;}
|
||||
const std::string& GetUniqueID() const {return m_UniqueID;}
|
||||
DiscIO::IVolume::ECountry GetCountry() const {return m_Country;}
|
||||
bool IsCompressed() const {return m_BlobCompressed;}
|
||||
u64 GetFileSize() const {return m_FileSize;}
|
||||
u64 GetVolumeSize() const {return m_VolumeSize;}
|
||||
const wxImage& GetImage() const {return m_Image;}
|
||||
|
||||
private:
|
||||
std::string m_FileName;
|
||||
std::string m_Name;
|
||||
std::string m_Company;
|
||||
|
@ -56,6 +46,7 @@ class CISOFile
|
|||
std::string m_UniqueID;
|
||||
|
||||
u64 m_FileSize;
|
||||
u64 m_VolumeSize;
|
||||
|
||||
DiscIO::IVolume::ECountry m_Country;
|
||||
|
||||
|
|
|
@ -35,8 +35,7 @@ CPluginManager::~CPluginManager()
|
|||
{}
|
||||
|
||||
|
||||
void
|
||||
CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
||||
void CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
||||
{
|
||||
m_PluginInfos.clear();
|
||||
|
||||
|
@ -91,7 +90,7 @@ CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
|||
break;
|
||||
}
|
||||
|
||||
CPluginInfo PluginInfo(orig_name);
|
||||
CPluginInfo PluginInfo(orig_name.c_str());
|
||||
if (PluginInfo.IsValid())
|
||||
{
|
||||
m_PluginInfos.push_back(PluginInfo);
|
||||
|
@ -100,11 +99,9 @@ CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CPluginManager::OpenAbout(void* _Parent, const std::string& _rFilename)
|
||||
void CPluginManager::OpenAbout(void* _Parent, const char *_rFilename)
|
||||
{
|
||||
if (Common::CPlugin::Load(_rFilename.c_str()))
|
||||
if (Common::CPlugin::Load(_rFilename))
|
||||
{
|
||||
Common::CPlugin::About((HWND)_Parent);
|
||||
Common::CPlugin::Release();
|
||||
|
@ -112,40 +109,34 @@ CPluginManager::OpenAbout(void* _Parent, const std::string& _rFilename)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
CPluginManager::OpenConfig(void* _Parent, const std::string& _rFilename)
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
{
|
||||
if (Common::CPlugin::Load(_rFilename.c_str()))
|
||||
if (Common::CPlugin::Load(_rFilename))
|
||||
{
|
||||
Common::CPlugin::Config((HWND)_Parent);
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CPluginInfo::CPluginInfo(const std::string& _rFileName)
|
||||
CPluginInfo::CPluginInfo(const char *_rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_Valid(false)
|
||||
{
|
||||
if (Common::CPlugin::Load(_rFileName.c_str()))
|
||||
if (Common::CPlugin::Load(_rFileName))
|
||||
{
|
||||
if (Common::CPlugin::GetInfo(m_PluginInfo))
|
||||
{
|
||||
m_Valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName.c_str());
|
||||
}
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!File::Exists(_rFileName)) {
|
||||
PanicAlert("Could not load plugin %s - file does not exist", _rFileName.c_str());
|
||||
PanicAlert("Could not load plugin %s - file does not exist", _rFileName);
|
||||
} else {
|
||||
PanicAlert("Failed to load plugin %s - unknown error.\n", _rFileName.c_str());
|
||||
PanicAlert("Failed to load plugin %s - unknown error.\n", _rFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,25 +22,15 @@
|
|||
|
||||
class CPluginInfo
|
||||
{
|
||||
public:
|
||||
|
||||
CPluginInfo(const std::string& _rFileName);
|
||||
|
||||
public:
|
||||
CPluginInfo(const char *_rFileName);
|
||||
bool IsValid() const {return(m_Valid);}
|
||||
|
||||
|
||||
const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);}
|
||||
|
||||
|
||||
const std::string& GetFileName() const {return(m_FileName);}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
PLUGIN_INFO m_PluginInfo;
|
||||
|
||||
std::string m_FileName;
|
||||
|
||||
bool m_Valid;
|
||||
};
|
||||
|
||||
|
@ -48,31 +38,20 @@ typedef std::vector<CPluginInfo>CPluginInfos;
|
|||
|
||||
class CPluginManager
|
||||
{
|
||||
public:
|
||||
|
||||
public:
|
||||
static CPluginManager& GetInstance() {return(m_Instance);}
|
||||
|
||||
|
||||
void ScanForPlugins(wxWindow* _wxWindow);
|
||||
|
||||
void OpenAbout(void* _Parent, const std::string& _rFilename);
|
||||
|
||||
void OpenConfig(void* _Parent, const std::string& _rFilename);
|
||||
|
||||
|
||||
void OpenAbout(void* _Parent, const char *_rFilename);
|
||||
void OpenConfig(void* _Parent, const char *_rFilename);
|
||||
const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
static CPluginManager m_Instance;
|
||||
|
||||
bool m_Initialized;
|
||||
|
||||
CPluginInfos m_PluginInfos;
|
||||
|
||||
CPluginManager();
|
||||
|
||||
~CPluginManager();
|
||||
};
|
||||
|
||||
|
|
|
@ -252,9 +252,7 @@ void CPluginOptions::CallConfig(wxChoice* _pChoice)
|
|||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||
|
||||
if (pInfo != NULL)
|
||||
{
|
||||
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName());
|
||||
}
|
||||
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,9 +266,7 @@ void CPluginOptions::CallAbout(wxChoice* _pChoice)
|
|||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||
|
||||
if (pInfo != NULL)
|
||||
{
|
||||
CPluginManager::GetInstance().OpenAbout((HWND) this->GetHandle(), pInfo->GetFileName());
|
||||
}
|
||||
CPluginManager::GetInstance().OpenAbout((HWND) this->GetHandle(), pInfo->GetFileName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -305,4 +301,3 @@ bool CPluginOptions::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
|||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue