MCPcopy Create free account
hub / github.com/MultiMC/Launcher / SkinUploadDialog

Method SkinUploadDialog

launcher/ui/dialogs/SkinUploadDialog.cpp:112–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112SkinUploadDialog::SkinUploadDialog(MinecraftAccountPtr acct, QWidget *parent)
113 :QDialog(parent), m_acct(acct), ui(new Ui::SkinUploadDialog)
114{
115 ui->setupUi(this);
116
117 // FIXME: add a model for this, download/refresh the capes on demand
118 auto &data = *acct->accountData();
119 int index = 0;
120 ui->capeCombo->addItem(tr("No Cape"), QVariant());
121 auto currentCape = data.minecraftProfile.currentCape;
122 if(currentCape.isEmpty()) {
123 ui->capeCombo->setCurrentIndex(index);
124 }
125
126 for(auto & cape: data.minecraftProfile.capes) {
127 index++;
128 if(cape.data.size()) {
129 QPixmap capeImage;
130 if(capeImage.loadFromData(cape.data, "PNG")) {
131 QPixmap preview = QPixmap(10, 16);
132 QPainter painter(&preview);
133 painter.drawPixmap(0, 0, capeImage.copy(1, 1, 10, 16));
134 ui->capeCombo->addItem(capeImage, cape.alias, cape.id);
135 if(currentCape == cape.id) {
136 ui->capeCombo->setCurrentIndex(index);
137 }
138 continue;
139 }
140 }
141 ui->capeCombo->addItem(cape.alias, cape.id);
142 if(currentCape == cape.id) {
143 ui->capeCombo->setCurrentIndex(index);
144 }
145 }
146}

Callers

nothing calls this directly

Calls 5

accountDataMethod · 0.80
isEmptyMethod · 0.80
copyMethod · 0.80
setupUiMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected