예제 #1
0
void HelpSearchView::CreateQtPartControl(QWidget* parent)
{
  if (m_ResultWidget == nullptr)
  {
    m_Parent = parent;

    auto   vLayout = new QVBoxLayout(parent);

    // This will be lead to strange behavior when using multiple instances of this view
    // because the QHelpSearchResultWidget instance is shared. The new view will
    // reparent the widget.
    m_ResultWidget = m_SearchEngine->resultWidget();
    m_QueryWidget = new QHelpSearchQueryWidget();

    vLayout->addWidget(m_QueryWidget);
    vLayout->addWidget(m_ResultWidget);

    connect(m_QueryWidget, SIGNAL(search()), this, SLOT(search()));
    connect(m_ResultWidget, SIGNAL(requestShowLink(QUrl)), this,
            SLOT(requestShowLink(QUrl)));

    connect(m_SearchEngine, SIGNAL(searchingStarted()), this,
            SLOT(searchingStarted()));
    connect(m_SearchEngine, SIGNAL(searchingFinished(int)), this,
            SLOT(searchingFinished(int)));

    QTextBrowser* browser = m_ResultWidget->findChild<QTextBrowser*>();
    if (browser) // Will be null if QtHelp was configured not to use CLucene.
    {
      browser->viewport()->installEventFilter(this);
      browser->setContextMenuPolicy(Qt::CustomContextMenu);
      connect(browser, SIGNAL(customContextMenuRequested(QPoint)),
              this, SLOT(showContextMenu(QPoint)));
    }
  }
예제 #2
0
QT_BEGIN_NAMESPACE

SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent)
    : QWidget(parent)
    , zoomCount(0)
    , searchEngine(engine)
{
    TRACE_OBJ
    QVBoxLayout *vLayout = new QVBoxLayout(this);

    resultWidget = searchEngine->resultWidget();
    QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();

    vLayout->addWidget(queryWidget);
    vLayout->addWidget(resultWidget);

    setFocusProxy(queryWidget);

    connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
    connect(resultWidget, SIGNAL(requestShowLink(QUrl)), this,
        SIGNAL(requestShowLink(QUrl)));

    connect(searchEngine, SIGNAL(searchingStarted()), this,
        SLOT(searchingStarted()));
    connect(searchEngine, SIGNAL(searchingFinished(int)), this,
        SLOT(searchingFinished(int)));

    QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
    if (browser) // Will be null if lib was configured not to use CLucene.
        browser->viewport()->installEventFilter(this);
}
예제 #3
0
void SearchWidget::showEvent(QShowEvent *event)
{
    if (!event->spontaneous() && !searchEngine) {
        QVBoxLayout *vLayout = new QVBoxLayout(this);
        vLayout->setMargin(0);
        vLayout->setSpacing(0);

        searchEngine = new QHelpSearchEngine(&LocalHelpManager::helpEngine(), this);

        Utils::StyledBar *toolbar = new Utils::StyledBar(this);
        toolbar->setSingleRow(false);
        QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();
        QLayout *tbLayout = new QVBoxLayout();
        tbLayout->setSpacing(6);
        tbLayout->setMargin(4);
        tbLayout->addWidget(queryWidget);
        toolbar->setLayout(tbLayout);

        Utils::StyledBar *toolbar2 = new Utils::StyledBar(this);
        toolbar2->setSingleRow(false);
        tbLayout = new QVBoxLayout();
        tbLayout->setSpacing(0);
        tbLayout->setMargin(0);
        tbLayout->addWidget(resultWidget = searchEngine->resultWidget());
        toolbar2->setLayout(tbLayout);

        vLayout->addWidget(toolbar);
        vLayout->addWidget(toolbar2);

        setFocusProxy(queryWidget);

        connect(queryWidget, SIGNAL(search()), this, SLOT(search()));
        connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, this,
                [this](const QUrl &url) {
                    emit linkActivated(url, currentSearchTerms(), false/*newPage*/);
                });

        connect(searchEngine, SIGNAL(searchingStarted()), this,
            SLOT(searchingStarted()));
        connect(searchEngine, SIGNAL(searchingFinished(int)), this,
            SLOT(searchingFinished(int)));

        QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>();
        browser->viewport()->installEventFilter(this);

        connect(searchEngine, SIGNAL(indexingStarted()), this,
            SLOT(indexingStarted()));
        connect(searchEngine, SIGNAL(indexingFinished()), this,
            SLOT(indexingFinished()));

        QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished",
            Qt::QueuedConnection);
    }
예제 #4
0
TmainHelp::TmainHelp(QWidget* parent) :
  QWidget(parent)
{
  int pixSize = getPixSize();
  QString bbrEnd = QLatin1String("</b><br>");
  QString nbsp3 = QLatin1String(" &nbsp; ");
  QString helpTxt = QLatin1String("<br><b>") + QApplication::translate("TmainHelp", "Using Nootka may be divided into three stages:", "Don't try to translate the entries in this context/section too strict, rather use some nice words into your language to describe it. The statements like '%1' are images(icons) inside the text");
  helpTxt += QLatin1String("</b><table><tr><td>&nbsp;</td><td><hr><b>");

  helpTxt += QApplication::translate("TmainHelp", "I. Discovering") + bbrEnd;
  helpTxt += QApplication::translate("TmainHelp", "Exploring the interface of Nootka and how musical scores work. Just click on elements of the interface to see and get to know Nootka. Also, you can play or sing if you have a mic or web-cam.") + "<br>";
  helpTxt += QApplication::translate("TmainHelp", "Press %1 buttons to see help and %2 button to adjust Nootka to your preference.").
      arg(nbsp3 + pixToHtml(Tpath::img("logo"), pixSize * 2.2) + QLatin1String(" <span style=\"font-size: x-large;\"> + </span> ")
                            + pixToHtml(Tpath::img("help"), pixSize)  + nbsp3).
      arg(nbsp3 + pixToHtml(Tpath::img("systemsettings"), pixSize) + nbsp3);
  helpTxt += ThelpDialogBase::onlineDocP("getting-started");

  helpTxt += "<hr><b>" + QApplication::translate("TmainHelp", "II. Exercises and exams") + bbrEnd;
	helpTxt += exerciseAndExamText();
  helpTxt += ThelpDialogBase::onlineDocP("exercises");

  helpTxt += QLatin1String("<hr><b>") + QApplication::translate("TmainHelp", "III. Analyzing") + bbrEnd;
#if defined (Q_OS_ANDROID)
  helpTxt += QLatin1String("This feature isn't ready yet in Android version.<br><b>You may transfer Nootka files to desktop computer and see the results in Nootka version there.");
#else
  helpTxt += QApplication::translate("TmainHelp", "Nootka will tell you about what you've been thinking for so long... and about the progress you've been making so far....<br>Press %1 button to see and to analyze the results of your exams, find your weak points, and improve.").
    arg(nbsp3 + pixToHtml(Tpath::img("charts"), pixSize) + nbsp3);
#endif
  helpTxt += ThelpDialogBase::onlineDocP("analyze");
  helpTxt += QLatin1String("</td></tr></table>");

  helpTxt += QLatin1String("<hr><b><span style=\"font-size: xx-large;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
          + QApplication::translate("TmainHelp", "Have fun!") + QLatin1String("</span></b>");

  QTextBrowser *helpEdit = new QTextBrowser(this);
  helpEdit->setHtml(helpTxt);
	helpEdit->setReadOnly(true);
  helpEdit->setOpenExternalLinks(true);
  helpEdit->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::LinksAccessibleByMouse);
  QScroller::grabGesture(helpEdit->viewport(), QScroller::LeftMouseButtonGesture);
#if defined (Q_OS_ANDROID)
  helpEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  helpEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
// 	qDebug() << helpEdit->toHtml();

  auto lay = new QVBoxLayout;
  lay->addWidget(helpEdit);
  setLayout(lay);
}
예제 #5
0
AboutDialog::AboutDialog(QWidget *parent)
    : QDialog(parent)
{
  currAuths = {{
    "Guilherme Brondani Torri - " + tr("GUI programmer, Verilog-A dynamic loader"),
    "Mike Brinson - " + tr("testing, modelling and documentation, tutorial contributor"),
    "Richard Crozier - " + tr("testing, modelling, Octave."),
    "Bastien Roucaries - " + tr("bondwire and rectangular waveguide model implementation"),
    "Frans Schreuder - " + tr("GUI programmer, release"),
    "Vadim Kuznetsov - " + tr("filter synthesis (qucs-activefilter), SPICE integration (NGSPICE, Xyce)"),
    "Claudio Girardi - " + tr("testing, general fixes"),
    "Felix Salfelder - " + tr("refactoring, modularity"),
    "Andr\xe9s Mart\xednez Mera - " + tr("RF design tools")
  }};
  
  prevDevs = {{
      "Michael Margraf - " + tr("founder of the project, GUI programmer"),
      "Stefan Jahn - " + tr("Programmer of simulator"),
      "Jens Flucke - " + tr("webpages and translator"),
      "Raimund Jacob - " + tr("tester and applyer of Stefan's patches, author of documentation"),
      "Vincent Habchi - " + tr("coplanar line and filter synthesis code, documentation contributor"),
      "Toyoyuki Ishikawa - " + tr("some filter synthesis code and attenuator synthesis"),
      "Gopala Krishna A - " + tr("GUI programmer, Qt4 porter"),
      "Helene Parruitte - " + tr("programmer of the Verilog-AMS interface"),
      "Gunther Kraut - " + tr("equation solver contributions, exponential sources, author of documentation"),
      "Andrea Zonca - " + tr("temperature model for rectangular waveguide"),
      "Clemens Novak - " + tr("GUI programmer"),
      "You-Tang Lee (YodaLee) - " + tr("GUI programmer, Qt4 porter")
  }};

  trAuths = {{
    tr("German by") + " Stefan Jahn",
    tr("Polish by") + " Dariusz Pienkowski",
    tr("Romanian by") + " Radu Circa",
    tr("French by") + " Vincent Habchi, F5RCS",
    tr("Portuguese by") + " Luciano Franca, Helio de Sousa, Guilherme Brondani Torri",
    tr("Spanish by") + " Jose L. Redrejo Rodriguez",
    tr("Japanese by") + " Toyoyuki Ishikawa",
    tr("Italian by") + " Giorgio Luparia, Claudio Girardi",
    tr("Hebrew by") + " Dotan Nahum",
    tr("Swedish by") + " Markus Gothe, Peter Landgren",
    tr("Turkish by") + " Onur Cobanoglu, Ozgur Cobanoglu",
    tr("Hungarian by") + " Jozsef Bus",
    tr("Russian by") + " Igor Gorbounov",
    tr("Czech by") + " Marek Straka,Martin Stejskal",
    tr("Catalan by") + " Antoni Subirats",
    tr("Ukrainian by") + " Dystryk",
    tr("Arabic by") + " Chabane Noureddine",
    tr("Kazakh by") + " Erbol Keshubaev"
  }};
  
  std::shuffle(currAuths.begin(), currAuths.end(), rng);

  QLabel *lbl;

  setWindowTitle(tr("About Qucs"));

  all = new QVBoxLayout(this);
  //all->setContentsMargins(0,0,0,0);
  //all->setSpacing(0);

  QLabel *iconLabel = new QLabel();
  iconLabel->setPixmap(QPixmap(QString(":/bitmaps/hicolor/128x128/apps/qucs.png")));

  QWidget *hbox = new QWidget();
  QHBoxLayout *hl = new QHBoxLayout(hbox);
  hl->setContentsMargins(0,0,0,0);

  hl->addWidget(iconLabel);
  all->addWidget(hbox);
 
  QWidget *vbox = new QWidget();
  QVBoxLayout *vl = new QVBoxLayout(vbox);
  //vl->setContentsMargins(0,0,0,0);
  hl->addWidget(vbox);

  QString versionText;
  versionText = tr("Version")+" "+PACKAGE_VERSION+
#ifdef GIT
    " ("+GIT+") " +
#endif
    "\n";

  vl->addWidget(new QLabel("<span style='font-size:x-large; font-weight:bold;'>Quite Universal Circuit Simulator</span>"));
  lbl = new QLabel(versionText);
  lbl->setAlignment(Qt::AlignHCenter);
  vl->addWidget(lbl);
  vl->addWidget(new QLabel(tr("Copyright (C)")+" 2011-2016 Qucs Team\n"+
			   tr("Copyright (C)")+" 2003-2009 Michael Margraf"));

  lbl = new QLabel("\nThis is free software; see the source for copying conditions."
		   "\nThere is NO warranty; not even for MERCHANTABILITY or "
		   "\nFITNESS FOR A PARTICULAR PURPOSE.\n");
  lbl->setAlignment(Qt::AlignHCenter);
  all->addWidget(lbl);

  QTabWidget *t = new QTabWidget();
  all->addWidget(t);
  connect(t, SIGNAL(currentChanged(int)), this, SLOT(currentChangedSlot(int)));

  authorsBrowser = new QTextBrowser;
  // the Ctrl-Wheel event we would like to filter is handled by the viewport
  authorsBrowser->viewport()->installEventFilter(this);
  trBrowser = new QTextBrowser;
  trBrowser->viewport()->installEventFilter(this);

  QString supportText;
  // link to home page, help mailing list, IRC ?
  supportText = tr("Home Page") + " : <a href='http://qucs.sourceforge.net/'>http://qucs.sourceforge.net/</a><br/>"+
    tr("Documentation start page") + " : <a href='http://qucs.sourceforge.net/docs.html'>http://qucs.sourceforge.net/docs.html</a><br/>" +
    tr("Components reference manual") + " : <a href='http://qucs.github.io/qucs-manual/'>http://qucs.github.io/qucs-manual/</a><br/><br/>" +
    tr("If you need help on using Qucs, please join the") + "<br/>" +
    tr("help mailing list") + " : <a href='https://sourceforge.net/p/qucs/mailman/qucs-help/'>" + tr("qucs-help on SourceForge") + "</a><br/>" +
    "<small>(" + tr("please attach the schematic you are having problems with") + ")</small><br/><br/>" + 
    // use http://webchat.freenode.net/?channels=qucs ?
    tr("IRC general discussion channel") + " : <a href='irc://irc.freenode.net/qucs'>#qucs on freenode.net</a><br/><br/>" +
    tr("Additional resources") + " : <a href='https://github.com/Qucs/qucs#resources'>https://github.com/Qucs/qucs#resources</a>";

  QTextBrowser *supportBrowser = new QTextBrowser;
  supportBrowser->viewport()->installEventFilter(this);
  supportBrowser->setOpenExternalLinks(true);
  supportBrowser->setHtml(supportText);

  QString licenseText;
  licenseText = "Qucs 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, or (at your option) any later version.<br/><br/>This software is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details..<br/><br/> You should have received a copy of the GNU General Public License along with Qucs, see the file COPYING. If not see <a href='http://www.gnu.org/licenses/'>http://www.gnu.org/licenses/</a> or write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,Boston, MA 02110-1301, USA.";

  QTextBrowser *licenseBrowser = new QTextBrowser;
  licenseBrowser->viewport()->installEventFilter(this);
  licenseBrowser->setOpenExternalLinks(true);
  licenseBrowser->setHtml(licenseText);

  t->addTab(authorsBrowser, tr("Authors"));
  t->addTab(trBrowser, tr("Translations"));
  t->addTab(supportBrowser, tr("Support"));
  t->addTab(licenseBrowser, tr("License"));

  QWidget *hbBtn = new QWidget();
  QHBoxLayout *hlBtn = new QHBoxLayout(hbBtn);
  hlBtn->setContentsMargins(0,0,0,0);
  all->addWidget(hbBtn);

  QPushButton *okButton = new QPushButton(tr("&OK"), parent);
  okButton->setFocus();
  connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
  hlBtn->addStretch();
  hlBtn->addWidget(okButton);

  setAuthorsText();
  setTrText();
  prevTab = 0; // first Tab is selected by default
}