Files
vpn-dns-gateway/demo/tikzrefinery/code/src/ui/tkrShapePalette.cpp
T
vsun1 27b82c169e
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Add frozen TikZRefinery demo baseline and build pipeline
2026-11-25 22:46:33 -05:00

54 lines
2.4 KiB
C++

#include "ui/tkrShapePalette.h"
#include <QGroupBox>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
namespace TikzRefinery {
namespace {
constexpr int iPageMargin = 10;
constexpr int iPageSpacing = 10;
constexpr int iStretchWeight = 1;
constexpr int iProviderSummaryLine = 0;
}
tkrShapePalette::tkrShapePalette(QWidget *pParent) : QWidget(pParent)
{
setObjectName(QStringLiteral("shapePalette"));
QVBoxLayout *pLayout = new QVBoxLayout(this);
pLayout->setContentsMargins(iPageMargin, iPageMargin, iPageMargin, iPageMargin);
pLayout->setSpacing(iPageSpacing);
QGroupBox *pShapeGroup = new QGroupBox(tr("Rectangle support"), this);
QVBoxLayout *pShapeLayout = new QVBoxLayout(pShapeGroup);
m_pProviderLabel = new QLabel(pShapeGroup);
m_pProviderLabel->setTextFormat(Qt::PlainText);
m_pProviderLabel->setWordWrap(true);
pShapeLayout->addWidget(m_pProviderLabel);
m_pAvailabilityLabel = new QLabel(pShapeGroup);
m_pAvailabilityLabel->setWordWrap(true);
pShapeLayout->addWidget(m_pAvailabilityLabel);
QPushButton *pCreateButton = new QPushButton(tr("Create rectangle"), pShapeGroup);
pCreateButton->setObjectName(QStringLiteral("createShapeButton"));
pCreateButton->setEnabled(false);
pCreateButton->setToolTip(tr("Shape creation is in development. Open a supported TikZ file to edit existing shapes."));
pShapeLayout->addWidget(pCreateButton);
pLayout->addWidget(pShapeGroup);
QLabel *pDevelopmentLabel = new QLabel(tr("Shape creation is in development. For now, open a TikZ file to move or resize existing shapes."), this);
pDevelopmentLabel->setWordWrap(true);
pLayout->addWidget(pDevelopmentLabel);
pLayout->addStretch(iStretchWeight);
setProviderDescription({}, false);
}
void tkrShapePalette::setProviderDescription(const QString &strDescription, bool bAvailable)
{
// Keep paths and runtime identity in About, not in the normal palette flow.
m_pProviderLabel->setText(bAvailable ? strDescription.section(QLatin1Char('\n'), iProviderSummaryLine, iProviderSummaryLine)
: tr("Rectangle plugin unavailable"));
m_pAvailabilityLabel->setText(bAvailable ? tr("Loaded for display, selection, movement and resizing.")
: tr("See Help > About for plugin details. Creation remains unavailable."));
}
} // namespace TikzRefinery