diff options
| author | 2011-03-18 22:30:41 -0400 | |
|---|---|---|
| committer | 2011-03-18 22:34:29 -0400 | |
| commit | ffca1bf32a2eed46c4f36fab4aefd939d051935b (patch) | |
| tree | fabacce7ba65cd299fc000cfb34b69475aa9c887 /Introduction.cpp | |
| parent | Send over local computer. (diff) | |
| download | Author-ffca1bf32a2eed46c4f36fab4aefd939d051935b.tar.xz Author-ffca1bf32a2eed46c4f36fab4aefd939d051935b.zip | |
Include about dialog with license.
Diffstat (limited to 'Introduction.cpp')
| -rw-r--r-- | Introduction.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Introduction.cpp b/Introduction.cpp index b07cb29..b19593c 100644 --- a/Introduction.cpp +++ b/Introduction.cpp @@ -8,10 +8,20 @@ #include <QDateTime> #include <QSettings> #include <QLabel> +#include <QMenuBar> +#include <QPlainTextEdit> +#include <QStyle> +#include <QFile> +#include <QApplication> +#include <QDialogButtonBox> 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("<img src=\":/typewriter.png\" width=\"64\" height=\"64\" align=\"left\"><h4><i>Author</i> for Mac v.%1</h4><p align=\"justify\"><i>Author</i> helps you write distraction free as the great writers have for centuries. It was inspired by many long conversations with <a href=\"http://www.signal11.com\">Adam Weiss</a> and was birthed by <a href=\"http://www.jasondonenfeld.com\">Jason Donenfeld</a> and <a href=\"http://www.zx2c4.com\">ZX2C4 Software</a>.</p><p>Visit the <a href=\"http://www.zx2c4.com/projects/author\"><i>Author</i> website</a> for more information. You may address any questions to <a href=\"mailto:AuthorApp@zx2c4.com\">AuthorApp@zx2c4.com</a>.</p><p>(C) Copyright 2011 Jason A. Donenfeld. All Rights Reserved.</p>").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(); +} |
