MoeNavigator is an attempt to write a web browser that is highly configurable, secure, anonymous and fast.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

82 lines
2.0 KiB

  1. /*
  2. This file is part of MoeNavigator
  3. Copyright (C) 2012-2017 Moritz Strohm <ncc1988@posteo.de>
  4. This program 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. This program 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. */
  15. #include "GUIHandler.h"
  16. #include <iostream>
  17. GUIHandler::GUIHandler(QObject *parent) :
  18. QObject(parent)
  19. {
  20. }
  21. void GUIHandler::EmitNewTabRequest(QString url)
  22. {
  23. emit NewTabRequest(url);
  24. }
  25. void GUIHandler::EmitNewTabRequestFromQAction()
  26. {
  27. QUrl url = ((QAction*)QObject::sender())->data().toUrl();
  28. //std::cerr << "DEBUG: EmitNewTabRequestFromQAction: new url: " << url.toString().toStdString() << std::endl;
  29. emit NewTabRequest(url.toString());
  30. }
  31. void GUIHandler::EmitURLChange(QUrl newURL)
  32. {
  33. //TODO: check if a signal relay exists so that this won't be necessary
  34. emit URLChanged(QObject::sender(), newURL);
  35. }
  36. void GUIHandler::EmitTitleChange(QString newTitle)
  37. {
  38. QObject* sender = QObject::sender();
  39. emit TitleChanged(sender, newTitle);
  40. }
  41. void GUIHandler::EmitURLHover(QString url, QString title, QString content)
  42. {
  43. emit URLHovered(url);
  44. }
  45. void GUIHandler::EmitStatusBarText(QString newText)
  46. {
  47. emit StatusBarTextChanged(newText);
  48. }
  49. void GUIHandler::EmitLoadStart()
  50. {
  51. emit LoadStatusChanged(QObject::sender(), GUIHandler::LOAD_STATUS_STARTED);
  52. }
  53. void GUIHandler::EmitLoadFinished(bool success)
  54. {
  55. if(success)
  56. {
  57. emit LoadStatusChanged(QObject::sender(), GUIHandler::LOAD_STATUS_FINISHED);
  58. }
  59. else
  60. {
  61. emit LoadStatusChanged(QObject::sender(), GUIHandler::LOAD_STATUS_ERROR);
  62. }
  63. }