|
|
|
|
|
#include "nmSwitchOutlineConfirmationDlg.h"
|
|
|
|
|
|
#include "ZxBaseUtil.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
#include <QSizePolicy>
|
|
|
|
|
|
#include <QStyle>
|
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
|
|
|
|
nmSwitchOutlineConfirmationDlg::nmSwitchOutlineConfirmationDlg(
|
|
|
|
|
|
const QString& sCurrentType, const QString& sTargetType, QWidget* pParent)
|
|
|
|
|
|
: iDlgBase(pParent)
|
|
|
|
|
|
{
|
|
|
|
|
|
createUi(sCurrentType, sTargetType);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>֡<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Ͱ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ߴ磬<DFB4><E7A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ס<EFBFBD>
|
|
|
|
|
|
adjustSize();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void nmSwitchOutlineConfirmationDlg::createUi(
|
|
|
|
|
|
const QString& sCurrentType, const QString& sTargetType)
|
|
|
|
|
|
{
|
|
|
|
|
|
const bool bRedraw = sCurrentType == sTargetType;
|
|
|
|
|
|
setWindowTitle(bRedraw ? tr("Redraw boundary") : tr("Change boundary"));
|
|
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
setModal(true);
|
|
|
|
|
|
// Esc <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ť<EFBFBD><C5A5>ֻ<EFBFBD><D6BB><EFBFBD>ؾܾ<D8BE><DCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>κ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
setIgnoreEsc(false);
|
|
|
|
|
|
|
|
|
|
|
|
QVBoxLayout* pMainLayout = new QVBoxLayout(this);
|
|
|
|
|
|
pMainLayout->setContentsMargins(12, 10, 12, 0);
|
|
|
|
|
|
pMainLayout->setSpacing(10);
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* pContent = new QWidget(this);
|
|
|
|
|
|
pContent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
|
|
QHBoxLayout* pContentLayout = new QHBoxLayout(pContent);
|
|
|
|
|
|
pContentLayout->setContentsMargins(0, 0, 0, 0);
|
|
|
|
|
|
pContentLayout->setSpacing(10);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><>ʾͼ<CABE><CDBC><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>չʾ<D5B9><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>˶Ե<CBB6><D4B5><EFBFBD>Ϣ<EFBFBD>ųɲ<C5B3><C9B2><EFBFBD><EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
QLabel* pIconLabel = new QLabel(pContent);
|
|
|
|
|
|
const int nIconSize = style()->pixelMetric(QStyle::PM_MessageBoxIconSize);
|
|
|
|
|
|
pIconLabel->setPixmap(style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(nIconSize, nIconSize));
|
|
|
|
|
|
pContentLayout->addWidget(pIconLabel, 0, Qt::AlignTop);
|
|
|
|
|
|
const QString sMessage = bRedraw
|
|
|
|
|
|
? tr("Redraw %1?").arg(sCurrentType)
|
|
|
|
|
|
: tr("Replace %1 with %2 and start drawing?").arg(sCurrentType, sTargetType);
|
|
|
|
|
|
QLabel* pMessageLabel = new QLabel(sMessage, pContent);
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>еļ<D0B5><C4BC><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5>ַ<EFBFBD><D6B7><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洰<EFBFBD>ڻ<EFBFBD><DABB>С<EFBFBD>
|
|
|
|
|
|
pMessageLabel->setTextFormat(Qt::PlainText);
|
|
|
|
|
|
pMessageLabel->setWordWrap(true);
|
|
|
|
|
|
pMessageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
|
|
|
|
|
pContentLayout->addWidget(pMessageLabel, 1);
|
|
|
|
|
|
pMainLayout->addWidget(pContent);
|
|
|
|
|
|
pMainLayout->addStretch(1);
|
|
|
|
|
|
pMainLayout->addWidget(createFooter());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* nmSwitchOutlineConfirmationDlg::createFooter()
|
|
|
|
|
|
{
|
|
|
|
|
|
QWidget* pFooter = new QWidget(this);
|
|
|
|
|
|
pFooter->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
|
|
|
|
|
QHBoxLayout* pLayout = new QHBoxLayout(pFooter);
|
|
|
|
|
|
pLayout->setContentsMargins(4, 5, 4, 5);
|
|
|
|
|
|
pLayout->setSpacing(8);
|
|
|
|
|
|
pLayout->addStretch(1);
|
|
|
|
|
|
QDialogButtonBox* pButtons = new QDialogButtonBox(
|
|
|
|
|
|
QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, pFooter);
|
|
|
|
|
|
QPushButton* pConfirmButton = pButtons->button(QDialogButtonBox::Ok);
|
|
|
|
|
|
QPushButton* pCancelButton = pButtons->button(QDialogButtonBox::Cancel);
|
|
|
|
|
|
pConfirmButton->setText(tr("Start drawing"));
|
|
|
|
|
|
pConfirmButton->setIcon(zxLoadIcon("OK"));
|
|
|
|
|
|
pConfirmButton->setDefault(false);
|
|
|
|
|
|
pCancelButton->setText(tr("Cancel"));
|
|
|
|
|
|
pCancelButton->setIcon(zxLoadIcon("Cancel"));
|
|
|
|
|
|
pCancelButton->setDefault(true);
|
|
|
|
|
|
pCancelButton->setFocus(Qt::OtherFocusReason);
|
|
|
|
|
|
pLayout->addWidget(pButtons);
|
|
|
|
|
|
connect(pButtons, SIGNAL(accepted()), this, SLOT(accept()));
|
|
|
|
|
|
connect(pButtons, SIGNAL(rejected()), this, SLOT(reject()));
|
|
|
|
|
|
return pFooter;
|
|
|
|
|
|
}
|