Mercurial > hg > easyhg
comparison src/mainwindow.cpp @ 719:5074e870df22
Adjust sizing of About and Help dialogs
author | Chris Cannam |
---|---|
date | Thu, 13 Dec 2018 10:58:29 +0000 |
parents | 5b3bcb2d0943 |
children |
comparison
equal
deleted
inserted
replaced
718:dfabf544f682 | 719:5074e870df22 |
---|---|
177 return identifier; | 177 return identifier; |
178 } | 178 } |
179 | 179 |
180 void MainWindow::about() | 180 void MainWindow::about() |
181 { | 181 { |
182 QMessageBox::about(this, tr("About EasyMercurial"), | 182 QString text; |
183 tr("<qt><h2>EasyMercurial v%1</h2>" | 183 text += "<qt>"; |
184 | |
185 text += tr("<h2>EasyMercurial v%1</h2>").arg(EASYHG_VERSION); | |
186 | |
184 #ifdef Q_OS_MAC | 187 #ifdef Q_OS_MAC |
185 "<font size=-1>" | 188 text += "<font size=-1>"; |
186 #endif | 189 #endif |
187 "<p>EasyMercurial is a simple user interface for the " | 190 text += tr("<p>EasyMercurial is a simple user interface for the " |
188 "Mercurial</a> version control system.</p>" | 191 "Mercurial</a> version control system.</p>"); |
189 "<h4>Credits and Copyright</h4>" | 192 |
190 "<p>Development carried out by Chris Cannam for " | 193 text += tr("<h4>Credits and Copyright</h4>"); |
191 "SoundSoftware.ac.uk at the Centre for Digital Music, " | 194 |
192 "Queen Mary, University of London.</p>" | 195 text += tr("<p>Development carried out by Chris Cannam for " |
193 "<p>EasyMercurial is based on HgExplorer by " | 196 "SoundSoftware.ac.uk at the Centre for Digital Music, " |
194 "Jari Korhonen, with thanks.</p>" | 197 "Queen Mary, University of London.</p>"); |
195 "<p style=\"margin-left: 2em;\">" | 198 |
196 "Copyright © 2013 Queen Mary, University of London.<br>" | 199 text += tr("<p>EasyMercurial is based on HgExplorer by " |
197 "Copyright © 2010 Jari Korhonen.<br>" | 200 "Jari Korhonen, with thanks.</p>"); |
198 "Copyright © 2013 Chris Cannam." | 201 |
199 "</p>" | 202 text += tr("<p style=\"margin-left: 2em;\">"); |
200 "<p style=\"margin-left: 2em;\">" | 203 text += tr("Copyright © 2013-2018 Queen Mary, University of London.<br>"); |
201 "This program requires Mercurial, by Matt Mackall and others.<br>" | 204 text += tr("Copyright © 2010 Jari Korhonen.<br>"); |
202 "This program uses Qt by Nokia.<br>" | 205 text += tr("Copyright © 2013 Chris Cannam."); |
203 "This program uses Nuvola icons by David Vignoni.<br>" | 206 text += tr("</p>"); |
204 "This program may use KDiff3 by Joachim Eibl.<br>" | 207 |
205 "This program may use PyQt by River Bank Computing.<br>" | 208 text += tr("<p style=\"margin-left: 2em;\">"); |
206 "Packaging for Mercurial and other dependencies on Windows is derived from TortoiseHg by Steve Borho and others." | 209 text += tr("This program requires Mercurial, by Matt Mackall and others.<br>"); |
207 "</p>" | 210 text += tr("This program uses Qt by The Qt Company.<br>"); |
208 "<h4>License</h4>" | 211 text += tr("This program uses Nuvola icons by David Vignoni.<br>"); |
209 "<p>This program is free software; you can redistribute it and/or " | 212 text += tr("This program may use KDiff3 by Joachim Eibl.<br>"); |
210 "modify it under the terms of the GNU General Public License as " | 213 text += tr("This program may use PyQt by River Bank Computing.<br>"); |
211 "published by the Free Software Foundation; either version 2 of the " | 214 text += tr("Packaging for Mercurial and other dependencies on Windows is derived from TortoiseHg by Steve Borho and others."); |
212 "License, or (at your option) any later version. See the file " | 215 text += tr("</p>"); |
213 "COPYING included with this distribution for more information.</p>" | 216 |
217 text += tr("<h4>License</h4>"); | |
218 text += tr("<p>This program is free software; you can redistribute it and/or " | |
219 "modify it under the terms of the GNU General Public License as " | |
220 "published by the Free Software Foundation; either version 2 of the " | |
221 "License, or (at your option) any later version. See the file " | |
222 "COPYING included with this distribution for more information.</p>"); | |
214 #ifdef Q_OS_MAC | 223 #ifdef Q_OS_MAC |
215 "</font>" | 224 text += "</font>"; |
216 #endif | 225 #endif |
217 ).arg(EASYHG_VERSION)); | 226 |
227 // use our own dialog so we can influence the size | |
228 | |
229 QDialog *d = new QDialog(this); | |
230 d->setWindowTitle(tr("About %1").arg(QApplication::applicationName())); | |
231 | |
232 QGridLayout *layout = new QGridLayout; | |
233 d->setLayout(layout); | |
234 | |
235 int row = 0; | |
236 | |
237 QLabel *iconLabel = new QLabel; | |
238 iconLabel->setPixmap(QApplication::windowIcon().pixmap(64, 64)); | |
239 layout->addWidget(iconLabel, row, 0, Qt::AlignTop); | |
240 | |
241 QLabel *mainText = new QLabel(); | |
242 layout->addWidget(mainText, row, 1, 1, 2); | |
243 | |
244 layout->setRowStretch(row, 10); | |
245 layout->setColumnStretch(1, 10); | |
246 | |
247 ++row; | |
248 | |
249 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok); | |
250 layout->addWidget(bb, row++, 0, 1, 3); | |
251 connect(bb, SIGNAL(accepted()), d, SLOT(accept())); | |
252 | |
253 mainText->setWordWrap(true); | |
254 mainText->setOpenExternalLinks(true); | |
255 mainText->setText(text); | |
256 | |
257 d->setMinimumSize(400, 400); | |
258 d->exec(); | |
259 | |
260 delete d; | |
218 } | 261 } |
219 | 262 |
220 void MainWindow::clearSelections() | 263 void MainWindow::clearSelections() |
221 { | 264 { |
222 m_hgTabs->clearSelections(); | 265 m_hgTabs->clearSelections(); |
3259 connect(fwd, SIGNAL(clicked()), text, SLOT(forward())); | 3302 connect(fwd, SIGNAL(clicked()), text, SLOT(forward())); |
3260 back->setEnabled(false); | 3303 back->setEnabled(false); |
3261 fwd->setEnabled(false); | 3304 fwd->setEnabled(false); |
3262 layout->addWidget(bb, 2, 0, 1, 4); | 3305 layout->addWidget(bb, 2, 0, 1, 4); |
3263 layout->setColumnStretch(3, 20); | 3306 layout->setColumnStretch(3, 20); |
3264 m_helpDialog->resize(450, 500); | 3307 double baseEm; |
3308 #ifdef Q_OS_MAC | |
3309 baseEm = 17.0; | |
3310 #else | |
3311 baseEm = 15.0; | |
3312 #endif | |
3313 double em = QFontMetrics(QFont()).height(); | |
3314 double ratio = em / baseEm; | |
3315 m_helpDialog->setMinimumSize(450 * ratio, 500 * ratio); | |
3265 } | 3316 } |
3266 QTextBrowser *tb = m_helpDialog->findChild<QTextBrowser *>(); | 3317 QTextBrowser *tb = m_helpDialog->findChild<QTextBrowser *>(); |
3267 if (tb) tb->home(); | 3318 if (tb) tb->home(); |
3268 m_helpDialog->show(); | 3319 m_helpDialog->show(); |
3269 m_helpDialog->raise(); | 3320 m_helpDialog->raise(); |