Mercurial > mercurial > hgweb_rsearcher.cgi
view src/main.cpp @ 2:7fe3417cefc8
GUI.
author | pyon@macmini |
---|---|
date | Tue, 02 Oct 2018 21:20:05 +0900 |
parents | eaa27e4ed5be |
children | db4813125eb8 |
line wrap: on
line source
// Filename : main.cpp // Last Change: 2018-10-02 Tue 21:00:32. // #include "main.h" #include "auth.h" #include "rsearcher.h" IMPLEMENT_APP( MyApp ) IMPLEMENT_CLASS( MyApp, wxApp ) MyApp::MyApp() { develop = true; } MyApp::~MyApp() { } bool MyApp::OnInit() { if ( !wxApp::OnInit() ) return false; wxImage::AddHandler( new wxJPEGHandler ); wxImage::AddHandler( new wxPNGHandler ); InitSetting(); GetData(); AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize ); 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 ); } authdlg->ShowModal(); authdlg->Destroy(); mainframe->Show( true ); return true; } int MyApp::OnExit() { SaveSetting(); return 0; } void MyApp::InitSetting() { conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT( "app.conf" ); config = new wxFileConfig( wxT( "MyApp" ), wxT( "T.Mutoh" ), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); config->SetPath( wxT( "/Geometry" ) ); config->Read( wxT( "x" ), &rect.x ); config->Read( wxT( "y" ), &rect.y ); config->Read( wxT( "w" ), &rect.width ); config->Read( wxT( "h" ), &rect.height ); config->SetPath( wxT( "/Server" ) ); config->Read( wxT( "server" ), &m_server ); config->Read( wxT( "proxy" ), &m_server ); delete config; //m_server = wxT( "192.168.79.124:80" ); if ( m_server.IsSameAs( wxEmptyString, false ) ) m_server = wxT( "192.168.21.151:80" ); // nginx } void MyApp::SaveSetting() { 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 ); 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 ); }