📄 ui_menu.cpp
字号:
/* * btg Copyright (C) 2005 Michael Wojciechowski. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* * $Id: ui_menu.cpp,v 1.1.4.1 2007/09/17 15:34:50 wojci Exp $ */#include "ui.h"#include <bcore/logmacro.h>#include "detailwindow.h"#include "helpwindow.h"#include "filelist.h"#include "fileview.h"#include "peerlist.h"#include "basemenu.h"#include "limitwindow.h"#include <bcore/client/handlerthr.h>#include "handler.h"#include <bcore/command/limit_base.h>#include <bcore/hrr.h>#define GET_HANDLER_INST \ boost::shared_ptr<boost::mutex> ptr = handlerthread_->mutex(); \ boost::mutex::scoped_lock interface_lock(*ptr); \ Handler* handler = dynamic_cast<Handler*>(handlerthread_->handler());namespace btg{ namespace UI { namespace cli { using namespace btg::core; void UI::handleMenuEntry(menuEntries const _menuentry, t_int const _context_id, std::string const& _filename) { switch (_menuentry) { case UI::M_START: { { GET_HANDLER_INST; handler->reqStart(_context_id); if (handler->lastCommandSuccess()) { actionSuccess("Start", _filename); } else { actionFailture("Start", _filename); } } break; } case UI::M_STOP: { { GET_HANDLER_INST; handler->reqStop(_context_id); if (handler->lastCommandSuccess()) { actionSuccess("Stop", _filename); } else { actionFailture("Stop", _filename); } } break; } case UI::M_ABORT: { { GET_HANDLER_INST; handler->reqAbort(_context_id, false); if (handler->lastCommandSuccess()) { handler->resetStatusList(); std::vector<t_int> id_list; id_list.push_back(_context_id); mainwindow_.remove(id_list); refresh(); actionSuccess("Abort", _filename); } else { actionFailture("Abort", _filename); } } break; } case UI::M_ERASE: { { GET_HANDLER_INST; handler->reqAbort(_context_id, true /* erase */); if (handler->lastCommandSuccess()) { handler->resetStatusList(); std::vector<t_int> id_list; id_list.push_back(_context_id); mainwindow_.remove(id_list); refresh(); actionSuccess("Erase", _filename); } else { actionFailture("Erase", _filename); } } break; } case UI::M_LIMIT: { statuswindow_.setStatus("Limiting torrent."); t_int download = limitBase::LIMIT_DISABLED; t_int upload = limitBase::LIMIT_DISABLED; t_int seedTimeout = limitBase::LIMIT_DISABLED; t_int seedPercent = limitBase::LIMIT_DISABLED; if (limitPopup(_context_id, download, upload, seedTimeout, seedPercent)) { setLimit(_context_id, _filename, download, upload, seedTimeout, seedPercent); } else { statuswindow_.setStatus("Setting limits cancelled."); } break; } case UI::M_CLEAN: { { GET_HANDLER_INST; handler->reqClean(_context_id); if (handler->lastCommandSuccess()) { handler->resetStatusList(); std::vector<t_int> id_list; id_list.push_back(_context_id); mainwindow_.remove(id_list); refresh(); actionSuccess("Clean", _filename); } else { actionFailture("Clean", _filename); } } break; } case UI::M_SHOWFILES: { { GET_HANDLER_INST; handler->reqFileInfo(_context_id); if (handler->lastCommandSuccess()) { actionSuccess("Show files", _filename); std::vector<btg::core::fileInformation> fi_lst; handler->getLastFileInfoList(fi_lst); handleShowFiles(fi_lst); } else { actionFailture("Show files", _filename); } } break; } case UI::M_SELECTFILES: { { GET_HANDLER_INST;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -