Minor changes

This commit is contained in:
Birunthan Mohanathas 2012-06-10 12:33:59 +03:00
parent 5dd2f249dd
commit 5c90577955
3 changed files with 56 additions and 34 deletions

View File

@ -1677,7 +1677,7 @@ int CRainmeter::ScanForSkinsRecursive(const std::wstring& path, std::wstring bas
{ {
if (wcscmp(L".", fileData.cFileName) != 0 && if (wcscmp(L".", fileData.cFileName) != 0 &&
wcscmp(L"..", fileData.cFileName) != 0 && wcscmp(L"..", fileData.cFileName) != 0 &&
!(level == 0 && wcscmp(L"@Backup", fileData.cFileName) == 0) && !(level == 0 && wcscmp(L"Backup", fileData.cFileName) == 0) &&
!(level == 1 && wcscmp(L"@Resources", fileData.cFileName) == 0)) !(level == 1 && wcscmp(L"@Resources", fileData.cFileName) == 0))
{ {
subfolders.push_back(filename); subfolders.push_back(filename);

View File

@ -1165,7 +1165,8 @@ void CSystem::SetWallpaper(const std::wstring& wallpaper, const std::wstring& st
Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str()); Bitmap* bitmap = Bitmap::FromFile(wallpaper.c_str());
if (bitmap && bitmap->GetLastStatus() == Ok) if (bitmap && bitmap->GetLastStatus() == Ok)
{ {
std::wstring file = Rainmeter->GetSettingsPath() + L"Wallpaper.bmp"; std::wstring file = Rainmeter->GetSettingsPath();
file += L"Wallpaper.bmp";
const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } }; const CLSID bmpClsid = { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } };
if (bitmap->Save(file.c_str(), &bmpClsid) == Ok) if (bitmap->Save(file.c_str(), &bmpClsid) == Ok)

View File

@ -581,6 +581,28 @@ bool CDialogInstall::ReadOptions(const WCHAR* file)
} }
} }
if (GetPrivateProfileString(section, newFormat ? L"LoadType" : L"LaunchType", L"", buffer, MAX_LINE_LENGTH, file) > 0)
{
bool loadSkin = _wcsicmp(buffer, newFormat ? L"Skin" : L"Load") == 0;
GetPrivateProfileString(section, newFormat ? L"Load" : L"LaunchCommand", L"", buffer, MAX_LINE_LENGTH, file);
if (loadSkin)
{
if (newFormat)
{
m_LoadSkins.push_back(buffer);
}
else
{
m_LoadSkins = Tokenize(buffer, L"|");
}
}
else
{
m_LoadTheme = buffer;
}
}
if (newFormat) if (newFormat)
{ {
if (GetPrivateProfileString(section, L"MinimumDotNET", L"", buffer, MAX_LINE_LENGTH, file) > 0 && if (GetPrivateProfileString(section, L"MinimumDotNET", L"", buffer, MAX_LINE_LENGTH, file) > 0 &&
@ -600,31 +622,43 @@ bool CDialogInstall::ReadOptions(const WCHAR* file)
return false; return false;
} }
} }
else
{
if (GetPrivateProfileString(section, L"LaunchType", L"", buffer, MAX_LINE_LENGTH, file) > 0)
{
bool loadSkins = _wcsicmp(buffer, L"load") == 0;
GetPrivateProfileString(section, L"LaunchCommand", L"", buffer, MAX_LINE_LENGTH, file);
if (loadSkins)
{
m_LoadSkins = Tokenize(buffer, L"|");
}
else
{
m_LoadTheme = buffer;
}
}
return true;
}
return true; return true;
} }
bool CDialogInstall::InstallPackage() bool CDialogInstall::InstallPackage()
{ {
if (!m_MergeSkins && m_BackupSkins)
{
// Move skins into backup folder
for (auto iter = m_PackageSkins.cbegin(); iter != m_PackageSkins.cend(); ++iter)
{
std::wstring from = g_Data.skinsPath + *iter;
std::wstring to = g_Data.skinsPath + L"Backup\\";
CreateDirectory(to.c_str(), NULL);
to += *iter;
to += L'\0'; // For SHFileOperation
// Delete current backup
SHFILEOPSTRUCT fo =
{
NULL,
FO_DELETE,
to.c_str(),
NULL,
FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
};
SHFileOperation(&fo);
if (!CopyFiles(from, to, true))
{
m_ErrorMessage = L"Unable to move to:\n";
m_ErrorMessage += to;
return false;
}
}
}
WCHAR buffer[MAX_PATH]; WCHAR buffer[MAX_PATH];
// Helper to sets buffer with current file name // Helper to sets buffer with current file name
@ -642,19 +676,6 @@ bool CDialogInstall::InstallPackage()
return false; return false;
}; };
if (!m_MergeSkins && m_BackupSkins)
{
// Move skins into backup folder
for (auto iter = m_PackageSkins.cbegin(); iter != m_PackageSkins.cend(); ++iter)
{
std::wstring from = g_Data.skinsPath + *iter;
std::wstring to = g_Data.skinsPath + L"Backup\\";
CreateDirectory(to.c_str(), NULL);
to += *iter;
CopyFiles(from, to, true);
}
}
unzGoToFirstFile(m_PackageUnzFile); unzGoToFirstFile(m_PackageUnzFile);
const WCHAR* root = m_PackageRoot.c_str(); const WCHAR* root = m_PackageRoot.c_str();
do do