no message

svn path=/trunk/boinc/; revision=733
This commit is contained in:
Eric Heien 2002-12-11 23:10:51 +00:00
parent 8e55d3890d
commit 92eb972df2
6 changed files with 681 additions and 677 deletions

View File

@ -21,8 +21,7 @@
#include "client_types.h"
#include "hostinfo.h"
double GetDiskFree();
double GetDiskSize();
typedef BOOL (CALLBACK* FreeFn)(LPCTSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
// Returns the number of seconds difference from UTC
//
@ -33,6 +32,31 @@ int get_timezone(void) {
return (tzi.Bias * 60);
}
// Returns total and free space on current disk (in bytes)
//
void get_host_disk_info( double &total_space, double &free_space ) {
FreeFn pGetDiskFreeSpaceEx;
pGetDiskFreeSpaceEx = (FreeFn)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExA");
if(pGetDiskFreeSpaceEx) {
ULARGE_INTEGER TotalNumberOfFreeBytes;
ULARGE_INTEGER TotalNumberOfBytes;
pGetDiskFreeSpaceEx(NULL, NULL, &TotalNumberOfBytes, &TotalNumberOfFreeBytes);
unsigned int uMB;
uMB = TotalNumberOfFreeBytes.QuadPart / (1024 * 1024);
free_space = uMB * 1024.0 * 1024.0;
uMB = TotalNumberOfBytes.QuadPart / (1024 * 1024);
total_space = uMB * 1024.0 * 1024.0;
} else {
DWORD dwSectPerClust;
DWORD dwBytesPerSect;
DWORD dwFreeClusters;
DWORD dwTotalClusters;
GetDiskFreeSpace(NULL, &dwSectPerClust, &dwBytesPerSect, &dwFreeClusters, &dwTotalClusters);
free_space = (double)dwFreeClusters * dwSectPerClust * dwBytesPerSect;
total_space = (double)dwTotalClusters * dwSectPerClust * dwBytesPerSect;
}
}
// Gets windows specific host information (not complete)
//
int get_host_info(HOST_INFO& host) {
@ -150,8 +174,7 @@ int get_host_info(HOST_INFO& host) {
break;
}
host.d_total = GetDiskSize();
host.d_free = GetDiskFree();
get_host_disk_info(host.d_total, host.d_free);
get_local_domain_name(host.domain_name);
get_local_ip_addr_str(host.ip_addr);
@ -188,39 +211,3 @@ bool host_is_running_on_batteries() {
GetSystemPowerStatus(&pStatus);
return (pStatus.ACLineStatus != 1);
}
//////////
// GetDiskFree
// arguments: void
// returns: amount of free disk space in MB
// function: calculates free disk space on current drive
double GetDiskFree()
{
ULARGE_INTEGER TotalNumberOfFreeBytes;
char path[256];
char drive[256];
GetCurrentDirectory(256, path);
memcpy(drive, path, 3);
drive[3] = 0;
GetDiskFreeSpaceEx(drive, NULL, NULL, &TotalNumberOfFreeBytes);
unsigned int MB = TotalNumberOfFreeBytes.QuadPart / (1024 * 1024);
return (double)MB * 1024.0 * 1024.0;
}
//////////
// GetDiskSize
// arguments: void
// returns: total disk space in bytes
// function: calculates total disk space on current drive
double GetDiskSize()
{
ULARGE_INTEGER TotalNumberOfBytes;
char path[256];
char drive[256];
GetCurrentDirectory(256, path);
memcpy(drive, path, 3);
drive[3] = 0;
GetDiskFreeSpaceEx(drive, NULL, &TotalNumberOfBytes, NULL);
unsigned int MB = TotalNumberOfBytes.QuadPart / (1024 * 1024);
return (double)MB * 1024.0 * 1024.0;
}

Binary file not shown.

View File

@ -58,13 +58,14 @@
#define ID_FILE_CLEARINACTIVE 40027
#define ID_FILE_CLEARMESSAGES 40028
#define ID_SETTINGS_PROXYSERVER 40029
#define ID_FILE_SHOWGRAPHICS 40030
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 128
#define _APS_NEXT_COMMAND_VALUE 40030
#define _APS_NEXT_COMMAND_VALUE 40031
#define _APS_NEXT_CONTROL_VALUE 1019
#define _APS_NEXT_SYMED_VALUE 101
#endif

View File

@ -175,6 +175,7 @@ IDR_MAINFRAME MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "Show &Graphics", ID_FILE_SHOWGRAPHICS
MENUITEM "Clear &Messages", ID_FILE_CLEARMESSAGES
MENUITEM "Clear &Inactive", ID_FILE_CLEARINACTIVE
MENUITEM SEPARATOR

File diff suppressed because it is too large Load Diff

View File

@ -27,8 +27,9 @@
#include <afxtempl.h>
#include <afxcoll.h>
#include <afxext.h>
#include <Tlhelp32.h>
#include <math.h>
#include "graphics_api.h"
#include "file_names.h"
#include "filesys.h"
#include "log_flags.h"
#include "client_state.h"
@ -65,6 +66,27 @@
#define PIE_DEPTH 0.25 // depth of pie chart
#define PI 3.14159 // pi
#define STATUS_ICON_ID (WM_USER + 1) // id for notifications from status icon
#define STATUS_MENU 0 // submenus for context menus
#define PROJECT_MENU 1
#define RESULT_MENU 2
#define XFER_MENU 3
#define PROJECT_ID 0 // child control ids
#define RESULT_ID 1
#define XFER_ID 2
#define MESSAGE_ID 3
#define MAX_LIST_ID 4 // for column titles
#define USAGE_ID 4
#define TAB_ID 5
#define PROJECT_COLS 5 // number of columns for each control
#define RESULT_COLS 7
#define XFER_COLS 6
#define MESSAGE_COLS 3
#define MAX_COLS 7
// typedefs
typedef BOOL (CALLBACK* InitFn)();
@ -131,7 +153,7 @@ protected:
CMapStringToOb m_Progs; // maps coordinate string to progress control
CProgressHeaderCtrl m_Header; // header for subclassing
CArray<int,int> m_ColWidths; // column widths for hiding and unhiding; a[i] > 0: col i shown; a[i] < 0: col i hidden, previous width -(a[i] - 1)
int m_iSort; // column and order of last sort: i = 0: no sort; i > 0: sorted ascending by col i - 1; < 0 sorted descending by col -(i-1)
int m_nSort; // column and order of last sort: i = 0: no sort; i > 0: sorted ascending by col i - 1; < 0 sorted descending by col -(i-1)
CFont* m_OldFont; // old font for setting subitem font
CArray<COLORREF,COLORREF> m_ItemColors; // special colors of items
CArray<CString,CString> m_ProjectURLs; // urls for project links
@ -169,11 +191,11 @@ public:
void SetTotal(double);
protected:
double m_total; // total amount of pie
CArray<double,double> m_Values; // specific values of pieces
CArray<COLORREF,COLORREF> m_Colors; // colors of pieces
CArray<CString,CString> m_Labels; // labels of pieces
CFont* m_Font; // font for control
double m_xTotal; // total amount of pie
CArray<double,double> m_xValues; // specific values of pieces
CArray<COLORREF,COLORREF> m_colors; // colors of pieces
CArray<CString,CString> m_strLabels; // labels of pieces
CFont* m_pFont; // font for control
void DrawPiePiece(CDC*, double, double);
void CirclePoint(CPoint*, int, double, CPoint*);
@ -218,11 +240,11 @@ protected:
CTabCtrl m_TabCtrl; // tab control for choosing display
CImageList m_TabIL; // image list for tab control
CBitmap m_TabBMP[5]; // bitmaps for tab image list
HINSTANCE m_IdleDll; // handle to dll for user idle
int m_IconState; // state of the status icon
BOOL m_Message; // does the user have a new message?
BOOL m_Suspend; // should apps be suspended?
int m_ContextItem; // item selected for context menu
HINSTANCE m_hIdleDll; // handle to dll for user idle
int m_nIconState; // state of the status icon
BOOL m_bMessage; // does the user have a new message?
BOOL m_bSuspend; // should apps be suspended?
int m_nContextItem; // item selected for context menu
void SetStatusIcon(DWORD);
void SaveUserSettings();
@ -238,6 +260,7 @@ protected:
afx_msg void OnCommandHelpAbout();
afx_msg void OnCommandProjectRelogin();
afx_msg void OnCommandProjectQuit();
afx_msg void OnCommandFileShowGraphics();
afx_msg void OnCommandFileClearInactive();
afx_msg void OnCommandFileClearMessages();
afx_msg void OnCommandHide();
@ -261,8 +284,8 @@ class CLoginDialog : public CDialog
public:
CLoginDialog(UINT, LPCTSTR, LPCTSTR);
afx_msg BOOL OnInitDialog();
CString m_url;
CString m_auth;
CString m_strUrl;
CString m_strAuth;
protected:
afx_msg void OnOK();
@ -279,7 +302,7 @@ class CQuitDialog : public CDialog
public:
CQuitDialog(UINT);
afx_msg BOOL OnInitDialog();
int m_sel;
int m_nSel;
protected:
afx_msg void OnOK();