mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Updating a skin should work now even if the current version is missing. This should solve the issue 121.
The default tray icon is shown if custom tray measure cannot be created.
This commit is contained in:
parent
fd9cac7add
commit
46570b6025
@ -995,47 +995,62 @@ void CRainmeter::CheckSkinVersions()
|
|||||||
if (CompareVersions(strVersionNew, strVersionInIni) == 1 &&
|
if (CompareVersions(strVersionNew, strVersionInIni) == 1 &&
|
||||||
CompareVersions(strVersionNew, strVersionCurrent) == 1)
|
CompareVersions(strVersionNew, strVersionCurrent) == 1)
|
||||||
{
|
{
|
||||||
std::wstring strMessage = L"The config called \"" + menu[i].name + L"\" is newer\nthan the one you are currently using.\n\n";
|
// Check if the old skin exists at all
|
||||||
strMessage += L"New config: " + (strVersionNew.empty() ? L"Unknown" : strVersionNew) + L"\n";
|
struct _stat64i32 s;
|
||||||
strMessage += L"Current config: " + (strVersionCurrent.empty() ? L"Unknown" : strVersionCurrent) + L"\n";
|
std::wstring strSkinPath = m_SkinPath + menu[i].name;
|
||||||
strMessage += L"\n";
|
if (_wstat(strSkinPath.c_str(), &s) == 0)
|
||||||
strMessage += L"Do you want to upgrade it?";
|
|
||||||
strMessage += L"\n\n";
|
|
||||||
strMessage += L"(If you select 'Yes' your old config\nwill be moved to the 'Backup' folder)";
|
|
||||||
|
|
||||||
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
|
||||||
{
|
{
|
||||||
// Make sure that the folder exists
|
std::wstring strMessage = L"The config called \"" + menu[i].name + L"\" is newer\nthan the one you are currently using.\n\n";
|
||||||
CreateDirectory(std::wstring(m_SkinPath + L"Backup").c_str(), NULL);
|
strMessage += L"New config: " + (strVersionNew.empty() ? L"Unknown" : strVersionNew) + L"\n";
|
||||||
|
strMessage += L"Current config: " + (strVersionCurrent.empty() ? L"Unknown" : strVersionCurrent) + L"\n";
|
||||||
|
strMessage += L"\n";
|
||||||
|
strMessage += L"Do you want to upgrade it?";
|
||||||
|
strMessage += L"\n\n";
|
||||||
|
strMessage += L"(If you select 'Yes' your old config\nwill be moved to the 'Backup' folder)";
|
||||||
|
|
||||||
// Check for illegal characters from the version number
|
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
||||||
if (strVersionCurrent.find_first_of(L"\\/\"*:?<>|") == std::wstring::npos)
|
|
||||||
{
|
{
|
||||||
std::wstring strTarget = m_SkinPath + L"Backup\\" + menu[i].name + L"-" + strVersionCurrent;
|
// Make sure that the folder exists
|
||||||
if (CopyFiles(m_SkinPath + menu[i].name, strTarget, true)) // Move the folder to "backup"
|
CreateDirectory(std::wstring(m_SkinPath + L"Backup").c_str(), NULL);
|
||||||
{
|
|
||||||
// Upgrade the skin
|
|
||||||
CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
|
|
||||||
|
|
||||||
// TODO: Temporary 'fix': If this was Enigma upgrade the themes too
|
// Check for illegal characters from the version number
|
||||||
if (menu[i].name == L"Enigma")
|
if (strVersionCurrent.find_first_of(L"\\/\"*:?<>|") == std::wstring::npos)
|
||||||
|
{
|
||||||
|
std::wstring strTarget = m_SkinPath + L"Backup\\" + menu[i].name + L"-" + strVersionCurrent;
|
||||||
|
if (CopyFiles(m_SkinPath + menu[i].name, strTarget, true)) // Move the folder to "backup"
|
||||||
{
|
{
|
||||||
std::wstring strMainThemes = m_Path + L"Themes";
|
// Upgrade the skin
|
||||||
std::wstring strCurrentThemes = GetSettingsPath();
|
CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
|
||||||
CopyFiles(strMainThemes, strCurrentThemes);
|
|
||||||
|
// TODO: Temporary 'fix': If this was Enigma upgrade the themes too
|
||||||
|
if (menu[i].name == L"Enigma")
|
||||||
|
{
|
||||||
|
std::wstring strMainThemes = m_Path + L"Themes";
|
||||||
|
std::wstring strCurrentThemes = GetSettingsPath();
|
||||||
|
CopyFiles(strMainThemes, strCurrentThemes);
|
||||||
|
}
|
||||||
|
// End of temporary 'fix'
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::wstring strMessage = L"Failed to upgrade the config.\nUnable to backup the current config.";
|
||||||
|
MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
// End of temporary 'fix'
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::wstring strMessage = L"Failed to upgrade the config.\nUnable to backup the current config.";
|
std::wstring strMessage = L"Failed to upgrade the config.\nThe version number contains illegal characters.";
|
||||||
MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR);
|
MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::wstring strMessage = L"A new version of config called \"" + menu[i].name + L"\" is available\n";
|
||||||
|
strMessage += L"Do you want to add it to your skin library?";
|
||||||
|
if (IDYES == MessageBox(NULL, strMessage.c_str(), APPNAME, MB_YESNO | MB_ICONQUESTION))
|
||||||
{
|
{
|
||||||
std::wstring strMessage = L"Failed to upgrade the config.\nThe version number contains illegal characters.";
|
CopyFiles(strMainSkinsPath + menu[i].name, m_SkinPath);
|
||||||
MessageBox(NULL, strMessage.c_str(), APPNAME, MB_OK | MB_ICONERROR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,11 +195,7 @@ BOOL CTrayWindow::ShowBalloonHelp()
|
|||||||
|
|
||||||
HICON CTrayWindow::CreateTrayIcon(double value)
|
HICON CTrayWindow::CreateTrayIcon(double value)
|
||||||
{
|
{
|
||||||
if (m_Measure == NULL)
|
if (m_Measure != NULL)
|
||||||
{
|
|
||||||
return LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM)
|
if (m_MeterType == TRAY_METER_TYPE_HISTOGRAM)
|
||||||
{
|
{
|
||||||
@ -290,7 +286,8 @@ HICON CTrayWindow::CreateTrayIcon(double value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
// Return the default icon if there is no valid measure
|
||||||
|
return LoadIcon(m_Instance, MAKEINTRESOURCE(IDI_TRAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
void CTrayWindow::ReadConfig(CConfigParser& parser)
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
const int revision_number = 291;
|
const int revision_number = 292;
|
Loading…
x
Reference in New Issue
Block a user