### Install and Run Webmscore Examples Source: https://github.com/librescore/webmscore/blob/webmscore/README.md Instructions for setting up and running the webmscore examples. Navigate to the web-example directory, install dependencies, and start the Node.js or browser example. ```sh cd ./web-example npm i npm start # Node.js example npm run start:browser # browser example ``` -------------------------------- ### Build and Run KDDockWidgets Example Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README.md Steps to build and run a KDDockWidgets example application after the framework has been installed. Ensure the CMAKE_PREFIX_PATH is set correctly. ```bash cd path/to/kddockwidgets/examples/dockwidgets/ cmake -G Ninja -DCMAKE_PREFIX_PATH=/path/where/to/install cmake --build . ./kddockwidgets_example ``` -------------------------------- ### Hello World QML Plugin Example Source: https://github.com/librescore/webmscore/blob/webmscore/doc/plugins.md A basic QML plugin for MuseScore that logs 'Hello World!' to the console and then quits. This serves as a starting point for understanding the structure of a MuseScore plugin. ```qml import MuseScore 3.0 MuseScore { menuPath: "Plugins.pluginName" description: "Description goes here" version: "1.0" onRun: { console.log("Hello World!"); Qt.quit(); } } ``` -------------------------------- ### Install aqtinstall Source: https://github.com/librescore/webmscore/blob/webmscore/README.md Install the `aqtinstall` tool using pip, which is required for downloading Qt5 for WebAssembly. ```sh pip install aqtinstall==2.1.* ``` -------------------------------- ### Run KDDW Python Example Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README-bindings.md Steps to run the KDDockWidgets Python example. This includes setting the PYTHONPATH if necessary, navigating to the example directory, generating resource files, and executing the main Python script. ```bash $ export PYTHONPATH=/kddw/install/path # Only if needed $ cd python/examples/ $ rcc -g python -o rc_assets.py ../../examples/dockwidgets/resources_example.qrc $ python3 main.py ``` -------------------------------- ### Run Python Example Application Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/python/examples/README.txt Execute the main Python script to launch the KDDockWidgets example application. Ensure the resource file has been generated first. ```bash ~# python3 main.py ``` -------------------------------- ### Install Executable Source: https://github.com/librescore/webmscore/blob/webmscore/build/Linux+BSD/portable/CMakeLists.txt Installs the 'findlib' executable to the 'bin' directory on the target system. ```cmake install(TARGETS findlib DESTINATION bin) ``` -------------------------------- ### Build and Install GoogleTest Standalone Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/googletest/googletest/README.md After generating build scripts, use 'make' to compile GoogleTest. If you have administrative privileges, 'sudo make install' can be used to install it system-wide. ```bash make sudo make install # Install in /usr/local/ by default ``` -------------------------------- ### Configure KDDockWidgets Example Build Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/examples/qtquick/dockwidgets/CMakeLists.txt Sets up the build environment for the QtQuick example, enabling automatic moc and rcc, and including current directories. It also finds the KDDockWidgets package. ```cmake cmake_minimum_required(VERSION 3.7) project(kddockwidgets_example_quick) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIRS ON) if(NOT TARGET kddockwidgets) # This will look for Qt, do find_package yourself manually before # if you want to look for a specific Qt version for instance. find_package(KDDockWidgets REQUIRED) endif() ``` -------------------------------- ### Install Google Mock Project Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/googletest/googlemock/CMakeLists.txt Installs the Google Mock project, including the gmock and gmock_main targets. ```cmake install_project(gmock gmock_main) ``` -------------------------------- ### Build and Install KDDockWidgets Framework Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README.md Instructions for building and installing the KDDockWidgets framework using CMake and Ninja. Adapt the generator and OS specific commands as needed. ```bash cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/path/where/to/install ../path/to/kddockwidgets cmake --build . cmake --build . --target install ``` -------------------------------- ### Installing Application Translation Files Source: https://github.com/librescore/webmscore/blob/webmscore/share/locale/CMakeLists.txt Installs the languages.json file and all .qm files (excluding English variants) from the current directory to the application's locale directory. ```cmake install(FILES ${CMAKE_CURRENT_LIST_DIR}/languages.json DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}locale ) install(DIRECTORY ./ DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}locale FILES_MATCHING REGEX ".*\.qm" REGEX ".*_en\.qm" EXCLUDE ) ``` -------------------------------- ### Configure and Install Pkgconfig File Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/src/libFLAC++/CMakeLists.txt Conditionally configures and installs the flac++.pc file for pkg-config if the INSTALL_PKGCONFIG_MODULES option is enabled. This helps other projects find the installed FLAC++ library. ```cmake if(INSTALL_PKGCONFIG_MODULES) set(prefix "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "${CMAKE_INSTALL_PREFIX}") set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") configure_file(flac++.pc.in flac++.pc @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/flac++.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() ``` -------------------------------- ### Install webmscore via npm Source: https://github.com/librescore/webmscore/blob/webmscore/README.md Install the webmscore package using npm. ```sh npm i webmscore ``` -------------------------------- ### startingUp Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-members.html Indicates whether the application is currently starting up. ```APIDOC ## startingUp ### Description Indicates whether the application is currently starting up. ### Method `startingUp() ` ``` -------------------------------- ### Install FLAC Executable in CMake Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/src/flac/CMakeLists.txt Installs the 'flacapp' executable to the runtime directory defined by CMAKE_INSTALL_BINDIR. This makes the 'flac' command available after installation. ```cmake install(TARGETS flacapp EXPORT targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ``` -------------------------------- ### Install Wallpapers with CMake Source: https://github.com/librescore/webmscore/blob/webmscore/share/wallpapers/CMakeLists.txt Installs a list of PNG image files to the specified destination directory. Ensure the destination path is correctly defined in your CMake variables. ```cmake install(FILES paper1.png paper2.png paper3.png paper4.png paper5.png paper6.png paper7.png background1.png DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}wallpapers ) ``` -------------------------------- ### Install MS Basic Sound Font Source: https://github.com/librescore/webmscore/blob/webmscore/share/sound/CMakeLists.txt Installs the 'FluidR3Mono_GM.sf3' sound font. It renames it to 'MS Basic.sf3' if it doesn't already exist in the source directory. Otherwise, it installs the existing 'MS Basic.sf3'. ```cmake if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/MS Basic.sf3") install (FILES FluidR3Mono_GM.sf3 DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}sound RENAME "MS Basic.sf3" ) else () install(FILES "MS Basic.sf3" DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}sound ) endif () ``` -------------------------------- ### Install MS Basic Sound Font License Source: https://github.com/librescore/webmscore/blob/webmscore/share/sound/CMakeLists.txt Installs the license file for the sound font. It renames 'FluidR3Mono_License.md' to 'MS Basic_License.md' if the latter does not exist in the source directory. Otherwise, it installs the existing 'MS Basic_License.md'. ```cmake if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/MS Basic_License.md") install (FILES FluidR3Mono_License.md DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}sound RENAME "MS Basic_License.md") else () install(FILES "MS Basic_License.md" DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}sound ) endif () ``` -------------------------------- ### Install Manual Files with CMake Source: https://github.com/librescore/webmscore/blob/webmscore/share/manual/CMakeLists.txt Installs the main manual files to the specified destination directory. Ensure the destination path is correctly defined in your CMake variables. ```cmake install (FILES DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}manual ) ``` -------------------------------- ### Install Google Test Project Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/googletest/googletest/CMakeLists.txt Installs the Google Test project, including the gtest and gtest_main libraries, using a custom install_project macro. ```cmake install_project(gtest gtest_main) ``` -------------------------------- ### Install metaflac Executable Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/src/metaflac/CMakeLists.txt Configures the installation of the metaflac executable to the runtime directory, ensuring it is placed in the correct location on the target system. ```cmake install(TARGETS metaflac EXPORT targets RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ``` -------------------------------- ### Installing Qt Translation Files Source: https://github.com/librescore/webmscore/blob/webmscore/share/locale/CMakeLists.txt Installs Qt's own translation files (.qm) from the Qt installation prefix to the application's locale directory. It specifically includes qtbase translations but excludes English and help-related files. ```cmake install(DIRECTORY ${QT_INSTALL_PREFIX}/translations/ DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}locale FILES_MATCHING REGEX "qt_.*\.qm" REGEX "qt_help_.*\.qm" EXCLUDE REGEX "qtbase_.*\.qm" REGEX "qt*_en\.qm" EXCLUDE) ``` -------------------------------- ### CMake Build Configuration for Custom Titlebar Example Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/examples/qtquick/customtitlebar/CMakeLists.txt Configures the CMake build for the custom titlebar Qt Quick example. It sets up project details, enables automatic moc/rcc, finds the KDDockWidgets library, and defines the executable with its source files and resources. ```cmake cmake_minimum_required(VERSION 3.7) project(kddockwidgets_customtitlebar_quick) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIRS ON) if(NOT TARGET kddockwidgets) # This will look for Qt, do find_package yourself manually before # if you want to look for a specific Qt version for instance. find_package(KDDockWidgets REQUIRED) endif() set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc ${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc) add_executable(kddockwidgets_customtitlebar_quick main.cpp ${RESOURCES_EXAMPLE_SRC}) target_link_libraries(kddockwidgets_customtitlebar_quick PRIVATE KDAB::kddockwidgets ) ``` -------------------------------- ### QtSingleCoreApplication::installTranslator Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsinglecoreapplication-members.html Installs the given translator into the application's translator list. Returns true if the translator was successfully installed, false otherwise. ```APIDOC ## QtSingleCoreApplication::installTranslator ### Description Installs the given translator into the application's translator list. Returns true if the translator was successfully installed, false otherwise. ### Method bool installTranslator ( QTranslator * translator ) ``` -------------------------------- ### Install QtForPython Dependencies Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README-bindings.md Install necessary QtForPython components using pip. Ensure the index URL and trusted host are correctly specified. The version of PySide2 must match the Qt version used for building KDDockWidgets. ```bash % pip3 install \ --index-url=http://download.qt.io/official_releases/QtForPython/ \ --trusted-host download.qt.io \ shiboken2 pyside2 shiboken2_generator ``` -------------------------------- ### Install FLAC Headers Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/CMakeLists.txt Installs the FLAC header files to the system's include directory. This is essential for users who want to compile applications that use the FLAC library. ```cmake install(FILES ${FLAC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC") ``` ```cmake install(FILES ${FLAC++_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC++") ``` -------------------------------- ### Configure and Install Package Config Files Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/googletest/googletest/CMakeLists.txt Generates and installs CMake package configuration files (Config.cmake and ConfigVersion.cmake) if INSTALL_GTEST is enabled. These files allow other projects to find and use Google Test. ```cmake # Create the CMake package file descriptors. if (INSTALL_GTEST) include(CMakePackageConfigHelpers) set(targets_export_name ${cmake_package_name}Targets CACHE INTERNAL "") set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated" CACHE INTERNAL "") set(cmake_files_install_dir "${CMAKE_INSTALL_LIBDIR}/cmake/${cmake_package_name}") set(version_file "${generated_dir}/${cmake_package_name}ConfigVersion.cmake") write_basic_package_version_file(${version_file} VERSION ${GOOGLETEST_VERSION} COMPATIBILITY AnyNewerVersion) install(EXPORT ${targets_export_name} NAMESPACE ${cmake_package_name}:: DESTINATION ${cmake_files_install_dir}) set(config_file "${generated_dir}/${cmake_package_name}Config.cmake") configure_package_config_file("${gtest_SOURCE_DIR}/cmake/Config.cmake.in" "${config_file}" INSTALL_DESTINATION ${cmake_files_install_dir}) install(FILES ${version_file} ${config_file} DESTINATION ${cmake_files_install_dir}) endif() ``` -------------------------------- ### CMakeLists.txt Configuration for KDDockWidgets Example Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/examples/minimal/CMakeLists.txt This snippet configures CMake for the minimal KDDockWidgets example. It sets the minimum CMake version, project name, and enables automatic handling of MOC, RCC, and include directories. It also finds the KDDockWidgets package and defines the executable with its source files and links against the KDDockWidgets library. ```cmake cmake_minimum_required(VERSION 3.7) project(kddockwidgets_minimal_example) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIRS ON) if(NOT TARGET kddockwidgets) # This will look for Qt, do find_package yourself manually before # if you want to look for a specific Qt version for instance. find_package(KDDockWidgets REQUIRED) endif() set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dockwidgets/resources_example.qrc) add_executable(kddockwidgets_minimal_example main.cpp ../dockwidgets/MyWidget.cpp ${RESOURCES_EXAMPLE_SRC} ) target_link_libraries(kddockwidgets_minimal_example PRIVATE KDAB::kddockwidgets ) ``` -------------------------------- ### Main Application Entry Point Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-example-trivial.html Initializes QtSingleApplication, checks for existing instances, and sets up the UI and message handling. If another instance is running, it sends a message and exits. ```cpp int main(int argc, char **argv) { QtSingleApplication instance(argc, argv); if (instance.sendMessage("Wake up!")) return 0; TextEdit logview; logview.setReadOnly(true); logview.show(); instance.setActivationWindow(&logview); QObject::connect(&instance, SIGNAL(messageReceived(const QString&)), &logview, SLOT(append(const QString&))); return instance.exec(); } ``` -------------------------------- ### Set Library Path for Shared Libraries Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README-bindings.md Environment variables to help the system locate shared libraries for shiboken2_generator, especially when encountering errors during example builds. Adjust the path to your PySide2 installation. ```bash export LD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #linux ``` ```bash export DYLD_LIBRARY_PATH=/usr/local/lib/python/dist-packages/PySide2/Qt/lib #Mac ``` -------------------------------- ### Get Previous UTF-8 Code Point with utf8::prior Source: https://github.com/librescore/webmscore/blob/webmscore/src/framework/global/thirdparty/utfcpp-3.2.1/README.md Decrements the iterator to the beginning of the previous UTF-8 code point and returns its value. Throws exceptions for invalid sequences or if the start iterator is reached. ```cpp template uint32_t prior(octet_iterator& it, octet_iterator start); char* twochars = "\xe6\x97\xa5\xd1\x88"; unsigned char* w = twochars + 3; int cp = prior (w, twochars); assert (cp == 0x65e5); assert (w == twochars); ``` -------------------------------- ### Install Workspaces Directory on MSVC Source: https://github.com/librescore/webmscore/blob/webmscore/mtest/mscore/workspaces/CMakeLists.txt Installs the workspaces directory to the binary directory when using the MSVC compiler. This is platform-specific installation logic. ```cmake if (MSVC) install(DIRECTORY ${CMAKE_INSTALL_PREFIX}/workspaces USE_SOURCE_PERMISSIONS DESTINATION ${CMAKE_CURRENT_BINARY_DIR} ) endif (MSVC) ``` -------------------------------- ### Install Specific Multisplitter Widget Header Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/src/CMakeLists.txt Installs a specific private multisplitter widget header file. This is part of the conditional installation logic. ```cmake install(FILES private/multisplitter/Widget_quick.h DESTINATION ${DOCKS_INCLUDES_INSTALL_PATH}/kddockwidgets/private/multisplitter) ``` -------------------------------- ### Setting up FT_Open_Face for Incremental Loading Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/freetype/docs/reference/ft2-incremental.html Example demonstrating how to set up the FT_Open_Args structure to enable incremental glyph loading using FT_PARAM_TAG_INCREMENTAL. ```c FT_Incremental_InterfaceRec inc_int; FT_Parameter parameter; FT_Open_Args open_args; // set up incremental descriptor inc_int.funcs = my_funcs; inc_int.object = my_object; // set up optional parameter parameter.tag = FT_PARAM_TAG_INCREMENTAL; parameter.data = &inc_int; // set up FT_Open_Args structure open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS; open_args.pathname = my_font_pathname; open_args.num_params = 1; open_args.params = ¶meter; // we use one optional argument // open the font error = FT_Open_Face( library, &open_args, index, &face ); ... ``` -------------------------------- ### Install FLAC++ Library Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/src/libFLAC++/CMakeLists.txt Installs the FLAC++ library artifacts (archive, library, runtime) to their designated locations based on CMake installation variables. ```cmake install(TARGETS FLAC++ EXPORT targets ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/") ``` -------------------------------- ### Install Targets and Fonts on macOS Source: https://github.com/librescore/webmscore/blob/webmscore/src/main/CMakeLists.txt Installs the mscore target as a bundle and copies various font files to the designated installation directory for macOS. ```cmake install(TARGETS mscore BUNDLE DESTINATION ${CMAKE_INSTALL_PREFIX}) install( FILES ${PROJECT_SOURCE_DIR}/fonts/bravura/BravuraText.otf ${PROJECT_SOURCE_DIR}/fonts/campania/Campania.otf ${PROJECT_SOURCE_DIR}/fonts/edwin/Edwin-BdIta.otf ${PROJECT_SOURCE_DIR}/fonts/edwin/Edwin-Bold.otf ${PROJECT_SOURCE_DIR}/fonts/edwin/Edwin-Italic.otf ${PROJECT_SOURCE_DIR}/fonts/edwin/Edwin-Roman.otf ${PROJECT_SOURCE_DIR}/fonts/gootville/GootvilleText.otf ${PROJECT_SOURCE_DIR}/fonts/FreeSans.ttf ${PROJECT_SOURCE_DIR}/fonts/FreeSerif.ttf ${PROJECT_SOURCE_DIR}/fonts/FreeSerifBold.ttf ${PROJECT_SOURCE_DIR}/fonts/FreeSerifItalic.ttf ${PROJECT_SOURCE_DIR}/fonts/FreeSerifBoldItalic.ttf ${PROJECT_SOURCE_DIR}/fonts/leland/Leland.otf ${PROJECT_SOURCE_DIR}/fonts/leland/LelandText.otf ${PROJECT_SOURCE_DIR}/fonts/mscore-BC.ttf ${PROJECT_SOURCE_DIR}/fonts/mscoreTab.ttf ${PROJECT_SOURCE_DIR}/fonts/mscore/MScoreText.ttf ${PROJECT_SOURCE_DIR}/fonts/mscore/MusescoreIcon.ttf ${PROJECT_SOURCE_DIR}/fonts/musejazz/MuseJazzText.otf ${PROJECT_SOURCE_DIR}/fonts/petaluma/PetalumaScript.otf ${PROJECT_SOURCE_DIR}/fonts/petaluma/PetalumaText.otf ${PROJECT_SOURCE_DIR}/fonts/finalemaestro/FinaleMaestroText-Regular.otf ${PROJECT_SOURCE_DIR}/fonts/finalebroadway/FinaleBroadwayText.otf DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}fonts ) ``` -------------------------------- ### Install Directories on macOS Source: https://github.com/librescore/webmscore/blob/webmscore/src/main/CMakeLists.txt Installs directories, excluding specific QtWebkit and debug library patterns, to the mscore share and install name path on macOS. ```cmake install(DIRECTORY ${QT_INSTALL_QML} DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME} REGEX ".*QtWebkit.*" EXCLUDE REGEX ".*QtTest.*" EXCLUDE REGEX ".*QtSensors.*" EXCLUDE REGEX ".*QtMultimedia.*" EXCLUDE REGEX ".*QtAudioEngine.*" EXCLUDE REGEX ".*_debug\.dylib" EXCLUDE) ``` -------------------------------- ### Download Qt5 for WebAssembly Source: https://github.com/librescore/webmscore/blob/webmscore/README.md Use `aqtinstall` to download a specific version of Qt5 for the wasm_32 platform and specify an output directory. Remember to update `web/Makefile` if the installation path or version changes. ```sh AQT_PREFIX=$PWD/build.qt5 Qt5_VER=5.15.2 Qt5_DIR=${AQT_PREFIX}/${Qt5_VER}/wasm_32 # if you change the install directory or Qt version, remember to also change the `PREFIX_PATH` variable in `web/Makefile` file # Download Qt using aqtinstall (https://github.com/miurahr/aqtinstall) pip install aqtinstall==2.1.* aqt install-qt linux desktop ${Qt5_VER} wasm_32 --outputdir ${AQT_PREFIX} --archives qtbase ``` -------------------------------- ### Conditionally Install English Manual Directory with CMake Source: https://github.com/librescore/webmscore/blob/webmscore/share/manual/CMakeLists.txt Installs the English language manual directory if it exists. This ensures that only available language packs are installed. ```cmake if (IS_DIRECTORY en) install (DIRECTORY en DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}manual ) endif (IS_DIRECTORY en) ``` -------------------------------- ### QtSingleApplication::initialize Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-obsolete.html This is an obsolete function. It is provided to keep old source code working. It is strongly advised against using it in new code. ```APIDOC ## void QtSingleApplication::initialize ( bool _dummy_ = true ) ### Description This is an obsolete function that is provided to keep old source code working. It is strongly advised against using it in new code. ### Method void ### Parameters #### Path Parameters - **_dummy_** (bool) - Optional - A dummy parameter, defaults to true. ``` -------------------------------- ### Conditionally Install German Manual Directory with CMake Source: https://github.com/librescore/webmscore/blob/webmscore/share/manual/CMakeLists.txt Installs the German language manual directory if it exists. This is part of the conditional installation logic for different language manuals. ```cmake if (IS_DIRECTORY de) install (DIRECTORY de DESTINATION ${Mscore_SHARE_NAME}${Mscore_INSTALL_NAME}manual ) endif (IS_DIRECTORY de) ``` -------------------------------- ### MainWindow Constructor Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-example-loader.html Initializes the MainWindow by creating a QMdiArea as the central widget. This sets up the basic user interface for managing multiple documents. ```cpp MainWindow::MainWindow() { workspace = new QMdiArea(this); setCentralWidget(workspace); } ``` -------------------------------- ### Define Executable and Resources Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/examples/qtquick/dockwidgets/CMakeLists.txt Defines the source files for the QtQuick example executable, including C++ sources and resource files. ```cmake set(RESOURCES_EXAMPLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/resources_qtquick_example.qrc ${CMAKE_CURRENT_SOURCE_DIR}/../../dockwidgets/resources_example.qrc) add_executable(kddockwidgets_example_quick main.cpp ${RESOURCES_EXAMPLE_SRC}) ``` -------------------------------- ### Main Function Entry Point Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-example-loader.html The main function initializes the Qt application and the QtSingleApplication instance. It connects the application's message received signal to the MainWindow's handleMessage slot. ```cpp #include "main.moc" int main(int argc, char **argv) { ``` -------------------------------- ### QtSingleCoreApplication::installEventFilter Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsinglecoreapplication-members.html Installs an event filter for the given object. Returns true if the event filter was successfully installed, false otherwise. ```APIDOC ## QtSingleCoreApplication::installEventFilter ### Description Installs an event filter for the given object. Returns true if the event filter was successfully installed, false otherwise. ### Method void installEventFilter ( QObject * filter ) ``` -------------------------------- ### QtSingleApplication Constructors Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication.html Provides details on the various constructors available for creating a QtSingleApplication instance, catering to different initialization needs. ```APIDOC ## QtSingleApplication::QtSingleApplication ( int & _argc_, char ** _argv_, bool _GUIenabled_ = true ) Creates a [QtSingleApplication](qtsingleapplication.html) object. The application identifier will be [QCoreApplication::applicationFilePath](http://qt.nokia.com/doc/4.6/qcoreapplication.html#applicationFilePath)(). _argc_, _argv_, and _GUIenabled_ are passed on to the QAppliation constructor. If you are creating a console application (i.e. setting _GUIenabled_ to false), you may consider using [QtSingleCoreApplication](qtsinglecoreapplication.html) instead. ## QtSingleApplication::QtSingleApplication ( const [QString](http://qt.nokia.com/doc/4.6/qstring.html) & _appId_, int & _argc_, char ** _argv_ ) Creates a [QtSingleApplication](qtsingleapplication.html) object with the application identifier _appId_. _argc_ and _argv_ are passed on to the QAppliation constructor. ## QtSingleApplication::QtSingleApplication ( int & _argc_, char ** _argv_, [Type](http://qt.nokia.com/doc/4.6/qapplication.html#Type-enum) _type_ ) Creates a [QtSingleApplication](qtsingleapplication.html) object. The application identifier will be [QCoreApplication::applicationFilePath](http://qt.nokia.com/doc/4.6/qcoreapplication.html#applicationFilePath)(). _argc_, _argv_, and _type_ are passed on to the QAppliation constructor. ## QtSingleApplication::QtSingleApplication ( Display * _dpy_, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _visual_ = 0, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _cmap_ = 0 ) Special constructor for X11, ref. the documentation of [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html)'s corresponding constructor. The application identifier will be [QCoreApplication::applicationFilePath](http://qt.nokia.com/doc/4.6/qcoreapplication.html#applicationFilePath)(). _dpy_, _visual_, and _cmap_ are passed on to the [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html) constructor. ## QtSingleApplication::QtSingleApplication ( Display * _dpy_, int & _argc_, char ** _argv_, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _visual_ = 0, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _cmap_ = 0 ) Special constructor for X11, ref. the documentation of [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html)'s corresponding constructor. The application identifier will be [QCoreApplication::applicationFilePath](http://qt.nokia.com/doc/4.6/qcoreapplication.html#applicationFilePath)(). _dpy_, _argc_, _argv_, _visual_, and _cmap_ are passed on to the [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html) constructor. ## QtSingleApplication::QtSingleApplication ( Display * _dpy_, const [QString](http://qt.nokia.com/doc/4.6/qstring.html) & _appId_, int _argc_, char ** _argv_, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _visual_ = 0, [Qt::HANDLE](http://qt.nokia.com/doc/4.6/qt.html#HANDLE-typedef) _cmap_ = 0 ) Special constructor for X11, ref. the documentation of [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html)'s corresponding constructor. The application identifier will be _appId_. _dpy_, _argc_, _argv_, _visual_, and _cmap_ are passed on to the [QApplication](http://qt.nokia.com/doc/4.6/qapplication.html) constructor. ``` -------------------------------- ### QtSingleCoreApplication::eventFilter Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsinglecoreapplication-members.html Installs an event filter for the given object. Returns true if the event filter was successfully installed, false otherwise. ```APIDOC ## QtSingleCoreApplication::eventFilter ### Description Installs an event filter for the given object. Returns true if the event filter was successfully installed, false otherwise. ### Method bool eventFilter ( QObject * watched, QEvent * event ) ``` -------------------------------- ### Using FT_LOAD_TARGET_LIGHT with FT_RENDER_MODE_LCD Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/freetype/docs/reference/ft2-base_interface.html Demonstrates how to use a hinting algorithm that doesn't correspond to the same rendering mode, such as using the 'light' hinting algorithm with horizontal LCD pixel mode. ```c FT_Load_Glyph( face, glyph_index, load_flags | FT_LOAD_TARGET_LIGHT ); FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD ); ``` -------------------------------- ### Handle Message and Show Window Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-example-loader.html If the message could not be sent (meaning this is the first instance), this code initializes the main window, handles the initial message, and sets up signal/slot connections for message reception and window activation. ```cpp MainWindow mw; mw.handleMessage(message); mw.show(); QObject::connect(&instance, SIGNAL(messageReceived(const QString&)), &mw, SLOT(handleMessage(const QString&))); instance.setActivationWindow(&mw, false); QObject::connect(&mw, SIGNAL(needToShow()), &instance, SLOT(activateWindow())); return instance.exec(); ``` -------------------------------- ### QtSingleCoreApplication::arguments Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsinglecoreapplication-members.html Returns the list of command-line arguments passed to the application. ```APIDOC ## QtSingleCoreApplication::arguments ### Description Returns the list of command-line arguments passed to the application. ### Method QStringList arguments () ``` -------------------------------- ### Convert Existing Application to Single Instance Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication.html This snippet shows how to modify an existing QApplication to use QtSingleApplication for single-instance behavior. It checks if an instance is already running and sends a message if it is, otherwise it proceeds with normal initialization. ```cpp // Original int main(int argc, char **argv) { QApplication app(argc, argv); MyMainWidget mmw; mmw.show(); return app.exec(); } ``` ```cpp // Single instance int main(int argc, char **argv) { QtSingleApplication app(argc, argv); if (app.isRunning()) return !app.sendMessage(someDataString); MyMainWidget mmw; app.setActivationWindow(&mmw); mmw.show(); return app.exec(); } ``` -------------------------------- ### Get Score Title with score.title() and score.titleFilenameSafe() Source: https://context7.com/librescore/webmscore/llms.txt Obtain the score's title. Use titleFilenameSafe() to get a version suitable for use in filenames. ```javascript WebMscore.ready.then(async () => { const score = await WebMscore.load('mscz', filedata) const title = await score.title() console.log('Title:', title) // "Aequale No. 1" const safeTitle = await score.titleFilenameSafe() console.log('Filename-safe title:', safeTitle) // "Aequale_No__1" score.destroy() }) ``` -------------------------------- ### QtSingleApplication::activationWindow Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication.html Returns the application's activation window if one has been set, otherwise returns 0. ```APIDOC ## [QWidget](http://qt.nokia.com/doc/4.6/qwidget.html) * QtSingleApplication::activationWindow () const Returns the applications activation window if one has been set by calling [setActivationWindow](qtsingleapplication.html#setActivationWindow)(), otherwise returns 0. See also [setActivationWindow](qtsingleapplication.html#setActivationWindow)(). ``` -------------------------------- ### utf8::unchecked::iterator Example Source: https://github.com/librescore/webmscore/blob/webmscore/src/framework/global/thirdparty/utfcpp-3.2.1/README.md An example demonstrating the usage of the `utf8::unchecked::iterator` for iterating over UTF-8 encoded strings without validity or range checks. ```APIDOC ## Example of use: ```cpp char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"; utf8::unchecked::iterator un_it(threechars); utf8::unchecked::iterator un_it2 = un_it; assert (un_it2 == un_it); assert (*un_it == 0x10346); assert (*(++un_it) == 0x65e5); assert ((*un_it++) == 0x65e5); assert (*un_it == 0x0448); assert (un_it != un_it2); utf8::::unchecked::iterator un_endit (threechars + 9); assert (++un_it == un_endit); assert (*(--un_it) == 0x0448); assert ((*un_it--) == 0x0448); assert (*un_it == 0x65e5); assert (--un_it == utf8::unchecked::iterator(threechars)); assert (*un_it == 0x10346); ``` This is an unchecked version of `utf8::iterator`. It is faster in many cases, but offers no validity or range checks. ``` -------------------------------- ### Looping Through Faces and Instances Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/freetype/docs/reference/ft2-base_interface.html This example shows how to iterate through all faces and their associated instances within a font file. It uses a do-while loop and a combined index to access each face-instance pair. Ensure proper error checking and resource management. ```c FT_Face face; FT_Long num_faces = 0; FT_Long num_instances = 0; FT_Long face_idx = 0; FT_Long instance_idx = 0; do { FT_Long id = ( instance_idx << 16 ) + face_idx; error = FT_Open_Face( library, args, id, &face ); if ( error ) { ... } num_faces = face->num_faces; num_instances = face->style_flags >> 16; ... FT_Done_Face( face ); if ( instance_idx < num_instances ) instance_idx++; else { face_idx++; instance_idx = 0; } } while ( face_idx < num_faces ) ``` -------------------------------- ### Install Man Pages Conditionally Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/flac/flac-1.3.4/CMakeLists.txt Installs the man pages for FLAC tools if the INSTALL_MANPAGES option is enabled during the CMake configuration. This provides users with documentation accessible via the 'man' command. ```cmake if(INSTALL_MANPAGES) install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}") endif() ``` -------------------------------- ### Compile webmscore Source: https://github.com/librescore/webmscore/blob/webmscore/README.md Navigate to the `web-public` directory, install npm dependencies, and build the project. The build artifacts will be located in the `web-public` directory. ```sh cd web-public npm i npm run build ``` -------------------------------- ### Send Message to Running Instance Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/singleapp/doc/html/qtsingleapplication-example-loader.html Creates a QtSingleApplication instance and attempts to send command-line arguments as a message to an already running instance. If successful, the process exits. ```cpp QtSingleApplication instance("File loader QtSingleApplication example", argc, argv); QString message; for (int a = 1; a < argc; ++a) { message += argv[a]; if (a < argc-1) message += " "; } if (instance.sendMessage(message)) return 0; ``` -------------------------------- ### Replace libclang.dll on Windows Source: https://github.com/librescore/webmscore/blob/webmscore/thirdparty/KDDockWidgets/README-bindings.md On Windows, replace the default libclang.dll in the shiboken2_generator directory with the one from your LLVM installation to resolve compatibility issues with MSVC2019. Ensure paths are adjusted to your specific Python and LLVM installations. ```bash cd C:\Python37\Lib\site-packages\shiboken2_generator copy libclang.dll libclang.dll.save copy "C:\Program Files\llvm\bin\libclang.dll" libclang.dll #Python3 installation in C:\Python37 and llvm in c:\Program Files\llvm. adjust as needed ```