connect(this, SIGNAL(searchWordList(QStringList)),
searchBarWidget, SLOT(searchWordList(QStringList)));
- connect(wordListWidget, SIGNAL(showTranslation(QList<Translation*>)),
- translationWidget, SLOT(show(QList<Translation*>)));
+ connect(backbone, SIGNAL(htmlReady())),
+ translationWidget, SLOT(show());
+
+ connect(backbone, SIGNAL(htmlReady()),
+ searchBarWidget, SLOT(showIdle()));
+
+ connect(wordListWidget, SIGNAL(clicked(QModelIndex)),
+ searchBarWidget, SLOT(showBusy()));
ui->centralWidget->layout()->addWidget(wordListWidget);
ui->centralWidget->layout()->addWidget(searchBarWidget);
historyShowToolButton->setEnabled(enabled);
}
+void SearchBarWidget::showBusy() {
+ searchingProgressBar->show();
+ setEnabled(false);
+}
+
+void SearchBarWidget::showIdle() {
+ searchingProgressBar->hide();
+ setEnabled(true);
+}
void SearchBarWidget::searchFinished() {
searchingProgressBar->hide();
void setEnabled(bool enabled = true);
void searchFinished();
void searchWordList(QStringList);
+ void showBusy();
+ void showIdle();
private Q_SLOTS:
void clearSearchWordToolButtonClicked();
void TranslationWidget::show() {
QWidget::show();
-}
-
-void TranslationWidget::show(QList<Translation*> translations) {
-
- show();
textEdit->clear();
+ QStringList translations = backbone->htmls();
+
QString trans;
- Translation* t;
+ QString t;
foreach(t, translations) {
- trans += t->toHtml() + "\n";
+ trans += t + "\n";
}
textEdit->setPlainText(trans);
textEdit->repaint(this->rect());
-
}
void TranslationWidget::initializeUI() {
public Q_SLOTS:
//! Request to show translation of word passed as QModelIndex from word list
void show();
- void show(QList<Translation*>);
private Q_SLOTS:
void showContextMenu(QPoint pos);
}
void WordListWidget::itemClicked(QModelIndex index) {
- emit showTranslation(searchResult[index.model()->data(index).toString()]);
+ backbone->searchHtml(searchResult[index.model()->data(index).toString()]);
}
#include <QtGui>
#include <QStringListModel>
#include "../backbone/backbone.h"
-
+#include "SearchBarWidget.h"
//! Displays list of words found in dictionaries
/*!