Base toolkit upon which the software is built. More...
Detailed Description
Base toolkit upon which the software is built.
TODO. list in src/plugins/score-plugin-avnd/Crousti/Concepts.hpp#L139.
This namespace contains only non-domain specific classes and utilities : serialization, model-view, documents, etc.
It is split in two folders :
coreis the internal mechanic to set-up the software : the actual widget classes, the plug-in loading code, etc.scoreis the "public" part of the score API : this code can be used by plug-ins.
This file contains facilities to serialize an object into a QJsonObject.
This file contains base types for the events and transitions of the state machines in score.
See the documentation for explanation of the general pattern
Namespaces | |
| namespace | gfx |
| Graphics rendering pipeline for ossia score. | |
| namespace | ProjectInfo |
Typedefs | |
| using | JsonWriter = ossia::json_writer |
| using | GlobalSettingsPresenter = SettingsDelegatePresenter< SettingsDelegateModel > |
| using | ActionGroupKey = StringKey< ActionGroup > |
| using | ActionKey = StringKey< Action > |
| using | ActionConditionKey = StringKey< score::ActionCondition > |
| template<typename T1 , typename T2 > | |
| using | enable_if_base_of = std::enable_if< std::is_base_of< T1, T2 >::value, void * > |
| using | FindCommandKey = std::pair< CommandGroupKey, CommandKey > |
| using | MaybeDocument = const score::DocumentContext * |
| template<typename Component > | |
| using | ComponentHierarchy = ComponentHierarchyManager< Component, typename Component::model_t, typename Component::component_t > |
| template<typename Component , bool HasOwnership = true> | |
| using | PolymorphicComponentHierarchy = PolymorphicComponentHierarchyManager< Component, typename Component::model_t, typename Component::component_t, typename Component::component_factory_list_t, HasOwnership > |
| template<typename Model > | |
| using | HierarchicalComponents = HierarchicalMember< Model, score::Components, &Model::components > |
| using | InterfaceKey = UuidKey< InterfaceBase > |
| using | ProjectSettingsPresenter = SettingsDelegatePresenter< ProjectSettingsModel > |
| using | ProjectSettingsView = SettingsDelegateView< ProjectSettingsModel > |
| using | PluginKey = UuidKey< Plugin > |
| using | SettingsDelegateFactoryList = InterfaceList< score::SettingsDelegateFactory > |
| template<typename T > | |
| using | sp = SettingsParameterMetadata< T > |
| using | GlobalSettingsView = SettingsDelegateView< SettingsDelegateModel > |
| using | uuid_t = uuids::uuid |
| using | any_map = ossia::any_map |
| using | any_serializer_map = score::hash_map< std::string, std::unique_ptr< any_serializer > > |
| using | Press_Event = NumberedEvent< 1 > |
| using | Move_Event = NumberedEvent< 2 > |
| using | Release_Event = NumberedEvent< 3 > |
| using | Cancel_Event = NumberedEvent< 4 > |
| using | Shift_Event = NumberedEvent< 5 > |
| using | Press_Transition = MatchedTransition< Press_Event > |
| using | Move_Transition = MatchedTransition< Move_Event > |
| using | Release_Transition = MatchedTransition< Release_Event > |
| using | Cancel_Transition = MatchedTransition< Cancel_Event > |
| using | ShiftTransition = MatchedTransition< Shift_Event > |
| using | comparable_function = std::shared_ptr< std::function< void()> > |
| using | id_generator = score::linear_id_generator |
| template<class Key , class T > | |
| using | hash_map = ossia::hash_map< Key, T > |
| using | ZipProgress = std::function< bool(int, int)> |
| Called with (files written, total). Return false to abort the archive. | |
Enumerations | |
| enum | Modifier_tagme { Click = 100 , Move = 200 , Release = 300 } |
| enum class | FileKind { Unknown , Audio , Video , Image , Midi , Model3D , Shader , Script , Data , Folder , Plugin } |
| enum class | CopyMode { Copy , Symlink , Hardlink } |
| How a collected file is materialized in the project folder. More... | |
| enum | TimeMode { Bars , Seconds , Flicks } |
| enum class | InputValidity { Valid , Unknown , Invalid } |
Functions | |
| const ApplicationContext & | AppContext () |
| const GUIApplicationContext & | GUIAppContext () |
| const ApplicationComponents & | AppComponents () |
| QString | displayedVersion () |
| The version as shown to users. | |
| void | setQApplicationMetadata () |
| template<typename RedoFun > | |
| void | loadCommandStack (const score::ApplicationComponents &components, DataStreamWriter &writer, score::CommandStack &stack, RedoFun redo_fun) |
| QString | newProcessedFilePath (const QString &sourceFile, const QDir &destination) |
| Obtains a new file name in the project folder to save a processed file. | |
| QString | libraryRootPath () |
| Root of the user library, from the settings. | |
| QString | defaultDocumentTemplate () |
| The template applied to new documents, or an empty string. | |
| QString | firstRunDocumentTemplate () |
| The guided score for first-time users, or an empty string. | |
| std::vector< DocumentTemplate > | availableDocumentTemplates () |
| std::vector< DocumentTemplate > | availableExampleDocuments () |
| Id< score::DocumentModel > | getStrongId (const std::vector< score::Document * > &v) |
| std::vector< LicenseInfo > | thirdPartyLicenses () |
| Sorted by name, case-insensitive. Only entries with a header or a text. | |
| ApplicationServices & | AppServices () noexcept |
| void | setupDefaultOpenGLFormat () noexcept |
| QBrush | bangFill (const QPalette &fallback, bool lit) |
| The fill of a bang: the circle an impulse gets. | |
| void | retargetInputMethod (QObject *target) noexcept |
Point the platform input method at target. | |
| void | watchSceneInputMethod (QGraphicsScene &scene) |
| Keep the platform input method in sync with the scene's focus item. | |
| QPointer< QGraphicsProxyWidget > & | currentRightClickWidget () |
| The one type-in box a right-click may have open. | |
| void | closeRightClickWidget () |
| Takes down whatever right-click box is open, if any. | |
| QGraphicsProxyWidget * | showTypeInBox (QGraphicsScene &scene, QPointF scenePos, const std::vector< TypeInField > &fields, std::function< void(int, double)> onChanged, std::function< void()> onFinished) |
| The type-in box a right-click raises over a control with more than one number in it. | |
| QString | toNumber (double v) noexcept |
| QString | toNumber (int v) noexcept |
| template<typename T > | |
| double | operator* (double lhs, const ValueAssigner< T > &rhs) noexcept |
| template<typename T > | |
| T & | component (const score::Components &c) |
| component Fetch a Component from Components by type | |
| template<typename T > | |
| T * | findComponent (const score::Components &c) noexcept |
| findComponent Tryies to fetch a Component from Components by type. | |
| template<typename T > | |
| auto | id (const Path< T > &path) |
| int | uiFontSize () noexcept |
| double | fontScale () noexcept |
| Current application font size over referenceFontSize. | |
| int | scaledPixels (int px) noexcept |
| QSize | scaledIcon (int px) noexcept |
| scaledPixels() as a square. | |
| void | onSkinChange (QObject *owner, std::function< void()> f) |
| QFont::HintingPreference | uiFontHinting () noexcept |
| QFont::StyleStrategy | uiFontStyleStrategy () noexcept |
| int | pixelFontGrid (const QString &family) noexcept |
| int | snapToFontGrid (const QFont &f, int px) noexcept |
| void | setSnappedPixelSize (QFont &f, int px) noexcept |
| setPixelSize through snapToFontGrid. | |
| void | registerApplicationFonts () |
| QFont | defaultApplicationFont () noexcept |
| bool | canSetGlobalScaleFactorLive () noexcept |
| bool | setGlobalScaleFactor (double factor) |
| void | setupApplicationFont (const QFont &f) |
| void | applyDefaultPalette (QPalette &p) |
| template<typename T > | |
| void | setSkinIconSize (T *widget, int px) |
| onSkinChange(widget, setIconSize(scaledIcon(px))). | |
| SCORE_LIB_BASE_EXPORT QString | addonArchitecture () |
| addonArchitecture | |
| NetworkSessionInterface * | findNetworkSessionInterface (const GUIApplicationContext &ctx) |
| The first plug-in able to join sessions, or nullptr. | |
| template<typename DocPlugin > | |
| auto & | addDocumentPlugin (score::Document &doc) |
| void | debug_types (const InterfaceBase *orig, const InterfaceBase *repl) noexcept |
| std::vector< Plugin_QtInterface * > & | staticPlugins () |
| template<typename T , typename Model > | |
| void | setupDefaultSettings (QSettings &set, const T &tuple, Model &model) |
| score::hash_map< std::string, std::unique_ptr< any_serializer > > & | anySerializers () |
| The serializers for types that go in ossia::any should fit in here. | |
| template<typename Obj , std::size_t N> | |
| bool | parseJsonField (const Obj &obj, const char(&key)[N], QString &out) |
Read one field of a JSON object, or leave out alone. | |
| template<typename Obj , std::size_t N> | |
| bool | parseJsonField (const Obj &obj, const char(&key)[N], bool &out) |
| template<typename T > | |
| bool | parseJsonNumber (double d, T &out) noexcept |
|
template<typename Obj , std::size_t N, typename T > requires ( (std::is_arithmetic_v<T> || std::is_enum_v<T>) && !std::is_same_v<T, bool>) | |
| bool | parseJsonField (const Obj &obj, const char(&key)[N], T &out) |
| template<typename Obj , std::size_t N> | |
| bool | parseJsonField (const Obj &obj, const char(&key)[N], QSize &out) |
| template<typename Object > | |
| auto | unmarshall (const JSONReader &obj) |
| const StringConstants & | StringConstant () |
| template<typename T > | |
| void | serialize_dyn_impl (DataStream::Serializer &v, const T &t) |
| template<typename T > | |
| void | serialize_dyn_impl (JSONObject::Serializer &v, const T &t) |
| template<typename TheClass > | |
| void | serialize_dyn (const VisitorVariant &vis, const TheClass &s) |
| template<typename TheClass > | |
| TheClass & | deserialize_dyn (const VisitorVariant &vis, TheClass &s) |
| template<typename TheClass > | |
| TheClass | deserialize_dyn (const VisitorVariant &vis) |
| template<typename Functor > | |
| auto | deserialize_dyn (const VisitorVariant &vis, Functor &&fun) |
| template<typename Type , typename Object > | |
| auto | marshall (const Object &obj) |
| marshall Serializes a single object | |
| template<typename Object > | |
| auto | unmarshall (const rapidjson::Value &obj) |
| template<typename Object > | |
| auto | unmarshall (const QByteArray &arr) |
| template<typename Transition , typename SourceState , typename TargetState , typename... Args> | |
| Transition * | make_transition (SourceState source, TargetState dest, Args &&... args) |
| std::pair< int, int > | availableCudaDevice () noexcept |
| bool | availableCudaToolkitDylibs (int major, int minor) noexcept |
| void | setCursorPos (QPointF pos) noexcept |
| void | moveCursorPos (QPointF pos) noexcept |
| QPoint | globalPos (QMouseEvent *event) |
| QPointF | globalPos (QWidget *viewport, QGraphicsSceneMouseEvent *event) |
| void | hideCursor (bool hasCursor) |
| void | showCursor () |
| template<typename T > | |
| void | clearAndDeleteLater (T &container, delete_later< T > &storage) noexcept |
| template<typename T > | |
| auto | clearAndDeleteLater (T &container) noexcept |
| std::optional< ossia::dylib_loader > | try_load_library (const char *name) noexcept |
| dlopen a library, reporting absence instead of throwing. | |
| std::optional< ossia::dylib_loader > | try_load_library (std::vector< std::string_view > names) noexcept |
Loads the first of names that can be found. | |
| QString | addUniqueSuffix (const QString &fileName) |
| QString | locateFilePath (const QString &filename) noexcept |
| QString | locateFilePath (const QString &filename, const score::DocumentContext &ctx) noexcept |
| QString | relativizeFilePath (const QString &filename, const score::DocumentContext &ctx) noexcept |
| bool | fast_contains (std::string_view data, std::string_view pattern) |
| bool | fileContains (QFile &f, std::string_view pattern) |
| QString | pickerStartFolder (const QString ¤t, const score::DocumentContext &ctx) noexcept |
| QString | pickerStartFolder (const QString ¤t) noexcept |
| QByteArray | mapAsByteArray (QFile &f) noexcept |
| std::string_view | mapAsStringView (QFile &f) noexcept |
| std::string | readFileAsString (QFile &f) noexcept |
| QString | readFileAsQString (QFile &f) noexcept |
| QStringList | list_ipv4_for_connecting () noexcept |
| QStringList | list_ipv4_for_listening () noexcept |
| bool | detectSystemEnrolment () |
| bool | isProjectRelativePath (const QString &path) noexcept |
| True if the path is one of the tokens score understands as a root. | |
| bool | isLibraryRelativePath (const QString &path) noexcept |
| FileKind | guessFileKind (const QString &path) noexcept |
| QString | mediaSubfolder (FileKind k) noexcept |
| Name of the project sub-folder collected files of that kind go into. | |
| PathRoots | pathRoots (const score::DocumentContext &ctx) noexcept |
| Roots of a live document. | |
| QString | locateFilePath (const QString &filename, const PathRoots &roots) noexcept |
| bool | isUnderFolder (const QString &path, const QString &root) noexcept |
| QString | relativizeFilePath (const QString &filename, const PathRoots &roots) noexcept |
| QString | sanitizeFileName (const QString &name) noexcept |
| bool | sameFileContents (const QString &lhs, const QString &rhs) noexcept |
| bool | materializeFile (const QString &source, const QString &destination, CopyMode mode, QString &error) |
| QString | pickerStartFolder (const QString ¤t, const PathRoots &roots, const QString &userDocuments, const QString &workingDir) noexcept |
| void | for_all_files (std::string_view root, std::function< void(std::string_view)> f) |
| template<typename Map > | |
| void | optimize_hash_map (Map &map) |
| template<typename T > | |
| indirect_iterator< T > | make_indirect_iterator (const T &it) noexcept |
| template<typename T > | |
| indirect_ptr_iterator< T > | make_indirect_ptr_iterator (const T &it) |
| template<typename T > | |
| indirect_map_iterator< T > | make_indirect_map_iterator (const T &it) |
| template<typename CastTo , typename T > | |
| indirect_cast_map_iterator< T, CastTo > | make_indirect_cast_map_iterator (const T &it) |
| template<typename T > | |
| auto | wrap_indirect (T &container) |
| bool | writeZipArchive (const QString &destination, const std::vector< ZipEntry > &entries, int level, QString &error, const ZipProgress &progress={}) |
Write entries into a zip archive at destination. | |
| bool | isSafeZipMemberName (const QString &name) |
| std::optional< ZipArchiveSummary > | summarizeZipArchive (const QString &archive) |
| Look at a zip's table of contents without inflating anything. | |
| QByteArray | readZipMember (const QString &archive, const QString &member, QString &error, quint64 maxSize) |
| bool | extractZipArchive (const QString &archive, const QString &destination, QString &error, const ZipProgress &progress={}) |
Extract every member of archive under destination. | |
| void | setCursor (Qt::CursorShape c) |
| setCursor sets the cursor safely. | |
| SCORE_LIB_BASE_EXPORT const QPalette & | transparentPalette () |
| void | setHelp (QWidget *widg, const QString &shorttxt, const QString &txt) |
| void | setHelp (QAction *widg, const QString &shorttxt, const QString &txt) |
| void | setHelp (QWidget *widg, const QString &txt) |
| void | setHelp (QAction *widg, const QString &txt) |
| void | installDragImageWorkaround () |
| Keep Qt's temporary drag-image element out of sight. | |
| void | setItemViewDragPixmap (QDrag &drag, QAbstractItemView &view, const QStyleOptionViewItem &option, const QModelIndexList &indexes) |
| Give a QDrag the drag image QAbstractItemView::startDrag would have made. | |
| int | question (QWidget *parent, const QString &title, const QString &text) |
| int | information (QWidget *parent, const QString &title, const QString &text) |
| int | warning (QWidget *parent, const QString &title, const QString &text) |
| QImage | get_image (QString str, QString svg={}) |
| QPixmap | get_pixmap (QString str, QString svg={}) |
| QCursor | get_cursor (QString str, double hotspot_x, double hostpot_y) |
| void | setGlobalTimeMode (TimeMode mode) |
| void | setInputValidity (QWidget &w, InputValidity v) |
| Tint a widget to flag what it holds, and keep the tint skin-aware. | |
Variables | |
| constexpr int | referenceFontSize = 13 |
| thread_local char | g_file_search_buffer [16384] |
| std::array< QString, 5 > | arrow_name |
| TimeMode | globalTimeMode = TimeMode::Bars |
Enumeration Type Documentation
◆ CopyMode
|
strong |
◆ FileKind
|
strong |
Category of an external file referenced by a document. Drives the sub-folder a collected file is copied into.
◆ InputValidity
|
strong |
Function Documentation
◆ addonArchitecture()
| SCORE_LIB_BASE_EXPORT QString score::addonArchitecture | ( | ) |
addonArchitecture
- Returns
- Architecture for the system score is compiled for.
◆ applyDefaultPalette()
| void score::applyDefaultPalette | ( | QPalette & | p | ) |
Runs f now and on every skin change. Needed for any size derived from a font: the window and the toolbars are built before the first skin loads.
Callable during that construction – Skin::instance() needs the application context, so the subscription is deferred by one event loop turn. The built-in widget colours, applied over whatever the style gave us. Shared with the startup path, which runs before the Skin can be built.
◆ bangFill()
| QBrush score::bangFill | ( | const QPalette & | fallback, |
| bool | lit | ||
| ) |
The fill of a bang: the circle an impulse gets.
Shared by score::QGraphicsButton in the node view and the device explorer's tree rows and address panel.
Falls back to the palette when the skin has no brushes to give – a no-GUI application context leaves them default-constructed.
- Parameters
-
lit The pressed state.
◆ canSetGlobalScaleFactorLive()
|
noexcept |
False below Qt 6.6, or without QT_CONFIG(highdpiscaling): QHighDpiScaling exists from 5.6 but only updates the screens from 6.5 and only emits the QScreen signals from 6.6.
◆ component()
| T & score::component | ( | const score::Components & | c | ) |
component Fetch a Component from Components by type
- Returns
- The component.
The component must have a member static const constexpr bool is_unique = true in order to use this function.
This guarantees that there will be a single component of a given type in the Components.
◆ currentRightClickWidget()
| QPointer< QGraphicsProxyWidget > & score::currentRightClickWidget | ( | ) |
The one type-in box a right-click may have open.
Right-clicking a second control – or the same one twice – used to leave the first box floating over the scene with nobody owning it: it is parented to the scene, not to the control, so nothing took it down.
A QPointer, so that a box torn down by its own control leaves nothing dangling here.
◆ defaultApplicationFont()
|
noexcept |
Does not touch Skin::instance(), so it is callable before the application context exists.
◆ displayedVersion()
| QString score::displayedVersion | ( | ) |
The version as shown to users.
"3.8.2" for a release build, "3.8.2+42" for a master build 42 commits after the release, "3.8.2+42 (branch @ commit)" for a build from another branch.
◆ extractZipArchive()
| bool score::extractZipArchive | ( | const QString & | archive, |
| const QString & | destination, | ||
| QString & | error, | ||
| const ZipProgress & | progress = {} |
||
| ) |
Extract every member of archive under destination.
Members that would escape the destination (absolute paths, "..") are refused. Existing files are overwritten. On failure or cancellation the files written by this call are removed again; pre-existing files are left alone.
◆ findComponent()
|
noexcept |
findComponent Tryies to fetch a Component from Components by type.
This works similarly to components ; instead of aborting, it returns a null pointer if the component does not exist.
- See also
- components
◆ guessFileKind()
|
noexcept |
Guess a file's kind from its extension. Never fails: unknown extensions map to FileKind::Unknown.
◆ installDragImageWorkaround()
| void score::installDragImageWorkaround | ( | ) |
Keep Qt's temporary drag-image element out of sight.
No-op outside of WebAssembly. Idempotent, and safe to call before the platform plugin has built its shadow root.
◆ isSafeZipMemberName()
| bool score::isSafeZipMemberName | ( | const QString & | name | ) |
False for a member name that would land outside the extraction folder: absolute paths, drive letters, backslashes, ".." components.
◆ isUnderFolder()
|
noexcept |
True when path is folder itself or lives below it. Both must be absolute. Used as the containment guard by everything that writes or deletes inside a project.
◆ locateFilePath() [1/3]
|
noexcept |
Same, for callers that run before any document exists – a –script file is read while the application is still starting up. <LIBRARY>: is a settings lookup and resolves fine; <PROJECT>: and relative paths have no document to resolve against and are returned untouched.
◆ locateFilePath() [2/3]
|
noexcept |
Resolve a stored path (absolute, document-relative, <PROJECT>: or <LIBRARY>:-prefixed) into an absolute one.
◆ locateFilePath() [3/3]
|
noexcept |
Will also look where the save file is located. TODO in the future also look in a "common" library folder.
◆ marshall()
| auto score::marshall | ( | const Object & | obj | ) |
marshall Serializes a single object
- Parameters
-
obj The object to serialize.
This will create the relevant serialization datatype for Type. For instance, a QByteArray if it is DataStream and a QJSonObject if it is JSONObject
◆ materializeFile()
| bool score::materializeFile | ( | const QString & | source, |
| const QString & | destination, | ||
| CopyMode | mode, | ||
| QString & | error | ||
| ) |
Create destination (and its parent folders) from source according to mode. Returns false and fills error on failure; never overwrites an existing destination.
◆ newProcessedFilePath()
| QString score::newProcessedFilePath | ( | const QString & | sourceFile, |
| const QDir & | destination | ||
| ) |
Obtains a new file name in the project folder to save a processed file.
e.g. if the source file is /tmp/foo.wav, the output may be
/home/myself/Documents/My score project/Processed/foo-0003.wav
◆ parseJsonField()
| bool score::parseJsonField | ( | const Obj & | obj, |
| const char(&) | key[N], | ||
| QString & | out | ||
| ) |
Read one field of a JSON object, or leave out alone.
rapidjson's operator[] and GetString/GetInt/GetDouble are RAPIDJSON_ASSERT: an absent key, or one holding the wrong type, aborts rather than failing. These check presence and type first and report whether the field was usable, which is what a settings object arriving from a script or a saved document needs.
◆ parseJsonNumber()
|
noexcept |
Narrowing a double that does not fit the destination is undefined, so the range is part of the type check.
◆ pickerStartFolder() [1/3]
|
noexcept |
Same, outside of any document (application settings): the library, the user's documents folder, or the working directory.
◆ pickerStartFolder() [2/3]
|
noexcept |
Where a file / folder picker should open for a control whose current value is current (absolute, document-relative, <PROJECT>: or <LIBRARY>:-prefixed, or empty). In order: the folder of the current file (or the current folder itself) if it exists, the document's folder, the library, the user's documents folder, the working directory - the first one that exists. Never empty.
◆ pickerStartFolder() [3/3]
|
noexcept |
Where a file / folder picker should open for a control of this document whose current value is current: see the PathRoots overload.
◆ pixelFontGrid()
|
noexcept |
Design grid of a pixel font score ships, 0 for anything else. These only render sharply at whole multiples of it.
◆ readZipMember()
| QByteArray score::readZipMember | ( | const QString & | archive, |
| const QString & | member, | ||
| QString & | error, | ||
| quint64 | maxSize = 256 *1024 *1024 |
||
| ) |
Inflate a single member of the archive. Empty (and error set) on failure, including members larger than maxSize bytes (a score file is small).
◆ registerApplicationFonts()
| void score::registerApplicationFonts | ( | ) |
Idempotent, and called by the Skin itself, so tests and alternate hosts get the fonts without the application bootstrap.
◆ relativizeFilePath() [1/2]
|
noexcept |
Turn an absolute path into a <PROJECT>: / <LIBRARY>: one when it lives under one of the roots. Paths that are already prefixed, or that live elsewhere, come back unchanged.
◆ relativizeFilePath() [2/2]
|
noexcept |
Will try to convert an absolute path in a relative path from the document's point of view
◆ retargetInputMethod()
|
noexcept |
Point the platform input method at target.
target is the object that should receive keyboard input – for a graphics scene, the QGraphicsView. Passing nullptr falls back to QGuiApplication::focusObject(), which is only correct when the target's window is already the focus window.
No-op outside of WebAssembly. Must be called synchronously from the code handling the user gesture.
◆ sameFileContents()
|
noexcept |
Byte-exact comparison. Two paths pointing at the same file compare equal without being read.
◆ sanitizeFileName()
|
noexcept |
Rewrite name into something creatable on every filesystem score runs on: no reserved characters, no Windows device names, no trailing dot or space, and short enough to survive a deep destination folder. Any directory part is dropped: the result is a single path component.
◆ scaledPixels()
|
noexcept |
A referenceFontSize-relative length in the current skin's terms, floored at one pixel.
◆ setGlobalScaleFactor()
| bool score::setGlobalScaleFactor | ( | double | factor | ) |
QT_SCALE_FACTOR, live, through Qt private API. Qt warns on the console when windows are open; the factor still applies. Bumps the Skin and emits changed() so the caches keyed on the device pixel ratio drop. False if the factor is out of range or scaling is unavailable.
◆ setInputValidity()
| void score::setInputValidity | ( | QWidget & | w, |
| InputValidity | v | ||
| ) |
Tint a widget to flag what it holds, and keep the tint skin-aware.
Sets only the roles the tint needs, so the widget keeps inheriting the rest.
◆ setItemViewDragPixmap()
| void score::setItemViewDragPixmap | ( | QDrag & | drag, |
| QAbstractItemView & | view, | ||
| const QStyleOptionViewItem & | option, | ||
| const QModelIndexList & | indexes | ||
| ) |
Give a QDrag the drag image QAbstractItemView::startDrag would have made.
Renders the dragged indices through the view's item delegate, the way the default startDrag implementation does. Views that override startDrag and do not set a pixmap otherwise leave QDrag::pixmap() null, which the platform plugin is then free to fill in with whatever it likes.
◆ setupApplicationFont()
| void score::setupApplicationFont | ( | const QFont & | f | ) |
Also reseeds the per-widget-class fonts the platform theme installs, which would otherwise win. Must run after QApplication::setStyle(), which resets that hash.
◆ setupDefaultOpenGLFormat()
|
noexcept |
Install the default QSurfaceFormat score's RHI needs, where that can be decided without probing (Apple, embedded GLES). No-op elsewhere: desktop GL is probed in the application.
MUST run before the first QOpenGLContext or QWindow exists – it is the DEFAULT format that decides which profile Apple hands out, and score::gfx::Window builds its own format from QSurfaceFormat::defaultFormat().
Lives here rather than in main.cpp because the TESTS need it too: the app sets its profile in setup_opengl(), which no test bootstrap reaches, so without this every test touching the OpenGL backend on macOS runs on Apple's legacy profile – GL 2.1 / GLSL 1.20 – instead of the 4.1 core the app itself uses. On that context QRhi has no texture arrays and no 3D textures, so RenderList creation throws and no window ever presents a frame.
◆ showTypeInBox()
| QGraphicsProxyWidget * score::showTypeInBox | ( | QGraphicsScene & | scene, |
| QPointF | scenePos, | ||
| const std::vector< TypeInField > & | fields, | ||
| std::function< void(int, double)> | onChanged, | ||
| std::function< void()> | onFinished | ||
| ) |
The type-in box a right-click raises over a control with more than one number in it.
A single spin box can be closed on QAbstractSpinBox::editingFinished, which is what DefaultGraphicsSliderImpl does. Several of them cannot: that signal is also emitted when the focus merely leaves a box, and moving from x to y is such a focus-out. Closing on it made every field but the first unreachable – clicking y took the whole box down.
The box goes away when the focus leaves it as a whole, which is the proxy item losing the scene focus. QApplication::focusWidget() cannot answer that question: a widget embedded in a QGraphicsProxyWidget never becomes the application's focus widget, the view stays it whatever is typed into.
- Parameters
-
onChanged (field index, value), as a field is typed into. onFinished once per field actually edited, when that edit is done: the release that turns the ongoing command into one undo step.
The box registers itself as the one currentRightClickWidget(), so raising any other takes it down.
◆ snapToFontGrid()
|
noexcept |
px rounded down to a multiple of f's grid, or up to one step when smaller than that; unchanged for an outline font. Any computed font size has to go through this.
◆ summarizeZipArchive()
| std::optional< ZipArchiveSummary > score::summarizeZipArchive | ( | const QString & | archive | ) |
Look at a zip's table of contents without inflating anything.
Returns nothing if the file is not a zip or holds no .score / .scorejson at its root or one folder down. When several qualify, the shallowest wins, then the one named like the archive.
◆ try_load_library()
|
inlinenoexcept |
dlopen a library, reporting absence instead of throwing.
ossia::dylib_loader only signals failure by throwing from its constructor, which makes it unusable as a direct member of the optional-dependency loaders: a function-try-block around a constructor rethrows when it falls off the end of the handler, so the "unavailable" flag those loaders check is never reached and the exception escapes their instance() accessor instead.
◆ uiFontHinting()
|
noexcept |
Hinting for the fonts built before any skin has loaded. A skin sets it per role, which wins over this.
◆ uiFontSize()
|
noexcept |
Application font size before any skin has loaded; the "application" role replaces it.
◆ uiFontStyleStrategy()
|
noexcept |
NoSubpixelAntialias on macOS: QCocoaScreen rewrites Subpixel_None to Subpixel_RGB, so the style strategy is the only way to get grayscale AA.
◆ watchSceneInputMethod()
| void score::watchSceneInputMethod | ( | QGraphicsScene & | scene | ) |
Keep the platform input method in sync with the scene's focus item.
No-op outside of WebAssembly.
◆ writeZipArchive()
| bool score::writeZipArchive | ( | const QString & | destination, |
| const std::vector< ZipEntry > & | entries, | ||
| int | level, | ||
| QString & | error, | ||
| const ZipProgress & | progress = {} |
||
| ) |
Write entries into a zip archive at destination.
Aborting or failing leaves no half-written archive behind: the archive is built next to the destination and only moved into place once complete.
level is 0 (store) to 9 (smallest). Media is already compressed, so the default is deliberately low – spending minutes to shave a percent off a folder of video is not a trade anyone wants.
Variable Documentation
◆ arrow_name
| std::array<QString, 5> score::arrow_name |
◆ referenceFontSize
|
inlineconstexpr |
The font size every hardcoded pixel length in the widget UI was drawn against.