Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/main.cpp @ 7:29829e98d510
add net.cpp
author | pyon@macmini |
---|---|
date | Fri, 26 Oct 2018 21:05:11 +0900 |
parents | 9a8b581c1993 |
children | ae89ce4793d8 |
line wrap: on
line diff
--- a/src/main.cpp Tue Oct 23 19:15:22 2018 +0900 +++ b/src/main.cpp Fri Oct 26 21:05:11 2018 +0900 @@ -1,5 +1,5 @@ // Filename : main.cpp -// Last Change: 2018-10-23 火 10:09:42. +// Last Change: 2018-10-26 金 13:14:54. // #include "id.h" #include "main.h" @@ -26,10 +26,10 @@ wxImage::AddHandler( new wxPNGHandler ); InitSetting(); - // Login Dialog - AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); - authdlg->SetServer( m_server ); - authdlg->GetDB(); + // Main Window + MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); + mainframe->SetServer( m_serveraddr, m_serverport ); + mainframe->GetDB(); // Splash Screen wxFileSystem::AddHandler( new wxZipFSHandler ); @@ -41,13 +41,15 @@ wxInputStream* s = file->GetStream(); wxImage image( *s, wxBITMAP_TYPE_PNG ); wxBitmap bmp = wxBitmap( image ); - wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2500, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); + wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); delete file; } - wxMilliSleep( 200 ); + wxMilliSleep( 150 ); } delete fs; + // User Dialgo + AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); if ( !authdlg->LoadDB() ) { authdlg->Destroy(); return false; @@ -72,15 +74,13 @@ delete fs; } - // Main Window - MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); + mainframe->SetUser( authdlg->GetUser() ); + mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() ); + mainframe->LoadDB(); mainframe->InDevelop( true ); - mainframe->SetServer( m_server ); - mainframe->SetUser( authdlg->GetUser() ); - mainframe->LoadDB(); - mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() ); mainframe->Show( true ); - //mainframe->Destroy(); + } else { + mainframe->Destroy(); } authdlg->Destroy(); @@ -107,16 +107,19 @@ 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" ), &proxy ); + config->Read( wxT( "proxy_address" ), &m_serveraddr ); + config->Read( wxT( "proxy_port" ), &m_serverport ); + if ( m_serveraddr.IsSameAs( wxEmptyString, false ) ) { + config->Read( wxT( "address" ), &m_serveraddr ); + config->Read( wxT( "port" ), &m_serverport ); + } 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 + if ( m_serveraddr.IsSameAs( wxEmptyString, false ) ) { + m_serveraddr = wxT( "192.168.21.151" ); // nginx + m_serverport = 80; + } } void MyApp::SaveSetting()