#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); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum ); } WScanPreviewPanel::~WScanPreviewPanel() { delete ui; } 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->Type() == eScan) { CScan *pScan = static_cast(pRes); // Scan type if (pScan->IsImportant()) ui->ScanTypeLabel->setText("Important"); 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()); } else ui->ScanTextWidget->SetResource(nullptr); }