comparison src/rsearcher.cpp @ 8:82f9af6aa7e4

add net.cpp
author pyon@macmini
date Tue, 30 Oct 2018 17:26:02 +0900
parents 29829e98d510
children ae89ce4793d8
comparison
equal deleted inserted replaced
7:29829e98d510 8:82f9af6aa7e4
1 // Filename : rsearcher.cpp 1 // Filename : rsearcher.cpp
2 // Last Change: 2018-10-26 ‹à 15:12:02. 2 // Last Change: 2018-10-30 ‰Î 11:19:28.
3 // 3 //
4 4
5 #include <wx/arrstr.h> 5 #include <wx/arrstr.h>
6 #include <wx/html/htmprint.h> 6 #include <wx/html/htmprint.h>
7 #include <wx/clipbrd.h> 7 #include <wx/clipbrd.h>
300 m_searchCtrl->SetFocus(); 300 m_searchCtrl->SetFocus();
301 } 301 }
302 302
303 void MainFrame::OnPasteSearch( wxCommandEvent& WXUNUSED(event) ) 303 void MainFrame::OnPasteSearch( wxCommandEvent& WXUNUSED(event) )
304 { 304 {
305 PasteSeaarch(); 305 m_textCtrlName->SetValue( wxEmptyString );
306 m_textCtrlAddr->SetValue( wxEmptyString );
307 m_dataViewListCtrl->DeleteAllItems();
308 PasteSearch();
306 } 309 }
307 310
308 void MainFrame::OnPrint( wxCommandEvent& WXUNUSED(event) ) 311 void MainFrame::OnPrint( wxCommandEvent& WXUNUSED(event) )
309 { 312 {
310 PrintImages(); 313 PrintImages();
487 SetAcceleratorTable( accel ); 490 SetAcceleratorTable( accel );
488 } 491 }
489 492
490 void MainFrame::Cmd( wxString cmd ) 493 void MainFrame::Cmd( wxString cmd )
491 { 494 {
492 m_dataViewListCtrl->DeleteAllItems();
493 m_textCtrlName->SetValue( wxEmptyString ); 495 m_textCtrlName->SetValue( wxEmptyString );
494 m_textCtrlAddr->SetValue( wxEmptyString ); 496 m_textCtrlAddr->SetValue( wxEmptyString );
497 m_dataViewListCtrl->DeleteAllItems();
498 wxGetApp().RemoveFile( wxT( ".cache/*" ) );
495 LoadBitmaps( wxEmptyString, false ); 499 LoadBitmaps( wxEmptyString, false );
496 500
497 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) ); 501 wxRegEx reHhs( wxT( "^0[1238][0-9]{8}$" ) );
498 502
499 if ( cmd.IsSameAs( wxT( "q" ), true ) || cmd.IsSameAs( wxT( "9" ), true ) ) { 503 if ( cmd.IsSameAs( wxT( "q" ), true ) || cmd.IsSameAs( wxT( "9" ), true ) ) {
516 wxExecute( execmd ); 520 wxExecute( execmd );
517 return; 521 return;
518 } 522 }
519 523
520 if ( cmd.IsSameAs( wxT( "*" ), false ) ) { 524 if ( cmd.IsSameAs( wxT( "*" ), false ) ) {
521 PasteSeaarch(); 525 PasteSearch();
522 return; 526 return;
523 } 527 }
524 528
525 if ( cmd.IsSameAs( wxT( "+" ), false ) ) { 529 if ( cmd.IsSameAs( wxT( "+" ), false ) ) {
526 //PrintImages(); 530 //PrintImages();
638 sb->SetBitmap( wxBitmap( img ) ); 642 sb->SetBitmap( wxBitmap( img ) );
639 } 643 }
640 644
641 void MainFrame::GetImages( wxString hhs, wxString date ) 645 void MainFrame::GetImages( wxString hhs, wxString date )
642 { 646 {
643 GetImages2( hhs, date); return; // here comment out 647 //GetImages2( hhs, date); return; // here comment out ( by client.exe & return )
644 648
645 int estimate = 5; 649 int estimate = http.GetImagesSize( hhs, date ) / 1000000;
646 wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE ); 650 wxProgressDialog pd( wxT( "Connecting Server" ), wxT( "Start..." ), estimate, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
647 pd.SetSize( wxSize( 320, 140 ) ); 651 pd.SetSize( wxSize( 320, 140 ) );
648 652
649 http.GetImages( hhs, date ); 653 http.GetImages( hhs, date );
650 for ( int i = 0; i < estimate; i++ ) { 654 for ( int i = 0; i < estimate; i++ ) {
651 wxSleep( 1 ); 655 wxMilliSleep( 1 );
652 pd.Update( i, wxT( "Now Loading..." ) ); 656 pd.Update( i, wxT( "Now Loading..." ) );
653 } 657 }
654 } 658 }
655 659
656 void MainFrame::GetImages2( wxString hhs, wxString date ) 660 void MainFrame::GetImages2( wxString hhs, wxString date )
738 for ( int i = 0; i < 100; i++ ) { 742 for ( int i = 0; i < 100; i++ ) {
739 wxMilliSleep( 2 ); 743 wxMilliSleep( 2 );
740 pd.Update( i, wxString::Format( wxT( "Now loding ... ( %0.1f %% )" ), (float)i ) ); 744 pd.Update( i, wxString::Format( wxT( "Now loding ... ( %0.1f %% )" ), (float)i ) );
741 } 745 }
742 if ( errors.GetCount() > 0 ) { 746 if ( errors.GetCount() > 0 ) {
743 wxMessageBox( errors[0] ); 747 wxMessageBox( wxT( "crypto error: " )+ errors[0] );
744 return; 748 return;
745 } 749 }
746 for ( int i = 0; i < output.GetCount(); i++ ) { 750 for ( int i = 0; i < output.GetCount(); i++ ) {
747 wxArrayString buf = wxSplit( output[i], ',', '\\' ); 751 wxArrayString buf = wxSplit( output[i], ',', '\\' );
748 hhash[ buf[0] ] = new HhsClass( buf ); // no, birth, name, kana, addr, sex 752 hhash[ buf[0] ] = new HhsClass( buf ); // no, birth, name, kana, addr, sex
749 } 753 }
750 } 754 }
751 755
752 void MainFrame::PasteSeaarch( void ) 756 void MainFrame::PasteSearch( void )
753 { 757 {
754 wxString s; 758 wxString s;
755 if ( wxTheClipboard->Open() ) { 759 if ( wxTheClipboard->Open() ) {
756 if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) { 760 if ( wxTheClipboard->IsSupported( wxDF_TEXT ) ) {
757 wxTextDataObject data; 761 wxTextDataObject data;