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 
    304304endif()
    305305
    306306if(APPLE)
    307     set(MAC_BUNDLE_PATH "${CMAKE_INSTALL_PREFIX}/QMPlay2.app")
     307    set(MAC_BUNDLE_PATH "${BUNDLE_INSTALL_DIR}/QMPlay2.app")
    308308
    309309    # set paths to Bundle
    310310    set(CMAKE_INSTALL_DATAROOTDIR "${MAC_BUNDLE_PATH}/Contents/share")
    311311    set(CMAKE_INSTALL_LIBDIR      "${MAC_BUNDLE_PATH}/Contents/MacOS")
     312    if(NOT APPLE_STANDALONE_BUNDLE)
     313        include(GNUInstallDirs)
     314    endif()
    312315elseif(NOT WIN32)
    313316    include(GNUInstallDirs)
    314317endif()
    315318
    316 if(NOT APPLE)
     319# if(NOT APPLE)
    317320    set(INSTALL_PATH_ICONS "${CMAKE_INSTALL_DATAROOTDIR}/icons")
    318321    set(INSTALL_PATH_MIME "${CMAKE_INSTALL_DATAROOTDIR}/mime")
    319 endif()
     322# endif()
    320323
    321324if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
    322325    set(INSTALL_PATH_MAN "man") # exception for FreeBSD
    else() 
    350353    install(FILES AUTHORS ChangeLog LICENSE TODO README.md DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/qmplay2")
    351354endif()
    352355
    353 if(NOT APPLE AND NOT WIN32)
     356# if(NOT APPLE AND NOT WIN32)
    354357    # uninstall target
    355358    configure_file(
    356359        "${CMAKE_CURRENT_SOURCE_DIR}/src/cmake/Uninstall.cmake.in"
    if(NOT APPLE AND NOT WIN32) 
    359362
    360363    add_custom_target(uninstall
    361364        COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
    362 endif()
     365# endif()
    363366
    364367# Detect QtSvg and show warning if it doesn't exist
    365368if(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() 
    213213if(WIN32)
    214214    install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/)
    215215elseif(APPLE)
    216     install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX})
     216    install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${BUNDLE_INSTALL_DIR})
    217217
    218218    set(QT_LIBS_DIR "${Qt5Widgets_DIR}/../..")
    219219    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()
    246248else()
    247249    # 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()
    249255
    250256    # desktop files
    251257    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: 
    9494};
    9595#endif
    9696
    97 #ifndef Q_OS_MAC
     97// #ifndef Q_OS_MAC
    9898static void copyMenu(QMenu *dest, QMenu *src, QMenu *dontCopy = nullptr)
    9999{
    100100        QMenu *newMenu = new QMenu(src->title(), dest);
    static void copyMenu(QMenu *dest, QMenu *src, QMenu *dontCopy = nullptr) 
    110110        }
    111111        dest->addMenu(newMenu);
    112112}
    113 #endif
     113// #endif
    114114
    115115/* MainWidget */
    116116MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments)
    MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 
    164164
    165165        QMPlay2GUI.menuBar = new MenuBar;
    166166
    167 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     167#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    168168        tray = new QSystemTrayIcon(this);
    169169        tray->setIcon(QMPlay2Core.getIconFromTheme("QMPlay2-panel", QMPlay2Core.getQMPlay2Icon()));
    170170        tray->setVisible(settings.getBool("TrayVisible", true));
    MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 
    328328        if (settings.getBool("MainWidget/TabPositionNorth"))
    329329                setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    330330
    331 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     331#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    332332        const bool menuHidden = settings.getBool("MainWidget/MenuHidden", false);
    333333        menuBar->setVisible(!menuHidden);
    334334        hideMenuAct = new QAction(tr("&Hide menu bar"), menuBar);
    MainWidget::MainWidget(QPair<QStringList, QStringList> &arguments) 
    367367                QMPlay2GUI.videoAdjustment->restoreValues();
    368368
    369369        fullScreenDockWidgetState = settings.getByteArray("MainWidget/FullScreenDockWidgetState");
    370 #if defined Q_OS_MAC || defined Q_OS_ANDROID
     370#if /*defined Q_OS_MAC ||*/ defined Q_OS_ANDROID
    371371        show();
    372372#else
    373373        setVisible(settings.getBool("MainWidget/isVisible", true) ? true : !isTrayVisible());
    void MainWidget::createMenuBar() 
    848848        setMenuBar(menuBar);
    849849
    850850        QMenu *secondMenu = new QMenu(this);
    851 #ifndef Q_OS_MAC
     851// #ifndef Q_OS_MAC
    852852        copyMenu(secondMenu, menuBar->window);
    853853        secondMenu->addMenu(menuBar->widgets);
    854854        copyMenu(secondMenu, menuBar->playlist, menuBar->playlist->extensions);
    void MainWidget::createMenuBar() 
    858858        copyMenu(secondMenu, menuBar->help);
    859859        if (tray)
    860860                tray->setContextMenu(secondMenu);
    861 #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
     861// #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
    883883}
    884884void MainWidget::trayIconClicked(QSystemTrayIcon::ActivationReason reason)
    885885{
    886 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     886#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    887887        switch (reason)
    888888        {
    889889                case QSystemTrayIcon::Trigger:
    void MainWidget::toggleCompactView() 
    908908
    909909                hideAllExtensions();
    910910
    911 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     911#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    912912                menuBar->hide();
    913913#endif
    914914                mainTB->hide();
    void MainWidget::toggleCompactView() 
    931931
    932932                videoDock->fullScreen(false);
    933933
    934 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     934#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    935935                menuBar->setVisible(!hideMenuAct->isChecked());
    936936#endif
    937937
    void MainWidget::toggleFullScreen() 
    968968                dockWidgetState = saveState();
    969969#endif // Q_OS_ANDROID
    970970
    971 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     971#if /*!defined Q_OS_MAC &&*/ !defined Q_OS_ANDROID
    972972                menuBar->hide();
    973973#endif
    974974                statusBar->hide();
    void MainWidget::toggleFullScreen() 
    997997                videoDock->fullScreen(true);
    998998                videoDock->show();
    999999
    1000 #ifdef Q_OS_MAC
     1000// #ifdef Q_OS_MAC
    10011001                menuBar->window->toggleVisibility->setEnabled(false);
    1002 #endif
     1002// #endif
    10031003                menuBar->window->toggleCompactView->setEnabled(false);
    10041004                menuBar->window->toggleFullScreen->setShortcuts(QList<QKeySequence>() << menuBar->window->toggleFullScreen->shortcut() << QKeySequence("ESC"));
    10051005                fullScreen = true;
    void MainWidget::toggleFullScreen() 
    10111011        }
    10121012        else
    10131013        {
    1014 #ifdef Q_OS_MAC
     1014// #ifdef Q_OS_MAC
    10151015                menuBar->window->toggleVisibility->setEnabled(true);
    1016 #endif
     1016// #endif
    10171017                menuBar->window->toggleCompactView->setEnabled(true);
    10181018                menuBar->window->toggleFullScreen->setShortcuts(QList<QKeySequence>() << menuBar->window->toggleFullScreen->shortcut());
    10191019
    void MainWidget::toggleFullScreen() 
    10461046                        if (QDockWidget *dw = QMPlay2Ext->getDockWidget())
    10471047                                dw->setFeatures(QDockWidget::AllDockWidgetFeatures);
    10481048
    1049 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     1049// #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
    10501050                menuBar->setVisible(!hideMenuAct->isChecked());
    1051 #endif
     1051// #endif
    10521052                statusBar->show();
    10531053
    10541054                mainTB->setMovable(tb_movable);
    void MainWidget::about() 
    12391239        }
    12401240}
    12411241
    1242 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     1242// #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
    12431243void MainWidget::hideMenu(bool h)
    12441244{
    12451245        if (fullScreen || isCompactView)
    void MainWidget::hideMenu(bool h) 
    12501250                QMPlay2Core.getSettings().set("MainWidget/MenuHidden", h);
    12511251        }
    12521252}
    1253 #endif
     1253// #endif
    12541254void MainWidget::lockWidgets(bool l)
    12551255{
    12561256        if (fullScreen || isCompactView)
    QMenu *MainWidget::createPopupMenu() 
    13211321        QMenu *popupMenu = QMainWindow::createPopupMenu();
    13221322        if (!fullScreen && !isCompactView)
    13231323        {
    1324 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     1324// #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
    13251325                popupMenu->insertAction(popupMenu->actions().value(0), hideMenuAct);
    13261326                popupMenu->insertSeparator(popupMenu->actions().value(1));
    13271327                popupMenu->addSeparator();
    1328 #endif
     1328// #endif
    13291329                popupMenu->addAction(lockWidgetsAct);
    13301330        }
    13311331        for (QAction *act : popupMenu->actions())
    void MainWidget::closeEvent(QCloseEvent *e) 
    14851485        else
    14861486                settings.set("MainWidget/DockWidgetState", dockWidgetState);
    14871487        settings.set("MainWidget/FullScreenDockWidgetState", fullScreenDockWidgetState);
    1488 #ifndef Q_OS_MAC
     1488// #ifndef Q_OS_MAC
    14891489        settings.set("MainWidget/isVisible", isVisible());
    1490 #endif
     1490// #endif
    14911491        if (tray)
    14921492                settings.set("TrayVisible", tray->isVisible());
    14931493        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: 
    101101
    102102        void about();
    103103
    104 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     104// #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
    105105        void hideMenu(bool);
    106 #else
    107         void hideMenu(bool) {} //To avoid incorrect CPP file generated by MOC on Android
    108 #endif
     106// #else
     107//      void hideMenu(bool) {} //To avoid incorrect CPP file generated by MOC on Android
     108// #endif
    109109        void lockWidgets(bool);
    110110
    111111        void hideDocksSlot();
    private: 
    170170        AboutWidget *aboutW;
    171171        bool isCompactView, wasShow, fullScreen, seekSFocus;
    172172
    173 #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
     173// #if !defined Q_OS_MAC && !defined Q_OS_ANDROID
    174174        QAction *hideMenuAct;
    175 #endif
     175// #endif
    176176        QAction *lockWidgetsAct;
    177177
    178178        Updater updater;
  • src/gui/SettingsWidget.cpp

    diff --git a/src/gui/SettingsWidget.cpp b/src/gui/SettingsWidget.cpp
    index 6a3e351..fbb7f90 100644
    a b  
    6363#include "ui_SettingsPlayback.h"
    6464#include "ui_SettingsPlaybackModulesList.h"
    6565
    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)
    6767        #define ICONS_FROM_THEME
    6868#endif
    6969
  • src/qmplay2/CMakeLists.txt

    diff --git a/src/qmplay2/CMakeLists.txt b/src/qmplay2/CMakeLists.txt
    index 9d7c6e1..65bd006 100644
    a b if(WIN32) 
    225225    install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
    226226else()
    227227    install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
    228     if(NOT APPLE)
     228    if(NOT APPLE_STANDALONE_BUNDLE)
    229229        install(FILES ${QMPLAY2_HDR} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/QMPlay2")
    230230    endif()
    231231