Mercurial > mercurial > hgweb_searcher03.cgi
changeset 16:1ba97995f642
Get/Put DB files to shared-directory.
author | pyon@macmini |
---|---|
date | Thu, 19 Jun 2014 18:46:11 +0900 |
parents | de222bc84e48 |
children | acb59fbbe5ee |
files | Changes Makefile doc/Searcher 03 の新機能.docx doc/Searcher 03 の新機能.pdf include/common.h include/db.h include/hhsdb.h include/myframe.h include/preview.h include/update.h src/bprint.cpp src/db.cpp src/hhsdb.cpp src/myframe.cpp src/preview.cpp src/update.cpp |
diffstat | 8 files changed, 95 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Changes Sun Jun 15 16:45:52 2014 +0900 +++ b/Changes Thu Jun 19 18:46:11 2014 +0900 @@ -1,3 +1,8 @@ +version 03.18 +2014-06-20 + Get/Put DB files to shared-directory. + +---- version 03.17 2014-06-17 Implement Mouse-Gesture in PreviewDialog.
--- a/Makefile Sun Jun 15 16:45:52 2014 +0900 +++ b/Makefile Thu Jun 19 18:46:11 2014 +0900 @@ -1,5 +1,5 @@ # Makefile for wxWidgets Application -# Last Change: 14-May-2014. +# Last Change: 18-Jun-2014. # by Takayuki Mutoh # @@ -40,6 +40,7 @@ $(OBJDIR)/preview.o \ $(OBJDIR)/bprint.o \ $(OBJDIR)/db.o \ + $(OBJDIR)/update.o \ $(OBJDIR)/hhsdb.o \ $(OBJDIR)/marksheet.o \ $(OBJDIR)/cache.o \ @@ -68,7 +69,7 @@ -mkdir -p $(OBJDIR) $(CXX) -c $< -o $@ $(CXXFLAGS) -$(OBJDIR)/myframe.o: myframe.cpp myframe.h common.h db.h marksheet.h bprint.h cache.h preview.h kana.h hist.h +$(OBJDIR)/myframe.o: myframe.cpp myframe.h common.h db.h marksheet.h bprint.h cache.h preview.h kana.h hist.h update.h $(CXX) -c $< -o $@ $(CXXFLAGS) $(OBJDIR)/about.o: about.cpp about.h common.h @@ -101,6 +102,9 @@ $(OBJDIR)/hhsdb.o: hhsdb.cpp hhsdb.h common.h db.h $(CXX) -c $< -o $@ $(CXXFLAGS) +$(OBJDIR)/update.o: update.cpp update.h + $(CXX) -c $< -o $@ $(CXXFLAGS) + $(OBJDIR)/db.o: db.cpp db.h common.h $(CXX) -c $< -o $@ $(CXXFLAGS)
--- a/include/myframe.h Sun Jun 15 16:45:52 2014 +0900 +++ b/include/myframe.h Thu Jun 19 18:46:11 2014 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.h -// Last Change: 05-Jun-2014. +// Last Change: 19-Jun-2014. // #ifndef __MYFRAME_H__ #define __MYFRAME_H__ @@ -72,6 +72,7 @@ long lmin, lmax; double zmin, zmax; wxString m_hhsno; + wxString m_shared; protected: wxMenuBar* m_menubar;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/update.h Thu Jun 19 18:46:11 2014 +0900 @@ -0,0 +1,14 @@ +// Filename : update.h +// Last Change: 19-Jun-2014. + +#ifndef __UPDATE_H__ +#define __UPDATE_H__ + +#include "common.h" + +void CheckNewFiles( wxString shared ); +void GetFile( wxString target, wxString newfile ); +void PutFile( wxString newfile, wxString target ); + +#endif //__UPDATE_H__ +
--- a/src/myframe.cpp Sun Jun 15 16:45:52 2014 +0900 +++ b/src/myframe.cpp Thu Jun 19 18:46:11 2014 +0900 @@ -1,5 +1,5 @@ // Filename : myframe.cpp -// Last Change: 05-Jun-2014. +// Last Change: 19-Jun-2014. // #include "main.h" #include "db.h" @@ -14,8 +14,7 @@ #include "marksheet.h" #include "myframe.h" #include "bprint.h" - -#define DEBUG 1 +#include "update.h" /////////////////////////////////////////////////////////////// // カスタム検索ボックス @@ -353,6 +352,7 @@ this->Centre( wxBOTH ); LoadParam(); + CheckNewFiles( m_shared ); } MyFrame::~MyFrame() @@ -433,6 +433,11 @@ int x, y, w, h; + // Shaerd + config->SetPath( wxT("/Index") ); + config->Read( wxT("shared"), &m_shared ); + + // Mask config->SetPath( wxT("/Mask") ); config->Read( wxT("x1"), &x ); @@ -477,7 +482,7 @@ m_mask3old.SetPosition( wxPoint( x, y ) ); m_mask3old.SetSize( wxSize( w, h ) ); - // + // Marksheet config->SetPath( wxT("/Marksheet") ); config->Read( wxT("lmin"), &lmin );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/update.cpp Thu Jun 19 18:46:11 2014 +0900 @@ -0,0 +1,59 @@ +// Filename : update.cpp +// Last Change: 19-Jun-2014. + +#include "update.h" + +void CheckNewFiles( wxString shared ) +{ + // index + wxString cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); + wxFileName fn( cfile ); + wxDateTime ct = fn.GetModificationTime(); + + wxString nfile = shared + wxFILE_SEP_PATH + wxT("ccn.db"); + fn.Assign( nfile ); + wxDateTime nt = fn.GetModificationTime(); + + if ( nt - ct > wxTimeSpan::Week() ) { + wxMessageDialog md( NULL, wxT("インデックスが古くなっています.\n新しいインデックスを取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); + if ( md.ShowModal() == wxID_YES ) { + GetFile( cfile, nfile ); + } + } + else { + if ( ct - nt > wxTimeSpan::Day() ) + PutFile( nfile, cfile ); + } + + // hhs + cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db"); + fn.Assign( cfile ); + ct = fn.GetModificationTime(); + + nfile = shared + wxFILE_SEP_PATH + wxT("hhs.db"); + fn.Assign( nfile ); + nt = fn.GetModificationTime(); + + if ( nt - ct > wxTimeSpan::Week() ) { + wxMessageDialog md( NULL, wxT("被保険者情報の最新版があります.\n被保険者情報を取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); + if ( md.ShowModal() == wxID_YES ) { + GetFile( cfile, nfile ); + } + } + else { + if ( ct - nt > wxTimeSpan::Day() ) + PutFile( nfile, cfile ); + } +} + +void GetFile( wxString target, wxString newfile ) +{ + wxCopyFile( newfile, target, true ); + wxMessageBox( wxT("アップデート完了.") ); +} + +void PutFile( wxString newfile, wxString target ) +{ + wxCopyFile( target, newfile, true ); +} +