comparison src/main.cpp @ 13:f5ffc34f045a

manage DB.
author pyon@macmini
date Wed, 14 Nov 2018 19:43:40 +0900
parents 799b6008db8e
children c262e17de9b1
comparison
equal deleted inserted replaced
12:240752cbe11b 13:f5ffc34f045a
1 // Filename : main.cpp 1 // Filename : main.cpp
2 // Last Change: 2018-11-09 金 11:54:20. 2 // Last Change: 2018-11-14 水 12:54:16.
3 // 3 //
4 4
5 #include <wx/socket.h> 5 #include <wx/socket.h>
6 #include <wx/sstream.h> 6 #include <wx/sstream.h>
7 #include <wx/protocol/http.h> 7 #include <wx/protocol/http.h>
49 wxFileSystem::AddHandler( new wxZipFSHandler ); 49 wxFileSystem::AddHandler( new wxZipFSHandler );
50 50
51 // Main Window 51 // Main Window
52 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE ); 52 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
53 mainframe->SetServer( m_serveraddr, m_serverport ); 53 mainframe->SetServer( m_serveraddr, m_serverport );
54 mainframe->SetDBdir( m_dbdir );
54 mainframe->InDevelop( true ); 55 mainframe->InDevelop( true );
55 if ( !mainframe->GetDB() ) { 56 if ( !mainframe->GetDB( 1, 1, 1 ) ) {
56 mainframe->Destroy(); 57 mainframe->Destroy();
57 return true; 58 return true;
58 } 59 }
59 60
60 // Splash Screen 61 // Splash Screen
122 return true; 123 return true;
123 } 124 }
124 125
125 int MyApp::OnExit() 126 int MyApp::OnExit()
126 { 127 {
128 RemoveFile( wxT( "hhs.csv.tmp" ) );
129 RemoveFile( wxT( "hhs.csv" ) );
130 RemoveFile( wxT( "index.db.tmp" ) );
127 RemoveFile( wxT( "auth.db" ) ); 131 RemoveFile( wxT( "auth.db" ) );
128 RemoveFile( wxT( "hhs.db" ) ); 132 RemoveFile( wxT( "hhs.db" ) );
129 RemoveFile( wxT( ".cache/*" ) ); 133 RemoveFile( wxT( ".cache/*" ) );
130 SaveSetting(); 134 SaveSetting();
131 return 0; 135 return 0;
139 config->SetPath( wxT( "/Geometry" ) ); 143 config->SetPath( wxT( "/Geometry" ) );
140 config->Read( wxT( "x" ), &rect.x ); 144 config->Read( wxT( "x" ), &rect.x );
141 config->Read( wxT( "y" ), &rect.y ); 145 config->Read( wxT( "y" ), &rect.y );
142 config->Read( wxT( "w" ), &rect.width ); 146 config->Read( wxT( "w" ), &rect.width );
143 config->Read( wxT( "h" ), &rect.height ); 147 config->Read( wxT( "h" ), &rect.height );
148
149 config->SetPath( wxT( "/DBManage" ) );
150 config->Read( wxT( "dbdir" ), &m_dbdir );
144 151
145 config->SetPath( wxT( "/Server" ) ); 152 config->SetPath( wxT( "/Server" ) );
146 config->Read( wxT( "proxy_address" ), &m_serveraddr ); 153 config->Read( wxT( "proxy_address" ), &m_serveraddr );
147 config->Read( wxT( "proxy_port" ), &m_serverport ); 154 config->Read( wxT( "proxy_port" ), &m_serverport );
148 if ( m_serveraddr.IsSameAs( wxEmptyString, false ) ) { 155 if ( m_serveraddr.IsSameAs( wxEmptyString, false ) ) {