MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / update

Method update

src/exportdialog.cpp:248–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void ExportDialog::update()
249{
250 int seedcnt = 1;
251
252 if (ui->comboSeed->currentIndex() == 1)
253 {
254 const std::vector<uint64_t>& seeds = mainwindow->formControl->getResults();
255 seedcnt = seeds.size();
256 }
257
258 ui->labelNumSeeds->setText(QString::number(seedcnt));
259
260 int s = 2 * ui->comboScale->currentIndex();
261 int x0 = ui->lineEditX1->text().toInt() >> s;
262 int z0 = ui->lineEditZ1->text().toInt() >> s;
263 int x1 = ui->lineEditX2->text().toInt() >> s;
264 int z1 = ui->lineEditZ2->text().toInt() >> s;
265 if (x0 > x1) std::swap(x0, x1);
266 if (z0 > z1) std::swap(z0, z1);
267 x1 += 1;
268 z1 += 1;
269
270 if (ui->groupTiled->isChecked())
271 {
272 int tilesize = ui->comboTileSize->currentText().section('x', 0, 0).toInt();
273 int w = (int) ceil(x1 / (qreal)tilesize - (int) floor(x0 / (qreal)tilesize));
274 int h = (int) ceil(z1 / (qreal)tilesize - (int) floor(z0 / (qreal)tilesize));
275 int imgcnt = w * h * seedcnt;
276 ui->labelImgSize->setText(ui->comboTileSize->currentText());
277 ui->labelNumImg->setText(QString::number((w < 0 || h < 0) ? 0 : imgcnt));
278 }
279 else
280 {
281 int w = x1 > x0 ? x1 - x0 : 0;
282 int h = z1 > z0 ? z1 - z0 : 0;
283 ui->labelImgSize->setText(tr("%1x%2").arg(w).arg(h));
284 ui->labelNumImg->setText(QString::number(seedcnt));
285 }
286
287 WorldInfo wi;
288 mainwindow->getSeed(&wi, true);
289 int dim = mainwindow->getDim();
290
291 const char *p_mcs = mc2str(wi.mc);
292 QString wgen = (p_mcs ? p_mcs : "");
293 wgen += ", ";
294 if (dim == 0) {
295 wgen += tr("Overworld");
296 if (wi.large) wgen += tr("/large");
297 } else if (dim == -1) {
298 wgen += tr("Nether");
299 } else if (dim == +1) {
300 wgen += tr("The End");
301 }
302 ui->labelWorldGen->setText(wgen);
303 ui->labelY->setText(QString::number(wi.y));
304}
305

Callers

nothing calls this directly

Calls 3

getResultsMethod · 0.80
getSeedMethod · 0.45
getDimMethod · 0.45

Tested by

no test coverage detected