Mercurial > mercurial > hgweb_rsearcher.cgi
diff src/main.cpp @ 5:e3b10fb860b3
release v1.0.
author | pyon@macmini |
---|---|
date | Mon, 22 Oct 2018 22:17:02 +0900 |
parents | 06342fc544e4 |
children | 9a8b581c1993 |
line wrap: on
line diff
--- a/src/main.cpp Mon Oct 15 20:07:38 2018 +0900 +++ b/src/main.cpp Mon Oct 22 22:17:02 2018 +0900 @@ -1,5 +1,5 @@ // Filename : main.cpp -// Last Change: 2018-10-12 金 16:17:39. +// Last Change: 2018-10-22 月 16:14:28. // #include "id.h" #include "main.h" @@ -26,27 +26,55 @@ wxImage::AddHandler( new wxPNGHandler ); InitSetting(); - wxBitmap bmp; - if ( bmp.LoadFile( wxT( "./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 ); + // Splash Screen + wxFileSystem::AddHandler( new wxZipFSHandler ); + wxFileSystem* fs = new wxFileSystem(); + wxString archive = wxT( "file:///./myapp.bin" ); + for ( int i = 0; i < 11; i++ ) { + wxFSFile* file = fs->OpenFile( archive + wxString::Format( wxT( "#zip:startup%02d.png" ), i ) ); + if ( file ) { + 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, 3000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP ); + delete file; + } + wxMilliSleep( 250 ); } - AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Check User" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); - authdlg->SetServer( m_server ); + unsigned int seed = (unsigned int)time( 0 ); + srand( seed ); + int n = rand() % 13; + wxFSFile* file = fs->OpenFile( archive + wxString::Format( wxT( "#zip:%02d.jpg" ), n ) ); + if ( file ) { + wxInputStream* s = file->GetStream(); + wxFileOutputStream of( wxT( "./image/hello.jpg" ) ); + s->Read( of ); + delete file; + } + delete fs; - MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); - mainframe->SetServer( m_server ); - - if ( develop ) { - authdlg->InDevelop( true ); - mainframe->InDevelop( true ); - } + // Login Dialog + AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "Who are you ?" ), wxDefaultPosition, wxDefaultSize, wxCAPTION ); + authdlg->SetServer( m_server ); + if ( !authdlg->LoadDB() ) { + authdlg->Destroy(); + return false; + } if ( authdlg->ShowModal() == wxID_OK ) { + wxString ui = wxString::Format( wxT( "./image/" ) + authdlg->GetUser() + wxT( ".jpg" ) ); + if ( wxFileExists( ui ) ) wxCopyFile( ui, wxT( "./image/hello.jpg" ), true ); + + // Main Window + MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); + mainframe->InDevelop( true ); + mainframe->SetServer( m_server ); mainframe->SetUser( authdlg->GetUser() ); + mainframe->LoadDB(); + mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() ); mainframe->Show( true ); - } else { - mainframe->Destroy(); + //mainframe->Destroy(); } authdlg->Destroy();