#9245 replace Q_WS_MACX with Q_OS_MAC - the Q_OS_MAC macro is usable with Qt4 and Qt5.

This commit is contained in:
Stephan Witt 2014-08-25 20:08:59 +02:00
parent 4521fc757b
commit 3aa428fdea
19 changed files with 36 additions and 36 deletions

View File

@ -33,7 +33,7 @@
#include <map> #include <map>
#include <ctime> #include <ctime>
// FIXME: Q_WS_MACX is not available, it's in Qt // FIXME: Q_OS_MAC is not available, it's in Qt
#ifdef USE_MACOSX_PACKAGING #ifdef USE_MACOSX_PACKAGING
#include "support/linkback/LinkBackProxy.h" #include "support/linkback/LinkBackProxy.h"
#endif #endif

View File

@ -455,7 +455,7 @@ bool CategorizedCombo::eventFilter(QObject * o, QEvent * e)
void CategorizedCombo::setIconSize(QSize size) void CategorizedCombo::setIconSize(QSize size)
{ {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
bool small = size.height() < 20; bool small = size.height() < 20;
setAttribute(Qt::WA_MacSmallSize, small); setAttribute(Qt::WA_MacSmallSize, small);
setAttribute(Qt::WA_MacNormalSize, !small); setAttribute(Qt::WA_MacNormalSize, !small);

View File

@ -35,7 +35,7 @@
* *
* Therefore there is a tradeoff in enabling or disabling this (JMarc) * Therefore there is a tradeoff in enabling or disabling this (JMarc)
*/ */
#if defined(Q_WS_MACX) || defined(Q_OS_WIN) #if defined(Q_OS_MAC) || defined(Q_OS_WIN)
#define USE_NATIVE_FILEDIALOG 1 #define USE_NATIVE_FILEDIALOG 1
#endif #endif

View File

@ -613,7 +613,7 @@ void FindAndReplaceWidget::updateGUI()
Dialog * createGuiSearchAdv(GuiView & lv) Dialog * createGuiSearchAdv(GuiView & lv)
{ {
FindAndReplace * gui = new FindAndReplace(lv, Qt::RightDockWidgetArea); FindAndReplace * gui = new FindAndReplace(lv, Qt::RightDockWidgetArea);
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// On Mac show and floating // On Mac show and floating
gui->setFloating(true); gui->setFloating(true);
#endif #endif

View File

@ -77,7 +77,7 @@
#include "support/Systemcall.h" #include "support/Systemcall.h"
#include "support/TempFile.h" #include "support/TempFile.h"
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#include "support/AppleScript.h" #include "support/AppleScript.h"
#include "support/linkback/LinkBackProxy.h" #include "support/linkback/LinkBackProxy.h"
#endif #endif
@ -133,9 +133,9 @@
#include <objidl.h> #include <objidl.h>
#endif // Q_WS_WIN #endif // Q_WS_WIN
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#include <QMacPasteboardMime> #include <QMacPasteboardMime>
#endif // Q_WS_MACX #endif // Q_OS_MAC
#include "support/bind.h" #include "support/bind.h"
#include <boost/crc.hpp> #include <boost/crc.hpp>
@ -652,7 +652,7 @@ public:
} }
}; };
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// QMacPasteboardMimeGraphics can only be compiled on Mac. // QMacPasteboardMimeGraphics can only be compiled on Mac.
class QMacPasteboardMimeGraphics : public QMacPasteboardMime class QMacPasteboardMimeGraphics : public QMacPasteboardMime
@ -932,7 +932,7 @@ struct GuiApplication::Private
/// Only used on mac. /// Only used on mac.
QMenuBar * global_menubar_; QMenuBar * global_menubar_;
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
/// Linkback mime handler for MacOSX. /// Linkback mime handler for MacOSX.
QMacPasteboardMimeGraphics mac_pasteboard_mime_; QMacPasteboardMimeGraphics mac_pasteboard_mime_;
#endif #endif
@ -951,7 +951,7 @@ GuiApplication * guiApp;
GuiApplication::~GuiApplication() GuiApplication::~GuiApplication()
{ {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
closeAllLinkBackLinks(); closeAllLinkBackLinks();
#endif #endif
delete d; delete d;
@ -979,7 +979,7 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
if (lyxrc.quit_on_last_window_closed) if (lyxrc.quit_on_last_window_closed)
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
*/ */
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// FIXME: Do we need a lyxrc setting for this on Mac? This behaviour // FIXME: Do we need a lyxrc setting for this on Mac? This behaviour
// seems to be the default case for applications like LyX. // seems to be the default case for applications like LyX.
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
@ -2346,7 +2346,7 @@ void GuiApplication::execBatchCommands()
// Gives some error box here. // Gives some error box here.
return; return;
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#if QT_VERSION > 0x040600 #if QT_VERSION > 0x040600
setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta);
#endif #endif

View File

@ -213,7 +213,7 @@ GuiCharacter::GuiCharacter(GuiView & lv)
bc().addReadOnly(toggleallCB); bc().addReadOnly(toggleallCB);
bc().addReadOnly(autoapplyCB); bc().addReadOnly(autoapplyCB);
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// On Mac it's common to have tool windows which are always in the // On Mac it's common to have tool windows which are always in the
// foreground and are hidden when the main window is not focused. // foreground and are hidden when the main window is not focused.
setWindowFlags(Qt::Tool); setWindowFlags(Qt::Tool);

View File

@ -30,9 +30,9 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/lyxtime.h" #include "support/lyxtime.h"
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#include "support/linkback/LinkBackProxy.h" #include "support/linkback/LinkBackProxy.h"
#endif // Q_WS_MACX #endif // Q_OS_MAC
#include "frontends/alert.h" #include "frontends/alert.h"
@ -313,7 +313,7 @@ FileName GuiClipboard::getAsGraphics(Cursor const & cur, GraphicsType type) cons
// write the (LinkBack) PDF data // write the (LinkBack) PDF data
f.write(ar); f.write(ar);
if (type == LinkBackGraphicsType) { if (type == LinkBackGraphicsType) {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
void const * linkBackData; void const * linkBackData;
unsigned linkBackLen; unsigned linkBackLen;
getLinkBackData(&linkBackData, &linkBackLen); getLinkBackData(&linkBackData, &linkBackLen);
@ -324,7 +324,7 @@ FileName GuiClipboard::getAsGraphics(Cursor const & cur, GraphicsType type) cons
#else #else
// only non-Mac this should never happen // only non-Mac this should never happen
LATTEST(false); LATTEST(false);
#endif // Q_WS_MACX #endif // Q_OS_MAC
} }
f.close(); f.close();
@ -488,11 +488,11 @@ bool GuiClipboard::hasGraphicsContents(Clipboard::GraphicsType type) const
// handle LinkBack for Mac // handle LinkBack for Mac
if (type == LinkBackGraphicsType) if (type == LinkBackGraphicsType)
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
return isLinkBackDataInPasteboard(); return isLinkBackDataInPasteboard();
#else #else
return false; return false;
#endif // Q_WS_MACX #endif // Q_OS_MAC
// get mime data // get mime data
QStringList const & formats = cache_.formats(); QStringList const & formats = cache_.formats();

View File

@ -265,7 +265,7 @@ GuiFontInfo::GuiFontInfo(FontInfo const & f)
QString family = makeFontName(toqstr(lyxrc.roman_font_name), QString family = makeFontName(toqstr(lyxrc.roman_font_name),
toqstr(lyxrc.roman_font_foundry)); toqstr(lyxrc.roman_font_foundry));
font.setFamily(family); font.setFamily(family);
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#if QT_VERSION >= 0x040300 //&& QT_VERSION < 0x040800 #if QT_VERSION >= 0x040300 //&& QT_VERSION < 0x040800
// Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684 // Workaround for a Qt bug, see http://www.lyx.org/trac/ticket/3684
// and http://bugreports.qt.nokia.com/browse/QTBUG-11145. // and http://bugreports.qt.nokia.com/browse/QTBUG-11145.
@ -341,7 +341,7 @@ bool FontLoader::available(FontInfo const & f)
static vector<int> cache(NUM_FAMILIES, false); static vector<int> cache(NUM_FAMILIES, false);
FontFamily family = f.family(); FontFamily family = f.family();
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// Apple ships a font name "Symbol", which has more or less the same // Apple ships a font name "Symbol", which has more or less the same
// glyphs as the original PostScript Symbol font, but it uses a different // glyphs as the original PostScript Symbol font, but it uses a different
// encoding (see https://en.wikipedia.org/wiki/Symbol_(typeface)#cite_note-2). // encoding (see https://en.wikipedia.org/wiki/Symbol_(typeface)#cite_note-2).

View File

@ -704,7 +704,7 @@ docstring const KeySymbol::print(KeyModifier mod, bool forgui) const
if (forgui) if (forgui)
str = seq.toString(QKeySequence::NativeText); str = seq.toString(QKeySequence::NativeText);
else { else {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// Qt/Mac does not use Command and friends in the // Qt/Mac does not use Command and friends in the
// portable case, but the windows-like Control+x (bug 5421). // portable case, but the windows-like Control+x (bug 5421).
str = seq.toString(QKeySequence::NativeText); str = seq.toString(QKeySequence::NativeText);

View File

@ -9,7 +9,7 @@
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
#ifdef Q_WS_MAC #ifdef Q_OS_MAC
#define USE_RTL_OVERRIDE 1 #define USE_RTL_OVERRIDE 1
#endif #endif

View File

@ -61,7 +61,7 @@ GuiParagraph::GuiParagraph(GuiView & lv)
connect(labelWidth, SIGNAL(textChanged(QString)), connect(labelWidth, SIGNAL(textChanged(QString)),
this, SLOT(changed())); this, SLOT(changed()));
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// On Mac it's common to have tool windows which are always in the // On Mac it's common to have tool windows which are always in the
// foreground and are hidden when the main window is not focused. // foreground and are hidden when the main window is not focused.
setWindowFlags(Qt::Tool); setWindowFlags(Qt::Tool);

View File

@ -500,7 +500,7 @@ PrefInput::PrefInput(GuiPreferences * form)
// reveal checkbox for switching Ctrl and Meta on Mac: // reveal checkbox for switching Ctrl and Meta on Mac:
bool swapcb = false; bool swapcb = false;
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#if QT_VERSION > 0x040600 #if QT_VERSION > 0x040600
swapcb = true; swapcb = true;
#endif #endif

View File

@ -614,7 +614,7 @@ void GuiSpellchecker::updateView()
Dialog * createGuiSpellchecker(GuiView & lv) Dialog * createGuiSpellchecker(GuiView & lv)
{ {
GuiSpellchecker * gui = new GuiSpellchecker(lv, Qt::RightDockWidgetArea); GuiSpellchecker * gui = new GuiSpellchecker(lv, Qt::RightDockWidgetArea);
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
gui->setFloating(true); gui->setFloating(true);
#endif #endif
return gui; return gui;

View File

@ -98,7 +98,7 @@ bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
Dialog * createGuiToc(GuiView & lv) Dialog * createGuiToc(GuiView & lv)
{ {
GuiToc * toc; GuiToc * toc;
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// On Mac show at the right and floating // On Mac show at the right and floating
toc = new GuiToc(lv, Qt::RightDockWidgetArea); toc = new GuiToc(lv, Qt::RightDockWidgetArea);
toc->setFloating(true); toc->setFloating(true);

View File

@ -448,7 +448,7 @@ GuiView::GuiView(int id)
// We don't want to keep the window in memory if it is closed. // We don't want to keep the window in memory if it is closed.
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
#if !(defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && !defined(Q_WS_MACX) #if !(defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)) && !defined(Q_OS_MAC)
// QIcon::fromTheme was introduced in Qt 4.6 // QIcon::fromTheme was introduced in Qt 4.6
#if (QT_VERSION >= 0x040600) #if (QT_VERSION >= 0x040600)
// assign an icon to main form. We do not do it under Qt/Win or Qt/Mac, // assign an icon to main form. We do not do it under Qt/Win or Qt/Mac,
@ -1064,7 +1064,7 @@ void GuiView::on_lastWorkAreaRemoved()
return; return;
} }
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// On Mac we also close the last window because the application stay // On Mac we also close the last window because the application stay
// resident in memory. On other platforms we don't close the last // resident in memory. On other platforms we don't close the last
// window because this would quit the application. // window because this would quit the application.

View File

@ -61,7 +61,7 @@
#endif #endif
#include <QDrag> #include <QDrag>
#include <QHelpEvent> #include <QHelpEvent>
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
#include <QProxyStyle> #include <QProxyStyle>
#endif #endif
#include <QMainWindow> #include <QMainWindow>
@ -1487,7 +1487,7 @@ void EmbeddedWorkArea::disable()
// //
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
class NoTabFrameMacStyle : public QProxyStyle { class NoTabFrameMacStyle : public QProxyStyle {
public: public:
/// ///
@ -1518,7 +1518,7 @@ NoTabFrameMacStyle noTabFrameMacStyle;
TabWorkArea::TabWorkArea(QWidget * parent) TabWorkArea::TabWorkArea(QWidget * parent)
: QTabWidget(parent), clicked_tab_(-1) : QTabWidget(parent), clicked_tab_(-1)
{ {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
setStyle(&noTabFrameMacStyle); setStyle(&noTabFrameMacStyle);
#endif #endif

View File

@ -522,7 +522,7 @@ bool LayoutBox::eventFilter(QObject * o, QEvent * e)
void LayoutBox::setIconSize(QSize size) void LayoutBox::setIconSize(QSize size)
{ {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
bool small = size.height() < 20; bool small = size.height() < 20;
setAttribute(Qt::WA_MacSmallSize, small); setAttribute(Qt::WA_MacSmallSize, small);
setAttribute(Qt::WA_MacNormalSize, !small); setAttribute(Qt::WA_MacNormalSize, !small);

View File

@ -2231,7 +2231,7 @@ bool Menus::searchMenu(FuncRequest const & func,
void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial) void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
{ {
if (initial) { if (initial) {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// setup special mac specific menu items, but only do this // setup special mac specific menu items, but only do this
// the first time a QMenuBar is created. Otherwise Qt will // the first time a QMenuBar is created. Otherwise Qt will
// create duplicate items in the application menu. It seems // create duplicate items in the application menu. It seems
@ -2282,7 +2282,7 @@ void Menus::fillMenuBar(QMenuBar * qmb, GuiView * view, bool initial)
Menu * menu = new Menu(view, m->submenuname(), true); Menu * menu = new Menu(view, m->submenuname(), true);
menu->setTitle(label(*m)); menu->setTitle(label(*m));
#if defined(Q_WS_MACX) && (defined(QT_MAC_USE_COCOA) || (QT_VERSION >= 0x050000)) #if defined(Q_OS_MAC) && (defined(QT_MAC_USE_COCOA) || (QT_VERSION >= 0x050000))
// On Mac OS with QT/cocoa, the menu is not displayed if there is no action // On Mac OS with QT/cocoa, the menu is not displayed if there is no action
// so we create a temporary one here // so we create a temporary one here
QAction * action = new QAction(menu); QAction * action = new QAction(menu);

View File

@ -298,7 +298,7 @@ QStringList texFileList(QString const & filename)
QString const externalLineEnding(docstring const & str) QString const externalLineEnding(docstring const & str)
{ {
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
// The MAC clipboard uses \r for lineendings, and we use \n // The MAC clipboard uses \r for lineendings, and we use \n
return toqstr(subst(str, '\n', '\r')); return toqstr(subst(str, '\n', '\r'));
#elif defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN) #elif defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)