PageRenderTime 40ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/actiontools/src/helpbutton.cpp

https://github.com/Jmgr/actionaz
C++ | 47 lines | 22 code | 6 blank | 19 comment | 1 complexity | f8cb5dd46ea36948d02d198c474f47be MD5 | raw file
  1. /*
  2. Actiona
  3. Copyright (C) 2005 Jonathan Mercier-Ganady
  4. Actiona is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Actiona is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. Contact: jmgr@jmgr.info
  15. */
  16. #include "actiontools/helpbutton.hpp"
  17. #include <QDesktopServices>
  18. #include <QUrl>
  19. namespace ActionTools
  20. {
  21. HelpButton::HelpButton(QWidget *parent)
  22. : QPushButton(parent)
  23. {
  24. setText(QString());
  25. setIcon(QIcon(QStringLiteral(":/images/help.png")));
  26. setIconSize(QSize(16, 16));
  27. setMaximumWidth(24);
  28. setMaximumHeight(24);
  29. connect(this, &HelpButton::clicked, this, &HelpButton::onClicked);
  30. }
  31. void HelpButton::onClicked()
  32. {
  33. if(mTopic.isEmpty())
  34. return;
  35. QDesktopServices::openUrl(QUrl(QStringLiteral("http://wiki.actiona.tools/doku.php?id=%1").arg(mTopic)));
  36. }
  37. }