# HG changeset patch # User pyon@macmini # Date 1403171171 -32400 # Node ID 1ba97995f64220354ef1e200c818fc29be09b848 # Parent de222bc84e4802ad87c5d94c72dde17a90cbe032 Get/Put DB files to shared-directory. diff -r de222bc84e48 -r 1ba97995f642 Changes --- 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. diff -r de222bc84e48 -r 1ba97995f642 Makefile --- 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) diff -r de222bc84e48 -r 1ba97995f642 doc/Searcher 03 の新機能.docx Binary file doc/Searcher 03 の新機能.docx has changed diff -r de222bc84e48 -r 1ba97995f642 doc/Searcher 03 の新機能.pdf Binary file doc/Searcher 03 の新機能.pdf has changed diff -r de222bc84e48 -r 1ba97995f642 include/common.h diff -r de222bc84e48 -r 1ba97995f642 include/db.h diff -r de222bc84e48 -r 1ba97995f642 include/hhsdb.h diff -r de222bc84e48 -r 1ba97995f642 include/myframe.h --- 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; diff -r de222bc84e48 -r 1ba97995f642 include/preview.h diff -r de222bc84e48 -r 1ba97995f642 include/update.h --- /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__ + diff -r de222bc84e48 -r 1ba97995f642 src/bprint.cpp diff -r de222bc84e48 -r 1ba97995f642 src/db.cpp diff -r de222bc84e48 -r 1ba97995f642 src/hhsdb.cpp diff -r de222bc84e48 -r 1ba97995f642 src/myframe.cpp --- 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 ); diff -r de222bc84e48 -r 1ba97995f642 src/preview.cpp diff -r de222bc84e48 -r 1ba97995f642 src/update.cpp --- /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 ); +} +