History

move satoshi costs to VoxelEditPacketSender

Stephen Birarda committed 12 years ago

Commit 363cef61 parent eba92eb6 files · +44 −36Browse files

Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all

Unified · Split

interface/src/Application.cpp+31−0
@@ -3788,6 +3788,37 @@ void Application::uploadAttachment() { · 3787 unmodified lines
37883788 uploadModel(ATTACHMENT_MODEL);
37893789 }
37903790
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+
37913822 QString Application::getPreviousScriptLocation() {
37923823 QString suggestedName;
37933824 if (_previousScriptLocation.isEmpty()) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t