InfoTab::InfoTab(QWidget *parent) : QWidget(parent) { QTextBrowser *info = new QTextBrowser; info->setOpenExternalLinks(true); info->setFrameShape(QFrame::NoFrame); info->setFrameShadow(QFrame::Plain); info->setText( "<b>QIpMsg</b> © 2007-2010 Yichi Zhang <[email protected]><br><br>" "<b>" + tr("Version: %1").arg(VERSION) + "</b>" + "<br>" + tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>" + tr("Visit our web for updates:") + "<br>" + link("http://code.google.com/p/qipmsg") + "<br><br>" + tr("Join qipmsg group to report a bug or request new features:") + "<br>" + link("http://groups.google.com/group/qipmsg") + "<br><br>" ); QPalette p = info->palette(); p.setColor(QPalette::Base, palette().color(QPalette::Window)); info->setPalette(p); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(info); setLayout(mainLayout); }
/*! Constructs a new about box on top of given \a parent window. */ AboutBox::AboutBox(QWidget * parent) : QDialog(parent) { setWindowTitle("About MaxCalc"); tstring labelText = _T("MaxCalc v"); labelText += Constants::VERSION; labelText += _T(" ("); labelText += _T("built: "); tstring date = stringToWideString(__DATE__); labelText += date; labelText += _T(")<br>"); labelText += Constants::COPYRIGHT; labelText += _T("<br><a href='"); labelText += Constants::WEBSITE; labelText += _T("'>"); labelText += Constants::WEBSITE; labelText += _T("</a>"); QTextBrowser * label = new QTextBrowser; label->setHtml(QString::fromWCharArray(labelText.c_str())); label->setOpenExternalLinks(true); label->setFrameStyle(QFrame::NoFrame); QPalette p; p.setColor(QPalette::Base, p.color(QPalette::Background)); label->setPalette(p); label->setLineWrapMode(QTextEdit::NoWrap); label->document()->adjustSize(); label->setMinimumSize(label->document()->size().toSize()); label->setMaximumSize(label->document()->size().toSize()); QPushButton * closeButton = new QPushButton; closeButton->setText(tr("&Close")); QGridLayout * layout = new QGridLayout; layout->addWidget(label, 1, 0, 1, -1); layout->addItem(new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1, 1, 1); layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 0, 1, 1); layout->addWidget(closeButton, 3, 1, 1, 1); layout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding), 3, 2, 1, 1); setLayout(layout); setMaximumSize(sizeHint()); setMinimumSize(sizeHint()); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); }
ContributorTab::ContributorTab(QWidget *parent) : QWidget(parent) { QTextBrowser *contributors = new QTextBrowser; contributors->setOpenExternalLinks(true); contributors->setFrameShape(QFrame::NoFrame); contributors->setFrameShadow(QFrame::Plain); contributors->setText(getContributor()); QPalette p = contributors->palette(); p.setColor(QPalette::Base, palette().color(QPalette::Window)); contributors->setPalette(p); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(contributors); setLayout(mainLayout); }