⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wxcasprefs.cpp

📁 电驴的MAC源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Name:         wxCasPrefs Class////// Purpose:      Display user preferences dialog and manage configuration storage system////// Author:       ThePolish <thepolish@vipmail.ru>////// Copyright (C) 2004 by ThePolish////// Derived from CAS by Pedro de Oliveira <falso@rdk.homeip.net>////// Pixmats from aMule http://www.amule.org////// This program is free software; you can redistribute it and/or modify///  it under the terms of the GNU General Public License as published by/// the Free Software Foundation; either version 2 of the License, or/// (at your option) any later version.////// 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 General Public License/// along with this program; if not, write to the/// Free Software Foundation, Inc.,/// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// For compilers that support precompilation, includes "wx/wx.h"#ifdef __BORLANDC__ #pragma hdrstop#endif// For all others, include the necessary headers#ifndef WX_PRECOMP #include "wx/wx.h"#endif#include <wx/config.h>#include "wxcasprefs.h"#include "wxcascte.h"#include "wxcasframe.h"// ConstructorWxCasPrefs::WxCasPrefs ( wxWindow * parent ) : wxDialog ( parent, -1,		        wxString ( _		                   ( "Preferences" ) ) ){	// Prefs	wxConfigBase * prefs = wxConfigBase::Get();	// Main vertical Sizer	m_mainVBox = new wxBoxSizer ( wxVERTICAL );	// OS Path	m_osPathSBox =	    new wxStaticBox ( this, -1, _( "Directory containing amulesig.dat file" ) );	m_osPathSBoxSizer = new wxStaticBoxSizer ( m_osPathSBox, wxHORIZONTAL );	m_osPathTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString );	m_osPathBrowseButton =	    new wxButton ( this, ID_OSPATH_BROWSE_BUTTON, wxString ( _( "Browse" ) ) );	wxString str;	prefs->Read ( WxCasCte::AMULESIG_PATH_KEY, &str,	              WxCasCte::DEFAULT_AMULESIG_PATH );	// Text extent	wxInt32 charExtent, y;	m_osPathTextCtrl->GetTextExtent ( wxT( "8" ), &charExtent, &y );	m_osPathTextCtrl->SetSize ( wxSize ( charExtent * ( str.Length () + 1 ), -1 ) );	m_osPathTextCtrl->SetValue ( str );	m_osPathTextCtrl->	SetToolTip ( _	             ( "Enter here the directory where your amulesig.dat file is" ) );	m_osPathSBoxSizer->Add ( m_osPathTextCtrl, 1, wxALL | wxALIGN_CENTER, 5 );	m_osPathSBoxSizer->Add ( m_osPathBrowseButton, 0, wxALL | wxALIGN_CENTER, 5 );	m_mainVBox->Add ( m_osPathSBoxSizer, 0, wxGROW | wxALIGN_CENTER | wxALL, 10 );	// Refresh rate	m_refreshSBox = new wxStaticBox ( this, -1, wxEmptyString );	m_refreshSBoxSizer = new wxStaticBoxSizer ( m_refreshSBox, wxHORIZONTAL );	m_refreshSpinButton = new wxSpinCtrl ( this, -1 );	m_refreshSpinButton->SetRange ( WxCasCte::MIN_REFRESH_RATE,	                                WxCasCte::MAX_REFRESH_RATE );	m_refreshSpinButton->SetValue ( prefs->	                                Read ( WxCasCte::REFRESH_RATE_KEY,	                                       WxCasCte::DEFAULT_REFRESH_RATE ) );	m_refreshStaticText =	    new wxStaticText ( this, -1, _( "Refresh rate interval in seconds" ), wxDefaultPosition,	                       wxDefaultSize, wxALIGN_CENTRE );	m_refreshSBoxSizer->Add ( m_refreshSpinButton, 0, wxALL | wxALIGN_CENTER, 5 );	m_refreshSBoxSizer->Add ( m_refreshStaticText, 1, wxALL | wxALIGN_CENTER, 5 );	m_mainVBox->Add ( m_refreshSBoxSizer, 0, wxGROW | wxALIGN_CENTER | wxALL,	                  10 );	// Auto generate stat image	m_autoStatImgSBox = new wxStaticBox ( this, -1, wxEmptyString );	m_autoStatImgSBoxSizer =	    new wxStaticBoxSizer ( m_autoStatImgSBox, wxVERTICAL );	m_autoStatImgCheck =	    new wxCheckBox ( this, ID_AUTOSTATIMG_CHECK,	                     _	                     ( "Generate a stat image at every refresh event" ) );	m_autoStatImgSBoxSizer->Add ( m_autoStatImgCheck, 0,	                              wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 );	m_autoStatImgHBoxSizer = new wxBoxSizer ( wxHORIZONTAL );	wxString strs[] =	    {	        wxT ( "PNG" ), wxT ( "JPG" ), wxT ( "BMP" ) };	m_autoStatImgCombo =	    new wxComboBox ( this, ID_AUTOSTATIMG_COMBO,	                     prefs->	                     Read ( WxCasCte::AUTOSTATIMG_TYPE_KEY,	                            WxCasCte::DEFAULT_AUTOSTATIMG_TYPE ),	                     wxDefaultPosition, wxDefaultSize, 3, strs,	                     wxCB_DROPDOWN | wxCB_READONLY );	m_autoStatImgTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString );	m_autoStatImgTextCtrl->SetValue ( prefs->	                                  Read ( WxCasCte::AUTOSTATIMG_DIR_KEY,	                                         WxCasCte::DEFAULT_AUTOSTATIMG_PATH ) );	m_autoStatImgTextCtrl->	SetToolTip ( _	             ( "Enter here the directory where you want to generate the statistic image" ) );	m_autoStatImgButton =	    new wxButton ( this, ID_AUTOSTATIMG_BROWSE_BUTTON, wxString ( _( "Browse" ) ) );	m_autoStatImgHBoxSizer->Add ( m_autoStatImgCombo, 0, wxALIGN_CENTER | wxALL,	                              5 );	m_autoStatImgHBoxSizer->Add ( m_autoStatImgTextCtrl, 1,	                              wxALIGN_CENTER | wxALL, 5 );	m_autoStatImgHBoxSizer->Add ( m_autoStatImgButton, 0, wxALIGN_CENTER | wxALL,	                              5 );	m_autoStatImgSBoxSizer->Add ( m_autoStatImgHBoxSizer, 0,	                              wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 );	m_mainVBox->Add ( m_autoStatImgSBoxSizer, 0, wxGROW | wxALIGN_CENTER | wxALL,	                  5 );	// Auto FTP update stat image	m_ftpUpdateSBox = new wxStaticBox ( this, -1, wxEmptyString );	m_ftpUpdateSBoxSizer =	    new wxStaticBoxSizer ( m_ftpUpdateSBox, wxVERTICAL );	// Check	m_ftpUpdateCheck =	    new wxCheckBox ( this, ID_FTP_UPDATE_CHECK,	                     _	                     ( "Upload periodicaly your stat image to FTP server" ) );	m_ftpUpdateSBoxSizer->Add ( m_ftpUpdateCheck, 0,	                            wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 );	// Grid size	m_ftpUpdateGridSizer = new wxGridSizer( 2 );	// FTP Static text	m_ftpUrlStaticText = new wxStaticText ( this, -1, _( "FTP Url" ) );	m_ftpUpdateGridSizer->Add ( m_ftpUrlStaticText, 1,	                            wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 5 );	m_ftpPathStaticText = new wxStaticText ( this, -1, _( "FTP Path" ) );	m_ftpUpdateGridSizer->Add ( m_ftpPathStaticText, 1,	                            wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 5 );	// Url	m_ftpUrlTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString );	m_ftpUrlTextCtrl->SetValue ( prefs->	                             Read ( WxCasCte::FTP_URL_KEY,	                                    WxCasCte::DEFAULT_FTP_URL ) );	m_ftpUrlTextCtrl->	SetToolTip ( _	             ( "Enter here the URL of your FTP server" ) );	m_ftpUpdateGridSizer->Add ( m_ftpUrlTextCtrl, 1,	                            wxGROW | wxALIGN_LEFT | wxALIGN_TOP | wxALL, 5 );	// Path	m_ftpPathTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString );	m_ftpPathTextCtrl->SetValue ( prefs->	                              Read ( WxCasCte::FTP_PATH_KEY,	                                     WxCasCte::DEFAULT_FTP_PATH ) );	m_ftpPathTextCtrl->	SetToolTip ( _	             ( "Enter here the directory where putting your stat image on FTP server" ) );	m_ftpUpdateGridSizer->Add ( m_ftpPathTextCtrl, 1,	                            wxGROW | wxALIGN_LEFT | wxALIGN_TOP | wxALL, 5 );	// Login Static text	m_ftpUserStaticText = new wxStaticText ( this, -1, _( "User" ) );	m_ftpUpdateGridSizer->Add ( m_ftpUserStaticText, 1,	                            wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 5 );	m_ftpPasswdStaticText = new wxStaticText ( this, -1, _( "Password" ) );	m_ftpUpdateGridSizer->Add ( m_ftpPasswdStaticText, 1,	                            wxALIGN_LEFT | wxALIGN_BOTTOM | wxALL, 5 );	// User	m_ftpUserTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString );	m_ftpUserTextCtrl->SetValue ( prefs->	                              Read ( WxCasCte::FTP_USER_KEY,	                                     WxCasCte::DEFAULT_FTP_USER ) );	m_ftpUserTextCtrl->	SetToolTip ( _	             ( "Enter here the User name to log into your FTP server" ) );	m_ftpUpdateGridSizer->Add ( m_ftpUserTextCtrl, 1,	                            wxGROW | wxALIGN_LEFT | wxALIGN_TOP | wxALL, 5 );	// Passwd	m_ftpPasswdTextCtrl = new wxTextCtrl ( this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );	m_ftpPasswdTextCtrl->SetValue ( prefs->	                                Read ( WxCasCte::FTP_PASSWD_KEY,	                                       WxCasCte::DEFAULT_FTP_PASSWD ) );	m_ftpPasswdTextCtrl->	SetToolTip ( _	             ( "Enter here the User password to log into your FTP server" ) );	m_ftpUpdateGridSizer->Add ( m_ftpPasswdTextCtrl, 1,	                            wxGROW | wxALIGN_LEFT | wxALIGN_TOP | wxALL, 5 );	// Add to static sizer	m_ftpUpdateSBoxSizer->Add ( m_ftpUpdateGridSizer, 1,	                            wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5 );	// Upload rate

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -