Fix upload cost calculation for snapshots to inventory based on encoded image size and display upload cost to user
parent
698a3017a0
commit
0c380ebc08
|
|
@ -64,6 +64,8 @@ private:
|
|||
void updateControls(const LLSD& info) override;
|
||||
|
||||
void onSend();
|
||||
void updateUploadCost();
|
||||
S32 calculateUploadCost();
|
||||
};
|
||||
|
||||
static LLPanelInjector<LLPanelSnapshotInventory> panel_class1("llpanelsnapshotinventory");
|
||||
|
|
@ -92,6 +94,8 @@ bool LLPanelSnapshotInventory::postBuild()
|
|||
// virtual
|
||||
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
|
||||
{
|
||||
updateUploadCost();
|
||||
|
||||
LLPanelSnapshot::onOpen(key);
|
||||
}
|
||||
|
||||
|
|
@ -100,6 +104,8 @@ void LLPanelSnapshotInventory::updateControls(const LLSD& info)
|
|||
{
|
||||
const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
|
||||
getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
|
||||
|
||||
updateUploadCost();
|
||||
}
|
||||
|
||||
void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
|
||||
|
|
@ -111,19 +117,7 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
|
|||
|
||||
void LLPanelSnapshotInventory::onSend()
|
||||
{
|
||||
S32 w = 0;
|
||||
S32 h = 0;
|
||||
|
||||
if( mSnapshotFloater )
|
||||
{
|
||||
LLSnapshotLivePreview* preview = mSnapshotFloater->getPreviewView();
|
||||
if( preview )
|
||||
{
|
||||
preview->getSize(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
S32 expected_upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(w, h);
|
||||
S32 expected_upload_cost = calculateUploadCost();
|
||||
if (can_afford_transaction(expected_upload_cost))
|
||||
{
|
||||
if (mSnapshotFloater)
|
||||
|
|
@ -143,3 +137,25 @@ void LLPanelSnapshotInventory::onSend()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLPanelSnapshotInventory::updateUploadCost()
|
||||
{
|
||||
getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", calculateUploadCost()));
|
||||
}
|
||||
|
||||
S32 LLPanelSnapshotInventory::calculateUploadCost()
|
||||
{
|
||||
S32 w = 0;
|
||||
S32 h = 0;
|
||||
|
||||
if (mSnapshotFloater)
|
||||
{
|
||||
if (LLSnapshotLivePreview* preview = mSnapshotFloater->getPreviewView())
|
||||
{
|
||||
w = preview->getEncodedImageWidth();
|
||||
h = preview->getEncodedImageHeight();
|
||||
}
|
||||
}
|
||||
|
||||
return LLAgentBenefitsMgr::current().getTextureUploadCost(w, h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<combo_box.item label="Klein (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Mittel (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Groß (512x512)" name="Large(512x512)"/>
|
||||
<combo_box.item label="Aktuelles Fenster (512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Aktuelles Fenster" name="CurrentWindow"/>
|
||||
<combo_box.item label="Benutzerdefiniert" name="Custom"/>
|
||||
</combo_box>
|
||||
<spinner label="Breite x Höhe" name="inventory_snapshot_width"/>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@
|
|||
name="Large(512x512)"
|
||||
value="[i512,i512]" />
|
||||
<combo_box.item
|
||||
label="Current Window(512x512)"
|
||||
label="Current Window"
|
||||
name="CurrentWindow"
|
||||
value="[i0,i0]" />
|
||||
<combo_box.item
|
||||
|
|
@ -119,6 +119,8 @@
|
|||
type="string"
|
||||
word_wrap="true">
|
||||
To save your image as a texture select one of the square formats.
|
||||
|
||||
Upload cost: L$[UPLOAD_COST]
|
||||
</text>
|
||||
<button
|
||||
follows="right|bottom"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Guardar una imagen en el inventario cuesta [UPLOAD_COST] L$. Para guardar una imagen como una textura, selecciona uno de los formatos cuadrados.
|
||||
</text>
|
||||
<combo_box label="Resolución" name="texture_size_combo">
|
||||
<combo_box.item label="Ventana actual (512 × 512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Ventana actual" name="CurrentWindow"/>
|
||||
<combo_box.item label="Pequeña (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Mediana (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
L'enregistrement d'une image dans l'inventaire coûte [UPLOAD_COST] L$. Pour enregistrer votre image sous forme de texture, sélectionnez un format carré.
|
||||
</text>
|
||||
<combo_box label="Résolution" name="texture_size_combo">
|
||||
<combo_box.item label="Fenêtre actuelle (512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Fenêtre actuelle" name="CurrentWindow"/>
|
||||
<combo_box.item label="Petite (128 x 128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Moyenne (256 x 256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Grande (512 x 512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Salvare un'immagine nell'inventario costa L$[UPLOAD_COST]. Per salvare l'immagine come texture, selezionare uno dei formati quadrati.
|
||||
</text>
|
||||
<combo_box label="Risoluzione" name="texture_size_combo">
|
||||
<combo_box.item label="Finestra corrente (512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Finestra corrente" name="CurrentWindow"/>
|
||||
<combo_box.item label="Piccola (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Media (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</text>
|
||||
<view_border name="hr"/>
|
||||
<combo_box label="解像度" name="texture_size_combo">
|
||||
<combo_box.item label="現在のウィンドウ (512✕512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="現在のウィンドウ" name="CurrentWindow"/>
|
||||
<combo_box.item label="小(128✕128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="中(256✕256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="大(512✕512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Salvar uma imagem em seu inventário custa L$[UPLOAD_COST]. Para salvar sua imagem como uma textura, selecione um dos formatos quadrados.
|
||||
</text>
|
||||
<combo_box label="Resolução" name="texture_size_combo">
|
||||
<combo_box.item label="Janela ativa (512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Janela ativa" name="CurrentWindow"/>
|
||||
<combo_box.item label="Pequeno (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Médio (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Сохранение изображения в инвентаре стоит L$[UPLOAD_COST]. Чтобы сохранить его как текстуру, выберите один из квадратных форматов.
|
||||
</text>
|
||||
<combo_box label="Размер" name="texture_size_combo">
|
||||
<combo_box.item label="Текущее окно (512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Текущее окно" name="CurrentWindow"/>
|
||||
<combo_box.item label="Маленький (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Средний (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Большой (512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Bir görüntüyü envanterinize kaydetmenin maliyeti L$[UPLOAD_COST] olur. Görüntünüzü bir doku olarak kaydetmek için kare formatlardan birini seçin.
|
||||
</text>
|
||||
<combo_box label="Çözünürlük" name="texture_size_combo">
|
||||
<combo_box.item label="Mevcut Pencere(512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="Mevcut Pencere" name="CurrentWindow"/>
|
||||
<combo_box.item label="Küçük (128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="Orta (256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="Büyük (512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
將圖像儲存到收納區的費用為 L$[UPLOAD_COST]。 若要將圖像存為材質,請選擇一個正方格式。
|
||||
</text>
|
||||
<combo_box label="解析度" name="texture_size_combo">
|
||||
<combo_box.item label="目前視窗(512x512)" name="CurrentWindow"/>
|
||||
<combo_box.item label="目前視窗" name="CurrentWindow"/>
|
||||
<combo_box.item label="小(128x128)" name="Small(128x128)"/>
|
||||
<combo_box.item label="中(256x256)" name="Medium(256x256)"/>
|
||||
<combo_box.item label="大(512x512)" name="Large(512x512)"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue