Commit b0cd54c1 authored by Morten Johan Sorvig's avatar Morten Johan Sorvig Committed by Morten Johan Sørvig
Browse files

Replace Q_WS_MAC with Q_OS_MAC.



We want to carry over all mac-specific code paths
to Qt 5. WS_MAC is no longer set; OS_MAC is.

This change is compatible with Qt 4 builds since
OS_MAC is set whenever WS_MAC is. (OS_MAC would
also be set for the theoretical X11/Mac platform,
but that's anyway not a supported configuration
for Creator)

Change-Id: Ib25d8c4e83e7e27d911124cd48aa17fdb875923f
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent 896a7a65
......@@ -141,7 +141,7 @@ void ZoomTool::mouseReleaseEvent(QMouseEvent *event)
view()->setSceneRect(sceneArea);
} else {
Qt::KeyboardModifier modifierKey = Qt::ControlModifier;
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
modifierKey = Qt::AltModifier;
#endif
if (event->modifiers() & modifierKey) {
......
......@@ -152,7 +152,7 @@ void usage()
qWarning(" -I <directory> ........................... prepend to the module import search path,");
qWarning(" display path if <directory> is empty");
qWarning(" -P <directory> ........................... prepend to the plugin search path");
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport");
#else
qWarning(" -opengl .................................. use a QGLWidget for the viewport");
......@@ -215,7 +215,7 @@ struct ViewerOptions
useNativeFileBrowser = false;
#endif
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
useGL = true;
#endif
}
......@@ -375,7 +375,7 @@ static void parseCommandLineOptions(const QStringList &arguments)
} else if (arg == "-translation") {
if (lastArg) usage();
opts.translationFile = arguments.at(++i);
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
} else if (arg == "-no-opengl") {
opts.useGL = false;
#else
......@@ -530,7 +530,7 @@ int main(int argc, char ** argv)
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
#endif
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
#if defined (Q_WS_X11) || defined (Q_OS_MAC)
//### default to using raster graphics backend for now
bool gsSpecified = false;
for (int i = 0; i < argc; ++i) {
......
......@@ -274,12 +274,12 @@ void QDeclarativeTester::updateCurrentTime(int msec)
if (options & QDeclarativeViewer::TestImages) {
img.fill(qRgb(255,255,255));
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
bool oldSmooth = qt_applefontsmoothing_enabled;
qt_applefontsmoothing_enabled = false;
#endif
QPainter p(&img);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
qt_applefontsmoothing_enabled = oldSmooth;
#endif
......
......@@ -1575,7 +1575,7 @@ void QDeclarativeViewer::setUseGL(bool useGL)
#ifdef GL_SUPPORTED
if (useGL) {
QGLFormat format = QGLFormat::defaultFormat();
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
format.setSampleBuffers(true);
#else
format.setSampleBuffers(false);
......
......@@ -66,11 +66,11 @@ void Qt5NodeInstanceServer::initializeView(const QVector<AddImportContainer> &/*
Q_ASSERT(!sgView());
m_sgView = new QSGView;
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
sgView()->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
sgView()->show();
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
sgView()->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
sgView()->setUpdatesEnabled(false);
......
......@@ -78,12 +78,12 @@ void Qt4NodeInstanceServer::initializeView(const QVector<AddImportContainer> &/*
Q_ASSERT(!declarativeView());
m_declarativeView = new QDeclarativeView;
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
declarativeView()->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
declarativeView()->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
declarativeView()->show();
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
declarativeView()->setAttribute(Qt::WA_DontShowOnScreen, true);
#endif
}
......
......@@ -171,14 +171,14 @@ void DragWidget::protectedMoved()
void DragWidget::leaveEvent(QEvent *)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
unsetCursor();
#endif
}
void DragWidget::enterEvent(QEvent *)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
setCursor(Qt::ArrowCursor);
#endif
}
......@@ -226,7 +226,7 @@ ContextPaneWidget::ContextPaneWidget(QWidget *parent) : DragWidget(parent), m_cu
m_disableAction->setCheckable(true);
connect(m_disableAction.data(), SIGNAL(toggled(bool)), this, SLOT(onDisable(bool)));
m_pinned = false;
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
setCursor(Qt::ArrowCursor);
#endif
}
......
......@@ -182,14 +182,14 @@ void CustomColorDialog::setupWidgets()
void CustomColorDialog::leaveEvent(QEvent *)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
unsetCursor();
#endif
}
void CustomColorDialog::enterEvent(QEvent *)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
setCursor(Qt::ArrowCursor);
#endif
}
......
......@@ -562,7 +562,7 @@ QSize QStyleItem::sizeFromContents(int width, int height)
break;
case Header:
size = qApp->style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height), widget());
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
if (style() =="mac")
size.setHeight(15);
#endif
......@@ -575,7 +575,7 @@ QSize QStyleItem::sizeFromContents(int width, int height)
break;
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// ### hack - With even heights, the text baseline is off on mac
if (size.height() %2 == 0)
size.setHeight(size.height() + 1);
......@@ -738,7 +738,7 @@ void QStyleItem::setElementType(const QString &str)
// Gtk uses qobject cast, hence we need to separate this from menuitem
// On mac, we temporarily use the menu item because it has more accurate
// palette.
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
static QMenu *combo = new QMenu();
#else
static QComboBox *combo = new QComboBox();
......@@ -826,7 +826,7 @@ void QStyleItem::setElementType(const QString &str)
m_dummywidget->setAttribute(Qt::WA_QuitOnClose, false); // dont keep app open
m_dummywidget->setAttribute(Qt::WA_LayoutUsesWidgetRect);
m_dummywidget->winId();
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
m_dummywidget->setGeometry(-1000, 0, 10,10);
m_dummywidget->setVisible(visible); // Mac require us to set the visibility before this
#endif
......
......@@ -81,7 +81,7 @@ QSize DetailsButton::sizeHint() const
{
// TODO: Adjust this when icons become available!
const int w = fontMetrics().width(text()) + 32;
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
return QSize(w, 34);
#else
return QSize(w, 22);
......@@ -118,7 +118,7 @@ void DetailsButton::paintEvent(QPaintEvent *e)
QWidget::paintEvent(e);
QPainter p(this);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
// draw hover animation
if (!isDown() && m_fader > 0)
p.fillRect(rect().adjusted(1, 1, -2, -2), QColor(255, 255, 255, int(m_fader*180)));
......
......@@ -145,7 +145,7 @@ QPixmap DetailsWidgetPrivate::cacheBackground(const QSize &size, bool expanded)
QRect topRect(0, 0, size.width(), topHeight);
QRect fullRect(0, 0, size.width(), size.height());
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
p.fillRect(fullRect, qApp->palette().window().color());
#endif
p.fillRect(fullRect, QColor(255, 255, 255, 40));
......@@ -378,7 +378,7 @@ void DetailsWidget::setToolWidget(Utils::FadingPanel *widget)
d->m_toolWidget->adjustSize();
d->m_grid->addWidget(d->m_toolWidget, 0, 1, 1, 1, Qt::AlignRight);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
d->m_toolWidget->setOpacity(1.0);
#endif
d->changeHoverState(d->m_hovered);
......
......@@ -35,7 +35,7 @@
#include <QtGui/QHeaderView>
#include <QtGui/QFocusEvent>
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
#include <QtGui/QKeyEvent>
#endif
......@@ -87,7 +87,7 @@ void NavigationTreeView::resizeEvent(QResizeEvent *event)
QTreeView::resizeEvent(event);
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
void NavigationTreeView::keyPressEvent(QKeyEvent *event)
{
if ((event->key() == Qt::Key_Return
......
......@@ -50,7 +50,7 @@ protected:
void focusOutEvent(QFocusEvent *event);
void resizeEvent(QResizeEvent *event);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
void keyPressEvent(QKeyEvent *event);
#endif
};
......
......@@ -61,7 +61,7 @@
*/
/*static*/ const char * const Utils::PathChooser::browseButtonLabel =
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
QT_TRANSLATE_NOOP("Utils::PathChooser", "Choose...");
#else
QT_TRANSLATE_NOOP("Utils::PathChooser", "Browse...");
......
......@@ -71,7 +71,7 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
qreal StyleHelper::sidebarFontSize()
{
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
return 10;
#else
return 7.5;
......
......@@ -83,7 +83,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
m_toggleAction = new QAction(tr("Toggle Bookmark"), this);
Core::Command *cmd =
am->registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+M")));
......@@ -98,7 +98,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
//Previous
m_prevAction = new QAction(tr("Previous Bookmark"), this);
cmd = am->registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+,")));
......@@ -108,7 +108,7 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
//Next
m_nextAction = new QAction(tr("Next Bookmark"), this);
cmd = am->registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext);
#ifndef Q_WS_MAC
#ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+.")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Meta+.")));
......
......@@ -451,7 +451,7 @@ static QString msgActionWarning(QAction *newAction, int k, QAction *oldAction)
void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable)
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
action->setIconVisibleInMenu(false);
#endif
if (isEmpty())
......
......@@ -103,7 +103,7 @@ const char OPTIONS[] = "QtCreator.Options";
const char TOGGLE_SIDEBAR[] = "QtCreator.ToggleSidebar";
const char TOGGLE_FULLSCREEN[] = "QtCreator.ToggleFullScreen";
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
const char MINIMIZE_WINDOW[] = "QtCreator.MinimizeWindow";
const char ZOOM_WINDOW[] = "QtCreator.ZoomWindow";
#endif
......
......@@ -369,7 +369,7 @@ EditorManager::EditorManager(QWidget *parent) :
// Goto Previous In History Action
cmd = am->registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Tab")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Tab")));
......@@ -379,7 +379,7 @@ EditorManager::EditorManager(QWidget *parent) :
// Goto Next In History Action
cmd = am->registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Shift+Tab")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Tab")));
......@@ -389,7 +389,7 @@ EditorManager::EditorManager(QWidget *parent) :
// Go back in navigation history
cmd = am->registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Left")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Left")));
......@@ -399,7 +399,7 @@ EditorManager::EditorManager(QWidget *parent) :
// Go forward in navigation history
cmd = am->registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext);
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Right")));
#else
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+Right")));
......@@ -407,7 +407,7 @@ EditorManager::EditorManager(QWidget *parent) :
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory()));
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
QString prefix = tr("Meta+E");
#else
QString prefix = tr("Ctrl+E");
......@@ -1712,7 +1712,7 @@ void EditorManager::updateActions()
fName = curEditor->displayName();
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
window()->setWindowModified(curEditor->file()->isModified());
#endif
bool ww = curEditor->file()->isModified() && curEditor->file()->isReadOnly();
......@@ -1751,7 +1751,7 @@ void EditorManager::updateActions()
curEditor->file()->infoBar()->removeInfo(QLatin1String("Core.EditorManager.MakeWritable"));
}
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
} else { // curEditor
window()->setWindowModified(false);
#endif
......
......@@ -66,7 +66,7 @@
#include <QtGui/QSplitter>
#include <QtGui/QStackedLayout>
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
#include <qmacstyle_mac.h>
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment