aboutsummaryrefslogtreecommitdiff
path: root/qmidiplayer-desktop/qmpplugin.cpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-20 23:51:15 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2016-05-20 23:51:15 +0800
commit1ec23952dd7c022e11afbb93d93be1bac5c94081 (patch)
treec38c321d2374c72f4f607bd3742a59188dae1e60 /qmidiplayer-desktop/qmpplugin.cpp
parent78b384662f484e946a6a17c96e6c309df0c039da (diff)
downloadQMidiPlayer-1ec23952dd7c022e11afbb93d93be1bac5c94081.tar.xz
Scale GUI correctly on a high DPI device.
Fix building for Windows. RC-bugs still exist.
Diffstat (limited to 'qmidiplayer-desktop/qmpplugin.cpp')
-rw-r--r--qmidiplayer-desktop/qmpplugin.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/qmidiplayer-desktop/qmpplugin.cpp b/qmidiplayer-desktop/qmpplugin.cpp
index 2117bcf..7dfb01f 100644
--- a/qmidiplayer-desktop/qmpplugin.cpp
+++ b/qmidiplayer-desktop/qmpplugin.cpp
@@ -18,23 +18,24 @@ void qmpPluginManager::scanPlugins()
HANDLE dir;
std::vector<std::string> cpluginpaths;
//FindFirstFile, FindNextFile, FindClose
- LPWIN32_FIND_DATA file;
- dir=FindFirstFileA(L".\\plugins\\*.dll",file);
+ LPWIN32_FIND_DATAA file;
+ dir=FindFirstFileA(".\\plugins\\*.dll",file);
if(dir!=INVALID_HANDLE_VALUE)
{
cpluginpaths.push_back(std::string(file->cFileName));
- while(FindNextFile(dir,file))
+ while(FindNextFileA(dir,file))
cpluginpaths.push_back(std::string(file->cFileName));
}
FindClose(dir);
for(unsigned i=0;i<cpluginpaths.size();++i)
{
- HMODULE hso=LoadLibraryA(cpluginpaths[i].c_str());
+ HMODULE hso=LoadLibraryA((std::string(".\\plugins\\")+cpluginpaths[i]).c_str());
if(!hso){fprintf(stderr,"Error while loading library: %d\n",GetLastError());continue;}
FARPROC hndi=GetProcAddress(hso,"qmpPluginGetInterface");
if(!hndi){fprintf(stderr,"file %s doesn't seem to be a qmidiplayer plugin.\n",cpluginpaths[i].c_str());continue;}
qmpPluginEntry e=(qmpPluginEntry)hndi;
qmpPluginIntf* intf=e(pluginAPI);
+ //!!FIXME: Windows version crashes if intf->pluginGetVersion is called. Reason is still unknown.
plugins.push_back(qmpPlugin(std::string(intf->pluginGetName()),std::string(intf->pluginGetVersion()),std::string(cpluginpaths[i]),intf));
}
}
@@ -82,8 +83,8 @@ qmpPluginManager::~qmpPluginManager()
{
for(unsigned i=0;i<plugins.size();++i)
{
- if(plugins[i].initialized)plugins[i].interface->deinit();
- delete plugins[i].interface;
+ if(plugins[i].initialized)plugins[i].pinterface->deinit();
+ delete plugins[i].pinterface;
}
qmw=NULL;qsw=NULL;delete pluginAPI;
}
@@ -97,14 +98,14 @@ void qmpPluginManager::initPlugins()
{
if(!plugins[i].enabled)continue;
printf("Loaded plugin: %s\n",plugins[i].path.c_str());
- plugins[i].interface->init();plugins[i].initialized=true;
+ plugins[i].pinterface->init();plugins[i].initialized=true;
}
}
void qmpPluginManager::deinitPlugins()
{
for(unsigned i=0;i<plugins.size();++i)
{
- if(plugins[i].initialized)plugins[i].interface->deinit();
+ if(plugins[i].initialized)plugins[i].pinterface->deinit();
plugins[i].enabled=plugins[i].initialized=false;
}
}