From e2b0a7f39ccbdb10af4a6dca6cfbd7709d7eba6f Mon Sep 17 00:00:00 2001 From: Abs62 Date: Mon, 12 May 2014 17:53:13 +0400 Subject: [PATCH] Mac-specific: Adjust code for Qt5 build --- articleview.cc | 4 ++-- bgl_babylon.cc | 2 +- hotkeywrapper.cc | 2 +- hotkeywrapper.hh | 8 ++++---- keyboardstate.cc | 4 ++-- lionsupport.mm | 1 + mainwindow.cc | 4 ++-- preferences.cc | 2 +- scanpopup.cc | 4 ++-- sources.cc | 6 +++--- sources.hh | 4 ++-- 11 files changed, 21 insertions(+), 20 deletions(-) diff --git a/articleview.cc b/articleview.cc index c42fb72b..d6927eec 100644 --- a/articleview.cc +++ b/articleview.cc @@ -37,7 +37,7 @@ #include -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) #include "speechclient.hh" #endif @@ -1201,7 +1201,7 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref, if ( url.scheme() == "gdtts" ) { // TODO: Port TTS -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) // Text to speech QString md5Id = url.queryItemValue( "engine" ); QString text( url.path().mid( 1 ) ); diff --git a/bgl_babylon.cc b/bgl_babylon.cc index 64d0847b..869d0a46 100644 --- a/bgl_babylon.cc +++ b/bgl_babylon.cc @@ -106,7 +106,7 @@ bool Babylon::open() fflush( f ); -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC /* Under Mac OS X the above technique don't set reopen position properly */ int fn = DUP( fileno( f ) ); lseek( fn, i, SEEK_SET ); diff --git a/hotkeywrapper.cc b/hotkeywrapper.cc index fdccb95a..b658c1ee 100644 --- a/hotkeywrapper.cc +++ b/hotkeywrapper.cc @@ -70,7 +70,7 @@ HotkeyStruct::HotkeyStruct( quint32 key_, quint32 key2_, quint32 modifier_, modifier( modifier_ ), handle( handle_ ), id( id_ ) -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC , hkRef( 0 ) , hkRef2( 0 ) #endif diff --git a/hotkeywrapper.hh b/hotkeywrapper.hh index 127125b3..9189bff6 100644 --- a/hotkeywrapper.hh +++ b/hotkeywrapper.hh @@ -13,7 +13,7 @@ #endif -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC #define __SECURITYHI__ #include #endif @@ -32,7 +32,7 @@ struct HotkeyStruct quint32 modifier; int handle; int id; -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC EventHotKeyRef hkRef, hkRef2; #endif }; @@ -69,7 +69,7 @@ protected slots: void waitKey2(); -#ifndef Q_OS_MACX +#ifndef Q_OS_MAC private slots: bool checkState( quint32 vk, quint32 mod ); @@ -89,7 +89,7 @@ private: virtual bool winEvent ( MSG * message, long * result ); HWND hwnd; -#elif defined(Q_OS_MACX) +#elif defined(Q_OS_MAC) public: void activated( int hkId ); diff --git a/keyboardstate.cc b/keyboardstate.cc index a0da6f90..c7f90905 100644 --- a/keyboardstate.cc +++ b/keyboardstate.cc @@ -10,7 +10,7 @@ #include #include #include -#elif defined Q_OS_MACX +#elif defined Q_OS_MAC #define __SECURITYHI__ #include #endif @@ -32,7 +32,7 @@ bool KeyboardState::checkModifiersPressed( int mask ) ( mask & LeftShift && !( GetAsyncKeyState( VK_LSHIFT ) & 0x8000 ) ) || ( mask & RightShift && !( GetAsyncKeyState( VK_RSHIFT ) & 0x8000 ) ) ); - #elif defined Q_OS_MACX + #elif defined Q_OS_MAC UInt32 keys = GetCurrentKeyModifiers(); return !( ( mask & Alt && !( keys & ( 1 << optionKeyBit ) ) ) || diff --git a/lionsupport.mm b/lionsupport.mm index 511353c2..df16ea1a 100644 --- a/lionsupport.mm +++ b/lionsupport.mm @@ -1,3 +1,4 @@ +#include #include "lionsupport.h" bool LionSupport::isLion() diff --git a/mainwindow.cc b/mainwindow.cc index 6fd71bda..bc7a456c 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -778,7 +778,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ): updateStatusLine(); -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC if( cfg.preferences.startWithScanPopupOn && !MacMouseOver::isAXAPIEnabled() ) mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.png" ) ); @@ -2942,7 +2942,7 @@ void MainWindow::scanEnableToggled( bool on ) if ( on ) { scanPopup->enableScanning(); -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC if( !MacMouseOver::isAXAPIEnabled() ) mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.png" ) ); diff --git a/preferences.cc b/preferences.cc index faad8428..f72021d5 100644 --- a/preferences.cc +++ b/preferences.cc @@ -151,7 +151,7 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ): ui.rightCtrl->hide(); ui.leftShift->hide(); ui.rightShift->hide(); -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC ui.altKey->setText( "Opt" ); ui.winKey->setText( "Ctrl" ); ui.ctrlKey->setText( "Cmd" ); diff --git a/scanpopup.cc b/scanpopup.cc index 5113c593..6f59dae0 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -14,7 +14,7 @@ #include "gddebug.hh" #include "gestures.hh" -#ifdef Q_OS_MACX +#ifdef Q_OS_MAC #include "macmouseover.hh" #define MouseOver MacMouseOver #else @@ -27,7 +27,7 @@ using std::wstring; /// in their behavior on those platforms. static Qt::WindowFlags popupWindowFlags = -#if defined (Q_OS_WIN) || defined (Q_OS_MACX) +#if defined (Q_OS_WIN) || defined (Q_OS_MAC) Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint #else Qt::Popup diff --git a/sources.cc b/sources.cc index a8be1647..db668bc9 100644 --- a/sources.cc +++ b/sources.cc @@ -10,7 +10,7 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg): QWidget( parent ), -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) textToSpeechSource( NULL ), #endif itemDelegate( new QItemDelegate( this ) ), @@ -105,7 +105,7 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg): ui.forvoLanguageCodes->setText( forvo.languageCodes ); // Text to speech -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) textToSpeechSource = new TextToSpeechSource( this, cfg.voiceEngines ); ui.tabWidget->addTab( textToSpeechSource, QIcon(":/icons/playsound_color.png"), tr( "Text to Speech" ) ); #endif @@ -322,7 +322,7 @@ void Sources::on_removeProgram_clicked() Config::VoiceEngines Sources::getVoiceEngines() const { -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) if ( !textToSpeechSource ) return Config::VoiceEngines(); return textToSpeechSource->getVoiceEnginesModel().getCurrentVoiceEngines(); diff --git a/sources.hh b/sources.hh index 1556823e..dca8a804 100644 --- a/sources.hh +++ b/sources.hh @@ -12,7 +12,7 @@ #include #include -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) #include "texttospeechsource.hh" #endif @@ -284,7 +284,7 @@ signals: private: Ui::Sources ui; -#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) +#if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC ) TextToSpeechSource *textToSpeechSource; #endif