Mercurial > mercurial > hgweb_rsearcher.cgi
comparison src/main.cpp @ 2:7fe3417cefc8
GUI.
| author | pyon@macmini |
|---|---|
| date | Tue, 02 Oct 2018 21:20:05 +0900 |
| parents | eaa27e4ed5be |
| children | db4813125eb8 |
comparison
equal
deleted
inserted
replaced
| 1:eaa27e4ed5be | 2:7fe3417cefc8 |
|---|---|
| 1 // Filename : main.cpp | 1 // Filename : main.cpp |
| 2 // Last Change: 2018-10-01 Mon 23:14:59. | 2 // Last Change: 2018-10-02 Tue 21:00:32. |
| 3 // | 3 // |
| 4 #include "main.h" | 4 #include "main.h" |
| 5 #include "auth.h" | 5 #include "auth.h" |
| 6 #include "rsearcher.h" | 6 #include "rsearcher.h" |
| 7 | 7 |
| 24 wxImage::AddHandler( new wxJPEGHandler ); | 24 wxImage::AddHandler( new wxJPEGHandler ); |
| 25 wxImage::AddHandler( new wxPNGHandler ); | 25 wxImage::AddHandler( new wxPNGHandler ); |
| 26 InitSetting(); | 26 InitSetting(); |
| 27 GetData(); | 27 GetData(); |
| 28 | 28 |
| 29 AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxDefaultSize ); | 29 AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize ); |
| 30 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); | 30 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); |
| 31 mainframe->SetServer( m_server ); | |
| 31 | 32 |
| 32 if ( develop ) { | 33 if ( develop ) { |
| 33 authdlg->InDevelop( true ); | 34 authdlg->InDevelop( true ); |
| 34 mainframe->InDevelop( true ); | 35 mainframe->InDevelop( true ); |
| 35 } | 36 } |
| 43 } | 44 } |
| 44 | 45 |
| 45 int MyApp::OnExit() | 46 int MyApp::OnExit() |
| 46 { | 47 { |
| 47 SaveSetting(); | 48 SaveSetting(); |
| 48 DeleteData(); | |
| 49 return 0; | 49 return 0; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void MyApp::InitSetting() | 52 void MyApp::InitSetting() |
| 53 { | 53 { |
| 54 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf"); | 54 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT( "app.conf" ); |
| 55 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); | 55 config = new wxFileConfig( wxT( "MyApp" ), wxT( "T.Mutoh" ), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); |
| 56 | 56 |
| 57 config->SetPath( wxT("/Geometry") ); | 57 config->SetPath( wxT( "/Geometry" ) ); |
| 58 config->Read( wxT("x"), &rect.x ); | 58 config->Read( wxT( "x" ), &rect.x ); |
| 59 config->Read( wxT("y"), &rect.y ); | 59 config->Read( wxT( "y" ), &rect.y ); |
| 60 config->Read( wxT("w"), &rect.width ); | 60 config->Read( wxT( "w" ), &rect.width ); |
| 61 config->Read( wxT("h"), &rect.height ); | 61 config->Read( wxT( "h" ), &rect.height ); |
| 62 | |
| 63 config->SetPath( wxT( "/Server" ) ); | |
| 64 config->Read( wxT( "server" ), &m_server ); | |
| 65 config->Read( wxT( "proxy" ), &m_server ); | |
| 62 delete config; | 66 delete config; |
| 67 | |
| 68 //m_server = wxT( "192.168.79.124:80" ); | |
| 69 if ( m_server.IsSameAs( wxEmptyString, false ) ) | |
| 70 m_server = wxT( "192.168.21.151:80" ); // nginx | |
| 63 } | 71 } |
| 64 | 72 |
| 65 void MyApp::SaveSetting() | 73 void MyApp::SaveSetting() |
| 66 { | 74 { |
| 67 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); | 75 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE ); |
| 74 delete config; | 82 delete config; |
| 75 } | 83 } |
| 76 | 84 |
| 77 void MyApp::GetData() | 85 void MyApp::GetData() |
| 78 { | 86 { |
| 87 /* | |
| 79 // Go のプログラムを起動し,暗号化さた auth, hhs, index データを取得 | 88 // Go のプログラムを起動し,暗号化さた auth, hhs, index データを取得 |
| 89 wxArrayString output, errors; | |
| 90 wxString cmd = wxT( "./client.exe -u " ) + m_server; | |
| 91 wxExecute( cmd, output, errors, wxEXEC_SYNC, NULL ); // ok | |
| 92 */ | |
| 93 wxArrayString args; // http get | |
| 94 args.Add( wxT( "client.exe -u" ) ); | |
| 95 args.Add( m_server ); | |
| 96 | |
| 97 //wxMessageBox( wxJoin( args, ' ', '\\' ) ); | |
| 98 wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_ASYNC|wxEXEC_HIDE_CONSOLE ); | |
| 80 } | 99 } |
| 81 | 100 |
| 82 void MyApp::DeleteData() | |
| 83 { | |
| 84 // auth.db と hhs.db を削除 | |
| 85 } | |
| 86 |
