Added MAC OS X support and updated program icon from the old project wiki for better looks in Dock etc. Scan popup and hotkeys are not supported. The program is tested on Snow Leopard and Lion. Works with the default system libraries.

Signed-off-by: Denis Loginov <dinvlad@gmail.com>
This commit is contained in:
Denis Loginov 2011-08-06 14:39:16 -04:00
parent 078889dd63
commit b1553ccc75
8 changed files with 54 additions and 4 deletions

View file

@ -88,6 +88,12 @@ unix {
desktops2.files = redist/*.desktop
INSTALLS += desktops2
}
mac {
LIBS += -lvorbisfile \
-liconv \
-lhunspell-1.2 \
-L/usr/X11/lib
}
DEFINES += PROGRAM_VERSION=\\\"$$VERSION\\\"
# Input

View file

@ -65,6 +65,7 @@ HotkeyStruct::HotkeyStruct( quint32 key_, quint32 key2_, quint32 modifier_,
//////////////////////////////////////////////////////////////////////////
#ifndef Q_WS_MAC
HotkeyWrapper::HotkeyWrapper(QObject *parent) : QThread( parent ),
state2(false)
{
@ -545,4 +546,4 @@ void HotkeyWrapper::unregister()
}
#endif
#endif

View file

@ -32,6 +32,7 @@ struct HotkeyStruct
//////////////////////////////////////////////////////////////////////////
#ifndef Q_OS_MAC
class HotkeyWrapper : public QThread // Thread is actually only used on X11
{
Q_OBJECT
@ -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
//////////////////////////////////////////////////////////////////////////

BIN
icons/macicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View file

@ -10,7 +10,11 @@ Initializing::Initializing( QWidget * parent, bool showOnStartup ): QDialog( par
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 )
{

View file

@ -30,7 +30,9 @@ bool KeyboardState::checkModifiersPressed( int mask )
#else
XkbStateRec state;
#ifndef Q_OS_MAC
XkbGetState( QX11Info::display(), XkbUseCoreKbd, &state );
#endif
return !(
( mask & Alt && !( state.base_mods & Mod1Mask ) ) ||

10
main.cc
View file

@ -22,6 +22,10 @@
int main( int argc, char ** argv )
{
#ifdef Q_OS_MAC
setenv("LANG", "en_US.UTF-8", 1);
#endif
// The following clause fixes a race in the MinGW runtime where throwing
// exceptions for the first time in several threads simultaneously can cause
// an abort(). This code throws first exception in a safe, single-threaded
@ -88,7 +92,11 @@ int main( int argc, char ** argv )
app.setOrganizationDomain( "http://goldendict.org/" );
app.setStyle(new GdAppStyle);
app.setWindowIcon( QIcon( ":/icons/programicon.png" ) );
#ifndef Q_OS_MAC
app.setWindowIcon( QIcon( ":/icons/programicon.png" ) );
#else
app.setWindowIcon( QIcon( ":/icons/macicon.png" ) );
#endif
Config::Class cfg( Config::load() );

View file

@ -46,5 +46,6 @@
<file>CREDITS.txt</file>
<file>icons/highlighter.png</file>
<file>icons/error.png</file>
<file>icons/macicon.png</file>
</qresource>
</RCC>