void PediaMainForm::handleControlSelect(const EventType& event) { LookupManager* lookupManager = app().getLookupManager(); if (NULL != lookupManager && lookupManager->lookupInProgress()) return; bool fFullText = false; switch (event.data.ctlSelect.controlID) { case searchButton: // If button held for more than ~300msec, perform full text search. if (TimGetTicks() - lastPenDownTimestamp_ > app().ticksPerSecond()/3) fFullText = true; search(fFullText); break; case backButton: moveHistory(false); break; case forwardButton: moveHistory(true); break; default: assert(false); } }
ConsoleDock::ConsoleDock(QWidget *parent) : QDockWidget(parent) , mPlainTextEdit(new QPlainTextEdit) , mLineEdit(new QLineEdit) { setObjectName(QLatin1String("ConsoleDock")); setWindowTitle(tr("Console")); QWidget *widget = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(widget); layout->setMargin(0); layout->setSpacing(0); mPlainTextEdit->setReadOnly(true); QPalette p = mPlainTextEdit->palette(); p.setColor(QPalette::Base, Qt::black); p.setColor(QPalette::Text, Qt::lightGray); mPlainTextEdit->setPalette(p); mLineEdit->setPlaceholderText(tr("Execute script")); mLineEdit->setClearButtonEnabled(true); connect(mLineEdit, &QLineEdit::returnPressed, this, &ConsoleDock::executeScript); auto previousShortcut = new QShortcut(Qt::Key_Up, mLineEdit, nullptr, nullptr, Qt::WidgetShortcut); connect(previousShortcut, &QShortcut::activated, [this] { moveHistory(-1); }); auto nextShortcut = new QShortcut(Qt::Key_Down, mLineEdit, nullptr, nullptr, Qt::WidgetShortcut); connect(nextShortcut, &QShortcut::activated, [this] { moveHistory(1); }); layout->addWidget(mPlainTextEdit); layout->addWidget(mLineEdit); const auto outputs = PluginManager::objects<LoggingInterface>(); for (LoggingInterface *output : outputs) registerOutput(output); connect(PluginManager::instance(), &PluginManager::objectAdded, this, &ConsoleDock::onObjectAdded); setWidget(widget); }