mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
- Changed an interval of writing network statistics from a minute to two minutes.
- Code cosmetic changes.
This commit is contained in:
parent
3acb191e56
commit
dbd43ddfbc
@ -495,7 +495,7 @@ void CMeasureNet::ReadConfig(CConfigParser& parser, const WCHAR* section, NET ne
|
||||
m_Cumulative = 0!=parser.ReadInt(section, L"Cumulative", 0);
|
||||
if (m_Cumulative)
|
||||
{
|
||||
CSystem::SetNetworkStatisticsTimer();
|
||||
Rainmeter->SetNetworkStatisticsTimer();
|
||||
}
|
||||
|
||||
m_TrafficValue = parser.ReadFloat(section, L"TrafficValue", 0.0);
|
||||
|
@ -33,6 +33,15 @@
|
||||
|
||||
using namespace Gdiplus;
|
||||
|
||||
enum TIMER
|
||||
{
|
||||
TIMER_NETSTATS = 1
|
||||
};
|
||||
enum INTERVAL
|
||||
{
|
||||
INTERVAL_NETSTATS = 120000
|
||||
};
|
||||
|
||||
CRainmeter* Rainmeter; // The module
|
||||
|
||||
/*
|
||||
@ -681,6 +690,8 @@ CRainmeter::CRainmeter() :
|
||||
*/
|
||||
CRainmeter::~CRainmeter()
|
||||
{
|
||||
KillTimer(m_Window, TIMER_NETSTATS);
|
||||
|
||||
DeleteMeterWindow(NULL);
|
||||
|
||||
delete m_TrayWindow;
|
||||
@ -1075,9 +1086,18 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
if (wParam == TIMER_NETSTATS)
|
||||
{
|
||||
CMeasureNet::UpdateIFTable();
|
||||
CMeasureNet::UpdateStats();
|
||||
Rainmeter->WriteStats(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_RAINMETER_DELAYED_REFRESH_ALL:
|
||||
Rainmeter->RefreshAll();
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_RAINMETER_DELAYED_EXECUTE:
|
||||
if (lParam)
|
||||
@ -1087,7 +1107,7 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
||||
Rainmeter->ExecuteCommand(bang, NULL);
|
||||
free(bang); // _wcsdup()
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
@ -1096,6 +1116,11 @@ LRESULT CALLBACK CRainmeter::MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CRainmeter::SetNetworkStatisticsTimer()
|
||||
{
|
||||
static bool set = SetTimer(m_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** CreateDefaultConfigFile
|
||||
**
|
||||
@ -2489,7 +2514,7 @@ void CRainmeter::ReadStats()
|
||||
/*
|
||||
** WriteStats
|
||||
**
|
||||
** Writes the statistics to the ini-file. If bForce is false the stats are written only once per minute.
|
||||
** Writes the statistics to the ini-file. If bForce is false the stats are written only once per an appropriate interval.
|
||||
**
|
||||
*/
|
||||
void CRainmeter::WriteStats(bool bForce)
|
||||
@ -2498,7 +2523,7 @@ void CRainmeter::WriteStats(bool bForce)
|
||||
|
||||
ULONGLONG ticks = CSystem::GetTickCount64();
|
||||
|
||||
if (bForce || (lastWrite + 1000 * 60 < ticks))
|
||||
if (bForce || (lastWrite + INTERVAL_NETSTATS < ticks))
|
||||
{
|
||||
lastWrite = ticks;
|
||||
|
||||
|
@ -123,6 +123,8 @@ public:
|
||||
int Initialize(HINSTANCE hInstance, LPCWSTR szPath);
|
||||
int MessagePump();
|
||||
|
||||
void SetNetworkStatisticsTimer();
|
||||
|
||||
CConfigParser* GetCurrentParser() { return m_CurrentParser; }
|
||||
void SetCurrentParser(CConfigParser* parser) { m_CurrentParser = parser; }
|
||||
|
||||
|
@ -32,14 +32,12 @@ using namespace Gdiplus;
|
||||
|
||||
enum TIMER
|
||||
{
|
||||
TIMER_SHOWDESKTOP = 1,
|
||||
TIMER_NETSTATS = 2
|
||||
TIMER_SHOWDESKTOP = 1
|
||||
};
|
||||
enum INTERVAL
|
||||
{
|
||||
INTERVAL_SHOWDESKTOP = 250,
|
||||
INTERVAL_RESTOREWINDOWS = 100,
|
||||
INTERVAL_NETSTATS = 60000
|
||||
INTERVAL_RESTOREWINDOWS = 100
|
||||
};
|
||||
|
||||
MULTIMONITOR_INFO CSystem::c_Monitors = { 0 };
|
||||
@ -135,7 +133,6 @@ void CSystem::Initialize(HINSTANCE instance)
|
||||
void CSystem::Finalize()
|
||||
{
|
||||
KillTimer(c_Window, TIMER_SHOWDESKTOP);
|
||||
KillTimer(c_Window, TIMER_NETSTATS);
|
||||
|
||||
if (c_WinEventHook)
|
||||
{
|
||||
@ -156,11 +153,6 @@ void CSystem::Finalize()
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::SetNetworkStatisticsTimer()
|
||||
{
|
||||
static bool set = SetTimer(c_Window, TIMER_NETSTATS, INTERVAL_NETSTATS, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** MyInfoEnumProc
|
||||
**
|
||||
@ -1004,20 +996,12 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||
{
|
||||
case WM_WINDOWPOSCHANGING:
|
||||
((LPWINDOWPOS)lParam)->flags |= SWP_NOZORDER;
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
switch (wParam)
|
||||
if (wParam == TIMER_SHOWDESKTOP)
|
||||
{
|
||||
case TIMER_SHOWDESKTOP:
|
||||
CheckDesktopState(GetWorkerW());
|
||||
return 0;
|
||||
|
||||
case TIMER_NETSTATS:
|
||||
CMeasureNet::UpdateIFTable();
|
||||
CMeasureNet::UpdateStats();
|
||||
Rainmeter->WriteStats(false);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1042,10 +1026,13 @@ LRESULT CALLBACK CSystem::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lP
|
||||
PostMessage((*iter).second->GetWindow(), WM_DELAYED_MOVE, (WPARAM)uMsg, (LPARAM)0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -56,8 +56,6 @@ public:
|
||||
static void Initialize(HINSTANCE instance);
|
||||
static void Finalize();
|
||||
|
||||
static void SetNetworkStatisticsTimer();
|
||||
|
||||
static const MULTIMONITOR_INFO& GetMultiMonitorInfo() { return c_Monitors; }
|
||||
static size_t GetMonitorCount();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user