Skip to content

Commit

Permalink
Merge pull request #34 from dinvlad/master
Browse files Browse the repository at this point in the history
Added support for Mac OS X
  • Loading branch information
dragonroot committed Aug 7, 2011
2 parents 078889d + ee966c4 commit 2602a03
Show file tree
Hide file tree
Showing 40 changed files with 3,059 additions and 5 deletions.
11 changes: 11 additions & 0 deletions goldendict.pro
Expand Up @@ -88,6 +88,17 @@ unix {
desktops2.files = redist/*.desktop
INSTALLS += desktops2
}
mac {
LIBS += -liconv \
-lvorbisfile \
-lvorbis \
-logg \
-lhunspell-1.3
INCLUDEPATH += maclibs/include
LIBS += -Lmaclibs/lib \
-L/usr/X11/lib
ICON = icons/macicon.icns
}
DEFINES += PROGRAM_VERSION=\\\"$$VERSION\\\"

# Input
Expand Down
3 changes: 2 additions & 1 deletion hotkeywrapper.cc
Expand Up @@ -65,6 +65,7 @@ HotkeyStruct::HotkeyStruct( quint32 key_, quint32 key2_, quint32 modifier_,

//////////////////////////////////////////////////////////////////////////

#ifndef Q_WS_MAC
HotkeyWrapper::HotkeyWrapper(QObject *parent) : QThread( parent ),
state2(false)
{
Expand Down Expand Up @@ -545,4 +546,4 @@ void HotkeyWrapper::unregister()
}

#endif

#endif
28 changes: 28 additions & 0 deletions hotkeywrapper.hh
Expand Up @@ -32,6 +32,7 @@ struct HotkeyStruct

//////////////////////////////////////////////////////////////////////////

#ifndef Q_OS_MAC
class HotkeyWrapper : public QThread // Thread is actually only used on X11
{
Q_OBJECT
Expand Down Expand Up @@ -125,6 +126,33 @@ signals:

#endif
};
#else

class HotkeyWrapper : public QObject
{
Q_OBJECT

friend class QHotkeyApplication;

public:

DEF_EX( exInit, "Hotkey wrapper failed to init", std::exception )

HotkeyWrapper(QObject *parent): QObject( parent )
{}

bool setGlobalKey( int key, int key2, Qt::KeyboardModifiers modifier,
int handle )
{ return true; }

void unregister()
{}

signals:

void hotkeyActivated( int );
};
#endif

//////////////////////////////////////////////////////////////////////////

Expand Down
Binary file added icons/macicon.icns
Binary file not shown.
Binary file added icons/macicon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions initializing.cc
Expand Up @@ -9,8 +9,12 @@ Initializing::Initializing( QWidget * parent, bool showOnStartup ): QDialog( par
ui.setupUi( this );
setWindowFlags( Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
Qt::WindowMinimizeButtonHint );

setWindowIcon( QIcon( ":/icons/programicon.png" ) );

#ifndef Q_OS_MAC
setWindowIcon( QIcon( ":/icons/programicon.png" ) );
#else
setWindowIcon( QIcon( ":/icons/macicon.png" ) );
#endif

if ( showOnStartup )
{
Expand Down
4 changes: 3 additions & 1 deletion keyboardstate.cc
Expand Up @@ -14,7 +14,9 @@

bool KeyboardState::checkModifiersPressed( int mask )
{
#ifdef Q_OS_WIN32
#ifdef Q_OS_MAC
return false;
#elif defined Q_OS_WIN32

return !(
( mask & Alt && !( GetAsyncKeyState( VK_MENU ) & 0x8000 ) ) ||
Expand Down
136 changes: 136 additions & 0 deletions maclibs/include/hunspell/affentry.hxx
@@ -0,0 +1,136 @@
#ifndef _AFFIX_HXX_
#define _AFFIX_HXX_

#include "hunvisapi.h"

#include "atypes.hxx"
#include "baseaffix.hxx"
#include "affixmgr.hxx"

/* A Prefix Entry */

class LIBHUNSPELL_DLL_EXPORTED PfxEntry : protected AffEntry
{
AffixMgr* pmyMgr;

PfxEntry * next;
PfxEntry * nexteq;
PfxEntry * nextne;
PfxEntry * flgnxt;

public:

PfxEntry(AffixMgr* pmgr, affentry* dp );
~PfxEntry();

inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
struct hentry * checkword(const char * word, int len, char in_compound,
const FLAG needflag = FLAG_NULL);

struct hentry * check_twosfx(const char * word, int len, char in_compound, const FLAG needflag = NULL);

char * check_morph(const char * word, int len, char in_compound,
const FLAG needflag = FLAG_NULL);

char * check_twosfx_morph(const char * word, int len,
char in_compound, const FLAG needflag = FLAG_NULL);

inline FLAG getFlag() { return aflag; }
inline const char * getKey() { return appnd; }
char * add(const char * word, int len);

inline short getKeyLen() { return appndl; }

inline const char * getMorph() { return morphcode; }

inline const unsigned short * getCont() { return contclass; }
inline short getContLen() { return contclasslen; }

inline PfxEntry * getNext() { return next; }
inline PfxEntry * getNextNE() { return nextne; }
inline PfxEntry * getNextEQ() { return nexteq; }
inline PfxEntry * getFlgNxt() { return flgnxt; }

inline void setNext(PfxEntry * ptr) { next = ptr; }
inline void setNextNE(PfxEntry * ptr) { nextne = ptr; }
inline void setNextEQ(PfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(PfxEntry * ptr) { flgnxt = ptr; }

inline char * nextchar(char * p);
inline int test_condition(const char * st);
};




/* A Suffix Entry */

class LIBHUNSPELL_DLL_EXPORTED SfxEntry : protected AffEntry
{
AffixMgr* pmyMgr;
char * rappnd;

SfxEntry * next;
SfxEntry * nexteq;
SfxEntry * nextne;
SfxEntry * flgnxt;

SfxEntry * l_morph;
SfxEntry * r_morph;
SfxEntry * eq_morph;

public:

SfxEntry(AffixMgr* pmgr, affentry* dp );
~SfxEntry();

inline bool allowCross() { return ((opts & aeXPRODUCT) != 0); }
struct hentry * checkword(const char * word, int len, int optflags,
PfxEntry* ppfx, char ** wlst, int maxSug, int * ns,
// const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, char in_compound=IN_CPD_NOT);
const FLAG cclass = FLAG_NULL, const FLAG needflag = FLAG_NULL, const FLAG badflag = 0);

struct hentry * check_twosfx(const char * word, int len, int optflags, PfxEntry* ppfx, const FLAG needflag = NULL);

char * check_twosfx_morph(const char * word, int len, int optflags,
PfxEntry* ppfx, const FLAG needflag = FLAG_NULL);
struct hentry * get_next_homonym(struct hentry * he);
struct hentry * get_next_homonym(struct hentry * word, int optflags, PfxEntry* ppfx,
const FLAG cclass, const FLAG needflag);


inline FLAG getFlag() { return aflag; }
inline const char * getKey() { return rappnd; }
char * add(const char * word, int len);


inline const char * getMorph() { return morphcode; }

inline const unsigned short * getCont() { return contclass; }
inline short getContLen() { return contclasslen; }
inline const char * getAffix() { return appnd; }

inline short getKeyLen() { return appndl; }

inline SfxEntry * getNext() { return next; }
inline SfxEntry * getNextNE() { return nextne; }
inline SfxEntry * getNextEQ() { return nexteq; }

inline SfxEntry * getLM() { return l_morph; }
inline SfxEntry * getRM() { return r_morph; }
inline SfxEntry * getEQM() { return eq_morph; }
inline SfxEntry * getFlgNxt() { return flgnxt; }

inline void setNext(SfxEntry * ptr) { next = ptr; }
inline void setNextNE(SfxEntry * ptr) { nextne = ptr; }
inline void setNextEQ(SfxEntry * ptr) { nexteq = ptr; }
inline void setFlgNxt(SfxEntry * ptr) { flgnxt = ptr; }

inline char * nextchar(char * p);
inline int test_condition(const char * st, const char * begin);

};

#endif


0 comments on commit 2602a03

Please sign in to comment.