History

Remove useless Wallet.buy() scripting endpoint

Zach Fox committed 8 years ago

Commit 6f502801 parent a7a6dee2 files · +0 −30Browse files

Showing the changes to interface/src/scripting/WalletScriptingInterface.cpp (1 of 2 files). Show all

Unified · Split

interface/src/scripting/WalletScriptingInterface.cpp+0−28
@@ -22,31 +22,3 @@ void WalletScriptingInterface::refreshWalletStatus() { · 21 unmodified lines
22 auto wallet = DependencyManager::get<Wallet>();22 auto wallet = DependencyManager::get<Wallet>();
23 wallet->getWalletStatus();23 wallet->getWalletStatus();
24}24}
25
26static const QString CHECKOUT_QML_PATH = qApp->applicationDirPath() + "../../../qml/hifi/commerce/checkout/Checkout.qml";
27void WalletScriptingInterface::buy(const QString& name, const QString& id, const int& price, const QString& href) {
28 if (QThread::currentThread() != thread()) {
29 QMetaObject::invokeMethod(this, "buy", Q_ARG(const QString&, name), Q_ARG(const QString&, id), Q_ARG(const int&, price), Q_ARG(const QString&, href));
30 return;
31 }
32
33 auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
34 auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
35
36 tablet->loadQMLSource(CHECKOUT_QML_PATH);
37 DependencyManager::get<HMDScriptingInterface>()->openTablet();
38
39 QQuickItem* root = nullptr;
40 if (tablet->getToolbarMode() || (!tablet->getTabletRoot() && !qApp->isHMDMode())) {
41 root = DependencyManager::get<OffscreenUi>()->getRootItem();
42 } else {
43 root = tablet->getTabletRoot();
44 }
45 CheckoutProxy* checkout = new CheckoutProxy(root->findChild<QObject*>("checkout"));
46
47 // Example: Wallet.buy("Test Flaregun", "0d90d21c-ce7a-4990-ad18-e9d2cf991027", 17, "http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json");
48 checkout->writeProperty("itemName", name);
49 checkout->writeProperty("itemId", id);
50 checkout->writeProperty("itemPrice", price);
51 checkout->writeProperty("itemHref", href);
52}