Last active
August 29, 2015 13:57
-
-
Save Chocimier/9668157 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/WindowsManager.cpp b/src/core/WindowsManager.cpp | |
index f07fb84..024d59a 100644 | |
--- a/src/core/WindowsManager.cpp | |
+++ b/src/core/WindowsManager.cpp | |
@@ -35,10 +35,11 @@ | |
namespace Otter | |
{ | |
-WindowsManager::WindowsManager(MdiWidget *mdi, TabBarWidget *tabBar, StatusBarWidget *statusBar, bool privateSession) : QObject(mdi), | |
+WindowsManager::WindowsManager(MdiWidget *mdi, TabBarWidget *tabBar, StatusBarWidget *statusBar, MainWindow *mainWindow, bool privateSession) : QObject(mdi), | |
m_mdi(mdi), | |
m_tabBar(tabBar), | |
m_statusBar(statusBar), | |
+ m_mainWindow(mainWindow), | |
m_printedWindow(-1), | |
m_isPrivate(privateSession), | |
m_isRestored(false) | |
@@ -76,7 +77,7 @@ void WindowsManager::open(const QUrl &url, bool privateWindow, bool background, | |
} | |
} | |
- window = new Window(privateWindow, NULL, m_mdi); | |
+ window = new Window(privateWindow, NULL, m_mainWindow); | |
addWindow(window, background); | |
@@ -169,7 +170,7 @@ void WindowsManager::restore(const SessionMainWindow &session) | |
{ | |
for (int i = 0; i < session.windows.count(); ++i) | |
{ | |
- Window *window = new Window(m_isPrivate, NULL, m_mdi); | |
+ Window *window = new Window(m_isPrivate, NULL, m_mainWindow); | |
window->setSession(session.windows.at(i)); | |
addWindow(window); | |
@@ -196,7 +197,7 @@ void WindowsManager::restore(int index) | |
return; | |
} | |
- Window *window = new Window(m_isPrivate, NULL, m_mdi); | |
+ Window *window = new Window(m_isPrivate, NULL, m_mainWindow); | |
window->setSession(m_closedWindows.at(index)); | |
m_closedWindows.removeAt(index); | |
@@ -346,7 +347,7 @@ void WindowsManager::openWindow(ContentsWidget *widget, bool background, bool ne | |
} | |
else | |
{ | |
- addWindow(new Window(widget->isPrivate(), widget, m_mdi), background); | |
+ addWindow(new Window(widget->isPrivate(), widget, m_mainWindow), background); | |
} | |
} | |
diff --git a/src/core/WindowsManager.h b/src/core/WindowsManager.h | |
index 8a1d146..960113a 100644 | |
--- a/src/core/WindowsManager.h | |
+++ b/src/core/WindowsManager.h | |
@@ -21,6 +21,7 @@ | |
#define OTTER_WINDOWSMANAGER_H | |
#include "SessionsManager.h" | |
+#include "../ui/MainWindow.h" | |
#include "../ui/Window.h" | |
#include <QtCore/QUrl> | |
@@ -40,7 +41,7 @@ class WindowsManager : public QObject | |
Q_OBJECT | |
public: | |
- explicit WindowsManager(MdiWidget *mdi, TabBarWidget *tabBar, StatusBarWidget *statusBar, bool privateSession = false); | |
+ explicit WindowsManager(MdiWidget *mdi, TabBarWidget *tabBar, StatusBarWidget *statusBar, MainWindow *mainWindow, bool privateSession = false); | |
QAction* getAction(WindowAction action); | |
Window* getWindow(int index) const; | |
@@ -91,6 +92,7 @@ private: | |
MdiWidget *m_mdi; | |
TabBarWidget *m_tabBar; | |
StatusBarWidget *m_statusBar; | |
+ MainWindow *m_mainWindow; | |
QList<SessionWindow> m_closedWindows; | |
int m_printedWindow; | |
bool m_isPrivate; | |
diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp | |
index 240dd87..3c3c1d9 100644 | |
--- a/src/ui/MainWindow.cpp | |
+++ b/src/ui/MainWindow.cpp | |
@@ -139,7 +139,7 @@ MainWindow::MainWindow(bool privateSession, const SessionMainWindow &windows, QW | |
setCentralWidget(mdiWidget); | |
- m_windowsManager = new WindowsManager(mdiWidget, m_ui->tabsDockWidget->getTabBar(), m_ui->statusBar, (privateSession || SettingsManager::getValue(QLatin1String("Browser/PrivateMode")).toBool())); | |
+ m_windowsManager = new WindowsManager(mdiWidget, m_ui->tabsDockWidget->getTabBar(), m_ui->statusBar, this, (privateSession || SettingsManager::getValue(QLatin1String("Browser/PrivateMode")).toBool())); | |
SessionsManager::registerWindow(m_windowsManager); | |
@@ -1061,6 +1061,8 @@ bool MainWindow::event(QEvent *event) | |
m_ui->statusBar->show(); | |
} | |
+ emit fullScreenChanged(isFullScreen()); | |
+ | |
return result; | |
} | |
diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h | |
index 75ea8d4..c060d04 100644 | |
--- a/src/ui/MainWindow.h | |
+++ b/src/ui/MainWindow.h | |
@@ -23,6 +23,7 @@ | |
#include "../core/SessionsManager.h" | |
#include "../core/WindowsManager.h" | |
+#include <QtCore/QUrl> | |
#include <QtWidgets/QActionGroup> | |
#include <QtWidgets/QMainWindow> | |
@@ -116,6 +117,7 @@ private: | |
signals: | |
void requestedNewWindow(bool privateSession = false, bool background = false, QUrl url = QUrl()); | |
+ void fullScreenChanged(bool toFullScreen); | |
}; | |
} | |
diff --git a/src/ui/Window.cpp b/src/ui/Window.cpp | |
index bbbe0fe..5a02c09 100644 | |
--- a/src/ui/Window.cpp | |
+++ b/src/ui/Window.cpp | |
@@ -60,6 +60,7 @@ Window::Window(bool privateWindow, ContentsWidget *widget, QWidget *parent) : QW | |
connect(m_ui->addressWidget, SIGNAL(requestedLoadUrl(QUrl)), this, SLOT(setUrl(QUrl))); | |
connect(m_ui->addressWidget, SIGNAL(requestedSearch(QString,QString)), this, SLOT(search(QString,QString))); | |
connect(m_ui->searchWidget, SIGNAL(requestedSearch(QString,QString)), this, SLOT(handleSearchRequest(QString,QString))); | |
+ connect(parent, SIGNAL(fullScreenChanged(bool)), this, SLOT(toggleFullScreen(bool))); | |
} | |
Window::~Window() | |
@@ -439,6 +440,11 @@ void Window::setContentsWidget(ContentsWidget *widget) | |
connect(m_contentsWidget, SIGNAL(zoomChanged(int)), this, SIGNAL(zoomChanged(int))); | |
} | |
+void Window::toggleFullScreen(bool toFullScreen) | |
+{ | |
+ m_ui->navigationWidget->setVisible(!toFullScreen); | |
+} | |
+ | |
Window* Window::clone(bool cloneHistory, QWidget *parent) | |
{ | |
if (!m_contentsWidget || !canClone()) | |
diff --git a/src/ui/Window.h b/src/ui/Window.h | |
index 93818dd..66e5a2f 100644 | |
--- a/src/ui/Window.h | |
+++ b/src/ui/Window.h | |
@@ -174,6 +174,7 @@ protected slots: | |
void notifyRequestedOpenUrl(const QUrl &url, bool background, bool newWindow); | |
void updateGoBackMenu(); | |
void updateGoForwardMenu(); | |
+ void toggleFullScreen(bool toFullScreen); | |
private: | |
ContentsWidget *m_contentsWidget; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment