Mercurial > mercurial > hgweb_rsearcher.cgi
comparison src/mngdb.cpp @ 11:799b6008db8e
auto-upgrade.
author | pyon@macmini |
---|---|
date | Mon, 12 Nov 2018 19:35:50 +0900 |
parents | |
children | f5ffc34f045a |
comparison
equal
deleted
inserted
replaced
10:36811fd22bd2 | 11:799b6008db8e |
---|---|
1 // Filename : mngdeb.cpp | |
2 // Last Change: 2018-11-09 金 13:35:54. | |
3 // | |
4 | |
5 #include "id.h" | |
6 #include "mngdb.h" | |
7 | |
8 ManageDBFrame::ManageDBFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) | |
9 : wxFrame( parent, id, title, pos, size, style ) | |
10 { | |
11 this->SetSizeHints( wxDefaultSize, wxDefaultSize ); | |
12 | |
13 wxBoxSizer* bSizerTop = new wxBoxSizer( wxVERTICAL ); | |
14 | |
15 wxFlexGridSizer* fgSizer = new wxFlexGridSizer( 0, 2, 0, 0 ); | |
16 fgSizer->SetFlexibleDirection( wxBOTH ); | |
17 fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
18 | |
19 m_staticTextDate = new wxStaticText( this, wxID_ANY, wxT( "Date" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
20 fgSizer->Add( m_staticTextDate, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); | |
21 | |
22 m_datePicker = new wxDatePickerCtrl( this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN|wxDP_SHOWCENTURY ); | |
23 fgSizer->Add( m_datePicker, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
24 | |
25 m_staticTextHhs = new wxStaticText( this, wxID_ANY, wxT( "HHS" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
26 fgSizer->Add( m_staticTextHhs, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); | |
27 | |
28 m_filePickerHhs = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT( "Select a file" ), wxT( "*.db" ), wxDefaultPosition, wxDefaultSize, wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL ); | |
29 fgSizer->Add( m_filePickerHhs, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); | |
30 | |
31 m_staticTextCcn = new wxStaticText( this, wxID_ANY, wxT( "CCN" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
32 fgSizer->Add( m_staticTextCcn, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); | |
33 | |
34 m_filePickerCcn = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT( "Select a file" ), wxT( "*.db" ), wxDefaultPosition, wxDefaultSize, wxFLP_FILE_MUST_EXIST|wxFLP_OPEN|wxFLP_SMALL|wxFLP_USE_TEXTCTRL ); | |
35 fgSizer->Add( m_filePickerCcn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); | |
36 | |
37 bSizerTop->Add( fgSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); | |
38 | |
39 //--- | |
40 m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); | |
41 bSizerTop->Add( m_staticline, 0, wxEXPAND|wxALL, 5 ); | |
42 | |
43 wxBoxSizer* bSizerBtn = new wxBoxSizer( wxHORIZONTAL ); | |
44 | |
45 m_buttonBuild = new wxButton( this, ID_MNGBLD, wxT( "Build" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
46 bSizerBtn->Add( m_buttonBuild, 0, wxALL, 5 ); | |
47 | |
48 m_buttonUpld = new wxButton( this, ID_MNGUPLD, wxT( "Upload" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
49 bSizerBtn->Add( m_buttonUpld, 0, wxALL, 5 ); | |
50 | |
51 m_buttonExit = new wxButton( this, ID_MNGEXIT, wxT( "Exit" ), wxDefaultPosition, wxDefaultSize, 0 ); | |
52 bSizerBtn->Add( m_buttonExit, 0, wxALL, 5 ); | |
53 | |
54 bSizerTop->Add( bSizerBtn, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); | |
55 | |
56 this->SetSizer( bSizerTop ); | |
57 this->Layout(); | |
58 | |
59 this->Centre( wxBOTH ); | |
60 } | |
61 | |
62 ManageDBFrame::~ManageDBFrame() | |
63 { | |
64 } | |
65 | |
66 // Event Table | |
67 BEGIN_EVENT_TABLE( ManageDBFrame, wxFrame ) | |
68 EVT_BUTTON( ID_MNGBLD, ManageDBFrame::OnBuild ) | |
69 EVT_BUTTON( ID_MNGUPLD, ManageDBFrame::OnUpload ) | |
70 EVT_BUTTON( ID_MNGEXIT, ManageDBFrame::OnExit ) | |
71 END_EVENT_TABLE() | |
72 | |
73 // Event Handler | |
74 void ManageDBFrame::OnBuild( wxCommandEvent& WXUNUSED(event) ) | |
75 { | |
76 wxMessageBox( wxT( "build done." ) ); | |
77 } | |
78 | |
79 void ManageDBFrame::OnUpload( wxCommandEvent& WXUNUSED(event) ) | |
80 { | |
81 ClearServer(); | |
82 Upload( wxT( "index.db" ) ); | |
83 Upload( wxT( "hhs.db" ) ); | |
84 UpdateDB(); | |
85 wxMessageBox( wxT( "upload done." ) ); | |
86 } | |
87 | |
88 void ManageDBFrame::OnExit( wxCommandEvent& WXUNUSED(event) ) | |
89 { | |
90 Close(); | |
91 } | |
92 | |
93 | |
94 // Functions | |
95 void ManageDBFrame::Upload( wxString file ) | |
96 { | |
97 wxArrayString args; | |
98 args.Add( wxT( "client.exe" ) ); | |
99 args.Add( wxT( "-a" ) ); | |
100 args.Add( m_server ); | |
101 args.Add( file ); | |
102 | |
103 wxExecute( wxJoin( args, ' ', '\\' ) ); | |
104 } | |
105 | |
106 void ManageDBFrame::ClearServer( void ) | |
107 { | |
108 // go-server get /clean -> rm -f upload/* | |
109 wxArrayString args; | |
110 args.Add( wxT( "client.exe" ) ); | |
111 args.Add( m_server ); | |
112 | |
113 wxExecute( wxJoin( args, ' ', '\\' ) ); | |
114 } | |
115 | |
116 void ManageDBFrame::UpdateDB( void ) | |
117 { | |
118 // go-server get /mangedb -> mv upload/xxx db/index.db | |
119 // mv upload/yyy db/hhs.db | |
120 wxArrayString args; | |
121 args.Add( wxT( "client.exe" ) ); | |
122 args.Add( m_server ); | |
123 | |
124 wxExecute( wxJoin( args, ' ', '\\' ) ); | |
125 } | |
126 |