diff 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 diff
--- a/src/main.cpp	Mon Oct 01 23:18:29 2018 +0900
+++ b/src/main.cpp	Tue Oct 02 21:20:05 2018 +0900
@@ -1,5 +1,5 @@
 // Filename   : main.cpp
-// Last Change: 2018-10-01 Mon 23:14:59.
+// Last Change: 2018-10-02 Tue 21:00:32.
 //
 #include "main.h"
 #include "auth.h"
@@ -26,8 +26,9 @@
 	InitSetting();
     GetData();
 
-    AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxDefaultSize );
+    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 );
@@ -45,21 +46,28 @@
 int MyApp::OnExit()
 {
 	SaveSetting();
-    DeleteData();
     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 );
+    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("/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()
@@ -76,11 +84,17 @@
 
 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 );
 }
 
-void MyApp::DeleteData()
-{
-    // auth.db と hhs.db を削除
-}
-