Skip to content

Commit

Permalink
#ifndef Q_MOC_RUN
Browse files Browse the repository at this point in the history
#ifndef Q_MOC_RUN for QT4.8.6 BOOST_JOIN problem
  • Loading branch information
ctgiant committed May 6, 2015
1 parent 276eb74 commit b6e1afb
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 31 deletions.
46 changes: 43 additions & 3 deletions DeOxyRibose.pro
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,38 @@ UI_DIR = build
# use: qmake "RELEASE=1"
contains(RELEASE, 1) {
# Mac: compile for maximum compatibility (10.5, 32-bit)
macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.5 -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk
macx:QMAKE_CXXFLAGS += -mmacosx-version-min=10.9 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

!windows:!macx {
# Linux: static link
LIBS += -Wl,-Bstatic
}
}

# use: qmake "USE_QRCODE=1"
# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support
contains(USE_QRCODE, 1) {
message(Building with QRCode support)
DEFINES += USE_QRCODE
LIBS += -lqrencode
}

# use: qmake "USE_UPNP=1" ( enabled by default; default)
# or: qmake "USE_UPNP=0" (disabled by default)
# or: qmake "USE_UPNP=-" (not supported)
# miniupnpc (http://miniupnp.free.fr/files/) must be installed for support
contains(USE_UPNP, -) {
message(Building without UPNP support)
} else {
message(Building with UPNP support)
count(USE_UPNP, 0) {
USE_UPNP=1
}
DEFINES += USE_UPNP=$$USE_UPNP STATICLIB
INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH
LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc
win32:LIBS += -liphlpapi
}

# use: qmake "USE_DBUS=1"
contains(USE_DBUS, 1) {
Expand Down Expand Up @@ -404,11 +428,27 @@ isEmpty(BDB_INCLUDE_PATH) {
}

isEmpty(BOOST_LIB_PATH) {
macx:BOOST_LIB_PATH = /opt/local/lib
macx:BOOST_LIB_PATH = /usr/local/lib
}

isEmpty(BOOST_INCLUDE_PATH) {
macx:BOOST_INCLUDE_PATH = /opt/local/include
macx:BOOST_INCLUDE_PATH = /usr/local/include
}

isEmpty(OPENSSL_LIB_PATH) {
macx:OPENSSL_LIB_PATH = /opt/local/lib
}

isEmpty(OPENSSL_INCLUDE_PATH) {
macx:OPENSSL_INCLUDE_PATH = /opt/local/include

}
isEmpty(MINIUPNPC_LIB_PATH) {
macx:MINIUPNPC_LIB_PATH = /opt/local/lib
}

isEmpty(MINIUPNPC_INCLUDE_PATH) {
macx:MINIUPNPC_INCLUDE_PATH = /opt/local/include
}

windows:DEFINES += WIN32
Expand Down
4 changes: 4 additions & 0 deletions src/allocators.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

#include <string.h>
#include <string>

#ifndef Q_MOC_RUN
#include <boost/thread/mutex.hpp>
#endif

#include <map>

#ifdef WIN32
Expand Down
4 changes: 2 additions & 2 deletions src/json/json_spirit_reader_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "json_spirit_error_position.h"

//#define BOOST_SPIRIT_THREADSAFE // uncomment for multithreaded use, requires linking to boost.thread

#ifndef Q_MOC_RUN
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/version.hpp>
Expand All @@ -30,7 +30,7 @@
#include <boost/spirit/iterator/position_iterator.hpp>
#define spirit_namespace boost::spirit
#endif

#endif
namespace json_spirit
{
const spirit_namespace::int_parser < boost::int64_t > int64_p = spirit_namespace::int_parser < boost::int64_t >();
Expand Down
2 changes: 2 additions & 0 deletions src/json/json_spirit_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#include <cassert>
#include <sstream>
#include <stdexcept>
#ifndef Q_MOC_RUN
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/variant.hpp>
#endif

namespace json_spirit
{
Expand Down
3 changes: 3 additions & 0 deletions src/keystore.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

#include "crypter.h"
#include "sync.h"

#ifndef Q_MOC_RUN
#include <boost/signals2/signal.hpp>
#endif

class CScript;

Expand Down
4 changes: 4 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
#define XNA_NET_H

#include <deque>

#ifndef Q_MOC_RUN
#include <boost/array.hpp>
#include <boost/foreach.hpp>
#endif

#include <openssl/rand.h>

#ifndef WIN32
Expand Down
Binary file removed src/qt/locale/xna_en.qm
Binary file not shown.
11 changes: 7 additions & 4 deletions src/qt/macdockiconhandler.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H

#include <QtCore/QObject>
#include <QObject>
#include <QMainWindow>

QT_BEGIN_NAMESPACE
class QMenu;
class QIcon;
class QWidget;
QT_END_NAMESPACE

#ifdef __OBJC__
@class DockIconClickEventHandler;
Expand All @@ -18,27 +21,27 @@ class DockIconClickEventHandler;
class MacDockIconHandler : public QObject
{
Q_OBJECT

public:
~MacDockIconHandler();

QMenu *dockMenu();
void setIcon(const QIcon &icon);

void setMainWindow(QMainWindow *window);
static MacDockIconHandler *instance();

void handleDockIconClickEvent();

signals:
void dockIconClicked();

public slots:

private:
MacDockIconHandler();

DockIconClickEventHandler *m_dockIconClickEventHandler;
QWidget *m_dummyWidget;
QMenu *m_dockMenu;
QMainWindow *mainWindow;
};

#endif // MACDOCKICONCLICKHANDLER_H
50 changes: 41 additions & 9 deletions src/qt/macdockiconhandler.mm
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@

#include "macdockiconhandler.h"

#include <QMenu>
#include <QWidget>

extern void qt_mac_set_dock_menu(QMenu*);
#include <QTemporaryFile>
#include <QImageWriter>

#undef slots
#include <Cocoa/Cocoa.h>

#if QT_VERSION < 0x050000
extern void qt_mac_set_dock_menu(QMenu *);
#endif

@interface DockIconClickEventHandler : NSObject
{
MacDockIconHandler* dockIconHandler;
Expand Down Expand Up @@ -38,27 +41,36 @@ - (void)handleDockClickEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAp
Q_UNUSED(event)
Q_UNUSED(replyEvent)

if (dockIconHandler)
if (dockIconHandler) {
dockIconHandler->handleDockIconClickEvent();
}
}

@end

MacDockIconHandler::MacDockIconHandler() : QObject()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this];

this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this];
this->m_dummyWidget = new QWidget();
this->m_dockMenu = new QMenu(this->m_dummyWidget);
this->setMainWindow(NULL);
#if QT_VERSION < 0x050000
qt_mac_set_dock_menu(this->m_dockMenu);
#endif
[pool release];
}

void MacDockIconHandler::setMainWindow(QMainWindow *window) {
this->mainWindow = window;
}

MacDockIconHandler::~MacDockIconHandler()
{
[this->m_dockIconClickEventHandler release];
delete this->m_dummyWidget;
this->setMainWindow(NULL);
}

QMenu *MacDockIconHandler::dockMenu()
Expand All @@ -69,15 +81,29 @@ - (void)handleDockClickEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAp
void MacDockIconHandler::setIcon(const QIcon &icon)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSImage *image;
NSImage *image = nil;
if (icon.isNull())
image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
else {
// generate NSImage from QIcon and use this as dock icon.
QSize size = icon.actualSize(QSize(128, 128));
QPixmap pixmap = icon.pixmap(size);
CGImageRef cgImage = pixmap.toMacCGImageRef();
image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
CFRelease(cgImage);

// write temp file hack (could also be done through QIODevice [memory])
QTemporaryFile notificationIconFile;
if (!pixmap.isNull() && notificationIconFile.open()) {
QImageWriter writer(&notificationIconFile, "PNG");
if (writer.write(pixmap.toImage())) {
const char *cString = notificationIconFile.fileName().toUtf8().data();
NSString *macString = [NSString stringWithCString:cString encoding:NSUTF8StringEncoding];
image = [[NSImage alloc] initWithContentsOfFile:macString];
}
}

if(!image) {
// if testnet image could not be created, load std. app icon
image = [[NSImage imageNamed:@"NSApplicationIcon"] retain];
}
}

[NSApp setApplicationIconImage:image];
Expand All @@ -95,5 +121,11 @@ - (void)handleDockClickEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAp

void MacDockIconHandler::handleDockIconClickEvent()
{
if (this->mainWindow)
{
this->mainWindow->activateWindow();
this->mainWindow->show();
}

emit this->dockIconClicked();
}
2 changes: 2 additions & 0 deletions src/script.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#include <string>
#include <vector>

#ifndef Q_MOC_RUN
#include <boost/foreach.hpp>
#include <boost/variant.hpp>
#endif

#include "keystore.h"
#include "bignum.h"
Expand Down
26 changes: 14 additions & 12 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
#include <cstring>
#include <cstdio>

#ifndef Q_MOC_RUN
#include <boost/type_traits/is_fundamental.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/tuple/tuple_io.hpp>
#endif

#include "allocators.h"
#include "version.h"
Expand Down Expand Up @@ -824,18 +826,18 @@ class CDataStream
vch.insert(it, first, last);
}

void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
{
assert(last - first >= 0);
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
memcpy(&vch[nReadPos], &first[0], last - first);
}
else
vch.insert(it, first, last);
}
// void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
// {
// assert(last - first >= 0);
// if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
// {
// // special case for inserting at the front when there's room
// nReadPos -= (last - first);
// memcpy(&vch[nReadPos], &first[0], last - first);
// }
// else
// vch.insert(it, first, last);
// }

#if !defined(_MSC_VER) || _MSC_VER >= 1300
void insert(iterator it, const char* first, const char* last)
Expand Down
3 changes: 2 additions & 1 deletion src/sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
#ifndef XNA_SYNC_H
#define XNA_SYNC_H

#ifndef Q_MOC_RUN
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/locks.hpp>
#include <boost/thread/condition_variable.hpp>

#endif



Expand Down
3 changes: 3 additions & 0 deletions src/ui_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

#include <string>
#include "util.h" // for int64

#ifndef Q_MOC_RUN
#include <boost/signals2/signal.hpp>
#include <boost/signals2/last_value.hpp>
#endif

class CBasicKeyStore;
class CWallet;
Expand Down
2 changes: 2 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ typedef int pid_t; /* define for Windows compatibility */
#include <vector>
#include <string>

#ifndef Q_MOC_RUN
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#endif

#include <openssl/sha.h>
#include <openssl/ripemd.h>
Expand Down

0 comments on commit b6e1afb

Please sign in to comment.