Mac-specific: Adjust code for Qt5 build

This commit is contained in:
Abs62 2014-05-12 17:53:13 +04:00
parent 6331c49fa5
commit e2b0a7f39c
11 changed files with 21 additions and 20 deletions

View file

@ -37,7 +37,7 @@
#include <QBuffer> #include <QBuffer>
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
#include "speechclient.hh" #include "speechclient.hh"
#endif #endif
@ -1201,7 +1201,7 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref,
if ( url.scheme() == "gdtts" ) if ( url.scheme() == "gdtts" )
{ {
// TODO: Port TTS // TODO: Port TTS
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
// Text to speech // Text to speech
QString md5Id = url.queryItemValue( "engine" ); QString md5Id = url.queryItemValue( "engine" );
QString text( url.path().mid( 1 ) ); QString text( url.path().mid( 1 ) );

View file

@ -106,7 +106,7 @@ bool Babylon::open()
fflush( f ); fflush( f );
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
/* Under Mac OS X the above technique don't set reopen position properly */ /* Under Mac OS X the above technique don't set reopen position properly */
int fn = DUP( fileno( f ) ); int fn = DUP( fileno( f ) );
lseek( fn, i, SEEK_SET ); lseek( fn, i, SEEK_SET );

View file

@ -70,7 +70,7 @@ HotkeyStruct::HotkeyStruct( quint32 key_, quint32 key2_, quint32 modifier_,
modifier( modifier_ ), modifier( modifier_ ),
handle( handle_ ), handle( handle_ ),
id( id_ ) id( id_ )
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
, hkRef( 0 ) , hkRef( 0 )
, hkRef2( 0 ) , hkRef2( 0 )
#endif #endif

View file

@ -13,7 +13,7 @@
#endif #endif
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
#define __SECURITYHI__ #define __SECURITYHI__
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
@ -32,7 +32,7 @@ struct HotkeyStruct
quint32 modifier; quint32 modifier;
int handle; int handle;
int id; int id;
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
EventHotKeyRef hkRef, hkRef2; EventHotKeyRef hkRef, hkRef2;
#endif #endif
}; };
@ -69,7 +69,7 @@ protected slots:
void waitKey2(); void waitKey2();
#ifndef Q_OS_MACX #ifndef Q_OS_MAC
private slots: private slots:
bool checkState( quint32 vk, quint32 mod ); bool checkState( quint32 vk, quint32 mod );
@ -89,7 +89,7 @@ private:
virtual bool winEvent ( MSG * message, long * result ); virtual bool winEvent ( MSG * message, long * result );
HWND hwnd; HWND hwnd;
#elif defined(Q_OS_MACX) #elif defined(Q_OS_MAC)
public: public:
void activated( int hkId ); void activated( int hkId );

View file

@ -10,7 +10,7 @@
#include <QX11Info> #include <QX11Info>
#include <X11/X.h> #include <X11/X.h>
#include <X11/XKBlib.h> #include <X11/XKBlib.h>
#elif defined Q_OS_MACX #elif defined Q_OS_MAC
#define __SECURITYHI__ #define __SECURITYHI__
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#endif #endif
@ -32,7 +32,7 @@ bool KeyboardState::checkModifiersPressed( int mask )
( mask & LeftShift && !( GetAsyncKeyState( VK_LSHIFT ) & 0x8000 ) ) || ( mask & LeftShift && !( GetAsyncKeyState( VK_LSHIFT ) & 0x8000 ) ) ||
( mask & RightShift && !( GetAsyncKeyState( VK_RSHIFT ) & 0x8000 ) ) ); ( mask & RightShift && !( GetAsyncKeyState( VK_RSHIFT ) & 0x8000 ) ) );
#elif defined Q_OS_MACX #elif defined Q_OS_MAC
UInt32 keys = GetCurrentKeyModifiers(); UInt32 keys = GetCurrentKeyModifiers();
return !( return !(
( mask & Alt && !( keys & ( 1 << optionKeyBit ) ) ) || ( mask & Alt && !( keys & ( 1 << optionKeyBit ) ) ) ||

View file

@ -1,3 +1,4 @@
#include <AppKit/NSWindow.h>
#include "lionsupport.h" #include "lionsupport.h"
bool LionSupport::isLion() bool LionSupport::isLion()

View file

@ -778,7 +778,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
updateStatusLine(); updateStatusLine();
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
if( cfg.preferences.startWithScanPopupOn && !MacMouseOver::isAXAPIEnabled() ) if( cfg.preferences.startWithScanPopupOn && !MacMouseOver::isAXAPIEnabled() )
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000,
QPixmap( ":/icons/error.png" ) ); QPixmap( ":/icons/error.png" ) );
@ -2942,7 +2942,7 @@ void MainWindow::scanEnableToggled( bool on )
if ( on ) if ( on )
{ {
scanPopup->enableScanning(); scanPopup->enableScanning();
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
if( !MacMouseOver::isAXAPIEnabled() ) if( !MacMouseOver::isAXAPIEnabled() )
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000,
QPixmap( ":/icons/error.png" ) ); QPixmap( ":/icons/error.png" ) );

View file

@ -151,7 +151,7 @@ Preferences::Preferences( QWidget * parent, Config::Preferences const & p ):
ui.rightCtrl->hide(); ui.rightCtrl->hide();
ui.leftShift->hide(); ui.leftShift->hide();
ui.rightShift->hide(); ui.rightShift->hide();
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
ui.altKey->setText( "Opt" ); ui.altKey->setText( "Opt" );
ui.winKey->setText( "Ctrl" ); ui.winKey->setText( "Ctrl" );
ui.ctrlKey->setText( "Cmd" ); ui.ctrlKey->setText( "Cmd" );

View file

@ -14,7 +14,7 @@
#include "gddebug.hh" #include "gddebug.hh"
#include "gestures.hh" #include "gestures.hh"
#ifdef Q_OS_MACX #ifdef Q_OS_MAC
#include "macmouseover.hh" #include "macmouseover.hh"
#define MouseOver MacMouseOver #define MouseOver MacMouseOver
#else #else
@ -27,7 +27,7 @@ using std::wstring;
/// in their behavior on those platforms. /// in their behavior on those platforms.
static Qt::WindowFlags popupWindowFlags = 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 Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint
#else #else
Qt::Popup Qt::Popup

View file

@ -10,7 +10,7 @@
Sources::Sources( QWidget * parent, Config::Class const & cfg): Sources::Sources( QWidget * parent, Config::Class const & cfg):
QWidget( parent ), QWidget( parent ),
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
textToSpeechSource( NULL ), textToSpeechSource( NULL ),
#endif #endif
itemDelegate( new QItemDelegate( this ) ), itemDelegate( new QItemDelegate( this ) ),
@ -105,7 +105,7 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg):
ui.forvoLanguageCodes->setText( forvo.languageCodes ); ui.forvoLanguageCodes->setText( forvo.languageCodes );
// Text to speech // 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 ); textToSpeechSource = new TextToSpeechSource( this, cfg.voiceEngines );
ui.tabWidget->addTab( textToSpeechSource, QIcon(":/icons/playsound_color.png"), tr( "Text to Speech" ) ); ui.tabWidget->addTab( textToSpeechSource, QIcon(":/icons/playsound_color.png"), tr( "Text to Speech" ) );
#endif #endif
@ -322,7 +322,7 @@ void Sources::on_removeProgram_clicked()
Config::VoiceEngines Sources::getVoiceEngines() const 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 ) if ( !textToSpeechSource )
return Config::VoiceEngines(); return Config::VoiceEngines();
return textToSpeechSource->getVoiceEnginesModel().getCurrentVoiceEngines(); return textToSpeechSource->getVoiceEnginesModel().getCurrentVoiceEngines();

View file

@ -12,7 +12,7 @@
#include <QItemDelegate> #include <QItemDelegate>
#include <QItemEditorFactory> #include <QItemEditorFactory>
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
#include "texttospeechsource.hh" #include "texttospeechsource.hh"
#endif #endif
@ -284,7 +284,7 @@ signals:
private: private:
Ui::Sources ui; Ui::Sources ui;
#if defined( Q_OS_WIN32 ) || defined( Q_OS_MACX ) #if defined( Q_OS_WIN32 ) || defined( Q_OS_MAC )
TextToSpeechSource *textToSpeechSource; TextToSpeechSource *textToSpeechSource;
#endif #endif