0
|
1 // Filename : main.cpp
|
1
|
2 // Last Change: 2018-10-01 Mon 23:14:59.
|
0
|
3 //
|
|
4 #include "main.h"
|
|
5 #include "auth.h"
|
|
6 #include "rsearcher.h"
|
|
7
|
|
8 IMPLEMENT_APP( MyApp )
|
|
9
|
|
10 IMPLEMENT_CLASS( MyApp, wxApp )
|
|
11
|
|
12 MyApp::MyApp()
|
|
13 {
|
1
|
14 develop = true;
|
0
|
15 }
|
|
16 MyApp::~MyApp()
|
|
17 {
|
|
18 }
|
|
19
|
|
20 bool MyApp::OnInit()
|
|
21 {
|
|
22 if ( !wxApp::OnInit() ) return false;
|
|
23
|
|
24 wxImage::AddHandler( new wxJPEGHandler );
|
|
25 wxImage::AddHandler( new wxPNGHandler );
|
|
26 InitSetting();
|
|
27 GetData();
|
|
28
|
|
29 AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxDefaultSize );
|
1
|
30 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
|
|
31
|
|
32 if ( develop ) {
|
|
33 authdlg->InDevelop( true );
|
|
34 mainframe->InDevelop( true );
|
|
35 }
|
|
36
|
0
|
37 authdlg->ShowModal();
|
|
38 authdlg->Destroy();
|
|
39
|
|
40 mainframe->Show( true );
|
|
41
|
|
42 return true;
|
|
43 }
|
|
44
|
|
45 int MyApp::OnExit()
|
|
46 {
|
|
47 SaveSetting();
|
|
48 DeleteData();
|
|
49 return 0;
|
|
50 }
|
|
51
|
|
52 void MyApp::InitSetting()
|
|
53 {
|
|
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 );
|
|
56
|
|
57 config->SetPath( wxT("/Geometry") );
|
|
58 config->Read( wxT("x"), &rect.x );
|
|
59 config->Read( wxT("y"), &rect.y );
|
|
60 config->Read( wxT("w"), &rect.width );
|
|
61 config->Read( wxT("h"), &rect.height );
|
|
62 delete config;
|
|
63 }
|
|
64
|
|
65 void MyApp::SaveSetting()
|
|
66 {
|
|
67 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
|
|
68
|
|
69 config->SetPath( wxT("/Geometry") );
|
|
70 config->Write( wxT("x"), rect.x );
|
|
71 config->Write( wxT("y"), rect.y );
|
|
72 config->Write( wxT("w"), rect.width );
|
|
73 config->Write( wxT("h"), rect.height );
|
|
74 delete config;
|
|
75 }
|
|
76
|
|
77 void MyApp::GetData()
|
|
78 {
|
|
79 // Go のプログラムを起動し,暗号化さた auth, hhs, index データを取得
|
|
80 }
|
|
81
|
|
82 void MyApp::DeleteData()
|
|
83 {
|
|
84 // auth.db と hhs.db を削除
|
|
85 }
|
|
86
|