forked from qt-creator/qt-creator
Remove special code path for fullscreen support on Mac
This was necessary for supporting full screen on 10.7 even while keeping compatibility with 10.6. Since we no longer support 10.6, we can remove the workaround. Change-Id: I03e23e9203836ab6fb5a836fc06a525e44516d34 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -55,10 +55,6 @@
|
||||
#include "externaltoolmanager.h"
|
||||
#include "editormanager/systemeditor.h"
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#include "macfullscreen.h"
|
||||
#endif
|
||||
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -215,10 +211,6 @@ MainWindow::MainWindow() :
|
||||
auto dropSupport = new Utils::FileDropSupport(this);
|
||||
connect(dropSupport, SIGNAL(filesDropped(QStringList)),
|
||||
this, SLOT(openDroppedFiles(QStringList)));
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
MacFullScreen::addFullScreen(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::setSidebarVisible(bool visible)
|
||||
@@ -244,12 +236,19 @@ void MainWindow::setOverrideColor(const QColor &color)
|
||||
m_overrideColor = color;
|
||||
}
|
||||
|
||||
void MainWindow::setIsFullScreen(bool fullScreen)
|
||||
void MainWindow::updateFullScreenAction()
|
||||
{
|
||||
if (fullScreen)
|
||||
m_toggleFullScreenAction->setText(tr("Exit Full Screen"));
|
||||
else
|
||||
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
|
||||
if (isFullScreen()) {
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
m_toggleFullScreenAction->setText(tr("Exit Full Screen"));
|
||||
else
|
||||
m_toggleFullScreenAction->setChecked(true);
|
||||
} else {
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
|
||||
else
|
||||
m_toggleFullScreenAction->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::isNewItemDialogRunning() const
|
||||
@@ -652,11 +651,23 @@ void MainWindow::registerDefaultActions()
|
||||
cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
|
||||
|
||||
// Window separator
|
||||
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
|
||||
}
|
||||
|
||||
// Full Screen Action
|
||||
m_toggleFullScreenAction = new QAction(this);
|
||||
m_toggleFullScreenAction->setMenuRole(QAction::NoRole);
|
||||
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
|
||||
updateFullScreenAction();
|
||||
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||
connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
|
||||
|
||||
if (UseMacShortcuts)
|
||||
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
|
||||
|
||||
// Show Sidebar Action
|
||||
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
|
||||
tr("Show Sidebar"), this);
|
||||
@@ -676,25 +687,6 @@ void MainWindow::registerDefaultActions()
|
||||
connect(m_toggleModeSelectorAction, SIGNAL(triggered(bool)), ModeManager::instance(), SLOT(setModeSelectorVisible(bool)));
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS);
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
const QString fullScreenActionText(tr("Enter Full Screen"));
|
||||
bool supportsFullScreen = MacFullScreen::supportsFullScreen();
|
||||
#else
|
||||
const QString fullScreenActionText(tr("Full Screen"));
|
||||
bool supportsFullScreen = true;
|
||||
#endif
|
||||
if (supportsFullScreen) {
|
||||
// Full Screen Action
|
||||
m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
|
||||
m_toggleFullScreenAction->setMenuRole(QAction::NoRole);
|
||||
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
|
||||
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
|
||||
cmd->setAttribute(Command::CA_UpdateText); /* for Mac */
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||
connect(m_toggleFullScreenAction, SIGNAL(triggered(bool)), this, SLOT(setFullScreen(bool)));
|
||||
}
|
||||
|
||||
// Window->Views
|
||||
ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS);
|
||||
mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS);
|
||||
@@ -921,10 +913,8 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
qDebug() << "main window state changed to minimized=" << minimized;
|
||||
m_minimizeAction->setEnabled(!minimized);
|
||||
m_zoomAction->setEnabled(!minimized);
|
||||
} else {
|
||||
bool isFullScreen = (windowState() & Qt::WindowFullScreen) != 0;
|
||||
m_toggleFullScreenAction->setChecked(isFullScreen);
|
||||
}
|
||||
updateFullScreenAction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1131,25 +1121,13 @@ QPrinter *MainWindow::printer() const
|
||||
return m_printer;
|
||||
}
|
||||
|
||||
void MainWindow::setFullScreen(bool on)
|
||||
void MainWindow::toggleFullScreen()
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
Q_UNUSED(on)
|
||||
MacFullScreen::toggleFullScreen(this);
|
||||
#else
|
||||
if (bool(windowState() & Qt::WindowFullScreen) == on)
|
||||
return;
|
||||
|
||||
if (on) {
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
//statusBar()->hide();
|
||||
//menuBar()->hide();
|
||||
} else {
|
||||
if (isFullScreen()) {
|
||||
setWindowState(windowState() & ~Qt::WindowFullScreen);
|
||||
//menuBar()->show();
|
||||
//statusBar()->show();
|
||||
} else {
|
||||
setWindowState(windowState() | Qt::WindowFullScreen);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Display a warning with an additional button to open
|
||||
|
||||
Reference in New Issue
Block a user