7#include <QtCore/private/qcore_ohos_p.h>
8#include <QtCore/private/qohoscommon_p.h>
9#include <QtCore/qglobal.h>
10#include <QtCore/qlogging.h>
25template<
typename IdValueType,
typename TypeTag>
52template<
typename ...
Ts>
56template<
typename ForwardIt,
typename Predicate>
61 template<
typename... Args>
65template<
typename UnaryFunc,
typename... TupleElements,
std::size_t... TupleIndices>
68template<
typename UnaryFunc,
typename... TupleElements>
69void tupleForEach(
const std::tuple<TupleElements...> &tuple, UnaryFunc func);
73 QOhosConsumer<T> baseConsumer, QOhosConsumer<std::function<
void()>> asyncExecutor);
86 QOhosJsState &jsState, std::optional<QtOhos::QObjectThreadSafeRef> optInstanceMainWindowRef);
88template<
typename ForwardIt,
typename Predicate>
91 if (firstIt == lastIt)
94 auto outputIt = firstIt;
95 auto currentIt = firstIt;
96 auto nextIt = currentIt;
99 while (nextIt != lastIt) {
100 if (!predicate(*currentIt, *nextIt)) {
101 if (outputIt != currentIt) {
102 *outputIt =
std::move(*currentIt);
110 if (outputIt != currentIt) {
111 *outputIt =
std::move(*currentIt);
118template<
typename UnaryFunc,
typename... TupleElements,
std::size_t... TupleIndices>
124template<
typename UnaryFunc,
typename... TupleElements>
127 tupleForEach(tuple, func, std::make_index_sequence<
sizeof...(TupleElements)>());
136template<
typename IdValueType,
typename Tag>
142template<
typename IdValueType,
typename Tag>
145 return m_value == other.m_value;
148template<
typename IdValueType,
typename Tag>
151 return m_value != other.m_value;
154template<
typename IdValueType,
typename Tag>
157 return m_value < other.m_value;
160template<
typename IdValueType,
typename Tag>
166template<
typename IdValueType,
typename Tag>
169template<
typename IdValueType,
typename Tag>
172template<
typename IdValueType,
typename Tag>
175template<
typename IdValueType,
typename Tag>
180 QOhosConsumer<T> baseConsumer, QOhosConsumer<std::function<
void()>> asyncExecutor)
184 QOhosConsumer<T> baseConsumer;
185 QOhosConsumer<std::function<
void()>> asyncExecutor;
186 std::mutex pendingValueMutex;
187 std::optional<T> pendingValue;
190 auto context =
std::make_shared<Context>();
191 context->baseConsumer =
std::move(baseConsumer);
192 context->asyncExecutor =
std::move(asyncExecutor);
194 return [context](T value) {
195 std::lock_guard<
std::mutex> pendingValueLock(context->pendingValueMutex);
196 if (!context->pendingValue.has_value()) {
197 context->asyncExecutor(
199 std::optional<T> pendingValue;
201 std::lock_guard<
std::mutex> pendingValueLock(context->pendingValueMutex);
202 std::swap(pendingValue, context->pendingValue);
204 context->baseConsumer(pendingValue.value());
207 context->pendingValue.emplace(
std::move(value));
JsWindowRef(JsWindowRef &&)=delete
JsWindowRef(std::string owningQAbilityInstanceId, JsWindowId windowId, QNapi::Object jsWindow, QtOhos::QObjectThreadSafeRef owningQWindowRef)
JsWindowRef(const JsWindowRef &)=delete
QtOhos::QObjectThreadSafeRef owningQWindowRef() const
JsWindowRef & operator=(JsWindowRef &&)=delete
Result eval(const std::string &expr, const std::vector< QNapi::ValueWrapper > &exprArgs={}) const
bool isWindowShown() const
JsWindowRef & operator=(const JsWindowRef &)=delete
const std::string & owningQAbilityInstanceId() const
QNapi::Promise evalToPromiseOrRejectOnThrow(const std::string &expr, const std::vector< QNapi::ValueWrapper > &exprArgs={}) const
bool operator!=(const TypedId &other) const
IdValueType value() const
bool operator==(const TypedId &other) const
TypedId(IdValueType value)
TypedId(const TypedId &other)
TypedId & operator=(const TypedId &other)
TypedId & operator=(TypedId &&other)
bool operator<(const TypedId &other) const
std::optional< WindowProperties > tryGetWindowProperties(JsWindowId jsWindowId)
Combined button and popup list for selecting options.
@ WINDOW_MODE_SPLIT_PRIMARY
@ WINDOW_MODE_SPLIT_SECONDARY
@ NEW_PROCESS_ATTACH_TO_PARENT
@ NEW_PROCESS_ATTACH_TO_STATUS_BAR_ITEM
@ ATTACH_TO_STATUS_BAR_ITEM
@ FLAG_AUTH_PERSISTABLE_URI_PERMISSION
@ FLAG_AUTH_READ_URI_PERMISSION
@ FLAG_ABILITY_ON_COLLABORATE
@ FLAG_START_WITHOUT_TIPS
@ FLAG_AUTH_WRITE_URI_PERMISSION
@ NOTIFICATION_CONTENT_MULTILINE
@ NOTIFICATION_CONTENT_LONG_TEXT
@ NOTIFICATION_CONTENT_CONVERSATION
@ NOTIFICATION_CONTENT_SYSTEM_LIVE_VIEW
@ NOTIFICATION_CONTENT_PICTURE
@ NOTIFICATION_CONTENT_LIVE_VIEW
@ NOTIFICATION_CONTENT_BASIC_TEXT
@ ENTER_IMMERSIVE_DISABLE_TITLE_AND_DOCK_HOVER
@ FOLLOW_APP_IMMERSIVE_SETTING
@ TYPE_NAVIGATION_INDICATOR
std::optional< QNapi::Object > tryMapOptMainWindowToQAbility(QOhosJsState &jsState, std::optional< QtOhos::QObjectThreadSafeRef > optInstanceMainWindowRef)
std::string const char * mapBoolToTrueFalseStr(bool value)
QOhosConsumer< T > makeCompressingAsyncConsumer(QOhosConsumer< T > baseConsumer, QOhosConsumer< std::function< void()> > asyncExecutor)
ForwardIt removeMatchingWithLookahead(ForwardIt firstIt, ForwardIt lastIt, Predicate &&predicate)
std::optional< double > tryParseStringAsFiniteDouble(const std::string &inputString)
void tupleForEach(const std::tuple< TupleElements... > &tuple, UnaryFunc func, std::index_sequence< TupleIndices... >)
void tupleForEach(const std::tuple< TupleElements... > &tuple, UnaryFunc func)
constexpr T makeCopyByValue(T value)
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::bundle::bundleManager::SupportWindowMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::WindowStatusType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::ModalityType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::ConfigurationConstant::ColorMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::file::picker::DocumentSelectMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::AbilityConstant::WindowMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::wantConstant::Flags))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::AbilityConstant::ContinueState))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::AnimationType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::MaximizePresentation))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::inputMethod::Direction))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::display::Orientation))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::display::DisplaySourceMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::multimodalInput::pointer::PointerStyle))
QT_END_NAMESPACE Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::kit::ShareKit::systemShare::SelectionMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::notificationManager::ContentType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::AvoidAreaType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::AbilityConstant::LaunchReason))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::contextConstant::ProcessMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::inputMethod::RequestKeyboardReason))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::contextConstant::StartupVisibility))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::inputMethod::EnterKeyType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::kit::ShareKit::systemShare::SharePreviewMode))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::app::ability::AbilityConstant::OnContinueResult))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::WindowEventType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::abilityAccessCtrl::PermissionStatus))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::graphics::text::SystemFontType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::inputMethod::TextInputType))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::ohos::window::RectChangeReason))
Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QtOhosQpa::enums::kit::ShareKit::systemShare::ShareAbilityType))
std::optional< QOhosDisplayInfo::JsDisplayId > displayId
bool isDisplayMainOrExtended() const
QtOhosQpa::enums::ohos::display::Orientation JsDisplayOrientation
QtOhosQpa::enums::ohos::display::DisplaySourceMode DisplaySourceMode
std::optional< DisplaySourceMode > sourceMode
QSizeF physicalSize() const
QRect displayGeometryPixels() const
static std::optional< QNapi::Object > tryGetDisplayById(QOhosJsState &jsState, QOhosDisplayInfo::JsDisplayId displayId)
std::optional< QPoint > topLeftOffsetPixels
static QOhosDisplayInfo makeFromOhosDisplayObject(QOhosJsState &jsState, QNapi::Object displayObject)
std::optional< JsDisplayOrientation > orientation
bool shouldIgnoreDisplay() const
EvaluateSequentially(Args &&...)
static constexpr const char * fullTypeName
static constexpr std::array< std::pair< Enum, const char * >, 3 > enumeratorsNames
QtOhosQpa::enums::ohos::app::ability::contextConstant::ProcessMode Enum
static constexpr const char * fullTypeName
QtOhosQpa::enums::ohos::app::ability::contextConstant::StartupVisibility Enum
static constexpr std::array< std::pair< Enum, const char * >, 2 > enumeratorsNames
QtOhosQpa::enums::ohos::graphics::text::SystemFontType Enum
static constexpr std::array< std::pair< Enum, const char * >, 5 > enumeratorsNames
static constexpr const char * fullTypeName
static constexpr std::array< std::pair< Enum, const char * >, 15 > enumeratorsNames
QtOhosQpa::enums::ohos::inputMethod::TextInputType Enum
static constexpr const char * fullTypeName
static constexpr const char * fullTypeName
QtOhosQpa::enums::ohos::notificationManager::ContentType Enum
static constexpr std::array< std::pair< Enum, const char * >, 7 > enumeratorsNames