00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00040 ON_WM_LBUTTONDOWN()
00041
00042 END_MESSAGE_MAP()
00043
00044
00046
00047
00048 CWizardInterfacePage::CWizardInterfacePage() : CWizardPage(CWizardInterfacePage::IDD)
00049 {
00050
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
00056 }
00057
00058 CWizardInterfacePage::~CWizardInterfacePage()
00059 {
00060 }
00061
00062 void CWizardInterfacePage::DoDataExchange(CDataExchange* pDX)
00063 {
00064 CPropertyPage::DoDataExchange(pDX);
00065
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
00075 }
00076
00078
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
00151 if ( ( theApp.m_bNT ) &&
00152 ( !theApp.m_bLimitedConnections || Settings.General.IgnoreXPsp2 ) &&
00153 ( Settings.Connection.FirewallStatus == CONNECTION_OPEN ) &&
00154 ( Settings.Connection.InSpeed > 256 ) &&
00155 ( Settings.GetOutgoingBandwidth() > 16 ))
00156 return 0;
00157 else
00158 return IDD_WIZARD_FINISHED;
00159 }