# HG changeset patch # User Chris Cannam # Date 1544698709 0 # Node ID 5074e870df22fe952752bcc9f9c14aa60d557898 # Parent dfabf544f682446a258e79bacd37566e0993e6cf Adjust sizing of About and Help dialogs diff -r dfabf544f682 -r 5074e870df22 src/mainwindow.cpp --- a/src/mainwindow.cpp Thu Dec 13 07:10:21 2018 +0000 +++ b/src/mainwindow.cpp Thu Dec 13 10:58:29 2018 +0000 @@ -179,42 +179,85 @@ void MainWindow::about() { - QMessageBox::about(this, tr("About EasyMercurial"), - tr("

EasyMercurial v%1

" + QString text; + text += ""; + + text += tr("

EasyMercurial v%1

").arg(EASYHG_VERSION); + #ifdef Q_OS_MAC - "" + text += ""; #endif - "

EasyMercurial is a simple user interface for the " - "Mercurial version control system.

" - "

Credits and Copyright

" - "

Development carried out by Chris Cannam for " - "SoundSoftware.ac.uk at the Centre for Digital Music, " - "Queen Mary, University of London.

" - "

EasyMercurial is based on HgExplorer by " - "Jari Korhonen, with thanks.

" - "

" - "Copyright © 2013 Queen Mary, University of London.
" - "Copyright © 2010 Jari Korhonen.
" - "Copyright © 2013 Chris Cannam." - "

" - "

" - "This program requires Mercurial, by Matt Mackall and others.
" - "This program uses Qt by Nokia.
" - "This program uses Nuvola icons by David Vignoni.
" - "This program may use KDiff3 by Joachim Eibl.
" - "This program may use PyQt by River Bank Computing.
" - "Packaging for Mercurial and other dependencies on Windows is derived from TortoiseHg by Steve Borho and others." - "

" - "

License

" - "

This program is free software; you can redistribute it and/or " - "modify it under the terms of the GNU General Public License as " - "published by the Free Software Foundation; either version 2 of the " - "License, or (at your option) any later version. See the file " - "COPYING included with this distribution for more information.

" + text += tr("

EasyMercurial is a simple user interface for the " + "Mercurial version control system.

"); + + text += tr("

Credits and Copyright

"); + + text += tr("

Development carried out by Chris Cannam for " + "SoundSoftware.ac.uk at the Centre for Digital Music, " + "Queen Mary, University of London.

"); + + text += tr("

EasyMercurial is based on HgExplorer by " + "Jari Korhonen, with thanks.

"); + + text += tr("

"); + text += tr("Copyright © 2013-2018 Queen Mary, University of London.
"); + text += tr("Copyright © 2010 Jari Korhonen.
"); + text += tr("Copyright © 2013 Chris Cannam."); + text += tr("

"); + + text += tr("

"); + text += tr("This program requires Mercurial, by Matt Mackall and others.
"); + text += tr("This program uses Qt by The Qt Company.
"); + text += tr("This program uses Nuvola icons by David Vignoni.
"); + text += tr("This program may use KDiff3 by Joachim Eibl.
"); + text += tr("This program may use PyQt by River Bank Computing.
"); + text += tr("Packaging for Mercurial and other dependencies on Windows is derived from TortoiseHg by Steve Borho and others."); + text += tr("

"); + + text += tr("

License

"); + text += tr("

This program is free software; you can redistribute it and/or " + "modify it under the terms of the GNU General Public License as " + "published by the Free Software Foundation; either version 2 of the " + "License, or (at your option) any later version. See the file " + "COPYING included with this distribution for more information.

"); #ifdef Q_OS_MAC - "
" + text += "
"; #endif - ).arg(EASYHG_VERSION)); + + // use our own dialog so we can influence the size + + QDialog *d = new QDialog(this); + d->setWindowTitle(tr("About %1").arg(QApplication::applicationName())); + + QGridLayout *layout = new QGridLayout; + d->setLayout(layout); + + int row = 0; + + QLabel *iconLabel = new QLabel; + iconLabel->setPixmap(QApplication::windowIcon().pixmap(64, 64)); + layout->addWidget(iconLabel, row, 0, Qt::AlignTop); + + QLabel *mainText = new QLabel(); + layout->addWidget(mainText, row, 1, 1, 2); + + layout->setRowStretch(row, 10); + layout->setColumnStretch(1, 10); + + ++row; + + QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); + layout->addWidget(bb, row++, 0, 1, 3); + connect(bb, SIGNAL(accepted()), d, SLOT(accept())); + + mainText->setWordWrap(true); + mainText->setOpenExternalLinks(true); + mainText->setText(text); + + d->setMinimumSize(400, 400); + d->exec(); + + delete d; } void MainWindow::clearSelections() @@ -3261,7 +3304,15 @@ fwd->setEnabled(false); layout->addWidget(bb, 2, 0, 1, 4); layout->setColumnStretch(3, 20); - m_helpDialog->resize(450, 500); + double baseEm; +#ifdef Q_OS_MAC + baseEm = 17.0; +#else + baseEm = 15.0; +#endif + double em = QFontMetrics(QFont()).height(); + double ratio = em / baseEm; + m_helpDialog->setMinimumSize(450 * ratio, 500 * ratio); } QTextBrowser *tb = m_helpDialog->findChild(); if (tb) tb->home();