Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/main.cpp @ 3:db4813125eb8
many changes.
author | pyon@macmini |
---|---|
date | Thu, 11 Oct 2018 22:11:09 +0900 |
parents | 7fe3417cefc8 |
children | 06342fc544e4 |
line wrap: on
line diff
--- a/src/main.cpp Tue Oct 02 21:20:05 2018 +0900 +++ b/src/main.cpp Thu Oct 11 22:11:09 2018 +0900 @@ -1,5 +1,5 @@ // Filename : main.cpp -// Last Change: 2018-10-02 Tue 21:00:32. +// Last Change: 2018-10-11 木 16:52:40. // #include "main.h" #include "auth.h" @@ -24,9 +24,15 @@ wxImage::AddHandler( new wxJPEGHandler ); wxImage::AddHandler( new wxPNGHandler ); InitSetting(); - GetData(); - AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize ); + wxBitmap bmp; + if ( bmp.LoadFile( "./image/startup.png", wxBITMAP_TYPE_PNG ) ){ + wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 4000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); + } + + AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Check User" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); + authdlg->SetServer( m_server ); + MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); mainframe->SetServer( m_server ); @@ -35,10 +41,13 @@ mainframe->InDevelop( true ); } - authdlg->ShowModal(); - authdlg->Destroy(); - - mainframe->Show( true ); + if ( authdlg->ShowModal() == wxID_OK ) { + mainframe->SetUser( authdlg->GetUser() ); + mainframe->Show( true ); + } else { + mainframe->Destroy(); + } + authdlg->Destroy(); return true; } @@ -60,11 +69,13 @@ config->Read( wxT( "w" ), &rect.width ); config->Read( wxT( "h" ), &rect.height ); + wxString proxy; config->SetPath( wxT( "/Server" ) ); config->Read( wxT( "server" ), &m_server ); - config->Read( wxT( "proxy" ), &m_server ); + config->Read( wxT( "proxy" ), &proxy ); delete config; + if ( !proxy.IsSameAs( wxEmptyString, false ) ) m_server = proxy; //m_server = wxT( "192.168.79.124:80" ); if ( m_server.IsSameAs( wxEmptyString, false ) ) m_server = wxT( "192.168.21.151:80" ); // nginx @@ -72,29 +83,13 @@ void MyApp::SaveSetting() { - config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); + config = new wxFileConfig( wxT( "MyApp" ), wxT( "T.Mutoh" ), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); - config->SetPath( wxT("/Geometry") ); - config->Write( wxT("x"), rect.x ); - config->Write( wxT("y"), rect.y ); - config->Write( wxT("w"), rect.width ); - config->Write( wxT("h"), rect.height ); + config->SetPath( wxT( "/Geometry" ) ); + config->Write( wxT( "x" ), rect.x ); + config->Write( wxT( "y" ), rect.y ); + config->Write( wxT( "w" ), rect.width ); + config->Write( wxT( "h" ), rect.height ); delete config; } -void MyApp::GetData() -{ - /* - // Go のプログラムを起動し,暗号化さた auth, hhs, index データを取得 - wxArrayString output, errors; - wxString cmd = wxT( "./client.exe -u " ) + m_server; - wxExecute( cmd, output, errors, wxEXEC_SYNC, NULL ); // ok - */ - wxArrayString args; // http get - args.Add( wxT( "client.exe -u" ) ); - args.Add( m_server ); - - //wxMessageBox( wxJoin( args, ' ', '\\' ) ); - wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_ASYNC|wxEXEC_HIDE_CONSOLE ); -} -