diff --git a/src/GUI.cpp b/src/GUI.cpp index bc025644f..6c920af91 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -223,6 +223,10 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis GUI::~GUI() { qDebug("GUI destruction"); hide(); +#ifdef Q_WS_MAC + // Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305 + setUnifiedTitleAndToolBarOnMac(true); +#endif // Async deletion of Bittorrent session as early as possible // in order to speed up exit session_proxy sp = BTSession->asyncDeletion(); diff --git a/src/Icons/qbittorrent_mac.icns b/src/Icons/qbittorrent_mac.icns new file mode 100644 index 000000000..bcfffe69b Binary files /dev/null and b/src/Icons/qbittorrent_mac.icns differ diff --git a/src/Info.plist b/src/Info.plist new file mode 100644 index 000000000..e706fc573 --- /dev/null +++ b/src/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + torrent + + CFBundleTypeIconFile + qbittorrentDocument + CFBundleTypeName + BitTorrent Document + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + org.bitorrent.torrent + + LSIsAppleDefaultForType + + + + CFBundleIconFile + qbittorrent_mac.icns + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleGetInfoString + 2.2.8 + CFBundleSignature + ???? + CFBundleExecutable + qbittorrent + CFBundleIdentifier + com.yourcompany.qbittorrent + NOTE + This file was generated by Qt/QMake. + + diff --git a/src/misc.cpp b/src/misc.cpp index bfb678e92..15ab2fbe1 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -116,7 +116,10 @@ QString misc::QDesktopServicesCacheLocation() { OSErr err = FSFindFolder(kUserDomain, kCachedDataFolderType, false, &ref); if (err) return QString(); - QString path = getFullPath(ref); + QString path; + QByteArray ba(2048, 0); + if (FSRefMakePath(&ref, reinterpret_cast(ba.data()), ba.size()) == noErr) + path = QString::fromUtf8(ba).normalized(QString::NormalizationForm_C); path += QLatin1Char('/') + qApp->applicationName(); return path; #else diff --git a/src/qmacapplication.cpp b/src/qmacapplication.cpp index 0a40f2a14..6c9f13d56 100644 --- a/src/qmacapplication.cpp +++ b/src/qmacapplication.cpp @@ -28,8 +28,6 @@ * Contact : chris@qbittorrent.org */ -#ifdef Q_WS_MAC - #include #include "qmacapplication.h" @@ -52,4 +50,3 @@ bool QMacApplication::event(QEvent * event) { } } -#endif diff --git a/src/qmacapplication.h b/src/qmacapplication.h index 812878f4c..a3293f782 100644 --- a/src/qmacapplication.h +++ b/src/qmacapplication.h @@ -30,8 +30,6 @@ #ifndef QMACAPPLICATION_H #define QMACAPPLICATION_H -#ifdef Q_WS_MAC - #include "qtsingleapplication.h" #include @@ -47,9 +45,6 @@ signals: protected: bool event(QEvent *); - }; -#endif - #endif // QMACAPPLICATION_H diff --git a/src/src.pro b/src/src.pro index 9e6a08871..43053bab0 100644 --- a/src/src.pro +++ b/src/src.pro @@ -67,6 +67,19 @@ contains(DEBUG_MODE, 0) { message(Release build!) } +# Mac specific configuration +macx { + PREFIX = /usr/local + BINDIR = /usr/local/bin + DATADIR = /usr/local/share + + INCLUDEPATH += /usr/local/include/libtorrent /usr/include/openssl /usr/include /opt/local/include/boost /opt/local/include + LIBS += -ltorrent-rasterbar -lcrypto -L/opt/local/lib -lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt -framework Cocoa + + ICON = Icons/qbittorrent_mac.icns + QMAKE_INFO_PLIST = Info.plist +} + # Install !win32 { # Binary