gb_manage_dlg.cpp
来自「ncbi源码」· C++ 代码 · 共 182 行
CPP
182 行
/* * =========================================================================== * PRODUCTION $Log: gb_manage_dlg.cpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 20:57:43 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * PRODUCTION * =========================================================================== *//* $Id: gb_manage_dlg.cpp,v 1000.2 2004/06/01 20:57:43 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Mike DiCuccio * * File Description: * */#include <ncbi_pch.hpp>#include <corelib/ncbiapp.hpp>#include <corelib/ncbireg.hpp>#include "gb_manage_dlg.hpp"#include <bdb/bdb_blobcache.hpp>#include <gui/core/data_store.hpp>#include <gui/utils/system_path.hpp>#include <gui/dialogs/file_browser.hpp>BEGIN_NCBI_SCOPE#include "gb_manage_dlg_.cpp"CGBManageDlg::CGBManageDlg(){ m_Window.reset(x_CreateWindow());}void CGBManageDlg::Show(){ CNcbiApplication* app = CNcbiApplication::Instance(); _ASSERT(app); CNcbiRegistry& reg = app->GetConfig(); // basic GenBank settings string gc_size = reg.GetString("GBLOADER", "GcSize", "10000"); m_GCSize->value(gc_size.c_str()); string priority = reg.GetString("GBLOADER", "Priority", "99"); m_Priority->value(priority.c_str()); bool snps = reg.GetBool("GBLOADER", "LoadVariations", false); m_Variations->value(snps); // cache settings string cache_path = CSystemPath::ResolvePath("<home>", "cache"); cache_path = reg.GetString("GBLOADER", "Path", cache_path); m_CacheDir->value(cache_path.c_str()); int cache_age = reg.GetInt("GBLOADER", "Age", 5); m_CacheLifespan->value(NStr::IntToString(cache_age).c_str()); CDialog::Show();}void CGBManageDlg::x_OnClearCache(){ if (CDataStore::HasObject("BDB_Cache")) { CObject& obj = CDataStore::GetObject("BDB_Cache"); CBDB_CacheHolder* ch = dynamic_cast<CBDB_CacheHolder*>(&obj); if (ch) { ICache* cache = ch->GetBlobCache(); if (cache) { cache->Purge(0); } cache = ch->GetIdCache(); if (cache) { cache->Purge(0); } } }}void CGBManageDlg::x_OnBrowseCacheDir(){ string path = NcbiDirBrowser("Select the cache directory", ""); m_CacheDir->value(path.c_str()); m_CacheDir->redraw();}void CGBManageDlg::x_OnOK(){ CDialog::x_OnOK(); CNcbiApplication* app = CNcbiApplication::Instance(); _ASSERT(app); CNcbiRegistry& reg = app->GetConfig(); reg.Set("GBLOADER", "GcSize", m_GCSize->value(), CNcbiRegistry::ePersistent); reg.Set("GBLOADER", "Priority", m_Priority->value(), CNcbiRegistry::ePersistent); reg.Set("GBLOADER", "LoadVariations", m_Variations->value() ? "true" : "false", CNcbiRegistry::ePersistent); reg.Set("GBLOADER", "Path", m_CacheDir->value(), CNcbiRegistry::ePersistent);}END_NCBI_SCOPE/* * =========================================================================== * $Log: gb_manage_dlg.cpp,v $ * Revision 1000.2 2004/06/01 20:57:43 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9 * * Revision 1.9 2004/05/21 22:27:48 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.8 2004/03/11 17:42:30 dicuccio * Use new file chooser * * Revision 1.7 2004/03/01 15:13:07 dicuccio * Use correct registry entry for genbank loader. Make sure to set all possible * fields in dialog (cache age was missing) * * Revision 1.6 2004/02/27 17:56:30 kuznets * Implemented CGBManageDlg::x_OnClearCache() * * Revision 1.5 2004/02/17 20:35:27 rsmith * moved core/settings.[ch]pp and core/system_path.[ch]pp to config and utils, respectively. * * Revision 1.4 2004/02/17 17:20:29 dicuccio * Added handling of cache directory * * Revision 1.3 2003/10/10 17:38:19 dicuccio * Fixed compilation errors * * Revision 1.2 2003/10/10 17:17:57 dicuccio * Added cache params * * Revision 1.1 2003/09/29 15:38:18 dicuccio * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?