PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/fwbuilder-4.1.2/src/gui/WorkflowIcons.cpp

#
C++ | 96 lines | 54 code | 14 blank | 28 comment | 1 complexity | e85e7f6ea945dfa5f3693a12e0f76dcb MD5 | raw file
Possible License(s): GPL-2.0
  1. /*
  2. Firewall Builder
  3. Copyright (C) 2010 NetCitadel, LLC
  4. Author: Roman Bovsunivskiy a2k0001@gmail.com
  5. $Id: WorkflowIcons.cpp? 2786 2010-04-01 14:05:36Z a2k $
  6. This program is free software which we release under the GNU General Public
  7. License. You may redistribute and/or modify this program under the terms
  8. of that license as published by the Free Software Foundation; either
  9. version 2 of the License, or (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. To get a copy of the GNU General Public License, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #include "global.h"
  18. #include "ClickableLabel.h"
  19. #include "FWWindow.h"
  20. #include "ObjectManipulator.h"
  21. #include "ProjectPanel.h"
  22. #include "WorkflowIcons.h"
  23. #include "ui_WorkflowIcons.h"
  24. #include <fwbuilder/Firewall.h>
  25. #include <QDebug>
  26. #include <QDesktopServices>
  27. #include <QUrl>
  28. WorkflowIcons::WorkflowIcons(QWidget *parent) :
  29. QWidget(parent),
  30. ui(new Ui::WorkflowIcons_q)
  31. {
  32. ui->setupUi(this);
  33. }
  34. void WorkflowIcons::setUpSignals(QWidget *panel)
  35. {
  36. ObjectManipulator *om = panel->findChild<ObjectManipulator*>();
  37. QAction *newFirewall = om->findChild<QAction*>(QString("newObject_") + libfwbuilder::Firewall::TYPENAME);
  38. connect(ui->newFirewall, SIGNAL(clicked()), newFirewall, SLOT(trigger()));
  39. // global variable mw is null when this is running
  40. QObject *mainWindow = dynamic_cast<ProjectPanel*>(panel)->getWindow();
  41. QAction *import = mainWindow->findChild<QAction*>("policyImportAction");
  42. connect(ui->importConfig, SIGNAL(clicked()), import, SLOT(trigger()));
  43. connect(om, SIGNAL(libraryAccessChanged(bool)), this, SLOT(libraryAccessChanged(bool)));
  44. connect(ui->action_getting_started, SIGNAL(clicked()),
  45. this, SLOT(openTutorial()));
  46. }
  47. WorkflowIcons::~WorkflowIcons()
  48. {
  49. delete ui;
  50. }
  51. void WorkflowIcons::changeEvent(QEvent *e)
  52. {
  53. QWidget::changeEvent(e);
  54. switch (e->type()) {
  55. case QEvent::LanguageChange:
  56. ui->retranslateUi(this);
  57. break;
  58. default:
  59. break;
  60. }
  61. }
  62. void WorkflowIcons::libraryAccessChanged(bool writable)
  63. {
  64. ui->newFirewall->setEnabled(writable);
  65. ui->importConfig->setEnabled(writable);
  66. }
  67. void WorkflowIcons::openTutorial()
  68. {
  69. // if we want to show tutorial included with the package:
  70. // mw->showTutorial("getting_started");
  71. // if we want to open the page with video tutorials in the standard browser
  72. QDesktopServices::openUrl(QUrl("http://www.fwbuilder.org/4.0/videos.html",
  73. QUrl::StrictMode));
  74. }