Deprecated undocumented LogViewer option (in Rainmeter.ini); minor code cosmetics (poiru's suggestion)

This commit is contained in:
Brian Ferguson 2012-08-18 09:02:20 -06:00
parent d2e15c2761
commit 443d06f50d
2 changed files with 7 additions and 19 deletions

View File

@ -1283,18 +1283,18 @@ void CRainmeter::ReloadSettings()
void CRainmeter::EditSettings() void CRainmeter::EditSettings()
{ {
std::wstring file = L'\"' + m_IniFile; std::wstring file = L'"' + m_IniFile;
file += L'\"'; file += L'"';
RunFile(m_SkinEditor.c_str(), file.c_str()); RunFile(m_SkinEditor.c_str(), file.c_str());
} }
void CRainmeter::EditSkinFile(const std::wstring& name, const std::wstring& iniFile) void CRainmeter::EditSkinFile(const std::wstring& name, const std::wstring& iniFile)
{ {
std::wstring args = L'\"' + m_SkinPath; std::wstring args = L'"' + m_SkinPath;
args += name; args += name;
args += L'\\'; args += L'\\';
args += iniFile; args += iniFile;
args += L'\"'; args += L'"';
RunFile(m_SkinEditor.c_str(), args.c_str()); RunFile(m_SkinEditor.c_str(), args.c_str());
} }
@ -2334,19 +2334,9 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
m_SkinEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad"; m_SkinEditor = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad";
} }
m_LogViewer = parser.ReadString(L"Rainmeter", L"LogViewer", L"");
if (m_LogViewer.empty())
{
// Get the program path associated with .log files
DWORD cchOut = MAX_PATH;
HRESULT hr = AssocQueryString(ASSOCF_NOTRUNCATE, ASSOCSTR_EXECUTABLE, L".log", L"open", buffer, &cchOut);
m_LogViewer = (SUCCEEDED(hr) && cchOut > 0) ? buffer : L"Notepad";
}
if (m_Debug) if (m_Debug)
{ {
LogWithArgs(LOG_NOTICE, L"ConfigEditor: %s", m_SkinEditor.c_str()); LogWithArgs(LOG_NOTICE, L"ConfigEditor: %s", m_SkinEditor.c_str());
LogWithArgs(LOG_NOTICE, L"LogViewer: %s", m_LogViewer.c_str());
} }
m_TrayExecuteR = parser.ReadString(L"Rainmeter", L"TrayExecuteR", L"", false); m_TrayExecuteR = parser.ReadString(L"Rainmeter", L"TrayExecuteR", L"", false);
@ -3242,10 +3232,10 @@ void CRainmeter::StopLogging()
void CRainmeter::ShowLogFile() void CRainmeter::ShowLogFile()
{ {
std::wstring logFile = L'\"' + m_LogFile; std::wstring logFile = L'"' + m_LogFile;
logFile += L'\"'; logFile += L'"';
RunFile(m_LogViewer.c_str(), logFile.c_str()); RunFile(m_SkinEditor.c_str(), logFile.c_str());
} }
void CRainmeter::DeleteLogFile() void CRainmeter::DeleteLogFile()

View File

@ -153,7 +153,6 @@ public:
const std::wstring& GetDrive() { return m_Drive; } const std::wstring& GetDrive() { return m_Drive; }
const std::wstring& GetSkinEditor() { return m_SkinEditor; } const std::wstring& GetSkinEditor() { return m_SkinEditor; }
const std::wstring& GetLogViewer() { return m_LogViewer; }
const std::wstring& GetStatsDate() { return m_StatsDate; } const std::wstring& GetStatsDate() { return m_StatsDate; }
HWND GetWindow() { return m_Window; } HWND GetWindow() { return m_Window; }
@ -312,7 +311,6 @@ private:
std::list<LogInfo> m_LogData; std::list<LogInfo> m_LogData;
std::wstring m_SkinEditor; std::wstring m_SkinEditor;
std::wstring m_LogViewer;
CConfigParser* m_CurrentParser; CConfigParser* m_CurrentParser;