From ffca1bf32a2eed46c4f36fab4aefd939d051935b Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 18 Mar 2011 22:30:41 -0400 Subject: Include about dialog with license. --- Introduction.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'Introduction.cpp') diff --git a/Introduction.cpp b/Introduction.cpp index b07cb29..b19593c 100644 --- a/Introduction.cpp +++ b/Introduction.cpp @@ -8,10 +8,20 @@ #include #include #include +#include +#include +#include +#include +#include +#include Introduction::Introduction(QWidget *parent) : QDialog(parent) { +#ifdef Q_OS_MAC + QMenuBar *globalMenu = new QMenuBar(this); + globalMenu->addMenu(QLatin1String("About"))->addAction(QLatin1String("About Author"), this, SLOT(about())); +#endif setWindowTitle(tr("Author - Introduction")); QHBoxLayout *layout = new QHBoxLayout; @@ -106,3 +116,33 @@ void Introduction::loadExisting() m_title->setText(button->text()); accept(); } +void Introduction::about() +{ + QDialog *about = new QDialog(0, Qt::Popup); + QVBoxLayout *layout = new QVBoxLayout; + QLabel *mainText = new QLabel(tr("

Author for Mac v.%1

Author helps you write distraction free as the great writers have for centuries. It was inspired by many long conversations with Adam Weiss and was birthed by Jason Donenfeld and ZX2C4 Software.

Visit the Author website for more information. You may address any questions to AuthorApp@zx2c4.com.

(C) Copyright 2011 Jason A. Donenfeld. All Rights Reserved.

").arg(QApplication::applicationVersion())); + mainText->setOpenExternalLinks(true); + mainText->setTextInteractionFlags(Qt::TextInteractionFlags(style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, this))); + mainText->setWordWrap(true); + layout->addWidget(mainText); + QFile licenseText(QLatin1String(":/licenses.txt")); + licenseText.open(QIODevice::ReadOnly); + QPlainTextEdit *licenses = new QPlainTextEdit(licenseText.readAll()); + licenseText.close(); + QFont font; + font.setPointSize(8); + licenses->setFont(font); + licenses->setReadOnly(true); + licenses->setMaximumHeight(100); + QGroupBox *licenseBox = new QGroupBox(tr("Legal")); + QVBoxLayout *groupLayout = new QVBoxLayout; + groupLayout->addWidget(licenses); + licenseBox->setLayout(groupLayout); + layout->addWidget(licenseBox); + QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok); + buttons->setCenterButtons(style()->styleHint(QStyle::SH_MessageBox_CenterButtons, 0, this)); + connect(buttons, SIGNAL(accepted()), about, SLOT(accept())); + layout->addWidget(buttons); + about->setLayout(layout); + about->exec(); +} -- cgit v1.2.3-59-g8ed1b