pqParaViewMenuBuilders.cxx 30 KB
Newer Older
1 2 3 4 5 6 7 8 9
/*=========================================================================

   Program: ParaView
   Module:    pqParaViewMenuBuilders.cxx

   Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
   All rights reserved.

   ParaView is a free software; you can redistribute it and/or modify it
10
   under the terms of the ParaView license version 1.2.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

   See License_v1.2.txt for the full ParaView license.
   A copy of this license can be obtained by contacting
   Kitware Inc.
   28 Corporate Drive
   Clifton Park, NY 12065
   USA

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

========================================================================*/
#include "pqParaViewMenuBuilders.h"
33
#include "vtkPVConfig.h"
34 35

#include "ui_pqEditMenuBuilder.h"
36
#include "ui_pqFileMenuBuilder.h"
37 38 39 40 41

#include "pqAboutDialogReaction.h"
#include "pqAnimationTimeToolbar.h"
#include "pqApplicationCore.h"
#include "pqApplicationSettingsReaction.h"
42
#include "pqApplyPropertiesReaction.h"
43 44 45 46
#include "pqAxesToolbar.h"
#include "pqCameraLinkReaction.h"
#include "pqCameraToolbar.h"
#include "pqCameraUndoRedoReaction.h"
47
#include "pqCatalystConnectReaction.h"
48
#include "pqCatalystContinueReaction.h"
49
#include "pqCatalystExportReaction.h"
50
#include "pqCatalystPauseSimulationReaction.h"
51
#include "pqCatalystRemoveBreakpointReaction.h"
52
#include "pqCatalystScriptGeneratorReaction.h"
53
#include "pqCatalystSetBreakpointReaction.h"
54 55 56
#include "pqCategoryToolbarsBehavior.h"
#include "pqChangePipelineInputReaction.h"
#include "pqColorToolbar.h"
57
#include "pqCopyReaction.h"
58
#include "pqCreateCustomFilterReaction.h"
59
#include "pqCustomViewpointsToolbar.h"
60
#include "pqCustomizeShortcutsReaction.h"
61
#include "pqDataQueryReaction.h"
62
#include "pqDeleteReaction.h"
63
#include "pqDesktopServicesReaction.h"
64
#include "pqExampleVisualizationsDialogReaction.h"
65 66
#include "pqExportReaction.h"
#include "pqFiltersMenuReaction.h"
67
#ifdef PARAVIEW_USE_QTHELP
68
#include "pqHelpReaction.h"
69
#endif
70
#include "pqIgnoreSourceTimeReaction.h"
71
#include "pqImportCinemaReaction.h"
72
#include "pqLinkSelectionReaction.h"
73
#include "pqLoadDataReaction.h"
74
#include "pqLoadMaterialsReaction.h"
75
#include "pqLoadRestoreWindowLayoutReaction.h"
76 77 78
#include "pqLoadStateReaction.h"
#include "pqMainControlsToolbar.h"
#include "pqManageCustomFiltersReaction.h"
79
#include "pqManageFavoritesReaction.h"
80 81
#include "pqManageLinksReaction.h"
#include "pqManagePluginsReaction.h"
82
#include "pqPVApplicationCore.h"
83
#include "pqPropertiesPanel.h"
84
#include "pqProxyGroupMenuManager.h"
85
#include "pqRecentFilesMenu.h"
86
#include "pqReloadFilesReaction.h"
87
#include "pqRepresentationToolbar.h"
88
#include "pqResetDefaultSettingsReaction.h"
89 90 91 92 93 94 95
#include "pqSaveAnimationGeometryReaction.h"
#include "pqSaveAnimationReaction.h"
#include "pqSaveDataReaction.h"
#include "pqSaveScreenshotReaction.h"
#include "pqSaveStateReaction.h"
#include "pqServerConnectReaction.h"
#include "pqServerDisconnectReaction.h"
96
#include "pqSetMainWindowTitleReaction.h"
97
#include "pqSetName.h"
98
#include "pqShowHideAllReaction.h"
99
#include "pqSourcesMenuReaction.h"
100
#include "pqTemporalExportReaction.h"
101 102 103 104 105 106
#include "pqTestingReaction.h"
#include "pqTimerLogReaction.h"
#include "pqUndoRedoReaction.h"
#include "pqVCRToolbar.h"
#include "pqViewMenuManager.h"

107
#if VTK_MODULE_ENABLE_ParaView_pqPython
108
#include "pqMacroReaction.h"
109
#include "pqPythonManager.h"
110
#include "pqSGWritersMenuManager.h"
111
#include "pqTraceReaction.h"
112 113
#endif

114
#include <QApplication>
115
#include <QDockWidget>
116
#include <QFileInfo>
117 118 119 120 121
#include <QKeySequence>
#include <QLayout>
#include <QMainWindow>
#include <QMenu>

122
#include "vtkPVFileInformation.h"
123
#include "vtkSMProxyManager.h"
124

125 126 127 128 129 130 131 132 133
//-----------------------------------------------------------------------------
void pqParaViewMenuBuilders::buildFileMenu(QMenu& menu)
{
  QString objectName = menu.objectName();
  Ui::pqFileMenuBuilder ui;
  ui.setupUi(&menu);
  // since the UI file tends to change the name of the menu.
  menu.setObjectName(objectName);

134
  QObject::connect(
135
    ui.actionFileExit, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows()));
136 137 138

  // now setup reactions.
  new pqLoadDataReaction(ui.actionFileOpen);
139
  new pqImportCinemaReaction(ui.actionFileImportCinemaDatabase);
140
#if VTK_MODULE_ENABLE_VTK_RenderingRayTracing
141 142 143 144
  new pqLoadMaterialsReaction(ui.actionFileLoadMaterials);
#else
  delete ui.actionFileLoadMaterials;
#endif
145
  new pqRecentFilesMenu(*ui.menuRecentFiles, ui.menuRecentFiles);
146
  new pqReloadFilesReaction(ui.actionReloadFiles);
147 148 149 150 151 152 153 154 155 156 157 158 159

  new pqLoadStateReaction(ui.actionFileLoadServerState);
  new pqSaveStateReaction(ui.actionFileSaveServerState);

  new pqServerConnectReaction(ui.actionServerConnect);
  new pqServerDisconnectReaction(ui.actionServerDisconnect);

  new pqSaveScreenshotReaction(ui.actionFileSaveScreenshot);
  new pqSaveAnimationReaction(ui.actionFileSaveAnimation);
  new pqSaveAnimationGeometryReaction(ui.actionFileSaveGeometry);

  new pqExportReaction(ui.actionExport);
  new pqSaveDataReaction(ui.actionFileSaveData);
160

161 162
  new pqLoadRestoreWindowLayoutReaction(true, ui.actionFileLoadWindowArrangement);
  new pqLoadRestoreWindowLayoutReaction(false, ui.actionFileSaveWindowArrangement);
163 164 165
}

//-----------------------------------------------------------------------------
166
void pqParaViewMenuBuilders::buildEditMenu(QMenu& menu, pqPropertiesPanel* propertiesPanel)
167 168 169 170 171 172 173 174 175 176 177 178 179 180
{
  QString objectName = menu.objectName();
  Ui::pqEditMenuBuilder ui;
  ui.setupUi(&menu);
  // since the UI file tends to change the name of the menu.
  menu.setObjectName(objectName);

  new pqUndoRedoReaction(ui.actionEditUndo, true);
  new pqUndoRedoReaction(ui.actionEditRedo, false);
  new pqCameraUndoRedoReaction(ui.actionEditCameraUndo, true);
  new pqCameraUndoRedoReaction(ui.actionEditCameraRedo, false);
  new pqChangePipelineInputReaction(ui.actionChangeInput);
  new pqIgnoreSourceTimeReaction(ui.actionIgnoreTime);
  new pqDeleteReaction(ui.actionDelete);
181
  ui.actionDelete->setShortcut(QKeySequence(Qt::ALT + Qt::Key_D));
182
  new pqDeleteReaction(ui.actionDelete_All, true);
183 184
  new pqShowHideAllReaction(ui.actionShow_All, pqShowHideAllReaction::ActionType::Show);
  new pqShowHideAllReaction(ui.actionHide_All, pqShowHideAllReaction::ActionType::Hide);
185
  new pqSaveScreenshotReaction(ui.actionCopyScreenshotToClipboard, true);
186
  new pqCopyReaction(ui.actionCopy);
187
  new pqCopyReaction(ui.actionPaste, true);
188
  new pqApplicationSettingsReaction(ui.actionEditSettings);
189
  new pqDataQueryReaction(ui.actionQuery);
190
  new pqResetDefaultSettingsReaction(ui.actionResetDefaultSettings);
191
  new pqSetMainWindowTitleReaction(ui.actionSetMainWindowTitle);
192 193 194 195

  if (propertiesPanel)
  {
    QAction* applyAction = new QAction(QIcon(":/pqWidgets/Icons/pqUpdate16.png"), "Apply", &menu);
196
    applyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
197
    QAction* resetAction = new QAction(QIcon(":/pqWidgets/Icons/pqCancel16.png"), "Reset", &menu);
198
    resetAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_R));
199 200 201 202 203
    menu.insertAction(ui.actionDelete, applyAction);
    menu.insertAction(ui.actionDelete, resetAction);
    new pqApplyPropertiesReaction(propertiesPanel, applyAction, true);
    new pqApplyPropertiesReaction(propertiesPanel, resetAction, false);
  }
204 205 206
}

//-----------------------------------------------------------------------------
207
void pqParaViewMenuBuilders::buildSourcesMenu(QMenu& menu, QMainWindow* mainWindow)
208 209
{
  pqProxyGroupMenuManager* mgr = new pqProxyGroupMenuManager(&menu, "ParaViewSources");
210
  mgr->addProxyDefinitionUpdateListener("sources");
David E. DeMarle's avatar
David E. DeMarle committed
211
  mgr->setRecentlyUsedMenuSize(10);
212 213
  new pqSourcesMenuReaction(mgr);
  if (mainWindow)
214
  {
215 216
    // create toolbars for categories as needed.
    new pqCategoryToolbarsBehavior(mgr, mainWindow);
217
  }
218 219 220
}

//-----------------------------------------------------------------------------
221
void pqParaViewMenuBuilders::buildFiltersMenu(
222
  QMenu& menu, QMainWindow* mainWindow, bool hideDisabled, bool quickLaunchable)
223
{
224 225
  pqProxyGroupMenuManager* mgr =
    new pqProxyGroupMenuManager(&menu, "ParaViewFilters", quickLaunchable);
226
  mgr->addProxyDefinitionUpdateListener("filters");
227
  mgr->setRecentlyUsedMenuSize(10);
228
  mgr->setEnableFavorites(true);
229
  pqFiltersMenuReaction* menuReaction = new pqFiltersMenuReaction(mgr, hideDisabled);
230 231 232 233

  // Connect the filters menu about to show and the quick-launch dialog about to show
  // to update the enabled/disabled state of the menu items via the
  // pqFiltersMenuReaction
234 235 236 237 238 239 240
  menuReaction->connect(&menu, SIGNAL(aboutToShow()), SLOT(updateEnableState()));

  auto* pvappcore = pqPVApplicationCore::instance();
  if (quickLaunchable && pvappcore)
  {
    menuReaction->connect(pvappcore, SIGNAL(aboutToShowQuickLaunch()), SLOT(updateEnableState()));
  }
241 242

  if (mainWindow)
243
  {
244 245
    // create toolbars for categories as needed.
    new pqCategoryToolbarsBehavior(mgr, mainWindow);
246
  }
247 248 249 250 251
}

//-----------------------------------------------------------------------------
void pqParaViewMenuBuilders::buildToolsMenu(QMenu& menu)
{
252 253 254 255 256 257
  new pqCreateCustomFilterReaction(
    menu.addAction("Create Custom Filter...") << pqSetName("actionToolsCreateCustomFilter"));
  new pqCameraLinkReaction(
    menu.addAction("Add Camera Link...") << pqSetName("actionToolsAddCameraLink"));
  new pqLinkSelectionReaction(
    menu.addAction("Link with Selection") << pqSetName("actionToolsLinkSelection"));
258
  menu.addSeparator();
259 260 261 262
  new pqManageCustomFiltersReaction(
    menu.addAction("Manage Custom Filters...") << pqSetName("actionToolsManageCustomFilters"));
  new pqManageLinksReaction(
    menu.addAction("Manage Links...") << pqSetName("actionToolsManageLinks"));
263
  //<addaction name="actionToolsAddCameraLink" />
264
  // Add support for importing plugins only if ParaView was built shared.
265 266
  new pqManagePluginsReaction(
    menu.addAction("Manage Plugins...") << pqSetName("actionManage_Plugins"));
267

268 269 270 271
  QMenu* dummyMenu = new QMenu();
  pqProxyGroupMenuManager* mgr = new pqProxyGroupMenuManager(dummyMenu, "ParaViewFilters", false);
  mgr->addProxyDefinitionUpdateListener("filters");

272 273 274
  QAction* manageFavoritesAction = menu.addAction("Manage Favorites...")
    << pqSetName("actionManage_Favorites");
  new pqManageFavoritesReaction(manageFavoritesAction, mgr);
275

276 277 278
  new pqCustomizeShortcutsReaction(
    menu.addAction("Customize Shortcuts...") << pqSetName("actionCustomize"));

279 280
  menu.addSeparator(); // --------------------------------------------------

281
  //<addaction name="actionToolsDumpWidgetNames" />
282
  new pqTestingReaction(menu.addAction("Record Test...") << pqSetName("actionToolsRecordTest"),
283
    pqTestingReaction::RECORD);
284 285 286
  new pqTestingReaction(menu.addAction("Play Test...") << pqSetName("actionToolsPlayTest"),
    pqTestingReaction::PLAYBACK, Qt::QueuedConnection);
  new pqTestingReaction(menu.addAction("Lock View Size") << pqSetName("actionTesting_Window_Size"),
287
    pqTestingReaction::LOCK_VIEW_SIZE);
288 289
  new pqTestingReaction(
    menu.addAction("Lock View Size Custom...") << pqSetName("actionTesting_Window_Size_Custom"),
290
    pqTestingReaction::LOCK_VIEW_SIZE_CUSTOM);
291
  menu.addSeparator();
292
  new pqTimerLogReaction(menu.addAction("Timer Log") << pqSetName("actionToolsTimerLog"));
293 294
  menu.addSeparator(); // --------------------------------------------------

295
#if VTK_MODULE_ENABLE_ParaView_pqPython
296
  menu.addSeparator(); // --------------------------------------------------
297 298
  new pqTraceReaction(menu.addAction("Start Trace") << pqSetName("actionToolsStartStopTrace"),
    "Start Trace", "Stop Trace");
299
#endif
300 301 302 303 304 305 306 307 308
}

//-----------------------------------------------------------------------------
void pqParaViewMenuBuilders::buildViewMenu(QMenu& menu, QMainWindow& mainWindow)
{
  new pqViewMenuManager(&mainWindow, &menu);
}

//-----------------------------------------------------------------------------
309
void pqParaViewMenuBuilders::buildPipelineBrowserContextMenu(QMenu& menu)
310
{
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
  // Build the context menu manually so we can insert submenus where needed.
  QAction* actionPBOpen = new QAction(menu.parent());
  actionPBOpen->setObjectName(QStringLiteral("actionPBOpen"));
  QIcon icon4;
  icon4.addFile(
    QStringLiteral(":/pqWidgets/Icons/pqOpen24.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBOpen->setIcon(icon4);
  actionPBOpen->setShortcutContext(Qt::WidgetShortcut);
  actionPBOpen->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Open", Q_NULLPTR));
#ifndef QT_NO_TOOLTIP
  actionPBOpen->setToolTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Open", Q_NULLPTR));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
  actionPBOpen->setStatusTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Open", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

330 331 332 333 334 335 336 337 338 339 340 341 342
  QAction* actionPBShowAll = new QAction(menu.parent());
  actionPBShowAll->setObjectName(QStringLiteral("actionPBShowAll"));
  QIcon showAllIcon;
  showAllIcon.addFile(
    QStringLiteral(":/pqWidgets/Icons/pqEyeball.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBShowAll->setIcon(showAllIcon);
  actionPBShowAll->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Show All", Q_NULLPTR));
#ifndef QT_NO_STATUSTIP
  actionPBShowAll->setStatusTip(QApplication::translate(
    "pqPipelineBrowserContextMenu", "Shoo all source outputs in the pipeline", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

343 344
  QAction* actionPBHideAll = new QAction(menu.parent());
  actionPBHideAll->setObjectName(QStringLiteral("actionPBHideAll"));
345 346 347 348
  QIcon hideAllIcon;
  hideAllIcon.addFile(
    QStringLiteral(":/pqWidgets/Icons/pqEyeballClosed.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBHideAll->setIcon(hideAllIcon);
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
  actionPBHideAll->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Hide All", Q_NULLPTR));
#ifndef QT_NO_STATUSTIP
  actionPBHideAll->setStatusTip(QApplication::translate(
    "pqPipelineBrowserContextMenu", "Hide all source outputs in the pipeline", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

  QAction* actionPBCopy = new QAction(menu.parent());
  actionPBCopy->setObjectName(QStringLiteral("actionPBCopy"));
  QIcon icon2;
  icon2.addFile(
    QStringLiteral(":/pqWidgets/Icons/pqCopy22.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBCopy->setIcon(icon2);
  actionPBCopy->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Copy", Q_NULLPTR));
#ifndef QT_NO_STATUSTIP
  actionPBCopy->setStatusTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Copy Properties", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

  QAction* actionPBPaste = new QAction(menu.parent());
  actionPBPaste->setObjectName(QStringLiteral("actionPBPaste"));
  QIcon icon3;
  icon3.addFile(
    QStringLiteral(":/pqWidgets/Icons/pqPaste22.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBPaste->setIcon(icon3);
  actionPBPaste->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Paste", Q_NULLPTR));
#ifndef QT_NO_STATUSTIP
  actionPBPaste->setStatusTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Paste Properties", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

  QAction* actionPBChangeInput = new QAction(menu.parent());
  actionPBChangeInput->setObjectName(QStringLiteral("actionPBChangeInput"));
  actionPBChangeInput->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Change &Input...", Q_NULLPTR));
  actionPBChangeInput->setIconText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Change Input...", Q_NULLPTR));
#ifndef QT_NO_TOOLTIP
  actionPBChangeInput->setToolTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Change a Filter's Input", Q_NULLPTR));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
  actionPBChangeInput->setStatusTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Change a Filter's Input", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

  QAction* actionPBReloadFiles = new QAction(menu.parent());
  actionPBReloadFiles->setObjectName(QStringLiteral("actionPBReloadFiles"));
  actionPBReloadFiles->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Reload Files", Q_NULLPTR));
  actionPBReloadFiles->setIconText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Reload Files", Q_NULLPTR));
#ifndef QT_NO_TOOLTIP
  actionPBReloadFiles->setToolTip(QApplication::translate("pqPipelineBrowserContextMenu",
    "Reload data files in case they were changed externally.", Q_NULLPTR));
#endif // QT_NO_TOOLTIP

  QAction* actionPBIgnoreTime = new QAction(menu.parent());
  actionPBIgnoreTime->setObjectName(QStringLiteral("actionPBIgnoreTime"));
  actionPBIgnoreTime->setCheckable(true);
  actionPBIgnoreTime->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Ignore Time", Q_NULLPTR));
#ifndef QT_NO_TOOLTIP
  actionPBIgnoreTime->setToolTip(QApplication::translate("pqPipelineBrowserContextMenu",
    "Disregard this source/filter's time from animations", Q_NULLPTR));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_STATUSTIP
  actionPBIgnoreTime->setStatusTip(QApplication::translate("pqPipelineBrowserContextMenu",
    "Disregard this source/filter's time from animations", Q_NULLPTR));
#endif // QT_NO_STATUSTIP

  QAction* actionPBDelete = new QAction(menu.parent());
  actionPBDelete->setObjectName(QStringLiteral("actionPBDelete"));
  QIcon icon;
  icon.addFile(
    QStringLiteral(":/QtWidgets/Icons/pqDelete24.png"), QSize(), QIcon::Normal, QIcon::Off);
  actionPBDelete->setIcon(icon);
  actionPBDelete->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Delete", Q_NULLPTR));
#ifndef QT_NO_STATUSTIP
  actionPBDelete->setStatusTip(
    QApplication::translate("pqPipelineBrowserContextMenu", "Delete", Q_NULLPTR));
#endif // QT_NO_STATUSTIP
434

435
  QByteArray signalName = QMetaObject::normalizedSignature("deleteKey()");
436
  if (menu.parent()->metaObject()->indexOfSignal(signalName) != -1)
437
  {
438
    // Trigger a delete when the user requests a delete.
439
    QObject::connect(
440
      menu.parent(), SIGNAL(deleteKey()), actionPBDelete, SLOT(trigger()), Qt::QueuedConnection);
441
  }
442

443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
  QAction* actionPBCreateCustomFilter = new QAction(menu.parent());
  actionPBCreateCustomFilter->setObjectName(QStringLiteral("actionPBCreateCustomFilter"));
  actionPBCreateCustomFilter->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "&Create Custom Filter...", Q_NULLPTR));

  QAction* actionPBLinkSelection = new QAction(menu.parent());
  actionPBLinkSelection->setObjectName(QStringLiteral("actionPBLinkSelection"));
  actionPBLinkSelection->setText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Link with selection", Q_NULLPTR));
  actionPBLinkSelection->setIconText(
    QApplication::translate("pqPipelineBrowserContextMenu", "Link with selection", Q_NULLPTR));
#ifndef QT_NO_TOOLTIP
  actionPBLinkSelection->setToolTip(QApplication::translate("pqPipelineBrowserContextMenu",
    "Link this source and current selected source as a selection link", Q_NULLPTR));
#endif // QT_NO_TOOLTIP

  menu.addAction(actionPBOpen);
460
  menu.addAction(actionPBShowAll);
461 462 463 464
  menu.addAction(actionPBHideAll);
  menu.addAction(actionPBCopy);
  menu.addAction(actionPBPaste);
  menu.addAction(actionPBChangeInput);
465
  QMenu* addFilterMenu = menu.addMenu("Add Filter");
466 467
  pqParaViewMenuBuilders::buildFiltersMenu(
    *addFilterMenu, nullptr, true /*hide disabled*/, false /*quickLaunchable*/);
468 469 470 471 472 473
  menu.addAction(actionPBReloadFiles);
  menu.addAction(actionPBIgnoreTime);
  menu.addAction(actionPBDelete);
  menu.addAction(actionPBCreateCustomFilter);
  menu.addAction(actionPBLinkSelection);

474 475
  // And here the reactions come in handy! Just reuse the reaction used for
  // File | Open.
476
  new pqLoadDataReaction(actionPBOpen);
477 478
  new pqShowHideAllReaction(actionPBShowAll, pqShowHideAllReaction::ActionType::Show);
  new pqShowHideAllReaction(actionPBHideAll, pqShowHideAllReaction::ActionType::Hide);
479 480 481 482 483 484 485 486
  new pqCopyReaction(actionPBCopy);
  new pqCopyReaction(actionPBPaste, true);
  new pqChangePipelineInputReaction(actionPBChangeInput);
  new pqReloadFilesReaction(actionPBReloadFiles);
  new pqIgnoreSourceTimeReaction(actionPBIgnoreTime);
  new pqDeleteReaction(actionPBDelete);
  new pqCreateCustomFilterReaction(actionPBCreateCustomFilter);
  new pqLinkSelectionReaction(actionPBLinkSelection);
487 488 489
}

//-----------------------------------------------------------------------------
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
490
void pqParaViewMenuBuilders::buildMacrosMenu(QMenu& menu)
491
{
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
492
  Q_UNUSED(menu);
493
#if VTK_MODULE_ENABLE_ParaView_pqPython
494 495 496
  // Give the macros menu to the pqPythonMacroSupervisor
  pqPythonManager* manager = pqPVApplicationCore::instance()->pythonManager();
  if (manager)
497 498 499 500
  {
    new pqMacroReaction(menu.addAction("Add new macro...") << pqSetName("actionMacroCreate"));
    QMenu* editMenu = menu.addMenu("Edit...");
    QMenu* deleteMenu = menu.addMenu("Delete...");
501 502 503 504
    menu.addSeparator();
    manager->addWidgetForRunMacros(&menu);
    manager->addWidgetForEditMacros(editMenu);
    manager->addWidgetForDeleteMacros(deleteMenu);
505
  }
506 507 508 509 510 511
#endif
}

//-----------------------------------------------------------------------------
void pqParaViewMenuBuilders::buildHelpMenu(QMenu& menu)
{
512
  QString documentationPath(vtkPVFileInformation::GetParaViewDocDirectory().c_str());
513 514
  QString paraViewGettingStartedFile = documentationPath + "/GettingStarted.pdf";

Cory Quammen's avatar
Cory Quammen committed
515
  // Getting Started with ParaView
516 517 518
  new pqDesktopServicesReaction(QUrl::fromLocalFile(paraViewGettingStartedFile),
    (menu.addAction(QIcon(":/pqWidgets/Icons/pdf.png"), "Getting Started with ParaView")
                                  << pqSetName("actionGettingStarted")));
Cory Quammen's avatar
Cory Quammen committed
519 520

  // ParaView Guide
521
  QAction* guide = menu.addAction(QIcon(":/pqWidgets/Icons/pdf.png"), "ParaView Guide");
522 523
  guide->setObjectName("actionGuide");
  guide->setShortcut(QKeySequence::HelpContents);
524 525 526 527 528 529 530
  QString guideURL = QString("https://www.paraview.org/paraview-downloads/"
                             "download.php?submit=Download&version=v%1.%2&type=binary&os="
                             "Sources&downloadFile=ParaViewGuide-%1.%2.%3.pdf")
                       .arg(vtkSMProxyManager::GetVersionMajor())
                       .arg(vtkSMProxyManager::GetVersionMinor())
                       .arg(vtkSMProxyManager::GetVersionPatch());
  new pqDesktopServicesReaction(QUrl(guideURL), guide);
531

532
#ifdef PARAVIEW_USE_QTHELP
533
  // Help
534
  QAction* help = menu.addAction("Reader, Filter, and Writer Reference") << pqSetName("actionHelp");
535
  new pqHelpReaction(help);
536
#endif
537

Cory Quammen's avatar
Cory Quammen committed
538 539 540
  // -----------------
  menu.addSeparator();

541 542 543 544 545 546 547 548 549 550
  // ParaView Tutorial
  QString tutorialURL = QString("https://www.paraview.org/paraview-downloads/"
                                "download.php?submit=Download&version=v%1.%2&type=binary&os="
                                "Sources&downloadFile=ParaViewTutorial-%1.%2.%3.pdf")
                          .arg(vtkSMProxyManager::GetVersionMajor())
                          .arg(vtkSMProxyManager::GetVersionMinor())
                          .arg(vtkSMProxyManager::GetVersionPatch());
  new pqDesktopServicesReaction(
    QUrl(tutorialURL), (menu.addAction(QIcon(":/pqWidgets/Icons/pdf.png"), "ParaView Tutorial")
                         << pqSetName("actionTutorialNotes")));
Cory Quammen's avatar
Cory Quammen committed
551 552

  // Sandia National Labs Tutorials
553
  new pqDesktopServicesReaction(QUrl("http://www.paraview.org/Wiki/SNL_ParaView_4_Tutorials"),
Cory Quammen's avatar
Cory Quammen committed
554 555 556 557 558
    (menu.addAction("Sandia National Labs Tutorials") << pqSetName("actionSNLTutorial")));

  // Example Data Sets

  // Example Visualizations
559 560
  new pqExampleVisualizationsDialogReaction(
    menu.addAction("Example Visualizations") << pqSetName("ExampleVisualizations"));
Cory Quammen's avatar
Cory Quammen committed
561 562

  // -----------------
563
  menu.addSeparator();
Cory Quammen's avatar
Cory Quammen committed
564 565

  // ParaView Web Site
566
  new pqDesktopServicesReaction(QUrl("http://www.paraview.org"),
Cory Quammen's avatar
Cory Quammen committed
567 568 569
    (menu.addAction("ParaView Web Site") << pqSetName("actionWebSite")));

  // ParaView Wiki
570
  new pqDesktopServicesReaction(QUrl("http://www.paraview.org/Wiki/ParaView"),
Cory Quammen's avatar
Cory Quammen committed
571 572
    (menu.addAction("ParaView Wiki") << pqSetName("actionWiki")));

573 574 575
  // ParaView Community Support
  new pqDesktopServicesReaction(QUrl("http://www.paraview.org/community-support/"),
    (menu.addAction("ParaView Community Support") << pqSetName("actionCommunitySupport")));
Cory Quammen's avatar
Cory Quammen committed
576 577 578 579 580

  // ParaView Release Notes
  QString versionString(PARAVIEW_VERSION_FULL);
  int indexOfHyphen = versionString.indexOf('-');
  if (indexOfHyphen > -1)
581
  {
Cory Quammen's avatar
Cory Quammen committed
582
    versionString = versionString.left(indexOfHyphen);
583
  }
Cory Quammen's avatar
Cory Quammen committed
584 585 586 587 588 589 590 591 592
  versionString.replace('.', '-');
  new pqDesktopServicesReaction(
    QUrl("https://blog.kitware.com/paraview-" + versionString + "-release-notes/"),
    (menu.addAction("Release Notes") << pqSetName("actionReleaseNotes")));

  // -----------------
  menu.addSeparator();

  // Professional Support
593
  new pqDesktopServicesReaction(QUrl("http://www.kitware.com/products/paraviewpro.html"),
Cory Quammen's avatar
Cory Quammen committed
594 595 596
    (menu.addAction("Professional Support") << pqSetName("actionProfessionalSupport")));

  // Professional Training
597
  new pqDesktopServicesReaction(QUrl("http://www.kitware.com/products/protraining.php"),
Cory Quammen's avatar
Cory Quammen committed
598 599 600
    (menu.addAction("Professional Training") << pqSetName("actionTraining")));

  // Online Tutorials
601
  new pqDesktopServicesReaction(QUrl("http://www.paraview.org/tutorials/"),
602
    (menu.addAction("Online Tutorials") << pqSetName("actionTutorials")));
Cory Quammen's avatar
Cory Quammen committed
603 604

  // Online Blogs
605
  new pqDesktopServicesReaction(QUrl("https://blog.kitware.com/tag/ParaView/"),
606 607
    (menu.addAction("Online Blogs") << pqSetName("actionBlogs")));

Cory Quammen's avatar
Cory Quammen committed
608 609
#if !defined(__APPLE__)
  // -----------------
610
  menu.addSeparator();
Cory Quammen's avatar
Cory Quammen committed
611 612 613
#endif

  // About
614
  new pqAboutDialogReaction(menu.addAction("About...") << pqSetName("actionAbout"));
615 616 617 618 619 620 621 622 623 624
}

//-----------------------------------------------------------------------------
void pqParaViewMenuBuilders::buildToolbars(QMainWindow& mainWindow)
{
  QToolBar* mainToolBar = new pqMainControlsToolbar(&mainWindow)
    << pqSetName("MainControlsToolbar");
  mainToolBar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, mainToolBar);

625
  QToolBar* vcrToolbar = new pqVCRToolbar(&mainWindow) << pqSetName("VCRToolbar");
626 627 628 629 630 631 632 633
  vcrToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, vcrToolbar);

  QToolBar* timeToolbar = new pqAnimationTimeToolbar(&mainWindow)
    << pqSetName("currentTimeToolbar");
  timeToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, timeToolbar);

634 635 636 637 638 639 640
  QToolBar* customViewpointsToolbar = new pqCustomViewpointsToolbar(&mainWindow)
    << pqSetName("customViewpointsToolbar");
  customViewpointsToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, customViewpointsToolbar);

  mainWindow.addToolBarBreak();

641
  QToolBar* colorToolbar = new pqColorToolbar(&mainWindow) << pqSetName("variableToolbar");
642 643
  colorToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, colorToolbar);
644

645 646 647 648 649
  QToolBar* reprToolbar = new pqRepresentationToolbar(&mainWindow)
    << pqSetName("representationToolbar");
  reprToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, reprToolbar);

650
  QToolBar* cameraToolbar = new pqCameraToolbar(&mainWindow) << pqSetName("cameraToolbar");
651 652 653
  cameraToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, cameraToolbar);

654
  QToolBar* axesToolbar = new pqAxesToolbar(&mainWindow) << pqSetName("axesToolbar");
655 656 657
  axesToolbar->layout()->setSpacing(0);
  mainWindow.addToolBar(Qt::TopToolBarArea, axesToolbar);

658
#if VTK_MODULE_ENABLE_ParaView_pqPython
659
  // Give the macros menu to the pqPythonMacroSupervisor
660 661
  pqPythonManager* manager =
    qobject_cast<pqPythonManager*>(pqApplicationCore::instance()->manager("PYTHON_MANAGER"));
662
  if (manager)
663
  {
664 665
    QToolBar* macrosToolbar = new QToolBar("Macros Toolbars", &mainWindow)
      << pqSetName("MacrosToolbar");
666
    manager->addWidgetForRunMacros(macrosToolbar);
667
    mainWindow.addToolBar(Qt::TopToolBarArea, macrosToolbar);
668
  }
669 670
#endif
}
671 672

//-----------------------------------------------------------------------------
673
void pqParaViewMenuBuilders::buildCatalystMenu(QMenu& menu, QWidget* exportConfiguration)
674
{
675
  new pqCatalystConnectReaction(menu.addAction("Connect...") << pqSetName("actionCatalystConnect"));
676
  new pqCatalystPauseSimulationReaction(
677
    menu.addAction("Pause Simulation") << pqSetName("actionCatalystPauseSimulation"));
678

679
  new pqCatalystContinueReaction(menu.addAction("Continue") << pqSetName("actionCatalystContinue"));
680 681

  new pqCatalystSetBreakpointReaction(
682
    menu.addAction("Set Breakpoint") << pqSetName("actionCatalystSetBreakpoint"));
683 684

  new pqCatalystRemoveBreakpointReaction(
685
    menu.addAction("Remove Breakpoint") << pqSetName("actionCatalystRemoveBreakpoint"));
686

687
#if VTK_MODULE_ENABLE_ParaView_pqPython
688 689
#define SHOWNEWCATALYSTGUI 1
#if SHOWNEWCATALYSTGUI
690
  menu.addSeparator(); // --------------------------------------------------
691 692 693 694 695 696 697 698 699
  // QAction* cexport = menu.addAction("Configure Exports"); //WTH won't this show up on mac?
  // QAction* cexport = menu.addAction("Setup Exports"); //or this on mac?
  QAction* cexport = menu.addAction("Define Exports")
    << pqSetName("actionCatalystConfigure"); // but this is OK?
  QObject::connect(cexport, SIGNAL(triggered()), exportConfiguration, SLOT(show()));

  QAction* gcatalyst = menu.addAction("Export Catalyst Script")
    << pqSetName("actionExportCatalyst");
  new pqCatalystExportReaction(gcatalyst);
700 701 702 703
  QAction* gtemporal = menu.addAction("Export Temporal Script")
    << pqSetName("actionExportTemporal");
  new pqTemporalExportReaction(gtemporal);

704 705
#else
  (void)exportConfiguration; // avoid unreferenced parameter comp warning
706
#endif
707

708 709
#define SHOWOLDCATALYSTGUI 1
#if SHOWOLDCATALYSTGUI
710
  menu.addSeparator(); // --------------------------------------------------
711
  QAction* csg = menu.addAction("Generate Script -deprecated") << pqSetName("Export State");
712 713 714
  new pqCatalystScriptGeneratorReaction(csg);

  pqSGWritersMenuManager* menuMgr =
715
    new pqSGWritersMenuManager(&menu, "&Writers", "CatalystWritersMenu", nullptr);
716 717
  menuMgr->createMenu();
#endif
718 719
#else
  (void)exportConfiguration; // avoid unreferenced parameter comp warning
720
#endif
721
}