# HG changeset patch # User Chris Cannam # Date 1544104474 0 # Node ID 0329bbd4b57c0391e58d626714848c342f148bb2 # Parent cb4f7c3c01dd88cfa95a6005e99aeda8c9163c9c# Parent 1fc2e0269ae0b32ca4ad9c46e10492e21c7aaa59 Merge from branch "help" diff -r cb4f7c3c01dd -r 0329bbd4b57c src/mainwindow.cpp --- a/src/mainwindow.cpp Thu Dec 06 13:45:23 2018 +0000 +++ b/src/mainwindow.cpp Thu Dec 06 13:54:34 2018 +0000 @@ -1446,6 +1446,7 @@ MultiChoiceDialog *d = new MultiChoiceDialog (tr("Open Repository"), tr("What would you like to open?"), + tr("https://code.soundsoftware.ac.uk/projects/easyhg/wiki/HelpOpenDialog"), this); d->addChoice("remote", @@ -1540,6 +1541,7 @@ MultiChoiceDialog *d = new MultiChoiceDialog (tr("Set Remote Location"), tr("Set the remote location"), + "", this); QString explanation; diff -r cb4f7c3c01dd -r 0329bbd4b57c src/multichoicedialog.cpp --- a/src/multichoicedialog.cpp Thu Dec 06 13:45:23 2018 +0000 +++ b/src/multichoicedialog.cpp Thu Dec 06 13:54:34 2018 +0000 @@ -27,10 +27,13 @@ #include #include #include +#include #include -MultiChoiceDialog::MultiChoiceDialog(QString title, QString heading, QWidget *parent) : - QDialog(parent) +MultiChoiceDialog::MultiChoiceDialog(QString title, QString heading, + QString helpUrl, QWidget *parent) : + QDialog(parent), + m_helpUrl(helpUrl) { setModal(true); setWindowTitle(title); @@ -77,11 +80,21 @@ outer->addWidget(m_browseButton, 4, 2); connect(m_browseButton, SIGNAL(clicked()), this, SLOT(browse())); - QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok | - QDialogButtonBox::Cancel); + outer->addItem(new QSpacerItem(2, 12), 5, 0); + + QDialogButtonBox *bbox; + if (helpUrl != "") { + bbox = new QDialogButtonBox(QDialogButtonBox::Help | + QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); + } else { + bbox = new QDialogButtonBox(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); + } connect(bbox, SIGNAL(accepted()), this, SLOT(accept())); connect(bbox, SIGNAL(rejected()), this, SLOT(reject())); - outer->addWidget(bbox, 5, 0, 1, 3); + connect(bbox, SIGNAL(helpRequested()), this, SLOT(helpRequested())); + outer->addWidget(bbox, 6, 0, 1, 3); m_okButton = bbox->button(QDialogButtonBox::Ok); updateOkButton(); @@ -89,6 +102,12 @@ setMinimumWidth(480); } +void +MultiChoiceDialog::helpRequested() +{ + QDesktopServices::openUrl(m_helpUrl); +} + QString MultiChoiceDialog::getCurrentChoice() { diff -r cb4f7c3c01dd -r 0329bbd4b57c src/multichoicedialog.h --- a/src/multichoicedialog.h Thu Dec 06 13:45:23 2018 +0000 +++ b/src/multichoicedialog.h Thu Dec 06 13:54:34 2018 +0000 @@ -36,7 +36,9 @@ { Q_OBJECT public: - explicit MultiChoiceDialog(QString title, QString heading, + explicit MultiChoiceDialog(QString title, + QString heading, + QString helpUrl = "", QWidget *parent = 0); enum ArgType { @@ -63,12 +65,15 @@ void choiceChanged(); void urlChanged(const QString &); void fileChanged(const QString &); + void helpRequested(); void browse(); private: void updateFileComboFromURL(); void updateOkButton(); + QString m_helpUrl; + QMap m_texts; QMap m_descriptions; QMap m_argTypes;