comparison src/main.cpp @ 0:d3b8cd5aeb70

make repo.
author pyon@macmini
date Sun, 30 Sep 2018 17:27:04 +0900
parents
children eaa27e4ed5be
comparison
equal deleted inserted replaced
-1:000000000000 0:d3b8cd5aeb70
1 // Filename : main.cpp
2 // Last Change: 2018-09-29 Sat 15:11:45.
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 {
14 }
15 MyApp::~MyApp()
16 {
17 }
18
19 bool MyApp::OnInit()
20 {
21 if ( !wxApp::OnInit() ) return false;
22
23 wxImage::AddHandler( new wxJPEGHandler );
24 wxImage::AddHandler( new wxPNGHandler );
25 InitSetting();
26 GetData();
27
28 AuthDialog *authdlg = new AuthDialog( NULL, wxID_ANY, wxT( "" ), wxDefaultPosition, wxDefaultSize );
29 authdlg->ShowModal();
30 authdlg->Destroy();
31
32 MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxT( "Re:Searcher" ), wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
33 mainframe->Show( true );
34
35 return true;
36 }
37
38 int MyApp::OnExit()
39 {
40 SaveSetting();
41 DeleteData();
42 return 0;
43 }
44
45 void MyApp::InitSetting()
46 {
47 conf_file = wxGetCwd() + wxFILE_SEP_PATH + wxT("app.conf");
48 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
49
50 config->SetPath( wxT("/Geometry") );
51 config->Read( wxT("x"), &rect.x );
52 config->Read( wxT("y"), &rect.y );
53 config->Read( wxT("w"), &rect.width );
54 config->Read( wxT("h"), &rect.height );
55 delete config;
56 }
57
58 void MyApp::SaveSetting()
59 {
60 config = new wxFileConfig( wxT("MyApp"), wxT("T.Mutoh"), conf_file, wxEmptyString, wxCONFIG_USE_LOCAL_FILE );
61
62 config->SetPath( wxT("/Geometry") );
63 config->Write( wxT("x"), rect.x );
64 config->Write( wxT("y"), rect.y );
65 config->Write( wxT("w"), rect.width );
66 config->Write( wxT("h"), rect.height );
67 delete config;
68 }
69
70 void MyApp::GetData()
71 {
72 // Go のプログラムを起動し,暗号化さた auth, hhs, index データを取得
73 }
74
75 void MyApp::DeleteData()
76 {
77 // auth.db と hhs.db を削除
78 }
79