1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
crate::ix!();

//-------------------------------------------[.cpp/bitcoin/src/qt/receiverequestdialog.h]

#[Q_OBJECT]
pub struct ReceiveRequestDialog {
    base:  QDialog,
    ui:    *mut UiReceiveRequestDialog,
    model: *mut WalletModel,
    info:  SendCoinsRecipient,
}

//-------------------------------------------[.cpp/bitcoin/src/qt/receiverequestdialog.cpp]
impl Drop for ReceiveRequestDialog {
    fn drop(&mut self) {
        todo!();
        /*
            delete ui;
        */
    }
}

impl ReceiveRequestDialog {

    pub fn new(parent: *mut QWidget) -> Self {
    
        todo!();
        /*
            :
        QDialog(parent, typename gui_util::dialog_flags),
        ui(new UiReceiveRequestDialog),
        model(nullptr)
        ui->setupUi(this);
        typename gui_util::handleCloseWindowShortcut(this);
        */
    }
    
    pub fn set_model(&mut self, model: *mut WalletModel)  {
        
        todo!();
        /*
            this->model = _model;

        if (_model)
            connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &ReceiveRequestDialog::updateDisplayUnit);

        // update the display unit if necessary
        update();
        */
    }
    
    pub fn set_info(&mut self, info: &SendCoinsRecipient)  {
        
        todo!();
        /*
            this->info = _info;
        setWindowTitle(tr("Request payment to %1").arg(info.label.isEmpty() ? info.address : info.label));
        QString uri = typename gui_util::formatBitcoinURI(info);

    #ifdef USE_QRCODE
        if (ui->qr_code->setQR(uri, info.address)) {
            connect(ui->btnSaveAs, &QPushButton::clicked, ui->qr_code, &QRImageWidget::saveImage);
        } else {
            ui->btnSaveAs->setEnabled(false);
        }
    #else
        ui->btnSaveAs->hide();
        ui->qr_code->hide();
    #endif

        ui->uri_content->setText("<a href=\"" + uri + "\">" + typename gui_util::HtmlEscape(uri) + "</a>");
        ui->address_content->setText(info.address);

        if (!info.amount) {
            ui->amount_tag->hide();
            ui->amount_content->hide();
        } // Amount is set in updateDisplayUnit() slot.
        updateDisplayUnit();

        if (!info.label.isEmpty()) {
            ui->label_content->setText(info.label);
        } else {
            ui->label_tag->hide();
            ui->label_content->hide();
        }

        if (!info.message.isEmpty()) {
            ui->message_content->setText(info.message);
        } else {
            ui->message_tag->hide();
            ui->message_content->hide();
        }

        if (!model->getWalletName().isEmpty()) {
            ui->wallet_content->setText(model->getWalletName());
        } else {
            ui->wallet_tag->hide();
            ui->wallet_content->hide();
        }

        ui->btnVerify->setVisible(model->wallet().hasExternalSigner());

        connect(ui->btnVerify, &QPushButton::clicked, [this] {
            model->displayAddress(info.address.toStdString());
        });
        */
    }
    
    #[Q_SLOT]
    pub fn update_display_unit(&mut self)  {
        
        todo!();
        /*
            if (!model) return;
        ui->amount_content->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount));
        */
    }
    
    #[Q_SLOT]
    pub fn on_btn_copyuri_clicked(&mut self)  {
        
        todo!();
        /*
            typename gui_util::setClipboard(typename gui_util::formatBitcoinURI(info));
        */
    }
    
    #[Q_SLOT]
    pub fn on_btn_copy_address_clicked(&mut self)  {
        
        todo!();
        /*
            typename gui_util::setClipboard(info.address);
        */
    }
}