| 19 | } |
| 20 | |
| 21 | bool GrDatabase::Init() { |
| 22 | std::string base_path = QString::fromStdWString(FolderUtil::GetProgramDataPath()).toStdString(); |
| 23 | auto db_path = base_path + "/gr_data/gr_data.db"; |
| 24 | auto storage = InitAppDatabase(db_path); |
| 25 | storage.sync_schema(); |
| 26 | db_storage_ = storage; |
| 27 | |
| 28 | stream_operator_ = std::make_shared<StreamDBOperator>(shared_from_this()); |
| 29 | db_game_operator_ = std::make_shared<DBGameOperator>(context_, shared_from_this()); |
| 30 | visit_record_op_ = std::make_shared<VisitRecordOperator>(context_, shared_from_this()); |
| 31 | ft_record_op_ = std::make_shared<FileTransferRecordOperator>(context_, shared_from_this()); |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | std::shared_ptr<VisitRecordOperator> GrDatabase::GetVisitRecordOp() { |
| 36 | return visit_record_op_; |