Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all
Unified · Split
| @@ -3788,6 +3788,37 @@ void Application::uploadAttachment() { · 3787 unmodified lines | ||
| 3788 | 3788 | uploadModel(ATTACHMENT_MODEL); |
| 3789 | 3789 | } |
| 3790 | 3790 | |
| 3791 | +void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) { | |
| 3792 | + // from the domain-handler, figure out the satoshi cost per voxel and per meter cubed | |
| 3793 | + const QString VOXEL_SETTINGS_KEY = "voxels"; | |
| 3794 | + const QString PER_VOXEL_COST_KEY = "per-voxel-credits"; | |
| 3795 | + const QString PER_METER_CUBED_COST_KEY = "per-meter-cubed-credits"; | |
| 3796 | + const QString VOXEL_WALLET_UUID = "voxel-wallet"; | |
| 3797 | + | |
| 3798 | + const QJsonObject& voxelObject = domainSettingsObject[VOXEL_SETTINGS_KEY].toObject(); | |
| 3799 | + | |
| 3800 | + qint64 satoshisPerVoxel = 0; | |
| 3801 | + qint64 satoshisPerMeterCubed = 0; | |
| 3802 | + QUuid voxelWalletUUID; | |
| 3803 | + | |
| 3804 | + if (domainSettingsObject.isEmpty()) { | |
| 3805 | + float perVoxelCredits = (float) voxelObject[PER_VOXEL_COST_KEY].toDouble(); | |
| 3806 | + float perMeterCubedCredits = (float) voxelObject[PER_METER_CUBED_COST_KEY].toDouble(); | |
| 3807 | + | |
| 3808 | + satoshisPerVoxel = (qint64) floorf(perVoxelCredits * SATOSHIS_PER_CREDIT); | |
| 3809 | + satoshisPerMeterCubed = (qint64) floorf(perMeterCubedCredits * SATOSHIS_PER_CREDIT); | |
| 3810 | + | |
| 3811 | + voxelWalletUUID = QUuid(voxelObject[VOXEL_WALLET_UUID].toString()); | |
| 3812 | + } | |
| 3813 | + | |
| 3814 | + qDebug() << "Voxel costs are" << satoshisPerVoxel << "per voxel and" << satoshisPerMeterCubed << "per meter cubed"; | |
| 3815 | + qDebug() << "Destination wallet UUID for voxel payments is" << voxelWalletUUID; | |
| 3816 | + | |
| 3817 | + _voxelEditSender.setSatoshisPerVoxel(satoshisPerVoxel); | |
| 3818 | + _voxelEditSender.setSatoshisPerMeterCubed(satoshisPerMeterCubed); | |
| 3819 | + _voxelEditSender.setDestinationWalletUUID(voxelWalletUUID); | |
| 3820 | +} | |
| 3821 | + | |
| 3791 | 3822 | QString Application::getPreviousScriptLocation() { |
| 3792 | 3823 | QString suggestedName; |
| 3793 | 3824 | if (_previousScriptLocation.isEmpty()) { |