- MGR: Add the basic infrastructure for the up and comming news tab in

the advanced frame.
        
    clientgui/
        AdvancedFrame.cpp
        BOINCGUIApp.cpp
        Events.h
        stdwx.h
        ViewNews.cpp, .h (Added)
        ViewResources.cpp
    win_build/
        boincmgr_curl.vcproj

svn path=/trunk/boinc/; revision=17596
This commit is contained in:
Rom Walton 2009-03-13 19:53:32 +00:00
parent 42959eba07
commit 0e151ee5df
9 changed files with 277 additions and 14 deletions

View File

@ -3008,3 +3008,17 @@ Charlie 12 Mar 2009
BOINCBaseFrame.cpp, .h
BOINCGUIApp.cpp, .h
sg_BoincSimpleGUI.cpp, .h
Rom 13 Mar 2009
- MGR: Add the basic infrastructure for the up and comming news tab in
the advanced frame.
clientgui/
AdvancedFrame.cpp
BOINCGUIApp.cpp
Events.h
stdwx.h
ViewNews.cpp, .h (Added)
ViewResources.cpp
win_build/
boincmgr_curl.vcproj

View File

@ -45,6 +45,7 @@
#include "ViewMessages.h"
#include "ViewStatistics.h"
#include "ViewResources.h"
#include "ViewNews.h"
#include "DlgAbout.h"
#include "DlgOptions.h"
#include "DlgSelectComputer.h"
@ -655,6 +656,7 @@ bool CAdvancedFrame::RepopulateNotebook() {
CreateNotebookPage(new CViewMessages(m_pNotebook));
CreateNotebookPage(new CViewStatistics(m_pNotebook));
CreateNotebookPage(new CViewResources(m_pNotebook));
CreateNotebookPage(new CViewNews(m_pNotebook));
wxLogTrace(wxT("Function Start/End"), wxT("CAdvancedFrame::RepopulateNotebook - Function End"));
return true;

View File

@ -309,10 +309,12 @@ bool CBOINCGUIApp::OnInit() {
// Enable known image types
wxImage::AddHandler(new wxXPMHandler);
wxImage::AddHandler(new wxPNGHandler);
wxImage::AddHandler(new wxGIFHandler);
wxImage::AddHandler(new wxICOHandler);
wxInitAllImageHandlers();
// Enable additional file system type handlers
#if wxUSE_FS_INET && wxUSE_STREAMS && wxUSE_SOCKETS
wxFileSystem::AddHandler(new wxInternetFSHandler);
#endif
// Initialize the internationalization module

View File

@ -71,9 +71,10 @@
#define ID_LIST_WORKVIEW 7001
#define ID_LIST_TRANSFERSVIEW 7002
#define ID_LIST_MESSAGESVIEW 7003
#define ID_LIST_RESOURCEUTILIZATIONVIEW 7004
#define ID_LIST_STATISTICSVIEW 7005
#define ID_LIST_RESOURCEUTILIZATIONVIEWTOTAL 7006
#define ID_PIECTRL_RESOURCEUTILIZATIONVIEW 7004
#define ID_PIECTRL_RESOURCEUTILIZATIONVIEWTOTAL 7005
#define ID_LIST_STATISTICSVIEW 7006
#define ID_HTML_NEWSVIEW 7007
#define ID_TASK_BASE 8000
#define ID_TASK_PROJECTSVIEW 8000
#define ID_TASK_WORKVIEW 8001
@ -81,6 +82,7 @@
#define ID_TASK_MESSAGESVIEW 8003
#define ID_TASK_STATISTICSVIEW 8004
#define ID_TASK_RESOURCEUTILIZATIONVIEW 8005
#define ID_TASK_NEWSVIEW 8006
#define ID_TASK_PROJECT_UPDATE 9000
#define ID_TASK_PROJECT_SUSPEND 9002
#define ID_TASK_PROJECT_RESUME 9003
@ -110,6 +112,8 @@
#define ID_TASK_STATISTICS_MODEVIEW0 9610
#define ID_TASK_STATISTICS_MODEVIEW1 9611
#define ID_TASK_STATISTICS_MODEVIEW2 9612
#define ID_TASK_NEWS_BOINC 9700
#define ID_TASK_NEWS_BOINCWEBSITE 9701
#define ID_ANYDIALOG 10000
#endif

172
clientgui/ViewNews.cpp Normal file
View File

@ -0,0 +1,172 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "ViewNews.h"
#endif
#include "stdwx.h"
#include "BOINCGUIApp.h"
#include "BOINCBaseFrame.h"
#include "MainDocument.h"
#include "AdvancedFrame.h"
#include "BOINCTaskCtrl.h"
#include "ViewNews.h"
#include "Events.h"
#include "error_numbers.h"
#include "res/xfer.xpm"
IMPLEMENT_DYNAMIC_CLASS(CViewNews, CBOINCBaseView)
BEGIN_EVENT_TABLE (CViewNews, CBOINCBaseView)
EVT_BUTTON(ID_TASK_NEWS_BOINC, CViewNews::OnNewsBOINC)
EVT_BUTTON(ID_TASK_NEWS_BOINCWEBSITE, CViewNews::OnNewsBOINCWebsite)
END_EVENT_TABLE ()
CViewNews::CViewNews()
{}
CViewNews::CViewNews(wxNotebook* pNotebook) :
CBOINCBaseView(pNotebook)
{
CTaskItemGroup* pGroup = NULL;
CTaskItem* pItem = NULL;
//
// Setup View
//
wxFlexGridSizer* itemFlexGridSizer = new wxFlexGridSizer(2, 0, 0);
wxASSERT(itemFlexGridSizer);
itemFlexGridSizer->AddGrowableRow(0);
itemFlexGridSizer->AddGrowableCol(1);
m_pTaskPane = new CBOINCTaskCtrl(this, ID_TASK_NEWSVIEW, DEFAULT_TASK_FLAGS);
wxASSERT(m_pTaskPane);
m_pHtmlPane = new wxHtmlWindow(this, ID_HTML_NEWSVIEW, wxDefaultPosition, wxSize(640, -1), wxHW_SCROLLBAR_AUTO | wxHSCROLL | wxVSCROLL);
wxASSERT(m_pHtmlPane);
itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1);
itemFlexGridSizer->Add(m_pHtmlPane, 1, wxGROW|wxALL, 1);
SetSizer(itemFlexGridSizer);
Layout();
pGroup = new CTaskItemGroup( _("News Feeds") );
m_TaskGroups.push_back( pGroup );
pItem = new CTaskItem(
_("BOINC"),
_("Display the latest news about BOINC"),
ID_TASK_NEWS_BOINC
);
pGroup->m_Tasks.push_back( pItem );
pItem = new CTaskItem(
_("BOINC Website"),
_("Display the latest news about BOINC from the BOINC website"),
ID_TASK_NEWS_BOINCWEBSITE
);
pGroup->m_Tasks.push_back( pItem );
m_TaskGroups.push_back( pGroup );
// Create Task Pane Items
m_pTaskPane->UpdateControls();
// Display the BOINC website by default.
wxCommandEvent evt;
OnNewsBOINC(evt);
}
CViewNews::~CViewNews() {
}
wxString& CViewNews::GetViewName() {
static wxString strViewName(_("News"));
return strViewName;
}
wxString& CViewNews::GetViewDisplayName() {
static wxString strViewName(_("News"));
return strViewName;
}
const char** CViewNews::GetViewIcon() {
return xfer_xpm;
}
bool CViewNews::OnSaveState(wxConfigBase* WXUNUSED(pConfig)) {
return true;
}
bool CViewNews::OnRestoreState(wxConfigBase* WXUNUSED(pConfig)) {
return true;
}
void CViewNews::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
}
void CViewNews::OnNewsBOINC( wxCommandEvent& WXUNUSED(event) ) {
wxLogTrace(wxT("Function Start/End"), wxT("CViewNews::OnNewsBOINC - Function Begin"));
wxString strHTML = wxEmptyString;
wxString strNewsFile =
wxGetApp().GetRootDirectory() + wxFileName::GetPathSeparator() + wxT("news.html");
wxFFile f(strNewsFile.c_str());
if (f.IsOpened()) {
f.ReadAll(&strHTML);
f.Close();
} else {
strHTML.Printf (
wxT("<HTML><HEAD></HEAD><BODY>Could not open %s</BODY></HTML>"),
strNewsFile.c_str()
);
}
wxASSERT(m_pHtmlPane);
m_pHtmlPane->SetPage(strHTML);
wxLogTrace(wxT("Function Start/End"), wxT("CViewNews::OnNewsBOINC - Function End"));
}
void CViewNews::OnNewsBOINCWebsite( wxCommandEvent& WXUNUSED(event) ) {
wxLogTrace(wxT("Function Start/End"), wxT("CViewNews::OnNewsBOINCWebsite - Function Begin"));
wxASSERT(m_pHtmlPane);
m_pHtmlPane->LoadPage(wxT("http://boinc.berkeley.edu/"));
wxLogTrace(wxT("Function Start/End"), wxT("CViewNews::OnNewsBOINCWebsite - Function End"));
}

58
clientgui/ViewNews.h Normal file
View File

@ -0,0 +1,58 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#ifndef _VIEWNEWS_H_
#define _VIEWNEWS_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "ViewNews.cpp"
#endif
#include "BOINCBaseView.h"
class CViewNews : public CBOINCBaseView {
DECLARE_DYNAMIC_CLASS( CViewNews )
public:
CViewNews();
CViewNews(wxNotebook* pNotebook);
~CViewNews();
virtual wxString& GetViewName();
virtual wxString& GetViewDisplayName();
virtual const char** GetViewIcon();
void OnNewsBOINC( wxCommandEvent& event );
void OnNewsBOINCWebsite( wxCommandEvent& event );
protected:
wxHtmlWindow* m_pHtmlPane;
virtual bool OnSaveState( wxConfigBase* pConfig );
virtual bool OnRestoreState( wxConfigBase* pConfig );
virtual void OnListRender( wxTimerEvent& event );
DECLARE_EVENT_TABLE()
};
#endif

View File

@ -41,7 +41,6 @@ END_EVENT_TABLE ()
CViewResources::CViewResources()
{}
#define COLOR(c) wxColour(c>>16, (c>>8)&0xff, c&0xff)
CViewResources::CViewResources(wxNotebook* pNotebook) :
CBOINCBaseView(pNotebook)
{
@ -51,7 +50,7 @@ CViewResources::CViewResources(wxNotebook* pNotebook) :
wxASSERT(itemGridSizer);
// create pie chart ctrl for total disk usage
m_pieCtrlTotal = new wxPieCtrl(this, ID_LIST_RESOURCEUTILIZATIONVIEWTOTAL, wxDefaultPosition, wxSize(-1,-1));
m_pieCtrlTotal = new wxPieCtrl(this, ID_PIECTRL_RESOURCEUTILIZATIONVIEWTOTAL, wxDefaultPosition, wxSize(-1,-1));
wxASSERT(m_pieCtrlTotal);
// setup the legend
@ -72,7 +71,7 @@ CViewResources::CViewResources(wxNotebook* pNotebook) :
// create pie chart ctrl for BOINC disk usage
m_pieCtrlBOINC = new wxPieCtrl(this, ID_LIST_RESOURCEUTILIZATIONVIEW, wxDefaultPosition, wxSize(-1,-1));
m_pieCtrlBOINC = new wxPieCtrl(this, ID_PIECTRL_RESOURCEUTILIZATIONVIEW, wxDefaultPosition, wxSize(-1,-1));
wxASSERT(m_pieCtrlBOINC);
//setup the legend

View File

@ -109,6 +109,10 @@
#include <wx/grid.h>
#include <wx/thread.h>
#include <wx/imaglist.h>
#include <wx/html/htmlwin.h>
#include <wx/html/htmlproc.h>
#include <wx/fs_inet.h>
#ifdef _WIN32

View File

@ -74,7 +74,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxjpeg.lib wxtiff.lib wxzlib.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -270,7 +270,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxpngd.lib wxzlibd.lib boinc_dll.lib"
AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxjpegd.lib wxtiffd.lib wxpngd.lib wxzlibd.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="0"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -658,7 +658,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxpngd.lib wxzlibd.lib boinc_dll.lib"
AdditionalDependencies="MSVCRTD.LIB MSVCPRTD.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxmsw28d_html.lib wxregexd.lib wxexpatd.lib wxpngd.lib wxjpegd.lib wxtiffd.lib wxzlibd.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="0"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -848,7 +848,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxzlib.lib boinc_dll.lib"
AdditionalDependencies="MSVCRT.LIB MSVCPRT.LIB kernel32.lib user32.lib gdi32.lib ole32.lib oleacc.lib shell32.lib comdlg32.lib advapi32.lib oldnames.lib uuid.lib rpcrt4.lib comctl32.lib wsock32.lib wininet.lib wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxmsw28_adv.lib wxmsw28_core.lib wxmsw28_html.lib wxregex.lib wxexpat.lib wxpng.lib wxjpeg.lib wxtiff.lib wxzlib.lib boinc_dll.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;;&quot;$(WXWIN)\lib\vc_lib&quot;;&quot;$(WXWIN)\contrib\lib&quot;"
@ -3499,6 +3499,14 @@
RelativePath="..\clientgui\ViewMessages.h"
>
</File>
<File
RelativePath="..\clientgui\ViewNews.cpp"
>
</File>
<File
RelativePath="..\clientgui\ViewNews.h"
>
</File>
<File
RelativePath="..\clientgui\ViewProjects.cpp"
>