mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
iTunesPlugin now accepts commands as a !RainmeterPluginBang (i.e. you can use !RainmeterPluginBang "iTunesMeasure NextTrack" instead of creating an own measure for each command).
This commit is contained in:
parent
b9ae3a31d8
commit
6809d5bb4d
@ -12,7 +12,7 @@
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,1,0,0
|
||||
FILEVERSION 0,2,0,0
|
||||
PRODUCTVERSION PRODUCTVER
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
@ -29,7 +29,7 @@ BEGIN
|
||||
BLOCK "040904E4"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "iTunes Plugin for Rainmeter"
|
||||
VALUE "FileVersion", "1.1.0.0"
|
||||
VALUE "FileVersion", "0.2.0.0"
|
||||
VALUE "InternalName", "PluginiTunes"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2010 - Elestel"
|
||||
VALUE "OriginalFilename", "PluginiTunes.dll"
|
||||
|
@ -456,17 +456,17 @@ UINT Initialize(HMODULE instance, LPCTSTR iniFile, LPCTSTR section, UINT id)
|
||||
if (SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
|
||||
{
|
||||
InstanceCreated = true;
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesApp initialized successfully.");
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
|
||||
initEventHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to create the iTunesApp instance.");
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to find the iTunes window.");
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to find the iTunes window.");
|
||||
}
|
||||
|
||||
const wchar_t* type = ReadConfigString(section, L"Command", L"");
|
||||
@ -501,12 +501,12 @@ UINT Update(UINT id)
|
||||
if (!iTunesAboutToPromptUserToQuit && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
|
||||
{
|
||||
InstanceCreated = true;
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesApp initialized successfully.");
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: iTunesApp initialized successfully.");
|
||||
initEventHandler();
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"Unable to create the iTunesApp instance.");
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Unable to create the iTunesApp instance.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -693,9 +693,98 @@ void ExecuteBang(LPCTSTR args, UINT id)
|
||||
return;
|
||||
}
|
||||
|
||||
CCommandIdMap::const_iterator it = CommandIdMap.find(id);
|
||||
COMMAND_TYPE command = (it != CommandIdMap.end()) ? it->second : COMMAND_COUNT;
|
||||
COMMAND_TYPE command;
|
||||
|
||||
if (wcslen(args) == 0)
|
||||
{
|
||||
CCommandIdMap::const_iterator it = CommandIdMap.find(id);
|
||||
command = (it != CommandIdMap.end()) ? it->second : COMMAND_COUNT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_wcsicmp(args, L"Backtrack") == 0)
|
||||
{
|
||||
command = COMMAND_BACKTRACK;
|
||||
}
|
||||
else if (_wcsicmp(args, L"FastForward") == 0)
|
||||
{
|
||||
command = COMMAND_FASTFORWARD;
|
||||
}
|
||||
else if (_wcsicmp(args, L"NextTrack") == 0)
|
||||
{
|
||||
command = COMMAND_NEXTTRACK;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Pause") == 0)
|
||||
{
|
||||
command = COMMAND_PAUSE;
|
||||
}
|
||||
else if (_wcsicmp(args, L"PlayPause") == 0)
|
||||
{
|
||||
command = COMMAND_PLAYPAUSE;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Power") == 0)
|
||||
{
|
||||
command = COMMAND_POWER;
|
||||
}
|
||||
else if (_wcsicmp(args, L"PreviousTrack") == 0)
|
||||
{
|
||||
command = COMMAND_PREVIOUSTRACK;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Resume") == 0)
|
||||
{
|
||||
command = COMMAND_RESUME;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Rewind") == 0)
|
||||
{
|
||||
command = COMMAND_REWIND;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Stop") == 0)
|
||||
{
|
||||
command = COMMAND_STOP;
|
||||
}
|
||||
else if (_wcsicmp(args, L"SoundVolumeUp") == 0)
|
||||
{
|
||||
command = COMMAND_SOUNDVOLUMEUP;
|
||||
}
|
||||
else if (_wcsicmp(args, L"SoundVolumeDown") == 0)
|
||||
{
|
||||
command = COMMAND_SOUNDVOLUMEDOWN;
|
||||
}
|
||||
else if (_wcsicmp(args, L"ToggleiTunes") == 0)
|
||||
{
|
||||
command = COMMAND_TOGGLEITUNES;
|
||||
}
|
||||
else if (_wcsicmp(args, L"ToggleVisuals") == 0)
|
||||
{
|
||||
command = COMMAND_TOGGLEVISUALS;
|
||||
}
|
||||
else if (_wcsicmp(args, L"UpdateiPod") == 0)
|
||||
{
|
||||
command = COMMAND_UPDATEIPOD;
|
||||
}
|
||||
else if (_wcsicmp(args, L"UpdatePodcastFeeds") == 0)
|
||||
{
|
||||
command = COMMAND_UPDATEPODCASTFEEDS;
|
||||
}
|
||||
else if (_wcsicmp(args, L"GotoMusicStoreHomePage") == 0)
|
||||
{
|
||||
command = COMMAND_GOTOMUSICSTOREHOMEPAGE;
|
||||
}
|
||||
else if (_wcsicmp(args, L"Quit") == 0)
|
||||
{
|
||||
command = COMMAND_QUIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
LSLog(LOG_DEBUG, L"Rainmeter", L"iTunesPlugin: Invalid command.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case COMMAND_POWER:
|
||||
{
|
||||
if (!InstanceCreated)
|
||||
{
|
||||
if (COMMAND_POWER == command && CoInitialized && SUCCEEDED(iTunes.CreateInstance(CLSID_iTunesApp, NULL, CLSCTX_LOCAL_SERVER)))
|
||||
@ -707,16 +796,16 @@ void ExecuteBang(LPCTSTR args, UINT id)
|
||||
}
|
||||
InstanceCreated = true;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (command)
|
||||
else
|
||||
{
|
||||
case COMMAND_POWER:
|
||||
iTunes->Quit();
|
||||
iTunes.Release();
|
||||
InstanceCreated = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case COMMAND_TOGGLEITUNES:
|
||||
{
|
||||
IITBrowserWindowPtr browserWindow;
|
||||
@ -889,7 +978,7 @@ void Finalize(HMODULE instance, UINT id)
|
||||
|
||||
UINT GetPluginVersion()
|
||||
{
|
||||
return 0001;
|
||||
return 0002;
|
||||
}
|
||||
|
||||
LPCTSTR GetPluginAuthor()
|
||||
|
Loading…
Reference in New Issue
Block a user