📄 about.cpp
字号:
/*
* Funambol is a mobile platform developed by Funambol, Inc.
* Copyright (C) 2003 - 2007 Funambol, Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by
* the Free Software Foundation with the addition of the following permission
* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
* WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program; if not, see http://www.gnu.org/licenses or write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*
* You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite
* 305, Redwood City, CA 94063, USA, or at email address info@funambol.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License
* version 3, these Appropriate Legal Notices must retain the display of the
* "Powered by Funambol" logo. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display
* the words "Powered by Funambol".
*/
// About.cpp : implementation file
//
#include "stdafx.h"
#include "ui.h"
#include "About.h"
#include "customization.h"
#include "pim/ClientSettings.h"
#include "ClientUtil.h"
#include "LogLevelSettings.h"
#include "DeviceInfo.h"
#if defined(WIN32_PLATFORM_WFSP)
#define VPADDING 5
#else
#define VPADDING 17
#endif
// CAbout dialog
IMPLEMENT_DYNAMIC(CAbout, CDialog)
CAbout::CAbout(CWnd* pParent /*=NULL*/)
: CDialog(CAbout::IDD, pParent)
{
EEG = 0;
}
CAbout::~CAbout()
{
}
void CAbout::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_ABOUT_MSG, staticAboutMsg);
// DDX_Control(pDX, IDC_APP_LINK, appLink);
}
BEGIN_MESSAGE_MAP(CAbout, CDialog)
//#if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
ON_WM_SIZE()
//#endif
ON_WM_CTLCOLOR()
ON_WM_VSCROLL()
//ON_WM_PAINT()
//ON_COMMAND(ID_SILENT, &CAbout::EE)
ON_COMMAND(ID_MENU_DEVICEINFO, &CAbout::OnDeviceInfo)
ON_COMMAND(ID_MENU_LOGGING, &CAbout::OnMenuLogging)
END_MESSAGE_MAP()
// CAbout message handlers
void CAbout::EE(){
++EEG;
if(EEG == 10){
CString s2;
s2.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_SILENT);
SetDlgItemText(IDC_ABOUT_MSG, s2);
}
}
void CAbout::OnDeviceInfo(){
CDeviceInfo wnd;
INT_PTR result = wnd.DoModal();
}
void CAbout::OnMenuLogging(){
CLoglevelSettings wnd;
INT_PTR result = wnd.DoModal();
if (result == 5) {
EndDialog(0);
}
}
void CAbout::OnAppLink(){
SHELLEXECUTEINFO lpExecInfo;
memset(&lpExecInfo, 0, sizeof(SHELLEXECUTEINFO));
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
CString site("http://");
site += APP_LINK;
lpExecInfo.lpFile = site;
lpExecInfo.nShow = SW_SHOWNORMAL;
lpExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.lpVerb = _T("open");
ShellExecuteEx(&lpExecInfo);
ZeroMemory(&lpExecInfo, sizeof(SHELLEXECUTEINFO));
}
#if defined (WIN32_PLATFORM_PSPC)
BOOL CAbout::PreTranslateMessage(MSG* pMsg){
bool bProcessed =false;
if( ( (pMsg->message == WM_KEYDOWN)|| (pMsg->message == WM_KEYUP))){
WORD wScrollNotify = 0xFFFF;
if ( resIdOld == IDD_UI_ABOUT_WIDE ){
if(pMsg->wParam == VK_RIGHT){
wScrollNotify = SB_LINEDOWN;
}else if (pMsg->wParam == VK_LEFT){
wScrollNotify = SB_LINEUP;
}
}else{
if(pMsg->wParam == VK_DOWN){
wScrollNotify = SB_LINEDOWN;
}else if (pMsg->wParam == VK_UP){
wScrollNotify = SB_LINEUP;
}
}
::SendMessage(GetSafeHwnd(), WM_VSCROLL, MAKELONG(wScrollNotify, 0), 0L);
};
if(bProcessed)
return TRUE;
else
return CDialog::PreTranslateMessage(pMsg);
}
#endif
BOOL CAbout::OnInitDialog()
{
CString s1;
// set window text title
s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_ABOUT); SetWindowText(s1);
CDialog::OnInitDialog();
ZeroMemory(&dlgCommandBar, sizeof(SHMENUBARINFO));
dlgCommandBar.cbSize = sizeof(SHMENUBARINFO);
dlgCommandBar.hwndParent = this->GetSafeHwnd();
dlgCommandBar.dwFlags = SHCMBF_HMENU;
dlgCommandBar.nToolBarId = IDM_SK1_CLOSE;
dlgCommandBar.hInstRes = getLocalizationUtils()->getLocaleResource();
dlgCommandBar.nBmpId = 0;
dlgCommandBar.cBmpImages = 0;
if(!SHCreateMenuBar(&dlgCommandBar)){
TRACE(_T("Cannot create command bar!"));
return FALSE;
};
//
// Manage the vertical scrolling-bar
//
GetWindowRect(&dlgRect);
scrollbarPosition = 0; // reset bar position
// Get the position of the bottom object of the dialog,
// the max scrollbar height is derived from this.
// *** NOTE: CHANGE IT IF THE OBJECT POSITION CHANGES! ***
CRect aboutmessageRect;
GetDlgItem(IDC_ABOUT_CR)->GetClientRect(&aboutmessageRect);
// 5 = some space
// dlgMaxHeight = aboutmessageRect.bottom - dlgRect.top + 5;
// Set all scrollbar parameters
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL; // SIF_ALL = SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS;
si.nMin = 0;
si.nMax = dlgMaxHeight;
si.nPage = dlgRect.Height();
si.nPos = 0;
SetScrollInfo(SB_VERT, &si, TRUE);
s1="";
aboutMessage="";
versionMessage="";
//load the device info
HKEY key;
long err=0;
ULONG dim;
TCHAR *buf = NULL;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("\\Software\\") ROOT_CONTEXT_W,
0, KEY_READ, &key);
if(key != 0)
{
// Get value length
err = RegQueryValueEx(key, PLUGIN_VERSION, NULL, NULL, NULL, &dim);
if (err == ERROR_SUCCESS) {
if (dim > 0) {
buf = new TCHAR[dim + 1];
err = RegQueryValueEx(key, PLUGIN_VERSION, NULL, NULL,(UCHAR*)buf, &dim);
}
}
}
s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_ABOUT_MSG1);
s1 = escapeAmpString(s1);
CString s2(buf);
if(s2 != ""){
s1+=s2;
s1+="\n\n";
}
RegCloseKey(key);
if(buf){
delete [] buf; buf = NULL;
}
aboutMessage += s1;
//load copyright
if(FUNOPT_SHOW_DEV_INFO){
WCHAR wszMachineName[128];
SystemParametersInfo(SPI_GETOEMINFO, sizeof(wszMachineName),
&wszMachineName, 0);
WCHAR tst[500];
wsprintf(tst,L"%s",wszMachineName);
s1 ="";
s1.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_DEVICE);
s1 += ": ";
s1 += tst;
s1 += "\n";
s2.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_SETTCOMM_DEVID);
s1 += s2;
s1 += " ";
s1 += getRegConfig()->getDeviceConfig().getDevID();
s1 += "\n";
s2.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_SETTCOMM_CURRIP);
s1 += s2;
s1 += " ";
s1 += getRegConfig()->getIp().c_str();
s1 += "\n";
aboutMessage += s1;
}
// load plugin version from Registry
if(FUNOPT_SHOW_COPYRIGHT){
versionMessage += "\n";
s2.LoadString(getLocalizationUtils()->getLocaleResource(), IDS_ABOUT_MSG2);
versionMessage += s2;
}
SetDlgItemText(IDC_ABOUT_MSG, aboutMessage);
SetDlgItemText(IDC_ABOUT_MSG2, versionMessage);
GetDlgItem(IDC_ABOUT_MSG)->SetFont(&fontBold);
// set image position
CRect rectImage;
CRect rectClient;
int x = 0;
GetClientRect(&rectClient);
GetDlgItem(IDC_IMG_FUNLOGO)->GetClientRect(&rectImage);
x = (rectClient.Width()/2) - (rectImage.Width()/2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -