summaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
diff options
context:
space:
mode:
authorRoopesh Chander <roop@forwardbias.in>2009-11-02 23:46:11 +0530
committerRoopesh Chander <roop@forwardbias.in>2009-11-02 23:46:11 +0530
commit5612b1a18303f7fe81e61e64ae544d48c8b2b43b (patch)
tree274dab7916ed6b0d3c8e7afdf6f59a01a4beb76f /mainwindow.cpp
parentb56a1448be88a65cae969d35450bd308a737d3c8 (diff)
searching for scraps. doesnt work all that great. :(
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index f9455f7..435b18d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -103,6 +103,7 @@ void MainWindow::createScrapsToolbar(QGraphicsScene *scene) {
m_scrapsToolbar->setZValue(1000);
connect(m_dropDownList, SIGNAL(activated(int)), SLOT(scrapDropDownListActivated(int)));
+ connect(m_searchBar, SIGNAL(textChanged(QString)), SLOT(searchTextChanged(QString)));
connect(m_gotoBrowserButton, SIGNAL(clicked()), SLOT(showBrowser()));
}
@@ -316,19 +317,43 @@ void MainWindow::updateDropDownList() {
}
void MainWindow::scrapDropDownListActivated(int index) {
+ QColor color = Qt::blue;
WebScrapContainer *scrap = m_dropDownList->itemData(index).value<WebScrapContainer*>();
for (int i = 0; i < m_scraps.count(); i++) {
WebScrapContainer *ithScrap = qobject_cast<WebScrapContainer*>(m_scraps.at(i));
if (m_scraps.at(i) == scrap) {
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
- effect->setColor(Qt::blue);
+ effect->setColor(color);
effect->setOffset(0, 0);
effect->setBlurRadius(10);
m_scraps.at(i)->setGraphicsEffect(effect);
bubbleUpScrap(m_scraps.at(i));
+ scrap->webScrap()->highlightText("views");
} else {
- m_scraps.at(i)->setGraphicsEffect(0);
+ if (m_scraps.at(i)->graphicsEffect() &&
+ m_scraps.at(i)->graphicsEffect()->property("color").value<QColor>() == color)
+ m_scraps.at(i)->setGraphicsEffect(0);
}
}
+}
+void MainWindow::searchTextChanged(const QString& text) {
+ QColor color("#ff6600");
+ for (int i = 0; i < m_scraps.count(); i++) {
+ WebScrapContainer *ithScrap = qobject_cast<WebScrapContainer*>(m_scraps.at(i));
+ bool highlighted = ithScrap->webScrap()->highlightText(text);
+ if (highlighted) {
+ QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
+ effect->setColor(color);
+ effect->setOffset(0, 0);
+ effect->setBlurRadius(10);
+ m_scraps.at(i)->setGraphicsEffect(effect);
+ bubbleUpScrap(m_scraps.at(i));
+ } else {
+ if (m_scraps.at(i)->graphicsEffect() &&
+ m_scraps.at(i)->graphicsEffect()->property("color").value<QColor>() == color) {
+ m_scraps.at(i)->setGraphicsEffect(0);
+ }
+ }
+ }
}