Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

WizardInterfacePage.cpp

Go to the documentation of this file.
00001 //
00002 // WizardInterfacePage.cpp
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "Settings.h"
00025 #include "WizardInterfacePage.h"
00026 #include "WndMain.h"
00027 #include "Skin.h"
00028 #include "ShareazaURL.h"
00029 
00030 #ifdef _DEBUG
00031 #define new DEBUG_NEW
00032 #undef THIS_FILE
00033 static char THIS_FILE[] = __FILE__;
00034 #endif
00035 
00036 IMPLEMENT_DYNCREATE(CWizardInterfacePage, CWizardPage)
00037 
00038 BEGIN_MESSAGE_MAP(CWizardInterfacePage, CWizardPage)
00039         //{{AFX_MSG_MAP(CWizardInterfacePage)
00040         ON_WM_LBUTTONDOWN()
00041         //}}AFX_MSG_MAP
00042 END_MESSAGE_MAP()
00043 
00044 
00046 // CWizardInterfacePage property page
00047 
00048 CWizardInterfacePage::CWizardInterfacePage() : CWizardPage(CWizardInterfacePage::IDD)
00049 {
00050         //{{AFX_DATA_INIT(CWizardInterfacePage)
00051         m_bExpert                               = Settings.General.GUIMode != GUI_BASIC;
00052         m_bSimpleDownloadBars   = Settings.Downloads.SimpleBar;
00053         m_bTorrentInterface             = Settings.BitTorrent.AdvancedInterface;
00054         m_bHandleTorrents               = Settings.Web.Torrent;
00055         //}}AFX_DATA_INIT
00056 }
00057 
00058 CWizardInterfacePage::~CWizardInterfacePage()
00059 {
00060 }
00061 
00062 void CWizardInterfacePage::DoDataExchange(CDataExchange* pDX)
00063 {
00064         CPropertyPage::DoDataExchange(pDX);
00065         //{{AFX_DATA_MAP(CWizardInterfacePage)
00066         DDX_Control(pDX, IDC_DESCRIPTION_1, m_wndDescription1);
00067         DDX_Control(pDX, IDC_DESCRIPTION_0, m_wndDescription0);
00068         DDX_Control(pDX, IDC_INTERFACE_1, m_wndInterface1);
00069         DDX_Control(pDX, IDC_INTERFACE_0, m_wndInterface0);
00070         DDX_Radio(pDX, IDC_INTERFACE_0, m_bExpert);
00071         DDX_Check(pDX, IDC_DOWNLOADS_SIMPLEBAR, m_bSimpleDownloadBars);
00072         DDX_Check(pDX, IDC_TORRENT_INTERFACE, m_bTorrentInterface);
00073         DDX_Check(pDX, IDC_URI_TORRENT, m_bHandleTorrents);
00074         //}}AFX_DATA_MAP
00075 }
00076 
00078 // CWizardInterfacePage message handlers
00079 
00080 BOOL CWizardInterfacePage::OnInitDialog()
00081 {
00082         CWizardPage::OnInitDialog();
00083 
00084         Skin.Apply( _T("CWizardInterfacePage"), this );
00085 
00086         m_bExpert                               = Settings.General.GUIMode != GUI_BASIC;
00087         m_bSimpleDownloadBars   = Settings.Downloads.SimpleBar;
00088         m_bTorrentInterface             = Settings.BitTorrent.AdvancedInterface;
00089         m_bHandleTorrents               = Settings.Web.Torrent;
00090 
00091         UpdateData( FALSE );
00092 
00093         m_wndInterface0.SetFont( &theApp.m_gdiFontBold );
00094         m_wndInterface1.SetFont( &theApp.m_gdiFontBold );
00095 
00096         return TRUE;
00097 }
00098 
00099 BOOL CWizardInterfacePage::OnSetActive()
00100 {
00101         SetWizardButtons( PSWIZB_BACK | PSWIZB_NEXT );
00102         return CWizardPage::OnSetActive();
00103 }
00104 
00105 void CWizardInterfacePage::OnLButtonDown(UINT nFlags, CPoint point)
00106 {
00107         CRect rc;
00108 
00109         ClientToScreen( &point );
00110 
00111         m_wndDescription0.GetWindowRect( &rc );
00112         if ( rc.PtInRect( point ) )
00113         {
00114                 m_wndInterface0.SetCheck( TRUE );
00115                 m_wndInterface0.SetCheck( FALSE );
00116         }
00117 
00118         m_wndDescription1.GetWindowRect( &rc );
00119         if ( rc.PtInRect( point ) )
00120         {
00121                 m_wndInterface0.SetCheck( FALSE );
00122                 m_wndInterface1.SetCheck( TRUE );
00123         }
00124 
00125         CWizardPage::OnLButtonDown(nFlags, point);
00126 }
00127 
00128 LRESULT CWizardInterfacePage::OnWizardNext()
00129 {
00130         UpdateData( TRUE );
00131 
00132         Settings.Downloads.SimpleBar                    = m_bSimpleDownloadBars;
00133         Settings.BitTorrent.AdvancedInterface   = m_bTorrentInterface;
00134 
00135         if ( Settings.Web.Torrent != m_bHandleTorrents )
00136         {
00137                 Settings.Web.Torrent = m_bHandleTorrents;
00138                 CShareazaURL::Register();
00139         }
00140 
00141         CWaitCursor pCursor;
00142         CMainWnd* pMainWnd = (CMainWnd*)AfxGetMainWnd();
00143 
00144         if ( m_bExpert ) Settings.General.GUIMode = GUI_TABBED;
00145         else Settings.General.GUIMode = GUI_BASIC;
00146         pMainWnd->SetGUIMode( Settings.General.GUIMode, FALSE );
00147         
00148         Settings.Save();
00149 
00150         // If this system is capable of handling multiple networks, go to the network settings wizard.
00151         if ( ( theApp.m_bNT )                                                                                                   &&      // 9x based systems can't handle enough connections
00152                  ( !theApp.m_bLimitedConnections || Settings.General.IgnoreXPsp2 )      &&      // The connection rate limiting (XPsp2) makes multi-network performance awful
00153                  ( Settings.Connection.FirewallStatus == CONNECTION_OPEN )                      &&      // Firewalled users place a heavy load on other networks. (ED2K, in particular)
00154                  ( Settings.Connection.InSpeed > 256 )                                                          &&      // Must have a decent connection to be worth it. (Or extra traffic will slow downloads)
00155                  ( Settings.GetOutgoingBandwidth() > 16 ))                                                              // If your outbound bandwidth is too low, the ED2K ratio will throttle you anyway
00156                 return 0;
00157         else
00158                 return IDD_WIZARD_FINISHED;
00159 }

Generated on Thu Dec 15 10:39:51 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2