/* DocsPage::onNavigationDone * Called when a page finishes loading in the browser *******************************************************************/ void DocsPage::onNavigationDone(wxEvent& e) { updateNavButtons(); //wxWebViewEvent& ev = (wxWebViewEvent&)e; //LOG_MESSAGE(0, ev.GetURL()); }
void BlockExplorer::forward() { int NewIndex = m_HistoryIndex + 1; if (0 <= NewIndex && NewIndex < m_History.size()) { m_HistoryIndex = NewIndex; ui->searchBox->setText(m_History[NewIndex]); switchTo(m_History[NewIndex]); updateNavButtons(); } }
void BlockExplorer::goTo(const QString& query) { if (switchTo(query)) { ui->searchBox->setText(query); while (m_History.size() > m_HistoryIndex + 1) m_History.pop_back(); m_History.push_back(query); m_HistoryIndex = m_History.size() - 1; updateNavButtons(); } }
// Triggered when a word is clicked void Thesaurus::slotFindTerm(const QString &term, bool addToHistory) { // slotSetReplaceTerm(term); if (term.startsWith("http://")) { (void) new KRun(KUrl(term),0L); } else { if (addToHistory && m_edit->itemText(0) != term) { m_edit->insertItem(0, term); m_historyPos = m_edit->count(); m_edit->setCurrentIndex(0); } updateNavButtons(); findTermThesaurus(term); findTermWordnet(term); } }
void BlockExplorer::showEvent(QShowEvent*) { if (m_NeverShown) { m_NeverShown = false; CBlockIndex* pindexBest = mapBlockIndex[chainActive.Tip()->GetBlockHash()]; setBlock(pindexBest); QString text = QString("%1").arg(pindexBest->nHeight); ui->searchBox->setText(text); m_History.push_back(text); updateNavButtons(); if (!GetBoolArg("-txindex", false)) { QString Warning = tr("Not all transactions will be shown. To view all transactions you need to set txindex=1 in the configuration file (pivx.conf)."); QMessageBox::warning(this, "PIVX Core Blockchain Explorer", Warning, QMessageBox::Ok); } } }
/* DocsPage::onToolbarButton * Called when a toolbar button is clicked *******************************************************************/ void DocsPage::onToolbarButton(wxCommandEvent& e) { string button = e.GetString(); // Back if (button == "back" && wv_browser->CanGoBack()) wv_browser->GoBack(); // Forward else if (button == "forward" && wv_browser->CanGoForward()) wv_browser->GoForward(); // Home else if (button == "home") wv_browser->LoadURL(docs_url); // Tutorials else if (button == "tutorials") wv_browser->LoadURL(docs_url + "?page=Tutorials"); // Index else if (button == "index") wv_browser->LoadURL(docs_url + "?page=Wiki-Index"); // Edit else if (button == "edit") { // Stuff string page = wv_browser->GetCurrentURL().AfterLast('='); wxLaunchDefaultBrowser("https://github.com/sirjuddington/SLADE/wiki/" + page + "/_edit"); } // None else return; updateNavButtons(); }
Thesaurus::Thesaurus() { m_standAlone = false; m_thesProc = new KProcess; m_wnProc = new KProcess; m_dialog = new KDialog(0); m_dialog->setButtons(KDialog::Help | KDialog::Ok | KDialog::Cancel); m_dialog->setDefaultButton(KDialog::Ok); m_dialog->setHelp(QString(), "thesaurus"); m_dialog->resize(600, 400); KConfigGroup cfg = KGlobal::config()->group(""); m_dataFile = cfg.readEntry("datafile"); if (m_dataFile.isEmpty()) m_dataFile = KGlobal::dirs()->findResource("data", "koffice/thesaurus/thesaurus.txt"); setCaption(); m_noMatch = i18n("(No match)"); m_historyPos = 1; QWidget *page = new QWidget(); m_dialog->setMainWidget(page); QVBoxLayout *topLayout = new QVBoxLayout(page); topLayout->setMargin(KDialog::marginHint()); topLayout->setSpacing(KDialog::spacingHint()); QHBoxLayout *row1 = new QHBoxLayout; topLayout->addLayout(row1); m_edit = new KHistoryComboBox(page); QLabel editLabel(i18n("&Search for:"), page); editLabel.setBuddy(m_edit); m_search = new KPushButton(i18n("S&earch"), page); connect(m_search, SIGNAL(clicked()), this, SLOT(slotFindTerm())); row1->addWidget(&editLabel, 0); row1->addWidget(m_edit, 1); row1->addWidget(m_search, 0); m_back = new QToolButton(page); m_back->setIcon(KIcon(QString::fromLatin1("go-previous"))); m_back->setToolTip(i18nc("@action:button Go back to the previous word in history", "Back")); row1->addWidget(m_back, 0); m_forward = new QToolButton(page); m_forward->setIcon(KIcon(QString::fromLatin1("go-next"))); m_forward->setToolTip(i18nc("@action:button Go forward to the next word in history", "Forward")); row1->addWidget(m_forward, 0); KPushButton *lang = new KPushButton(i18n("Change Language..."), page); connect(lang, SIGNAL(clicked()), this, SLOT(slotChangeLanguage())); row1->addWidget(lang, 0); connect(m_back, SIGNAL(clicked()), this, SLOT(slotBack())); connect(m_forward, SIGNAL(clicked()), this, SLOT(slotForward())); m_tabWidget = new KTabWidget(page); topLayout->addWidget(m_tabWidget); // // Thesaurus Tab // QWidget *thesWidget = new QWidget(m_tabWidget); m_tabWidget->addTab(thesWidget, i18n("&Thesaurus")); QHBoxLayout *thesLayout = new QHBoxLayout; thesLayout->setSpacing(KDialog::spacingHint()); thesWidget->setLayout(thesLayout); QGroupBox *synGroupBox = new QGroupBox(i18n("Synonyms"), thesWidget); QHBoxLayout *synLayout = new QHBoxLayout(); synGroupBox->setLayout(synLayout); m_synListWidget = new QListWidget(synGroupBox); synLayout->addWidget(m_synListWidget); thesLayout->addWidget(synGroupBox); QGroupBox *hyperGroupBox = new QGroupBox(i18n("More General Words"), thesWidget); QHBoxLayout *hyperLayout = new QHBoxLayout(); hyperGroupBox->setLayout(hyperLayout); m_hyperListWidget = new QListWidget(hyperGroupBox); hyperLayout->addWidget(m_hyperListWidget); thesLayout->addWidget(hyperGroupBox); QGroupBox *hypoGroupBox = new QGroupBox(i18n("More Specific Words"), thesWidget); QHBoxLayout *hypoLayout = new QHBoxLayout(); hypoGroupBox->setLayout(hypoLayout); m_hypoListWidget = new QListWidget(hypoGroupBox); hypoLayout->addWidget(m_hypoListWidget); thesLayout->addWidget(hypoGroupBox); // single click -- keep display unambiguous by removing other selections: connect(m_synListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotSetReplaceTermSyn(QListWidgetItem *))); connect(m_hyperListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotSetReplaceTermHyper(QListWidgetItem *))); connect(m_hypoListWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotSetReplaceTermHypo(QListWidgetItem *))); // double click -- set the double clicked item as the new search term connect(m_synListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotFindTermFromList(QListWidgetItem *))); connect(m_hyperListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotFindTermFromList(QListWidgetItem *))); connect(m_hypoListWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(slotFindTermFromList(QListWidgetItem *))); // // WordNet Tab // QWidget *wnWidget = new QWidget(m_tabWidget); m_tabWidget->addTab(wnWidget, i18n("&Wordnet")); QVBoxLayout *wnLayout = new QVBoxLayout; wnLayout->setSpacing(KDialog::spacingHint()); wnLayout->setMargin(KDialog::marginHint()); wnWidget->setLayout(wnLayout); m_wnComboBox = new KComboBox(wnWidget); m_wnComboBox->setEditable(false); wnLayout->addWidget(m_wnComboBox); connect(m_wnComboBox, SIGNAL(activated(int)), this, SLOT(slotFindTerm())); m_resultTextBrowser = new KTextBrowser(wnWidget); m_resultTextBrowser->setReadOnly(true); connect(m_resultTextBrowser, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(slotFindTermFromUrl(const QUrl &))); wnLayout->addWidget(m_resultTextBrowser); // Connect for the history box m_edit->setTrapReturnKey(true); // Do not use Return as default key... connect(m_edit, SIGNAL(returnPressed()), this, SLOT(slotFindTerm())); connect(m_edit, SIGNAL(activated(int)), this, SLOT(slotGotoHistory(int))); QHBoxLayout *row2 = new QHBoxLayout( /*m_top_layout*/ ); topLayout->addLayout(row2); m_replaceLineEdit = new KLineEdit(page); m_replaceLabel = new QLabel(i18n("&Replace with:"), page); m_replaceLabel->setBuddy(m_replaceLineEdit); row2->addWidget(m_replaceLabel, 0); row2->addWidget(m_replaceLineEdit, 1); // Set focus m_edit->setFocus(); updateNavButtons(); connect(m_dialog, SIGNAL(accepted()), this, SLOT(process())); connect(m_dialog, SIGNAL(rejected()), this, SLOT(dialogClosed())); }