📄 wxcasframe.cpp
字号:
#endif status = _( "aMule is running" ); } //both disconnected else if ( (m_aMuleSig->GetAmuleState () == 0) && (m_aMuleSig->GetKadState () == 0)) { // Stat line 2 newline = MakeStatLine_2(); m_statLine_2->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 3 newline = MakeStatLine_3(); m_statLine_3->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 4 newline = MakeStatLine_4(); m_statLine_4->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 5 newline = MakeStatLine_5(); m_statLine_5->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 6 newline = MakeStatLine_6(); m_statLine_6->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 7 newline = MakeStatLine_7(); m_statLine_7->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Hits line 1 if ( m_aMuleSig->IsSessionMaxDlChanged() ) { newline = MakeHitsLine_1(); m_hitLine->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); } // Hits line 2 if ( m_aMuleSig->IsAbsoluteMaxDlChanged() ) { newline = MakeHitsLine_2(); m_absHitLine->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Save new records SaveAbsoluteHits(); }#ifdef __LINUX__ // System monitoring on Linux newline = MakeSysLine_1(); m_sysLine_1->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); newline = MakeSysLine_2(); m_sysLine_2->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount );#endif status = _( "aMule is running, but disconnected" ); } // aMule is connecting else if ( m_aMuleSig->GetAmuleState () == 2 ) { // Stat line 2 newline = MakeStatLine_2(); m_statLine_2->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 3 newline = MakeStatLine_3(); m_statLine_3->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 4 newline = MakeStatLine_4(); m_statLine_4->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 5 newline = MakeStatLine_5(); m_statLine_5->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 6 newline = MakeStatLine_6(); m_statLine_6->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Stat line 7 newline = MakeStatLine_7(); m_statLine_7->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Hits line 1 if ( m_aMuleSig->IsSessionMaxDlChanged() ) { newline = MakeHitsLine_1(); m_hitLine->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); } // Hits line 2 if ( m_aMuleSig->IsAbsoluteMaxDlChanged() ) { newline = MakeHitsLine_2(); m_absHitLine->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); // Save new records SaveAbsoluteHits(); }#ifdef __LINUX__ // System monitoring on Linux newline = MakeSysLine_1(); m_sysLine_1->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount ); newline = MakeSysLine_2(); m_sysLine_2->SetLabel ( newline ); newMaxLineCount = GetMaxUInt( newline.Length (), newMaxLineCount );#endif status = _( "aMule is connecting..." ); } // aMule status is unknown else { status = _( "Oh Oh, aMule status is unknown..." ); } Thaw (); // Set status bar SetStatusText ( status ); // Resize only if needed if ( m_maxLineCount != newMaxLineCount ) { m_maxLineCount = newMaxLineCount; return ( TRUE ); } else { return ( FALSE ); }}// Refresh period changingboolWxCasFrame::ChangeRefreshPeriod( const int newPeriod ){ // As the user can stop it, we must let it in the same state // it was before changing period bool wasRunning = FALSE; if ( m_refresh_timer->IsRunning() ) { wasRunning = TRUE; } bool ok = m_refresh_timer->Start( newPeriod ); if ( ! wasRunning ) { m_refresh_timer->Stop(); } return ( ok );}// Ftp update period changingboolWxCasFrame::ChangeFtpUpdatePeriod( const int newPeriod ){ // As the user can stop it, we must let it in the same state // it was before changing period bool wasRunning = FALSE; if ( m_ftp_update_timer->IsRunning() ) { wasRunning = TRUE; } bool ok = m_ftp_update_timer->Start( newPeriod ); if ( ! wasRunning ) { m_ftp_update_timer->Stop(); } return ( ok );}// Set amulesig.dat filevoidWxCasFrame::SetAmuleSigFile( const wxFileName& file ){ m_aMuleSig->SetAmuleSig ( file );}wxStringWxCasFrame::MakeStatLine_1() const{ wxString newline; if ( m_aMuleSig->GetAmuleState () == 1 || m_aMuleSig->GetKadState () == 1 || m_aMuleSig->GetKadState () == 2 ) { newline = _( "aMule " ) + m_aMuleSig->GetVersion () + _( " has been running for " ) + m_aMuleSig->GetRunTime (); } else if ( m_aMuleSig->GetUpStatus () == 0 ) { newline = _( "aMule " ) + m_aMuleSig->GetVersion () + _( " is stopped !" ); } else if ( m_aMuleSig->GetAmuleState () == 0 && m_aMuleSig->GetKadState () == 0 ) { newline = _( "aMule " ) + m_aMuleSig->GetVersion () + _( " is not connected !" ); } else if ( m_aMuleSig->GetAmuleState () == 2 ) { newline = _( "aMule " ) + m_aMuleSig->GetVersion () + _( " is connecting..." ); } else { newline = _( "aMule " ) + m_aMuleSig->GetVersion () + _( " is doing something strange, check it !" ); } return ( newline );}wxStringWxCasFrame::MakeStatLine_2() const{ wxString notTooLongName ( m_aMuleSig->GetServerName () ); if ( notTooLongName.Length() > 32 ) { notTooLongName = notTooLongName.Left( 32 ) + wxT( "..." ); } if ((m_aMuleSig->GetAmuleState () == 0) && (m_aMuleSig->GetKadState() == 0)){ wxString newline = m_aMuleSig->GetUser () + _( " is not connected !" ); return ( newline ); } if (m_aMuleSig->GetAmuleState () == 0) { wxString newline = m_aMuleSig->GetUser () + _( " is connected to " ) + _( " Kad: " ); if(m_aMuleSig->GetKadState() == 2) { newline += _( "ok" ); } else if (m_aMuleSig->GetKadState() == 1) { newline += _( "firewalled" ); } else { newline += _( "off" ); } return ( newline ); } else { wxString newline = m_aMuleSig->GetUser () + _( " is on " ) + notTooLongName + wxT( " [" ) + m_aMuleSig->GetServerIP () + wxT( ":" ) + m_aMuleSig->GetServerPort () + wxT( "]" ) + _( " with " ) + m_aMuleSig->GetConnexionIDType () + wxT( " |" ) + _( " Kad: " ); if(m_aMuleSig->GetKadState() == 2) { newline += _( "ok" ); } else if (m_aMuleSig->GetKadState() == 1) { newline += _( "firewalled" ); } else { newline += _( "off" ); } return ( newline ); }}wxStringWxCasFrame::MakeStatLine_3() const{ wxString newline = _( "Total Download: " ) + m_aMuleSig->GetConvertedTotalDL () + _( ", Upload: " ) + m_aMuleSig->GetConvertedTotalUL (); return ( newline );}wxStringWxCasFrame::MakeStatLine_4() const{ wxString newline = _( "Session Download: " ) + m_aMuleSig->GetConvertedSessionDL () + _( ", Upload: " ) + m_aMuleSig->GetConvertedSessionUL (); return ( newline );}wxStringWxCasFrame::MakeStatLine_5() const{ wxString newline = _( "Download: " ) + m_aMuleSig->GetDLRate () + _( " kB/s, Upload: " ) + m_aMuleSig->GetULRate () + _( " kB/s" ); return ( newline );}wxStringWxCasFrame::MakeStatLine_6() const{ wxString newline = _( "Sharing: " ) + m_aMuleSig->GetSharedFiles () + _( " file(s), Clients on queue: " ) + m_aMuleSig->GetQueue (); return ( newline );}wxStringWxCasFrame::MakeStatLine_7() const{ wxDateTime now = wxDateTime::Now(); wxString newline = _( "Time: " ) + now.Format( wxDefaultDateTimeFormat , wxDateTime::Local ); return ( newline );}wxStringWxCasFrame::MakeHitsLine_1() const{ wxString newline = wxString::Format ( _( "%.2f kB/s" ), m_aMuleSig->GetSessionMaxDL () ) + _( " on " ) + m_aMuleSig->GetSessionMaxDlDate().Format( wxT( "%c" ) ); return ( newline );}wxStringWxCasFrame::MakeHitsLine_2() const{ wxString newline = wxString::Format ( _( "%.2f kB/s" ), m_aMuleSig->GetAbsoluteMaxDL() ) + _( " on " ) + m_aMuleSig->GetAbsoluteMaxDlDate().Format( wxT( "%c" ) ); return ( newline );}#ifdef __LINUX__ // System monitoring on LinuxwxStringWxCasFrame::MakeSysLine_1() const{ wxString newline = _( "System Load Average (1-5-15 min): " ) + m_sysMonitor->GetSysLoad_1 () + wxT( " " ) + m_sysMonitor->GetSysLoad_5 () + wxT( " " ) + m_sysMonitor->GetSysLoad_15 (); return ( newline );}wxStringWxCasFrame::MakeSysLine_2() const{ wxString newline = _( "System uptime: " ) + m_sysMonitor->GetUptime (); return ( newline );}#endifvoid WxCasFrame::SaveAbsoluteHits(){ wxConfigBase * prefs = wxConfigBase::Get(); prefs->Write( WxCasCte::ABSOLUTE_MAX_DL_KEY, ( long ) ( 1024.0 * m_aMuleSig->GetAbsoluteMaxDL() ) ); prefs->Write( WxCasCte::ABSOLUTE_MAX_DL_DATE_KEY, ( long ) ( m_aMuleSig->GetAbsoluteMaxDlDate().GetTicks() ) ); prefs->Flush();}// File_checked_for_headers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -