Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions qucs/qucs/components/componentdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
* *
***************************************************************************/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "componentdialog.h"
#include "qucs.h"
#include "schematic.h"
Expand All @@ -33,6 +37,8 @@
#include <QComboBox>
#include <QGroupBox>
#include <QPushButton>
#include <QUrl>
#include <QDesktopServices>
#include <QEvent>
#include <QKeyEvent>
#include <QDebug>
Expand Down Expand Up @@ -403,12 +409,17 @@ ComponentDialog::ComponentDialog(Component *c, Schematic *d)
hbox2->setLayout(h2);
h2->setSpacing(5);
all->addWidget(hbox2);
QPushButton *help = new QPushButton(tr("Help"));
QPushButton *ok = new QPushButton(tr("OK"));
QPushButton *apply = new QPushButton(tr("Apply"));
QPushButton *cancel = new QPushButton(tr("Cancel"));
h2->addWidget(ok);
h2->addWidget(apply);
h2->addWidget(cancel);
// set stretch factors to limit the space taken by the added stretch
h2->addWidget(help, 1);
h2->addStretch(1);
h2->addWidget(ok, 1);
h2->addWidget(apply, 1);
h2->addWidget(cancel, 1);
connect(help, SIGNAL(clicked()), SLOT(slotButtHelp()));
connect(ok, SIGNAL(clicked()), SLOT(slotButtOK()));
connect(apply, SIGNAL(clicked()), SLOT(slotApplyInput()));
connect(cancel, SIGNAL(clicked()), SLOT(slotButtCancel()));
Expand Down Expand Up @@ -1056,6 +1067,19 @@ void ComponentDialog::slotApplyInput()

}

// -------------------------------------------------------------------------
// Is called if the "Help"-button is pressed.
void ComponentDialog::slotButtHelp()
{
QString linkName = QString(Comp->Model);

qDebug() << "HELP : model = " << linkName;
// for local testing use something like
// QDesktopServices::openUrl(QUrl::fromLocalFile("<base dir>/qucs-manual/build/html/component_reference.html").toString() + "#" + linkName.toLower());

QDesktopServices::openUrl(QUrl("http://qucs.github.io/qucs-manual/" PACKAGE_VERSION "/html-en/component_reference.html#" + linkName.toLower(), QUrl::TolerantMode));
}

// -------------------------------------------------------------------------
void ComponentDialog::slotBrowseFile()
{
Expand Down
1 change: 1 addition & 0 deletions qucs/qucs/components/componentdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ComponentDialog : public QDialog {
private slots:
void slotButtOK();
void slotButtCancel();
void slotButtHelp();
void slotSelectProperty(QTableWidgetItem *item);
void slotApplyInput();
void slotApplyState(int State);
Expand Down