#include "WScanPreviewPanel.h" #include "ui_WScanPreviewPanel.h" #include "WStringPreviewPanel.h" #include WScanPreviewPanel::WScanPreviewPanel(QWidget *parent) : IPreviewPanel(parent), ui(new Ui::WScanPreviewPanel) { ui->setupUi(this); ui->ScanTextWidget->setFrameShape(QFrame::NoFrame); ui->ScanTextWidget->layout()->setContentsMargins(9,0,9,9); } WScanPreviewPanel::~WScanPreviewPanel() { delete ui; } QSize WScanPreviewPanel::sizeHint() const { return QSize(400, 0); } EResType WScanPreviewPanel::ResType() { return eScan; } void WScanPreviewPanel::SetResource(CResource *pRes) { // Clear existing UI ui->ScanTypeLabel->clear(); ui->ScanSpeedLabel->clear(); ui->ScanCategoryLabel->clear(); // Set up new UI if (pRes && (pRes->Type() == eScan)) { CScan *pScan = static_cast(pRes); // Scan type if (pScan->IsImportant()) ui->ScanTypeLabel->setText("Important"); else { if (pScan->Version() <= ePrime) ui->ScanTypeLabel->setText("Normal"); else ui->ScanTypeLabel->setText("Normal"); } // Scan speed if (pScan->IsSlow()) ui->ScanSpeedLabel->setText("Slow"); else ui->ScanSpeedLabel->setText("Fast"); // Scan category switch (pScan->LogbookCategory()) { case CScan::eNone: ui->ScanCategoryLabel->setText("None"); break; case CScan::eChozoLore: ui->ScanCategoryLabel->setText("Chozo Lore"); break; case CScan::ePirateData: ui->ScanCategoryLabel->setText("Pirate Data"); break; case CScan::eCreatures: ui->ScanCategoryLabel->setText("Creatures"); break; case CScan::eResearch: ui->ScanCategoryLabel->setText("Research"); break; } // Scan text ui->ScanTextWidget->SetResource(pScan->ScanText()); // Show logbook category? (Yes on MP1, no on MP2+) if (pScan->Version() <= ePrime) { ui->CategoryInfoLabel->show(); ui->ScanCategoryLabel->show(); } else { ui->CategoryInfoLabel->hide(); ui->ScanCategoryLabel->hide(); } } else ui->ScanTextWidget->SetResource(nullptr); }