Пример #1
0
bool DictWidget::lookup(const QString &word)
{
    if (word.isEmpty())
    {
        return false;
    }

    resetSimilarWordsOffset();

    // Clean the word.
    word_ = word.trimmed();

    // Title
    QString result;
    bool ret = dict_.translate(word_, result);

    formatResult(result);

    // Result
    doc_.setHtml(result);

    // Always stop timer as the screen can be updated later.
    launchTimer(false);

    updateVisibleWidgets();
    onDetailsClicked(true);
    return ret;
}
Пример #2
0
bool DictFrame::lookup(const QString &word)
{
    if (word.isEmpty())
    {
        return false;
    }

    resetSimilarWordsOffset();

    // Clean the word.
    word_ = word.trimmed();

    // Title
    QString result;
    bool ret = dict_mgr_.translate(word_, result);

    formatResult(result);

    // Result
    doc_.setHtml(result);

    updateVisibleWidgets();
    onDetailsClicked(true);
    return ret;
}
Пример #3
0
void VideosWindow::onContextMenuRequested(const QPoint &pos)
{
    if (ui->objectList->currentIndex().data(UserRoleHeader).toBool()) return;

    QMenu *contextMenu = new KbMenu(this);
    contextMenu->setAttribute(Qt::WA_DeleteOnClose);
    contextMenu->addAction(tr("Delete"), this, SLOT(onDeleteClicked()));
    contextMenu->addAction(tr("Share"), this, SLOT(onShareClicked()));
    contextMenu->addAction(tr("Details"), this, SLOT(onDetailsClicked()));
    contextMenu->exec(this->mapToGlobal(pos));
}
Пример #4
0
bool DictWidget::lookup(const QString &word)
{
    if (word.isEmpty() || word_ == word.trimmed())
    {
        return false;
    }

    resetSimilarWordsOffset();

    // Clean the word.
    word_ = word.trimmed();

    //remove quotes (“ ” " ) If it in the words
    if(word_.contains(QChar(0x201C)) || word_.contains(QChar(0x201D)) || word_.contains(QChar(0x0022)))
    {
        word_.remove(QChar(0x201C));
        word_.remove(QChar(0x201D));
        word_.remove(QChar(0x0022));
    }

    // Title
    QString result;
    QString fuzzy_word("");
    bool ret = dict_.fuzzyTranslate(word_, result, fuzzy_word);
    fuzzy_word_ = fuzzy_word;

    formatResult(result, fuzzy_word);

    // Result
    doc_.setHtml(result);

    // Always stop timer as the screen can be updated later.
    launchTimer(false);

    update_parent_ = false;
    updateVisibleWidgets();
    onDetailsClicked(true);
    return ret;
}