⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui_menu.cpp

📁 LINUX下
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                        handler->reqGetFiles(_context_id);                                                      if (handler->lastCommandSuccess())                           {                              btg::core::selectedFileEntryList files;                              handler->getLastSelectedFiles(files);                              switch (handleSelectFiles(_context_id, files))                                 {                                 case sS_SELECT_RESIZE:                                    {                                       actionAbortedByResize("Select files", _filename);                                       break;                                    }                                 case sS_SELECT_SUCCESS:                                    {                                       actionSuccess("Select files", _filename);                                       break;                                    }                                 case sS_SELECT_FAILURE:                                    {                                       actionFailture("Select files", _filename);                                       break;                                    }                                 case sS_SELECT_ABORT:                                    {                                       actionAborted("Select files", _filename);                                       break;                                    }                                 }                           }                        else                           {                              actionFailture("Select files", _filename);                           }                     }                     break;                  }               case UI::M_SHOWPEERS:                  {                     {                        GET_HANDLER_INST;                        handler->reqPeers(_context_id);                        if (handler->lastCommandSuccess())                           {                              actionSuccess("Show peers", _filename);                              t_peerList peerlist;                              handler->getLastPeers(peerlist);                              handleShowPeers(peerlist);                           }                        else                           {                              actionFailture("Show peers", _filename);                           }                     }                     break;                  }               case UI::M_UNDEF:                  {                     break;                  }               }         }         void UI::handleMenu()         {            btg::core::Status teststatus;            if (!mainwindow_.getSelection(teststatus))               {                  // There is nothing to show a menu for.                  statuswindow_.setError("Not showing menu, no torrents.");                  return;               }            statuswindow_.setStatus("Select entry.");            std::vector<menuEntry> contents;            contents.push_back(menuEntry(UI::M_START, "Start", "Start a torrent"));            contents.push_back(menuEntry(UI::M_STOP,  "Stop",  "Stop a torrent"));            contents.push_back(menuEntry(UI::M_ABORT, "Abort", "Abort a torrent"));            contents.push_back(menuEntry(UI::M_ERASE, "Erase", "Erase a torrent"));            contents.push_back(menuEntry(UI::M_LIMIT, "Limit", "Limit a torrent"));            contents.push_back(menuEntry(UI::M_CLEAN, "Clean", "Clean a torrent"));            contents.push_back(menuEntry(UI::M_SHOWFILES, "Show files",                                          "Show the files contained in a torrent"));            contents.push_back(menuEntry(UI::M_SELECTFILES, "Select files",                                          "Select files to download"));            contents.push_back(menuEntry(UI::M_SHOWPEERS, "Show peers",                                          "Show the peers for a torrent"));            windowSize menudimensions;            mainwindow_.getSize(menudimensions);            baseMenu bm(keymap_, menudimensions, "Torrent menu", contents);            switch(bm.run())               {               case dialog::R_RESIZE:                  {                     // the window was resized.                     handleResizeMainWindow();		                       // abort showing menu.                     return;                     break;                  }               case dialog::R_NCREAT:                  {                     return;                     break;                  }               default:                  {                     break;                  }               }            if (bm.getResult() == baseMenu::BM_cancel)               {                  statuswindow_.setStatus("Selection aborted.");                  return;               }            menuEntries entry = UI::M_UNDEF;            switch (bm.getResult())               {               case UI::M_START:                  entry = M_START;                  break;               case UI::M_STOP:                  entry = M_STOP;                  break;               case UI::M_ABORT:                  entry = M_ABORT;                  break;               case UI::M_ERASE:                  entry = M_ERASE;                  break;               case UI::M_LIMIT:                  entry = M_LIMIT;                  break;               case UI::M_CLEAN:                  entry = M_CLEAN;                  break;               case UI::M_SHOWFILES:                  entry = M_SHOWFILES;                  break;               case UI::M_SELECTFILES:                  entry = M_SELECTFILES;                  break;               case UI::M_SHOWPEERS:                  entry = M_SHOWPEERS;                  break;               case UI::M_UNDEF:                  break;               default:                  break;               }            std::vector<t_int> selected_ids;            mainwindow_.getMarked(selected_ids);            btg::core::Status status;            if (selected_ids.size() > 0)               {                  // A number of torrents was marked.                  //                  // Handle setting more limits than one.                  if (entry == UI::M_LIMIT)                     {                        handleManyLimits(selected_ids);                        return;                     }                  std::vector<t_int>::const_iterator iter;                  for (iter = selected_ids.begin();                       iter != selected_ids.end();                       iter++)                     {                        if (mainwindow_.get(*iter, status))                           {                              t_int context_id     = status.contextID();                              std::string filename = status.filename();                              handleMenuEntry(entry,                                              context_id,                                              filename);                           }                     }                                    // Force updating of contexts.                  handlerthread_->forceUpdate();               }            else               {                  // Nothing was marked, use the currently selected                  // torrent.                  //                  if (!mainwindow_.getSelection(status))                     {                        return;                     }                  // Something was marked.                  t_int context_id     = status.contextID();                  std::string filename = status.filename();                  handleMenuEntry(entry,                                  context_id,                                  filename);                  // Force updating of contexts.                  handlerthread_->forceUpdate();               }         }      } // namespace cli   } // namespace UI} // namespace btg

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -