From b6d2649ddcd474b37286cbb0b65b862324704806 Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Sat, 10 Sep 2016 20:08:58 +0300 Subject: [PATCH] Initial Mac support in CMake configuration --- CMakeLists.txt | 47 +- cmake/TrMacros.cmake | 38 ++ macosx/CMakeLists.txt | 434 ++++++++++++++++++ macosx/ExpandedPathToIconTransformer.m | 2 + macosx/Info.plist.in | 133 ++++++ macosx/NSApplicationAdditions.h | 2 + macosx/NSMutableArrayAdditions.h | 2 + macosx/ProgressGradients.h | 3 + macosx/QuickLookPlugin/CMakeLists.txt | 91 ++++ .../QuickLookPlugin/GeneratePreviewForURL.m | 2 + macosx/QuickLookPlugin/Info.plist.in | 62 +++ macosx/TorrentCell.h | 2 + macosx/VDKQueue/VDKQueue.m | 2 + 13 files changed, 814 insertions(+), 6 deletions(-) create mode 100644 macosx/CMakeLists.txt create mode 100644 macosx/Info.plist.in create mode 100644 macosx/QuickLookPlugin/CMakeLists.txt create mode 100644 macosx/QuickLookPlugin/Info.plist.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 5deb1e41b..ba04fcfd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(transmission) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +set(CMAKE_MACOSX_RPATH ON) + include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckFunctionExists) @@ -14,6 +16,7 @@ include(TrMacros) option(ENABLE_DAEMON "Build daemon" ON) tr_auto_option(ENABLE_GTK "Build GTK+ client" AUTO) tr_auto_option(ENABLE_QT "Build Qt client" AUTO) +tr_auto_option(ENABLE_MAC "Build Mac client" AUTO) option(ENABLE_UTILS "Build utils (create, edit, show)" ON) option(ENABLE_CLI "Build command-line client" OFF) option(ENABLE_TESTS "Build unit tests" ON) @@ -277,6 +280,21 @@ if(ENABLE_QT) tr_fixup_auto_option(ENABLE_QT QT_FOUND QT_IS_REQUIRED) endif() +if(ENABLE_MAC) + tr_get_required_flag(ENABLE_MAC MAC_IS_REQUIRED) + + if(APPLE) + set(MAC_FOUND ON) + else() + set(MAC_FOUND OFF) + if(MAC_IS_REQUIRED) + message(SEND_ERROR "Mac build is impossible on non-Mac system.") + endif() + endif() + + tr_fixup_auto_option(ENABLE_MAC MAC_FOUND MAC_IS_REQUIRED) +endif() + find_package(ZLIB ${ZLIB_MINIMUM}) if(ZLIB_FOUND) add_definitions(-DHAVE_ZLIB) @@ -287,10 +305,18 @@ set(THIRD_PARTY_DIR ${CMAKE_SOURCE_DIR}/third-party) if(WIN32) tr_add_external_auto_library(EVENT2 libevent event) else() + set(EVENT2_CONFIGURE_FLAGS) + if(APPLE) + if(CRYPTO_PKG STREQUAL "openssl") + list(APPEND EVENT2_CONFIGURE_FLAGS "CPPFLAGS=-I${CRYPTO_INCLUDE_DIRS}") + else() + list(APPEND EVENT2_CONFIGURE_FLAGS "CPPFLAGS=-I${THIRD_PARTY_DIR}/openssl/include") + endif() + endif() tr_add_external_auto_library(EVENT2 libevent event BUILD_IN_SOURCE 1 CONFIGURE_COMMAND "/autogen.sh" - COMMAND "/configure" "--prefix=" "--disable-shared") + COMMAND "/configure" "--prefix=" "--disable-shared" ${EVENT2_CONFIGURE_FLAGS}) endif() tr_add_external_auto_library(NATPMP libnatpmp natpmp) @@ -510,20 +536,29 @@ if(ENABLE_TESTS) enable_testing() endif() +function(tr_install_web DST_DIR) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/web DESTINATION ${DST_DIR} + PATTERN *.am EXCLUDE + PATTERN *.in EXCLUDE + PATTERN *.scss EXCLUDE) +endfunction() + add_subdirectory(libtransmission) -foreach(P daemon cli utils gtk qt) +set(MAC_PROJECT_DIR macosx) + +foreach(P daemon cli utils gtk qt mac) string(TOUPPER "${P}" P_ID) if(ENABLE_${P_ID}) + if(DEFINED ${P_ID}_PROJECT_DIR) + set(P ${${P_ID}_PROJECT_DIR}) + endif() add_subdirectory(${P}) endif() endforeach() if(ENABLE_DAEMON OR ENABLE_GTK OR ENABLE_QT) - install(DIRECTORY web DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${TR_NAME} - PATTERN *.am EXCLUDE - PATTERN *.in EXCLUDE - PATTERN *.scss EXCLUDE) + tr_install_web(${CMAKE_INSTALL_DATAROOTDIR}/${TR_NAME}) endif() if(ENABLE_GTK AND ENABLE_NLS) diff --git a/cmake/TrMacros.cmake b/cmake/TrMacros.cmake index 565ab5e67..09dfe205c 100644 --- a/cmake/TrMacros.cmake +++ b/cmake/TrMacros.cmake @@ -145,3 +145,41 @@ function(tr_select_library LIBNAMES FUNCNAME DIRS OVAR) endforeach() set(${OVAR} "${LIBNAME}" PARENT_SCOPE) endfunction() + +function(tr_fixup_bundle_item BUNDLE_DIR BUNDLE_ITEMS DEP_DIRS) + while(BUNDLE_ITEMS) + list(GET BUNDLE_ITEMS 0 ITEM) + list(REMOVE_AT BUNDLE_ITEMS 0) + + set(ITEM_FULL_BUNDLE_PATH "${BUNDLE_DIR}/${ITEM}") + get_filename_component(ITEM_FULL_BUNDLE_DIR "${ITEM_FULL_BUNDLE_PATH}" PATH) + + unset(ITEM_DEPS) + get_prerequisites("${ITEM_FULL_BUNDLE_PATH}" ITEM_DEPS 1 0 "${ITEM_FULL_BUNDLE_PATH}" "${DEP_DIRS}") + + foreach(DEP IN LISTS ITEM_DEPS) + gp_resolve_item("${ITEM_FULL_BUNDLE_PATH}" "${DEP}" "${ITEM_FULL_BUNDLE_DIR}" "${DEP_DIRS}" DEP_FULL_PATH) + + if(DEP_FULL_PATH MATCHES "[.]dylib$") + get_filename_component(DEP_NAME "${DEP_FULL_PATH}" NAME) + file(COPY "${DEP_FULL_PATH}" DESTINATION "${BUNDLE_DIR}/Contents/MacOS/") + set(DEP_BUNDLE_PATH "Contents/MacOS/${DEP_NAME}") + elseif(DEP_FULL_PATH MATCHES "^(.+)/(([^/]+[.]framework)/.+)$") + set(DEP_NAME "${CMAKE_MATCH_2}") + file(COPY "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}" DESTINATION "${BUNDLE_DIR}/Contents/Frameworks/" PATTERN "Headers" EXCLUDE) + set(DEP_BUNDLE_PATH "Contents/Frameworks/${DEP_NAME}") + else() + message(FATAL_ERROR "Don't know how to fixup '${DEP_FULL_PATH}'") + endif() + + execute_process(COMMAND install_name_tool -change "${DEP}" "@rpath/${DEP_NAME}" "${ITEM_FULL_BUNDLE_PATH}") + + set(DEP_FULL_BUNDLE_PATH "${BUNDLE_DIR}/${DEP_BUNDLE_PATH}") + execute_process(COMMAND chmod u+w "${DEP_FULL_BUNDLE_PATH}") + execute_process(COMMAND install_name_tool -id "@rpath/${DEP_NAME}" "${DEP_FULL_BUNDLE_PATH}") + + list(REMOVE_ITEM BUNDLE_ITEMS "${DEP_BUNDLE_PATH}") + list(APPEND BUNDLE_ITEMS "${DEP_BUNDLE_PATH}") + endforeach() + endwhile() +endfunction() diff --git a/macosx/CMakeLists.txt b/macosx/CMakeLists.txt new file mode 100644 index 000000000..1cf1b137b --- /dev/null +++ b/macosx/CMakeLists.txt @@ -0,0 +1,434 @@ +project(trmac) + +find_program(IBTOOL_EXECUTABLE ibtool REQUIRED) +find_program(TIFFUTIL_EXECUTABLE tiffutil REQUIRED) +find_program(INSTALL_NAME_TOOL_EXECUTABLE install_name_tool REQUIRED) + +macro(tr_wrap_xib IFILE OFILE) + get_filename_component(twx_nib_dir "${OFILE}" DIRECTORY) + add_custom_command( + OUTPUT ${OFILE} + COMMAND ${CMAKE_COMMAND} -E make_directory ${twx_nib_dir} + COMMAND ${IBTOOL_EXECUTABLE} --compile ${OFILE} ${IFILE} + DEPENDS ${IFILE} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + VERBATIM + ) +endmacro() + +function(tr_tiff_from_pngs OFILE) + get_filename_component(ODIR "${OFILE}" DIRECTORY) + add_custom_command( + OUTPUT ${OFILE} + COMMAND ${CMAKE_COMMAND} -E make_directory ${ODIR} + COMMAND ${TIFFUTIL_EXECUTABLE} -cathidpicheck ${ARGN} -out ${OFILE} + DEPENDS ${ARGN} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + VERBATIM + ) +endfunction() + +set(${PROJECT_NAME}_SOURCES + AboutWindowController.m + AddMagnetWindowController.m + AddWindowController.m + BadgeView.m + Badger.m + BlocklistDownloader.m + BlocklistDownloaderViewController.m + BlocklistScheduler.m + BonjourController.m + ButtonToolbarItem.m + ColorTextField.m + Controller.m + CreatorWindowController.m + DragOverlayView.m + DragOverlayWindow.m + ExpandedPathToIconTransformer.m + ExpandedPathToPathTransformer.m + FileListNode.m + FileNameCell.m + FileOutlineController.m + FileOutlineView.m + FilePriorityCell.m + FileRenameSheetController.m + FilterBarController.m + FilterBarView.m + FilterButton.m + GlobalOptionsPopoverViewController.m + GroupToolbarItem.m + GroupsController.m + GroupsPrefsController.m + InfoActivityViewController.m + InfoFileViewController.m + InfoGeneralViewController.m + InfoOptionsViewController.m + InfoPeersViewController.m + InfoTabButtonBack.m + InfoTabButtonCell.m + InfoTextField.m + InfoTrackersViewController.m + InfoWindowController.m + main.m + MessageWindowController.m + NSApplicationAdditions.m + NSImageAdditions.m + NSMutableArrayAdditions.m + NSStringAdditions.m + PeerProgressIndicatorCell.m + PeerTableView.m + PiecesView.m + PortChecker.m + PredicateEditorRowTemplateAny.m + PrefsController.m + PrefsWindow.m + ProgressGradients.m + ShareToolbarItem.m + ShareTorrentFileHelper.m + StatsWindowController.m + StatusBarController.m + StatusBarView.m + ToolbarSegmentedCell.m + Torrent.m + TorrentCell.m + TorrentGroup.m + TorrentTableView.m + TrackerCell.m + TrackerNode.m + TrackerTableView.m + URLSheetWindowController.m + WebSeedTableView.m +) + +set(${PROJECT_NAME}_HEADERS + AboutWindowController.h + AddMagnetWindowController.h + AddWindowController.h + BadgeView.h + Badger.h + BlocklistDownloader.h + BlocklistDownloaderViewController.h + BlocklistScheduler.h + BonjourController.h + ButtonToolbarItem.h + ColorTextField.h + Controller.h + CreatorWindowController.h + DragOverlayView.h + DragOverlayWindow.h + ExpandedPathToIconTransformer.h + ExpandedPathToPathTransformer.h + FileListNode.h + FileNameCell.h + FileOutlineController.h + FileOutlineView.h + FilePriorityCell.h + FileRenameSheetController.h + FilterBarController.h + FilterBarView.h + FilterButton.h + GlobalOptionsPopoverViewController.h + GroupToolbarItem.h + GroupsController.h + GroupsPrefsController.h + InfoActivityViewController.h + InfoFileViewController.h + InfoGeneralViewController.h + InfoOptionsViewController.h + InfoPeersViewController.h + InfoTabButtonBack.h + InfoTabButtonCell.h + InfoTextField.h + InfoTrackersViewController.h + InfoViewController.h + InfoWindowController.h + MessageWindowController.h + NSApplicationAdditions.h + NSImageAdditions.h + NSMutableArrayAdditions.h + NSStringAdditions.h + PeerProgressIndicatorCell.h + PeerTableView.h + PiecesView.h + PortChecker.h + PredicateEditorRowTemplateAny.h + PrefsController.h + PrefsWindow.h + ProgressGradients.h + ShareToolbarItem.h + ShareTorrentFileHelper.h + StatsWindowController.h + StatusBarController.h + StatusBarView.h + ToolbarSegmentedCell.h + Torrent.h + TorrentCell.h + TorrentGroup.h + TorrentTableView.h + TrackerCell.h + TrackerNode.h + TrackerTableView.h + URLSheetWindowController.h + WebSeedTableView.h +) + +set(${PROJECT_NAME}_XIB_FILES + AboutWindow.xib + BlocklistStatusWindow.xib + FileRenameSheetController.xib + FilterBar.xib + InfoFileView.xib + InfoPeersView.xib + InfoTrackersView.xib + InfoWindow.xib + MessageWindow.xib + StatsWindow.xib + StatusBar.xib + URLSheetWindow.xib +) + +set(${PROJECT_NAME}_RESOURCES + Defaults.plist + Credits.rtf + sparkle_dsa_pub.pem + ../COPYING + Images/Transmission.icns + Images/TransmissionDocument.icns +) + +set_source_files_properties(${${PROJECT_NAME}_RESOURCES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources +) + +set(${PROJECT_NAME}_HIDPI_IMAGES + ActionHover + ActionOn + Bandwidth + CleanupTemplate + CompleteCheck + CreateLarge + DownArrowGroupTemplate + DownArrowTemplate + FavIcon + Globe + Groups + GroupsNoneTemplate + InfoActivity + InfoFiles + InfoGeneral + InfoOptions + InfoPeers + InfoTracker + Lock + Magnet + PauseHover + PauseOff + PauseOn + PinTemplate + PriorityControlHigh + PriorityControlLow + PriorityControlNormal + PriorityHighTemplate + PriorityLowTemplate + PriorityNormalTemplate + PurpleDotFlat + PurpleDotGlossy + RedDotFlat + RedDotGlossy + Remote + ResumeHover + ResumeNoWaitHover + ResumeNoWaitOff + ResumeNoWaitOn + ResumeOff + ResumeOn + RevealHover + RevealOff + RevealOn + ToolbarCreateTemplate + ToolbarFilterTemplate + ToolbarInfoTemplate + ToolbarOpenTemplate + ToolbarOpenWebTemplate + ToolbarPauseAllTemplate + ToolbarPauseSelectedTemplate + ToolbarRemoveTemplate + ToolbarResumeAllTemplate + ToolbarResumeSelectedTemplate + Transfers + TurtleTemplate + UpArrowGroupTemplate + UpArrowTemplate + YellowDotFlat + YellowDotGlossy + YingYangGroupTemplate + YingYangTemplate +) + +foreach(IMG ${${PROJECT_NAME}_HIDPI_IMAGES}) + set(IMG_DIR "Images/Images.xcassets/${IMG}.imageset") + list(APPEND ${PROJECT_NAME}_RESOURCES ${IMG_DIR}/${IMG}.png ${IMG_DIR}/${IMG}@2x.png) + if(COMBINE_HIDPI_ARTWORK) + list(APPEND ${PROJECT_NAME}_RESOURCES ${PROJECT_BINARY_DIR}/Images/${IMG}.tiff) + tr_tiff_from_pngs(${PROJECT_BINARY_DIR}/Images/${IMG}.tiff ${IMG_DIR}/${IMG}.png ${IMG_DIR}/${IMG}@2x.png) + set_source_files_properties(${PROJECT_BINARY_DIR}/Images/${IMG}.tiff PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) + else() + set_source_files_properties(${IMG_DIR}/${IMG}.png ${IMG_DIR}/${IMG}@2x.png PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) + endif() +endforeach() + +set(${PROJECT_NAME}_LODPI_IMAGES + DownloadBadge + QuitBadge + UploadBadge +) + +foreach(IMG ${${PROJECT_NAME}_LODPI_IMAGES}) + set(IMG_DIR "Images/Images.xcassets/${IMG}.imageset") + list(APPEND ${PROJECT_NAME}_RESOURCES ${IMG_DIR}/${IMG}.png) + set_source_files_properties(${IMG_DIR}/${IMG}.png PROPERTIES + MACOSX_PACKAGE_LOCATION Resources + ) +endforeach() + +set(${PROJECT_NAME}_LINGUAS + da + de + en + es + fr + it + nl + pt_PT + ru + tr +) + +if(ENABLE_NLS) + set(${PROJECT_NAME}_ENABLED_LINGUAS ${${PROJECT_NAME}_LINGUAS}) +else() + set(${PROJECT_NAME}_ENABLED_LINGUAS en) +endif() + +set(${PROJECT_NAME}_LANG_XIB_FILES + AddMagnetWindow.xib + AddWindow.xib + Creator.xib + GlobalOptionsPopover.xib + GroupRules.xib + InfoActivityView.xib + InfoGeneralView.xib + InfoOptionsView.xib + MainMenu.xib + PrefsWindow.xib +) + +set(${PROJECT_NAME}_LANG_STRINGS_FILES + InfoPlist.strings + Localizable.strings +) + +set(${PROJECT_NAME}_NIB_FILES) +foreach(F ${${PROJECT_NAME}_XIB_FILES}) + get_filename_component(F_BASE "${F}" NAME_WE) + set(F_NIB "${PROJECT_BINARY_DIR}/${F_BASE}.nib") + tr_wrap_xib("${F}" "${F_NIB}") + list(APPEND ${PROJECT_NAME}_NIB_FILES "${F_NIB}") +endforeach() + +set_source_files_properties(${${PROJECT_NAME}_NIB_FILES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) + +set(${PROJECT_NAME}_LINGUAS_XIB_FILES) +set(${PROJECT_NAME}_LINGUAS_NIB_FILES) +foreach(LANG ${${PROJECT_NAME}_ENABLED_LINGUAS}) + set(${PROJECT_NAME}_${LANG}_NIB_FILES) + foreach(F ${${PROJECT_NAME}_LANG_XIB_FILES}) + set(F_XIB "${LANG}.lproj/${F}") + get_filename_component(F_BASE "${F}" NAME_WE) + set(F_NIB "${PROJECT_BINARY_DIR}/${LANG}.lproj/${F_BASE}.nib") + tr_wrap_xib("${F_XIB}" "${F_NIB}") + list(APPEND ${PROJECT_NAME}_LINGUAS_XIB_FILES "${F_XIB}") + list(APPEND ${PROJECT_NAME}_LINGUAS_NIB_FILES "${F_NIB}") + list(APPEND ${PROJECT_NAME}_${LANG}_NIB_FILES "${F_NIB}") + endforeach() + + set(${PROJECT_NAME}_${LANG}_STRINGS_FILES) + foreach(F ${${PROJECT_NAME}_LANG_STRINGS_FILES}) + list(APPEND ${PROJECT_NAME}_${LANG}_STRINGS_FILES ${LANG}.lproj/${F}) + endforeach() +endforeach() + +include_directories( + ${CMAKE_SOURCE_DIR}/libtransmission + ${PROJECT_SOURCE_DIR}/VDKQueue +) + +add_definitions( + -Wno-unused-parameter + "-Wno-#warnings" +) + +add_library(vdkqueue STATIC + VDKQueue/VDKQueue.m + VDKQueue/VDKQueue.h +) + +foreach(LANG ${${PROJECT_NAME}_ENABLED_LINGUAS}) + list(APPEND ${PROJECT_NAME}_RESOURCES ${${PROJECT_NAME}_${LANG}_NIB_FILES} ${${PROJECT_NAME}_${LANG}_STRINGS_FILES}) + set_source_files_properties(${${PROJECT_NAME}_${LANG}_NIB_FILES} ${${PROJECT_NAME}_${LANG}_STRINGS_FILES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources/${LANG}.lproj) +endforeach() + +add_executable(${TR_NAME}-mac MACOSX_BUNDLE + ${${PROJECT_NAME}_SOURCES} + ${${PROJECT_NAME}_HEADERS} + ${${PROJECT_NAME}_XIB_FILES} + ${${PROJECT_NAME}_NIB_FILES} + ${${PROJECT_NAME}_LINGUAS_XIB_FILES} + ${${PROJECT_NAME}_LINGUAS_NIB_FILES} + ${${PROJECT_NAME}_RESOURCES} +) + +find_library(GROWL_FRAMEWORK Growl PATHS ${PROJECT_SOURCE_DIR} NO_DEFAULT_PATHS) +find_library(SPARKLE_FRAMEWORK Sparkle PATHS ${PROJECT_SOURCE_DIR} NO_DEFAULT_PATHS) + +target_link_libraries(${TR_NAME}-mac + ${TR_NAME} + vdkqueue + ${GROWL_FRAMEWORK} + ${SPARKLE_FRAMEWORK} + "-framework AppKit" + "-framework Carbon" + "-framework Foundation" + "-framework IOKit" + "-framework Quartz" + "-framework Security" +) + +set(MAC_BUNDLE_NAME Transmission) + +set_target_properties(${TR_NAME}-mac PROPERTIES + OUTPUT_NAME ${MAC_BUNDLE_NAME} + MACOSX_BUNDLE_GUI_IDENTIFIER "org.m0k.transmission" + MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/Info.plist.in + INSTALL_RPATH "@executable_path;@executable_path/../Frameworks" +) + +add_subdirectory(QuickLookPlugin) + +install(TARGETS ${TR_NAME}-mac DESTINATION Applications) + +install(DIRECTORY TransmissionHelp DESTINATION Applications/${MAC_BUNDLE_NAME}.app/Contents/Resources) +tr_install_web(Applications/${MAC_BUNDLE_NAME}.app/Contents/Resources) + +install(CODE " + list(APPEND CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake\") + include(TrMacros) + include(GetPrerequisites) + tr_fixup_bundle_item(\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/Applications/${MAC_BUNDLE_NAME}.app\" \"Contents/MacOS/${MAC_BUNDLE_NAME}\" \"${PROJECT_SOURCE_DIR}\") +") diff --git a/macosx/ExpandedPathToIconTransformer.m b/macosx/ExpandedPathToIconTransformer.m index ed20f4ef5..e2030ffd7 100644 --- a/macosx/ExpandedPathToIconTransformer.m +++ b/macosx/ExpandedPathToIconTransformer.m @@ -20,6 +20,8 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#import + #import "ExpandedPathToIconTransformer.h" @implementation ExpandedPathToIconTransformer diff --git a/macosx/Info.plist.in b/macosx/Info.plist.in new file mode 100644 index 000000000..2d2f246f3 --- /dev/null +++ b/macosx/Info.plist.in @@ -0,0 +1,133 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + torrent + + CFBundleTypeIconFile + TransmissionDocument + CFBundleTypeName + BitTorrent Document + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + org.bittorrent.torrent + + + + CFBundleExecutable + Transmission + CFBundleGetInfoString + @TR_USER_AGENT_PREFIX@ (@TR_VCS_REVISION@) + CFBundleHelpBookFolder + TransmissionHelp + CFBundleHelpBookName + Transmission Help + CFBundleIconFile + Transmission + CFBundleIdentifier + org.m0k.transmission + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Transmission + CFBundlePackageType + APPL + CFBundleShortVersionString + @TR_USER_AGENT_PREFIX@ + CFBundleSignature + TR## + CFBundleURLTypes + + + CFBundleURLName + BitTorrent Magnet URL + CFBundleURLSchemes + + magnet + + + + CFBundleVersion + @TR_VCS_REVISION@ + LSApplicationCategoryType + public.app-category.utilities + LSMinimumSystemVersion + 10.7.0 + NSAppleScriptEnabled + YES + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + NSHumanReadableCopyright + Copyright © 2005-2016 The Transmission Project + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + NSServices + + + NSPortName + Transmission + NSSendTypes + + NSStringPboardType + NSURLPboardType + + + + NSSupportsAutomaticGraphicsSwitching + + SUAllowsAutomaticUpdates + + SUFeedURL + https://update.transmissionbt.com/appcast.xml + SUPublicDSAKeyFile + sparkle_dsa_pub.pem + SUScheduledCheckInterval + 86400 + UTExportedTypeDeclarations + + + UTTypeConformsTo + + public.data + public.item + com.bittorrent.torrent + + UTTypeDescription + BitTorrent Document + UTTypeIconFile + TransmissionDocument + UTTypeIdentifier + org.bittorrent.torrent + UTTypeReferenceURL + http://www.bittorrent.org/beps/bep_0000.html + UTTypeTagSpecification + + com.apple.ostype + TORR + public.filename-extension + + torrent + + public.mime-type + application/x-bittorrent + + + + + diff --git a/macosx/NSApplicationAdditions.h b/macosx/NSApplicationAdditions.h index ffe6bae67..839fbde2e 100644 --- a/macosx/NSApplicationAdditions.h +++ b/macosx/NSApplicationAdditions.h @@ -20,6 +20,8 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#import + #define NSByteCountFormatterMtLion NSClassFromString(@"NSByteCountFormatter") #define NSUserNotificationMtLion NSClassFromString(@"NSUserNotification") #define NSUserNotificationCenterMtLion NSClassFromString(@"NSUserNotificationCenter") diff --git a/macosx/NSMutableArrayAdditions.h b/macosx/NSMutableArrayAdditions.h index 8c9c9a4b9..e39fcb19a 100644 --- a/macosx/NSMutableArrayAdditions.h +++ b/macosx/NSMutableArrayAdditions.h @@ -20,6 +20,8 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#import + @interface NSMutableArray (NSMutableArrayAdditions) - (void) moveObjectAtIndex: (NSUInteger) fromIndex toIndex: (NSUInteger) toIndex; diff --git a/macosx/ProgressGradients.h b/macosx/ProgressGradients.h index 5d0625bb2..eb0d0883c 100644 --- a/macosx/ProgressGradients.h +++ b/macosx/ProgressGradients.h @@ -20,6 +20,9 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#import +#import + @interface ProgressGradients : NSObject + (NSGradient *) progressWhiteGradient; diff --git a/macosx/QuickLookPlugin/CMakeLists.txt b/macosx/QuickLookPlugin/CMakeLists.txt new file mode 100644 index 000000000..f14c005cc --- /dev/null +++ b/macosx/QuickLookPlugin/CMakeLists.txt @@ -0,0 +1,91 @@ +project(trmacql) + +set(${PROJECT_NAME}_SOURCES + ../NSApplicationAdditions.m + ../NSStringAdditions.m + GeneratePreviewForURL.m + GenerateThumbnailForURL.m + main.c +) + +set(${PROJECT_NAME}_HEADERS +) + +set(${PROJECT_NAME}_LINGUAS + da + de + en + es + fr + it + nl + pt_PT + ru + tr +) + +if(ENABLE_NLS) + set(${PROJECT_NAME}_ENABLED_LINGUAS ${${PROJECT_NAME}_LINGUAS}) +else() + set(${PROJECT_NAME}_ENABLED_LINGUAS en) +endif() + +set(${PROJECT_NAME}_LANG_STRINGS_FILES + Localizable.strings +) + +set(${PROJECT_NAME}_RESOURCES + style.css +) + +set_source_files_properties(${${PROJECT_NAME}_RESOURCES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) + +foreach(LANG ${${PROJECT_NAME}_ENABLED_LINGUAS}) + set(${PROJECT_NAME}_${LANG}_STRINGS_FILES) + foreach(F ${${PROJECT_NAME}_LANG_STRINGS_FILES}) + list(APPEND ${PROJECT_NAME}_${LANG}_STRINGS_FILES ${LANG}.lproj/${F}) + list(APPEND ${PROJECT_NAME}_RESOURCES ${${PROJECT_NAME}_${LANG}_STRINGS_FILES}) + set_source_files_properties(${${PROJECT_NAME}_${LANG}_STRINGS_FILES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources/${LANG}.lproj) + endforeach() +endforeach() + +add_library(${TR_NAME}-mac-ql MODULE + ${${PROJECT_NAME}_SOURCES} + ${${PROJECT_NAME}_HEADERS} + ${${PROJECT_NAME}_RESOURCES} +) + +set(MAC_QL_BUNDLE_NAME QuickLookPlugin) + +set_target_properties(${TR_NAME}-mac-ql PROPERTIES + OUTPUT_NAME ${MAC_QL_BUNDLE_NAME} + MACOSX_BUNDLE ON + BUNDLE ON + BUNDLE_EXTENSION qlgenerator + MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/Info.plist.in" + INSTALL_RPATH "@loader_path/../../../../../MacOS;@loader_path/../../../../../Frameworks" +) + +target_include_directories(${TR_NAME}-mac-ql PRIVATE + .. +) + +target_link_libraries(${TR_NAME}-mac-ql + ${TR_NAME} + "-framework Foundation" + "-framework CoreFoundation" + "-framework CoreServices" + "-framework AppKit" + "-framework QuickLook" +) + +install(TARGETS ${TR_NAME}-mac-ql DESTINATION Applications/${MAC_BUNDLE_NAME}.app/Contents/Library/QuickLook) + +install(CODE " + list(APPEND CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake\") + include(TrMacros) + include(GetPrerequisites) + tr_fixup_bundle_item(\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/Applications/${MAC_BUNDLE_NAME}.app\" \"Contents/Library/QuickLook/${MAC_QL_BUNDLE_NAME}.qlgenerator/Contents/MacOS/${MAC_QL_BUNDLE_NAME}\" \"\") +") diff --git a/macosx/QuickLookPlugin/GeneratePreviewForURL.m b/macosx/QuickLookPlugin/GeneratePreviewForURL.m index 72cafeabc..3822e3df6 100644 --- a/macosx/QuickLookPlugin/GeneratePreviewForURL.m +++ b/macosx/QuickLookPlugin/GeneratePreviewForURL.m @@ -1,3 +1,5 @@ +#import + #import "transmission.h" #import "NSStringAdditions.h" diff --git a/macosx/QuickLookPlugin/Info.plist.in b/macosx/QuickLookPlugin/Info.plist.in new file mode 100644 index 000000000..8954973b6 --- /dev/null +++ b/macosx/QuickLookPlugin/Info.plist.in @@ -0,0 +1,62 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeRole + QLGenerator + LSItemContentTypes + + org.bittorrent.torrent + com.bittorrent.torrent + + + + CFBundleExecutable + QuickLookPlugin + CFBundleIdentifier + org.m0k.transmission.QuickLookPlugin + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + QuickLookPlugin + CFBundleShortVersionString + 1 + CFBundleVersion + 1.0 + CFPlugInDynamicRegisterFunction + + CFPlugInDynamicRegistration + NO + CFPlugInFactories + + FDF02409-6B04-4738-973D-1AADB4FC34D8 + QuickLookGeneratorPluginFactory + + CFPlugInTypes + + 5E2D9680-5022-40FA-B806-43349622E5B9 + + FDF02409-6B04-4738-973D-1AADB4FC34D8 + + + CFPlugInUnloadFunction + + NSHumanReadableCopyright + Copyright © 2005-2016 The Transmission Project + QLNeedsToBeRunInMainThread + + QLPreviewHeight + 600 + QLPreviewWidth + 600 + QLSupportsConcurrentRequests + + QLThumbnailMinimumSize + 17 + + diff --git a/macosx/TorrentCell.h b/macosx/TorrentCell.h index 8b9b88ed2..bbcfb4189 100644 --- a/macosx/TorrentCell.h +++ b/macosx/TorrentCell.h @@ -20,6 +20,8 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ +#import + @interface TorrentCell : NSActionCell { NSUserDefaults * fDefaults; diff --git a/macosx/VDKQueue/VDKQueue.m b/macosx/VDKQueue/VDKQueue.m index f1bc83b14..a96426d5e 100755 --- a/macosx/VDKQueue/VDKQueue.m +++ b/macosx/VDKQueue/VDKQueue.m @@ -19,6 +19,8 @@ // 3. This notice may not be removed or altered from any source // distribution. +#import + #import "VDKQueue.h" #import #import -- 2.40.0