Showing the changes to interface/src/scripting/WalletScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -13,3 +13,28 @@ · 12 unmodified lines | |||
| 13 | 13 | ||
| 14 | WalletScriptingInterface::WalletScriptingInterface() { | 14 | WalletScriptingInterface::WalletScriptingInterface() { |
| 15 | } | 15 | } |
| 16 | |||
| 17 | static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml"; | ||
| 18 | void WalletScriptingInterface::buy() { | ||
| 19 | auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); | ||
| 20 | auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); | ||
| 21 | |||
| 22 | if (!tablet->isPathLoaded(CHECKOUT_QML_PATH)) { | ||
| 23 | tablet->loadQMLSource(CHECKOUT_QML_PATH); | ||
| 24 | } | ||
| 25 | DependencyManager::get<HMDScriptingInterface>()->openTablet(); | ||
| 26 | |||
| 27 | QVariant message = {}; | ||
| 28 | |||
| 29 | |||
| 30 | tablet->sendToQml(message); .sendToQml({ | ||
| 31 | method: 'updateCheckoutQML', params : { | ||
| 32 | itemId: '0d90d21c-ce7a-4990-ad18-e9d2cf991027', | ||
| 33 | itemName : 'Test Flaregun', | ||
| 34 | itemAuthor : 'hifiDave', | ||
| 35 | itemPrice : 17, | ||
| 36 | itemHref : 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', | ||
| 37 | }, | ||
| 38 | canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified | ||
| 39 | }); | ||
| 40 | } | ||