コード例 #1
0
bool SpectralLibraryManager::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList)
{
    mpProgress = Service<PlugInManagerServices>()->getProgress(this);
    if (mpProgress != NULL)
    {
        Service<DesktopServices>()->createProgressDialog(getName(), mpProgress);
    }

    // Create edit library action
    if (isBatch() == false)
    {
        QPixmap pixEditLib(EditSpectralLibraryIcon);
        mpEditSpectralLibraryAction = new QAction(QIcon(pixEditLib),
                "&Edit Spectral Library", this);
        mpEditSpectralLibraryAction->setAutoRepeat(false);
        mpEditSpectralLibraryAction->setStatusTip("Display the editor for adding and removing "
                "signatures used by the Spectral Library Match algorithm plug-ins.");
        VERIFYNR(connect(mpEditSpectralLibraryAction, SIGNAL(triggered()), this, SLOT(editSpectralLibrary())));

        ToolBar* pToolBar = static_cast<ToolBar*>(Service<DesktopServices>()->getWindow("Spectral", TOOLBAR));
        if (pToolBar != NULL)
        {
            pToolBar->addSeparator();
            pToolBar->addButton(mpEditSpectralLibraryAction);
        }
    }

    return true;
}
コード例 #2
0
QAction* SpectralLibraryMatchResults::createAction()
{
   // Add toolbar button and menu item to invoke the window
   QAction* pShowAction(NULL);
   ToolBar* pToolBar = static_cast<ToolBar*>(Service<DesktopServices>()->getWindow("Spectral", TOOLBAR));
   if (pToolBar != NULL)
   {
      MenuBar* pMenuBar = pToolBar->getMenuBar();
      if (pMenuBar != NULL)
      {
         QAction* pMenuAction = pMenuBar->getMenuItem("/Spectral/Support Tools");
         if (pMenuAction != NULL)
         {
            QMenu* pMenu = pMenuBar->getMenu(pMenuAction);
            if (pMenu != NULL)
            {
               pShowAction = pMenu->addAction("Spectral Library Match Results Window");
               if (pShowAction != NULL)
               {
                  QPixmap pixShowResults(ShowResultsIcon);
                  pShowAction->setIcon(QIcon(pixShowResults));
                  pShowAction->setCheckable(true);
                  pShowAction->setAutoRepeat(false);
                  pShowAction->setStatusTip("Toggles the display of the Spectral Library Match Results Window");
                  pToolBar->addSeparator();
                  pToolBar->addButton(pShowAction);
               }
            }
         }
      }
   }

   return pShowAction;
}