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.
 
 
 
 
 

142 lines
3.8 KiB

  1. /*
  2. This file is part of MoeNavigator
  3. Copyright (C) 2012-2019 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. #ifndef MOENAVIGATORMAIN_H
  16. #define MOENAVIGATORMAIN_H
  17. #include <QMainWindow>
  18. #include <QSettings>
  19. #include <QPointer>
  20. #include "configurationwindow.h"
  21. #include "moenavigatoraboutdialog.h"
  22. #include "ui_moenavigatormain.h"
  23. #include "GUIHandler.h"
  24. #include "BrowserTabWidget.h"
  25. #include <iostream>
  26. #include <memory>
  27. namespace Ui {
  28. class MoeNavigatorMain;
  29. }
  30. class MoeNavigatorMain : public QMainWindow
  31. {
  32. Q_OBJECT
  33. public:
  34. explicit MoeNavigatorMain(QWidget *parent = 0);
  35. MoeNavigatorMain(QString url);
  36. ~MoeNavigatorMain();
  37. void OpenURL(QString URL);
  38. void Search(QString URL);
  39. void LoadMarkup(std::string markup);
  40. public slots:
  41. /**
  42. * A slot for opening the configuration window.
  43. */
  44. void ShowConfigWindow();
  45. /**
  46. * A slot for opening the about window.
  47. */
  48. void ShowAboutDialog();
  49. void UpdateConfiguration();
  50. /**
  51. * Opens a new tab with an URL.
  52. *
  53. * @param QString tab_url The URL to open in the new tab.
  54. */
  55. void openNewTab(QString tab_url);
  56. /**
  57. * Opens an empty new tab.
  58. */
  59. void openNewTab();
  60. void LoadNewURL();
  61. void UpdateURLFields(QObject* sender, QUrl newURL);
  62. //void UpdateTitleFields(QObject* newTitleSender, QString newTitle);
  63. void UpdateStatusBar(QString newURL, QString newTitle, QString newContent);
  64. void UpdateLoadingStatus(
  65. QObject* sender,
  66. GUIHandler::LoadingStatus loadingStatus
  67. );
  68. /**
  69. * Switches the browser engine.
  70. *
  71. * @param bool use_mne Whether to use MoeNavigatorEngine (true)
  72. * or WebKit using QtWebkit (false).
  73. */
  74. void switchEngine(bool use_mne);
  75. //TODO: rewrite content for multi-tab support
  76. //and for page-specific configurations
  77. void UpdatePageButtons();
  78. void UpdateTorStatus(bool enabled);
  79. void UpdateImageDisplayStatus(bool enabled);
  80. void UpdateJavaScriptStatus(bool enabled);
  81. void UpdateCookieStatus(bool enabled);
  82. void UpdateWebStorageStatus(bool enabled);
  83. void ToggleDomainSettings(bool enabled);
  84. void SwitchTab();
  85. void CloseTab(int tabId);
  86. /**
  87. * Navigates to the next URL in the URL history.
  88. */
  89. void NextURL();
  90. /**
  91. * Navigates to the previously visited URL from the URL history.
  92. */
  93. void PreviousURL();
  94. /**
  95. * Triggers the reload of the currently visited page.
  96. */
  97. void ReloadPage();
  98. protected:
  99. void InitApplication();
  100. Ui::MoeNavigatorMain* ui;
  101. QPointer<ConfigurationWindow> configWindow;
  102. QPointer<MoeNavigatorAboutDialog> aboutDialog;
  103. std::vector <std::weak_ptr<BrowserTabWidget>> tabs;
  104. QPointer<BrowserTabWidget> current_tab;
  105. GUIHandler* uiHandler;
  106. QPointer<QSettings> settings;
  107. QString configPath;
  108. QPointer<QTabWidget> tab_widget;
  109. };
  110. #endif // MOENAVIGATORMAIN_H