Improved Insight window sizing on load - reduced to a more appropriate size, based on the size of the target package widget

Also tidied the isVariantSupported() implementation
This commit is contained in:
Nav
2021-11-17 21:42:21 +00:00
parent 24821fa56d
commit d4a0264474

View File

@@ -288,13 +288,15 @@ void InsightWindow::showEvent(QShowEvent* event) {
} }
bool InsightWindow::isVariantSupported(const TargetVariant& variant) { bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
const auto pinCount = variant.pinDescriptorsByNumber.size();
/* /*
* Because the size of the pin body widget is fixed, for all of our target package widgets, we run out of screen * Because the size of the pin body widget is fixed, for all of our target package widgets, we run out of screen
* estate for target variants with more than 100 pins. * estate for target variants with more than 100 pins.
* *
* This will be addressed at some point, but for now, we just won't support variants with more than 100 pins. * This will be addressed at some point, but for now, we just won't support variants with more than 100 pins.
*/ */
if (variant.pinDescriptorsByNumber.size() > 100) { if (pinCount > 100) {
return false; return false;
} }
@@ -303,14 +305,17 @@ bool InsightWindow::isVariantSupported(const TargetVariant& variant) {
|| variant.package == TargetPackage::SSOP || variant.package == TargetPackage::SSOP
) { ) {
// All DIP, SOIC and SSOP variants must have a pin count that is a multiple of two // All DIP, SOIC and SSOP variants must have a pin count that is a multiple of two
if (variant.pinDescriptorsByNumber.size() % 2 == 0) { if (pinCount % 2 == 0) {
return true; return true;
} }
} }
if (variant.package == TargetPackage::QFP || variant.package == TargetPackage::QFN) { if (variant.package == TargetPackage::QFP || variant.package == TargetPackage::QFN) {
// All QFP and QFN variants must have a pin count that is a multiple of four /*
if (variant.pinDescriptorsByNumber.size() % 4 == 0) { * All QFP and QFN variants must have a pin count that is a multiple of four. And there must be
* more than one pin per side.
*/
if (pinCount % 4 == 0 && pinCount > 4) {
return true; return true;
} }
} }
@@ -369,8 +374,8 @@ void InsightWindow::selectVariant(const TargetVariant* variant) {
} }
this->setMinimumSize( this->setMinimumSize(
this->targetPackageWidget->width() + 700, this->targetPackageWidget->width() + 400,
this->targetPackageWidget->height() + 450 this->targetPackageWidget->height() + 150
); );
this->adjustPanels(); this->adjustPanels();