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

📄 btgncli.cpp

📁 LINUX下
💻 CPP
📖 第 1 页 / 共 2 页
字号:
      {	// BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to initialize logging");         delete starthelper;         starthelper = 0;         delete handler;         handler = 0;         delete externalization;         externalization = 0;         delete cla;         cla = 0;         delete config;         config = 0;         delete lastfiles;         lastfiles = 0;	 iw->showError("Unable to initialize logging.");	 delete iw;	 iw = 0;         projectDefaults::killInstance();         logWrapper::killInstance();         return BTG_ERROR_EXIT;      }   // In case authorization is required from the user, erase the   // init window to avoid dealing with ncurses.   // It will be recreated later.   iw->hide();   delete iw;   iw = 0;   if (config->authSet())      {         // Auth info is in the config.         starthelper->setUser(config->getUserName());         starthelper->setPasswordHash(config->getPasswordHash());      }   else      {         // Ask the user about which username and password to use.         if (starthelper->execute(startupHelper::op_auth) != startupHelper::or_auth_success)            {	      // BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to initialize auth");               delete starthelper;               starthelper = 0;               delete handler;               handler = 0;               delete externalization;               externalization = 0;               delete cla;               cla = 0;               delete config;               config = 0;               delete lastfiles;               lastfiles = 0;	       // Show the init window to display the error.	       iw = new initWindow(kmap);	       iw->show();	       iw->showError("Authorization failed.");	       delete iw;	       iw = 0;               projectDefaults::killInstance();               logWrapper::killInstance();               return BTG_ERROR_EXIT;            }      }   // Recreate the init window.   iw = new initWindow(kmap);   iw->show();   iw->updateProgress(initWindow::IEV_SETUP);   /// Initialize the transport.   starthelper->execute(startupHelper::op_init);   // Handle command line options:   if (cla->doList())      {	 // iw->showError("Unable to list sessions.");	 delete iw;	 iw = 0;         starthelper->execute(startupHelper::op_list);         // Clean up, before quitting.         delete starthelper;         starthelper = 0;         delete handler;         handler = 0;         delete externalization;         externalization = 0;         delete cla;         cla = 0;         delete config;         config = 0;         delete lastfiles;         lastfiles = 0;         projectDefaults::killInstance();         logWrapper::killInstance();         return BTG_NORMAL_EXIT;      }   else if (cla->doAttachFirst())      {         // Attach to the first available session.         if (starthelper->execute(startupHelper::op_attach_first) == startupHelper::or_attach_first_failture)            {	      // BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to attach to session");               // Clean up, before quitting.               delete starthelper;               starthelper = 0;               delete handler;               handler = 0;               delete externalization;               externalization = 0;               delete cla;               cla = 0;               delete config;               config = 0;               delete lastfiles;               lastfiles = 0;	       iw->showError("Unable to attach to session.");	       delete iw;	       iw = 0;               projectDefaults::killInstance();               logWrapper::killInstance();               return BTG_ERROR_EXIT;            }      }   else if (cla->doAttach())      {         // Attach to a certain session, either specified on the         // command line or chosen by the user from a list.	iw->hide();	delete iw;	iw = 0;         if (starthelper->execute(startupHelper::op_attach) == startupHelper::or_attach_failture)            {	      // BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to attach to session");               // Clean up, before quitting.               delete starthelper;               starthelper = 0;               delete handler;               handler = 0;               delete externalization;               externalization = 0;               delete cla;               cla = 0;               delete config;               config = 0;               delete lastfiles;               lastfiles = 0;	       iw = new initWindow(kmap);	       iw->show();	       iw->showError("Unable to attach to session.");	       delete iw;	       iw = 0;	                      projectDefaults::killInstance();               logWrapper::killInstance();               return BTG_ERROR_EXIT;            }	iw = new initWindow(kmap);	iw->show();	iw->updateProgress(initWindow::IEV_SETUP);      }   // Only execute setup if we are not attaching to an existing session.   if ((!cla->doAttach()) && (!cla->doAttachFirst()))      {         if (starthelper->execute(startupHelper::op_setup) == startupHelper::or_setup_failture)            {	      // BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to connect to daemon.");               // Clean up, before quitting.               delete starthelper;               starthelper = 0;               delete handler;               handler = 0;               delete externalization;               externalization = 0;               delete cla;               cla = 0;               delete config;               config = 0;               delete lastfiles;               lastfiles = 0;	       iw->showError("Unable to connect to daemon.");	       delete iw;	       iw = 0;               projectDefaults::killInstance();               logWrapper::killInstance();               return BTG_ERROR_EXIT;            }      }#if defined(__APPLE__) && defined(__MACH__)#else   sigh_add(SIGINT, (void*)&global_signal_handler);   sigh_add(SIGTERM, (void*)&global_signal_handler);   /*     Not working...     sigh_add(SIGINT,   reinterpret_cast<void*>(&global_signal_handler));     sigh_add(SIGTERM,  reinterpret_cast<void*>(&global_signal_handler));   */   //sigh_add(SIGWINCH, (void*)&global_signal_handler);#endif   // Done using the start up helper.   delete starthelper;   starthelper = 0;   // Update init dialog.   iw->updateProgress(initWindow::IEV_SETUP_DONE);   // Update init dialog.   iw->updateProgress(initWindow::IEV_END);   iw->hide();   delete iw;   iw = 0;   t_long session = handler->session();   std::string strSession = btg::core::convertToString<t_long>(session);   // Start a thread that takes care of communicating with the daemon.   handlerThread* handlerthr = new handlerThread(verboseFlag, handler);   UI ui(strSession, neverAskFlag, kmap, colors, handlerthr);   // Init the ui.   ui.init();   // If the user requested to open any files, do it.   if (cla->inputFilenamesPresent())      {	t_strList filelist = cla->getInputFilenames();	ui.handleLoad(filelist);      }   ui.refresh();   // Main event loop.   while (ui.handleKeyboard());   ui.destroy();   // UI finished.   delete handlerthr;   handlerthr = 0;   if (config->modified())      {         config->write();      }   delete config;   config = 0;   if (lastfiles->modified())      {         bool status = lastfiles->save();         if (status)            {               BTG_NOTICE("Wrote lastfiles.");            }         else            {               BTG_FATAL_ERROR(GPD->sCLI_CLIENT(), "Unable to write the list of last opened files.");            }      }   else      {         BTG_NOTICE("Not writting lastfiles.");      }   delete lastfiles;   lastfiles = 0;   delete handler;   handler = 0;   delete externalization;   externalization = 0;   delete cla;   cla = 0;   projectDefaults::killInstance();   logWrapper::killInstance();   return BTG_NORMAL_EXIT;}void global_signal_handler(int _signal_no){   switch (_signal_no)      {      case SIGINT:      case SIGTERM:         {            break;         }      }}

⌨️ 快捷键说明

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