2004-05-17 22:15:10 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
2004-05-17 22:15:10 +00:00
|
|
|
// Revision History:
|
|
|
|
//
|
|
|
|
// $Log$
|
2004-09-21 01:30:29 +00:00
|
|
|
// Revision 1.9 2004/09/21 01:26:23 rwalton
|
|
|
|
// *** empty log message ***
|
|
|
|
//
|
2004-05-27 06:17:58 +00:00
|
|
|
// Revision 1.8 2004/05/27 06:17:57 rwalton
|
|
|
|
// *** empty log message ***
|
|
|
|
//
|
2004-05-21 06:27:15 +00:00
|
|
|
// Revision 1.7 2004/05/21 06:27:14 rwalton
|
|
|
|
// *** empty log message ***
|
|
|
|
//
|
2004-05-17 22:15:10 +00:00
|
|
|
// Revision 1.6 2004/05/17 22:15:08 rwalton
|
|
|
|
// *** empty log message ***
|
|
|
|
//
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "BOINCGUIApp.h"
|
|
|
|
#endif
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#include "stdwx.h"
|
2004-04-11 04:12:44 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainFrame.h"
|
|
|
|
#include "MainDocument.h"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_APP(CBOINCGUIApp)
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CBOINCGUIApp, wxApp)
|
|
|
|
|
|
|
|
|
|
|
|
bool CBOINCGUIApp::OnInit()
|
|
|
|
{
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
SetVendorName("Space Sciences Laboratory, U.C. Berkeley");
|
|
|
|
SetAppName("BOINC Manager");
|
|
|
|
|
|
|
|
// Commandline parsing is done in wxApp::OnInit()
|
|
|
|
if (!Inherited::OnInit())
|
|
|
|
return false;
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
// Enable image types we use for the task panes
|
|
|
|
wxImage::AddHandler(new wxXPMHandler);
|
|
|
|
|
|
|
|
// Enable the in memory virtual file system for
|
|
|
|
// storing images
|
|
|
|
wxFileSystem::AddHandler(new wxMemoryFSHandler);
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// Initialize the internationalization module
|
|
|
|
m_pLocale = new wxLocale();
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pLocale);
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
m_pLocale->Init();
|
|
|
|
m_pLocale->AddCatalog(GetAppName());
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
// Initialize the configuration storage module
|
|
|
|
m_pConfig = new wxConfig(wxTheApp->GetAppName());
|
2004-05-27 06:17:58 +00:00
|
|
|
wxConfigBase::Set(m_pConfig);
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pConfig);
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
// Initialize the main document
|
|
|
|
m_pDocument = new CMainDocument();
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pDocument);
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
// Initialize the main gui window
|
|
|
|
m_pFrame = new CMainFrame(GetAppName());
|
2004-05-21 06:27:15 +00:00
|
|
|
wxASSERT(NULL != m_pFrame);
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
SetTopWindow(m_pFrame);
|
|
|
|
m_pFrame->Show();
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int CBOINCGUIApp::OnExit()
|
|
|
|
{
|
|
|
|
if (m_pDocument)
|
|
|
|
delete m_pDocument;
|
|
|
|
|
|
|
|
if (m_pLocale)
|
|
|
|
delete m_pLocale;
|
|
|
|
|
|
|
|
return Inherited::OnExit();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CBOINCGUIApp::OnInitCmdLine(wxCmdLineParser &parser)
|
|
|
|
{
|
|
|
|
Inherited::OnInitCmdLine(parser);
|
|
|
|
static const wxCmdLineEntryDesc cmdLineDesc[] = {
|
|
|
|
{ wxCMD_LINE_SWITCH, "e", "example", "example command line option"},
|
|
|
|
{ wxCMD_LINE_NONE} //DON'T forget this line!!
|
|
|
|
};
|
|
|
|
parser.SetDesc(cmdLineDesc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CBOINCGUIApp::OnCmdLineParsed(wxCmdLineParser &parser)
|
|
|
|
{
|
|
|
|
// Give default processing (-?, --help and --verbose) the chance to do something.
|
|
|
|
Inherited::OnCmdLineParsed(parser);
|
|
|
|
if (parser.Found("example")) {
|
2004-04-11 05:42:55 +00:00
|
|
|
|
|
|
|
wxMessageDialog* pDlg = new wxMessageDialog(
|
|
|
|
NULL,
|
|
|
|
_("You have specified -e on the commmand line. The application will exit now."),
|
|
|
|
_("Example command line option"),
|
|
|
|
wxOK | wxICON_INFORMATION,
|
|
|
|
wxDefaultPosition
|
|
|
|
);
|
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
if (pDlg)
|
|
|
|
pDlg->ShowModal();
|
2004-04-11 05:42:55 +00:00
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
// Log a message, but only if --verbose has been set on the command line.
|
|
|
|
wxLogVerbose("Commandline has been parsed. -e was not found.");
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|