Ticket #54091: patch-macports-build.diff
File patch-macports-build.diff, 14.8 KB (added by RJVB (René Bertin), 8 years ago) |
---|
-
CMakeLists.txt
diff --git a/CMakeLists.txt b/CMakeLists.txt index 09a9376..4c5ea40 100644
a b if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang 304 304 endif() 305 305 306 306 if(APPLE) 307 set(MAC_BUNDLE_PATH "${ CMAKE_INSTALL_PREFIX}/QMPlay2.app")307 set(MAC_BUNDLE_PATH "${BUNDLE_INSTALL_DIR}/QMPlay2.app") 308 308 309 309 # set paths to Bundle 310 310 set(CMAKE_INSTALL_DATAROOTDIR "${MAC_BUNDLE_PATH}/Contents/share") 311 311 set(CMAKE_INSTALL_LIBDIR "${MAC_BUNDLE_PATH}/Contents/MacOS") 312 if(NOT APPLE_STANDALONE_BUNDLE) 313 include(GNUInstallDirs) 314 endif() 312 315 elseif(NOT WIN32) 313 316 include(GNUInstallDirs) 314 317 endif() 315 318 316 if(NOT APPLE)319 # if(NOT APPLE) 317 320 set(INSTALL_PATH_ICONS "${CMAKE_INSTALL_DATAROOTDIR}/icons") 318 321 set(INSTALL_PATH_MIME "${CMAKE_INSTALL_DATAROOTDIR}/mime") 319 endif()322 # endif() 320 323 321 324 if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_INSTALL_PREFIX STREQUAL "/usr/local") 322 325 set(INSTALL_PATH_MAN "man") # exception for FreeBSD … … else() 350 353 install(FILES AUTHORS ChangeLog LICENSE TODO README.md DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/qmplay2") 351 354 endif() 352 355 353 if(NOT APPLE AND NOT WIN32)356 # if(NOT APPLE AND NOT WIN32) 354 357 # uninstall target 355 358 configure_file( 356 359 "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/Uninstall.cmake.in" … … if(NOT APPLE AND NOT WIN32) 359 362 360 363 add_custom_target(uninstall 361 364 COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") 362 endif()365 # endif() 363 366 364 367 # Detect QtSvg and show warning if it doesn't exist 365 368 if(NOT SVG_MODULE_FOUND) -
src/gui/CMakeLists.txt
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 5853dc9..9b0ba01 100644
a b endif() 213 213 if(WIN32) 214 214 install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/) 215 215 elseif(APPLE) 216 install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${ CMAKE_INSTALL_PREFIX})216 install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${BUNDLE_INSTALL_DIR}) 217 217 218 218 set(QT_LIBS_DIR "${Qt5Widgets_DIR}/../..") 219 219 set(QT_PLUGINS_DIR "${QT_LIBS_DIR}/../plugins") 220 install(FILES 221 "${QT_PLUGINS_DIR}/platforms/libqcocoa.dylib" 222 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins/platforms") 223 install(FILES 224 "${QT_PLUGINS_DIR}/iconengines/libqsvgicon.dylib" 225 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins/iconengines") 226 install(DIRECTORY 227 "${QT_PLUGINS_DIR}/imageformats" 228 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins" 229 PATTERN "*_debug.dylib" EXCLUDE 230 PATTERN "*.dSYM" EXCLUDE) 231 install(DIRECTORY 232 "${QT_LIBS_DIR}/../translations" 233 DESTINATION "${MAC_BUNDLE_PATH}/Contents" 234 FILES_MATCHING 235 PATTERN "qtbase_*.qm") 236 install(CODE " 237 include(BundleUtilities) 238 set(BU_CHMOD_BUNDLE_ITEMS ON) 239 list(APPEND DIRS /usr/local/lib ${QT_LIBS_DIR}) 240 file(GLOB_RECURSE QMPLAY2_MODULES_AND_QT_PLUGINS 241 \"${MAC_BUNDLE_PATH}/Contents/MacOS/modules/*\" 242 \"${MAC_BUNDLE_PATH}/Contents/plugins/*.dylib\") 243 file(WRITE \"${MAC_BUNDLE_PATH}/Contents/Resources/qt.conf\") 244 fixup_bundle(${MAC_BUNDLE_PATH} \"\${QMPLAY2_MODULES_AND_QT_PLUGINS}\" \"\${DIRS}\") 245 ") 220 if(APPLE_STANDALONE_BUNDLE) 221 install(FILES 222 "${QT_PLUGINS_DIR}/platforms/libqcocoa.dylib" 223 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins/platforms") 224 install(FILES 225 "${QT_PLUGINS_DIR}/iconengines/libqsvgicon.dylib" 226 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins/iconengines") 227 install(DIRECTORY 228 "${QT_PLUGINS_DIR}/imageformats" 229 DESTINATION "${MAC_BUNDLE_PATH}/Contents/plugins" 230 PATTERN "*_debug.dylib" EXCLUDE 231 PATTERN "*.dSYM" EXCLUDE) 232 install(DIRECTORY 233 "${QT_LIBS_DIR}/../translations" 234 DESTINATION "${MAC_BUNDLE_PATH}/Contents" 235 FILES_MATCHING 236 PATTERN "qtbase_*.qm") 237 install(CODE " 238 include(BundleUtilities) 239 set(BU_CHMOD_BUNDLE_ITEMS ON) 240 list(APPEND DIRS /usr/local/lib ${QT_LIBS_DIR}) 241 file(GLOB_RECURSE QMPLAY2_MODULES_AND_QT_PLUGINS 242 \"${MAC_BUNDLE_PATH}/Contents/MacOS/modules/*\" 243 \"${MAC_BUNDLE_PATH}/Contents/plugins/*.dylib\") 244 file(WRITE \"${MAC_BUNDLE_PATH}/Contents/Resources/qt.conf\") 245 fixup_bundle(${MAC_BUNDLE_PATH} \"\${QMPLAY2_MODULES_AND_QT_PLUGINS}\" \"\${DIRS}\") 246 ") 247 endif() 246 248 else() 247 249 # executable 248 install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 250 if(APPLE) 251 install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${BUNDLE_INSTALL_DIR}) 252 else() 253 install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 254 endif() 249 255 250 256 # desktop files 251 257 file(GLOB DESKTOP_FILES Unix/QMPlay2*.desktop) -
src/gui/MainWidget.cpp
diff --git a/src/gui/MainWidget.cpp b/src/gui/MainWidget.cpp index b591041..75d9cf3 100644
a b public: 94 94 }; 95 95 #endif 96 96 97 #ifndef Q_OS_MAC97 // #ifndef Q_OS_MAC 98 98 static void copyMenu(QMenu *dest, QMenu *src, QMenu *dontCopy = nullptr) 99 99 { 100 100 QMenu *newMenu = new QMenu(src->title(), dest); … … static void copyMenu(QMenu *dest, QMenu *src, QMenu *dontCopy = nullptr) 110 110 } 111 111 dest->addMenu(newMenu); 112 112 } 113 #endif113 // #endif 114 114 115 115 /* MainWidget */ 116 116 MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) … … MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 164 164 165 165 QMPlay2GUI.menuBar = new MenuBar; 166 166 167 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID167 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 168 168 tray = new QSystemTrayIcon(this); 169 169 tray->setIcon(QMPlay2Core.getIconFromTheme("QMPlay2-panel", QMPlay2Core.getQMPlay2Icon())); 170 170 tray->setVisible(settings.getBool("TrayVisible", true)); … … MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 328 328 if (settings.getBool("MainWidget/TabPositionNorth")) 329 329 setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); 330 330 331 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID331 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 332 332 const bool menuHidden = settings.getBool("MainWidget/MenuHidden", false); 333 333 menuBar->setVisible(!menuHidden); 334 334 hideMenuAct = new QAction(tr("&Hide menu bar"), menuBar); … … MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 367 367 QMPlay2GUI.videoAdjustment->restoreValues(); 368 368 369 369 fullScreenDockWidgetState = settings.getByteArray("MainWidget/FullScreenDockWidgetState"); 370 #if defined Q_OS_MAC ||defined Q_OS_ANDROID370 #if /*defined Q_OS_MAC ||*/ defined Q_OS_ANDROID 371 371 show(); 372 372 #else 373 373 setVisible(settings.getBool("MainWidget/isVisible", true) ? true : !isTrayVisible()); … … void MainWidget::createMenuBar() 848 848 setMenuBar(menuBar); 849 849 850 850 QMenu *secondMenu = new QMenu(this); 851 #ifndef Q_OS_MAC851 // #ifndef Q_OS_MAC 852 852 copyMenu(secondMenu, menuBar->window); 853 853 secondMenu->addMenu(menuBar->widgets); 854 854 copyMenu(secondMenu, menuBar->playlist, menuBar->playlist->extensions); … … void MainWidget::createMenuBar() 858 858 copyMenu(secondMenu, menuBar->help); 859 859 if (tray) 860 860 tray->setContextMenu(secondMenu); 861 #else //On OS X add only the most important menu actions to dock menu862 secondMenu->addAction(menuBar->player->togglePlay);863 secondMenu->addAction(menuBar->player->stop);864 secondMenu->addAction(menuBar->player->next);865 secondMenu->addAction(menuBar->player->prev);866 secondMenu->addSeparator();867 secondMenu->addAction(menuBar->player->toggleMute);868 secondMenu->addSeparator();869 // Copy action, because PreferencesRole doesn't show in dock menu.870 QAction *settings = new QAction(menuBar->options->settings->icon(), menuBar->options->settings->text(), menuBar->options->settings->parent());871 connect(settings, &QAction::triggered, menuBar->options->settings, &QAction::trigger);872 secondMenu->addAction(settings);873 874 QAction *newInstanceAct = new QAction(tr("New window"), secondMenu);875 connect(newInstanceAct, &QAction::triggered, [] {876 QProcess::startDetached(QCoreApplication::applicationFilePath(), {"-noplay"}, QCoreApplication::applicationDirPath());877 });878 secondMenu->addSeparator();879 secondMenu->addAction(newInstanceAct);880 881 qt_mac_set_dock_menu(secondMenu);882 #endif861 // #else //On OS X add only the most important menu actions to dock menu 862 // secondMenu->addAction(menuBar->player->togglePlay); 863 // secondMenu->addAction(menuBar->player->stop); 864 // secondMenu->addAction(menuBar->player->next); 865 // secondMenu->addAction(menuBar->player->prev); 866 // secondMenu->addSeparator(); 867 // secondMenu->addAction(menuBar->player->toggleMute); 868 // secondMenu->addSeparator(); 869 // // Copy action, because PreferencesRole doesn't show in dock menu. 870 // QAction *settings = new QAction(menuBar->options->settings->icon(), menuBar->options->settings->text(), menuBar->options->settings->parent()); 871 // connect(settings, &QAction::triggered, menuBar->options->settings, &QAction::trigger); 872 // secondMenu->addAction(settings); 873 // 874 // QAction *newInstanceAct = new QAction(tr("New window"), secondMenu); 875 // connect(newInstanceAct, &QAction::triggered, [] { 876 // QProcess::startDetached(QCoreApplication::applicationFilePath(), {"-noplay"}, QCoreApplication::applicationDirPath()); 877 // }); 878 // secondMenu->addSeparator(); 879 // secondMenu->addAction(newInstanceAct); 880 // 881 // qt_mac_set_dock_menu(secondMenu); 882 // #endif 883 883 } 884 884 void MainWidget::trayIconClicked(QSystemTrayIcon::ActivationReason reason) 885 885 { 886 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID886 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 887 887 switch (reason) 888 888 { 889 889 case QSystemTrayIcon::Trigger: … … void MainWidget::toggleCompactView() 908 908 909 909 hideAllExtensions(); 910 910 911 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID911 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 912 912 menuBar->hide(); 913 913 #endif 914 914 mainTB->hide(); … … void MainWidget::toggleCompactView() 931 931 932 932 videoDock->fullScreen(false); 933 933 934 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID934 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 935 935 menuBar->setVisible(!hideMenuAct->isChecked()); 936 936 #endif 937 937 … … void MainWidget::toggleFullScreen() 968 968 dockWidgetState = saveState(); 969 969 #endif // Q_OS_ANDROID 970 970 971 #if !defined Q_OS_MAC &&!defined Q_OS_ANDROID971 #if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID 972 972 menuBar->hide(); 973 973 #endif 974 974 statusBar->hide(); … … void MainWidget::toggleFullScreen() 997 997 videoDock->fullScreen(true); 998 998 videoDock->show(); 999 999 1000 #ifdef Q_OS_MAC1000 // #ifdef Q_OS_MAC 1001 1001 menuBar->window->toggleVisibility->setEnabled(false); 1002 #endif1002 // #endif 1003 1003 menuBar->window->toggleCompactView->setEnabled(false); 1004 1004 menuBar->window->toggleFullScreen->setShortcuts(QList<QKeySequence>() << menuBar->window->toggleFullScreen->shortcut() << QKeySequence("ESC")); 1005 1005 fullScreen = true; … … void MainWidget::toggleFullScreen() 1011 1011 } 1012 1012 else 1013 1013 { 1014 #ifdef Q_OS_MAC1014 // #ifdef Q_OS_MAC 1015 1015 menuBar->window->toggleVisibility->setEnabled(true); 1016 #endif1016 // #endif 1017 1017 menuBar->window->toggleCompactView->setEnabled(true); 1018 1018 menuBar->window->toggleFullScreen->setShortcuts(QList<QKeySequence>() << menuBar->window->toggleFullScreen->shortcut()); 1019 1019 … … void MainWidget::toggleFullScreen() 1046 1046 if (QDockWidget *dw = QMPlay2Ext->getDockWidget()) 1047 1047 dw->setFeatures(QDockWidget::AllDockWidgetFeatures); 1048 1048 1049 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID1049 // #if !defined Q_OS_MAC && !defined Q_OS_ANDROID 1050 1050 menuBar->setVisible(!hideMenuAct->isChecked()); 1051 #endif1051 // #endif 1052 1052 statusBar->show(); 1053 1053 1054 1054 mainTB->setMovable(tb_movable); … … void MainWidget::about() 1239 1239 } 1240 1240 } 1241 1241 1242 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID1242 // #if !defined Q_OS_MAC && !defined Q_OS_ANDROID 1243 1243 void MainWidget::hideMenu(bool h) 1244 1244 { 1245 1245 if (fullScreen || isCompactView) … … void MainWidget::hideMenu(bool h) 1250 1250 QMPlay2Core.getSettings().set("MainWidget/MenuHidden", h); 1251 1251 } 1252 1252 } 1253 #endif1253 // #endif 1254 1254 void MainWidget::lockWidgets(bool l) 1255 1255 { 1256 1256 if (fullScreen || isCompactView) … … QMenu *MainWidget::createPopupMenu() 1321 1321 QMenu *popupMenu = QMainWindow::createPopupMenu(); 1322 1322 if (!fullScreen && !isCompactView) 1323 1323 { 1324 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID1324 // #if !defined Q_OS_MAC && !defined Q_OS_ANDROID 1325 1325 popupMenu->insertAction(popupMenu->actions().value(0), hideMenuAct); 1326 1326 popupMenu->insertSeparator(popupMenu->actions().value(1)); 1327 1327 popupMenu->addSeparator(); 1328 #endif1328 // #endif 1329 1329 popupMenu->addAction(lockWidgetsAct); 1330 1330 } 1331 1331 for (QAction *act : popupMenu->actions()) … … void MainWidget::closeEvent(QCloseEvent *e) 1485 1485 else 1486 1486 settings.set("MainWidget/DockWidgetState", dockWidgetState); 1487 1487 settings.set("MainWidget/FullScreenDockWidgetState", fullScreenDockWidgetState); 1488 #ifndef Q_OS_MAC1488 // #ifndef Q_OS_MAC 1489 1489 settings.set("MainWidget/isVisible", isVisible()); 1490 #endif1490 // #endif 1491 1491 if (tray) 1492 1492 settings.set("TrayVisible", tray->isVisible()); 1493 1493 settings.set("VolumeL", volW->volumeL()); -
src/gui/MainWidget.hpp
diff --git a/src/gui/MainWidget.hpp b/src/gui/MainWidget.hpp index c0ab81e..3348418 100644
a b private slots: 101 101 102 102 void about(); 103 103 104 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID104 // #if !defined Q_OS_MAC && !defined Q_OS_ANDROID 105 105 void hideMenu(bool); 106 #else107 void hideMenu(bool) {} //To avoid incorrect CPP file generated by MOC on Android108 #endif106 // #else 107 // void hideMenu(bool) {} //To avoid incorrect CPP file generated by MOC on Android 108 // #endif 109 109 void lockWidgets(bool); 110 110 111 111 void hideDocksSlot(); … … private: 170 170 AboutWidget *aboutW; 171 171 bool isCompactView, wasShow, fullScreen, seekSFocus; 172 172 173 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID173 // #if !defined Q_OS_MAC && !defined Q_OS_ANDROID 174 174 QAction *hideMenuAct; 175 #endif175 // #endif 176 176 QAction *lockWidgetsAct; 177 177 178 178 Updater updater; -
src/gui/SettingsWidget.cpp
diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp index 6a3e351..fbb7f90 100644
a b 63 63 #include "ui_SettingsPlayback.h" 64 64 #include "ui_SettingsPlaybackModulesList.h" 65 65 66 #if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)&& !defined(Q_OS_ANDROID)66 #if !defined(Q_OS_WIN) /*&& !defined(Q_OS_MAC)*/ && !defined(Q_OS_ANDROID) 67 67 #define ICONS_FROM_THEME 68 68 #endif 69 69 -
src/qmplay2/CMakeLists.txt
diff --git a/src/qmplay2/CMakeLists.txt b/src/qmplay2/CMakeLists.txt index 9d7c6e1..65bd006 100644
a b if(WIN32) 225 225 install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}) 226 226 else() 227 227 install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) 228 if(NOT APPLE )228 if(NOT APPLE_STANDALONE_BUNDLE) 229 229 install(FILES ${QMPLAY2_HDR} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/QMPlay2") 230 230 endif() 231 231