From 3e1d2590ac16c7d84dea4c0a89c906d8a4e45e65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mateusz=20P=C3=B3=C5=82rola?= Date: Wed, 8 Sep 2010 14:30:42 +0200 Subject: [PATCH] Search line gets focus afer start --- data/xsl/style.css | 44 ++++++++++++++++++++++++++++--- src/desktopWidget/MainWidget.cpp | 3 ++- src/mdictionary/gui/MainWindow.cpp | 2 ++ src/mdictionary/gui/NotifyManager.cpp | 1 + src/mdictionary/gui/SearchBarWidget.cpp | 29 ++++++++++++++------ src/mdictionary/gui/SearchBarWidget.h | 2 ++ 6 files changed, 68 insertions(+), 13 deletions(-) diff --git a/data/xsl/style.css b/data/xsl/style.css index 400f414..cf61a4d 100644 --- a/data/xsl/style.css +++ b/data/xsl/style.css @@ -1,9 +1,45 @@ -th.info { - background-color : #99FF99; +div.tab { + + border-style : solid; + border-width : 1px; + width : 100% } -th.key { - background-color : #99CCFF; +div.info { + font-weight : bold; + text-align : center; + + text-shadow : black 5px 5px 10px; + background-color : #99CCFF; + + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f7ffff), to(#dfffff)); + + padding-bottom: 8px; + padding-left: 10px; + padding-right: 10px; + padding-top: 8px; + + + +} + +div.key { + font-weight : bold; + text-align : center; + text-shadow : black 5px 5px 10px; + /*margin : 2px 2px 2px 2px; */ + background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#dfffff), to(#fffcca)); + padding-bottom: 8px; + padding-left: 10px; + padding-right: 10px; + padding-top: 8px; +} + +div.cell { + /*border-style : solid; + border-width : thin;*/ + /*margin : 2px 2px 2px 2px;*/ + background: -webkit-gradient(linear, 0% 0%, 0% 150%, from(#fffcca), to(#FFFFFF)); } span.i { diff --git a/src/desktopWidget/MainWidget.cpp b/src/desktopWidget/MainWidget.cpp index a4977a6..7a455ca 100644 --- a/src/desktopWidget/MainWidget.cpp +++ b/src/desktopWidget/MainWidget.cpp @@ -146,7 +146,8 @@ void HomeWidget::logoClicked() { void HomeWidget::paintEvent(QPaintEvent *event) { //custom painting of rounded corners QPainter p(this); - p.setBrush(QColor(0, 0, 0, 255)); + + p.setBrush(palette().background()); p.setPen(Qt::NoPen); diff --git a/src/mdictionary/gui/MainWindow.cpp b/src/mdictionary/gui/MainWindow.cpp index 71fe167..243f8c1 100644 --- a/src/mdictionary/gui/MainWindow.cpp +++ b/src/mdictionary/gui/MainWindow.cpp @@ -48,6 +48,8 @@ MainWindow::MainWindow(Backbone *backbone, QWidget *parent): setExactSearch(false); showMaximized(); + + searchBarWidget->setFocus(); } MainWindow::~MainWindow() { diff --git a/src/mdictionary/gui/NotifyManager.cpp b/src/mdictionary/gui/NotifyManager.cpp index d8b60ed..f2fe70e 100644 --- a/src/mdictionary/gui/NotifyManager.cpp +++ b/src/mdictionary/gui/NotifyManager.cpp @@ -103,6 +103,7 @@ void NotifyManager::showNotification(Notify::NotifyType type, QString text) { mbox->setIcon(QMessageBox::Information); + #endif break; diff --git a/src/mdictionary/gui/SearchBarWidget.cpp b/src/mdictionary/gui/SearchBarWidget.cpp index d9e73e9..f4ad398 100644 --- a/src/mdictionary/gui/SearchBarWidget.cpp +++ b/src/mdictionary/gui/SearchBarWidget.cpp @@ -88,20 +88,33 @@ QIcon SearchBarWidget::generateIcon(QIcon oryginal, qreal rotation) { newIcon.addPixmap(p); - p.setMask(p.createHeuristicMask()); - /* #ifdef Q_WS_MAEMO_5 - QPainter painter(&p); - QColor c = palette().background().color(); - // c.setAlpha(192); - painter.fillRect(p.rect(), c); + #ifdef Q_WS_MAEMO_5 + QImage img = p.toImage(); + + for(int i=0; i < img.width(); i++) { + for(int j=0; j < img.height(); j++) { + QColor c = img.pixel(i,j); + if(c != QColor(0,0,0,255)) { + c.setRed(c.red()/2); + c.setGreen(c.green()/2); + c.setBlue(c.blue()/2); + img.setPixel(i, j, c.rgb()); + } + } + } + p = p.fromImage(img); newIcon.addPixmap(p, QIcon::Disabled, QIcon::Off); - #endif*/ + #endif return newIcon; } +void SearchBarWidget::setFocus() { + searchWordLineEdit->setFocus(); +} + void SearchBarWidget::initializeUI() { #ifdef Q_WS_MAEMO_5 @@ -151,7 +164,7 @@ void SearchBarWidget::initializeUI() { clearSearchWordToolButton->setMaximumSize( clearSearchWordToolButton->sizeHint().height()/2, clearSearchWordToolButton->sizeHint().height()/2); - lineEditLayout->setContentsMargins(0,0,10,0); + lineEditLayout->setContentsMargins(0,0,15,0); #else clearSearchWordToolButton->setIcon(QIcon::fromTheme("edit-clear")); clearSearchWordToolButton->setMinimumSize( diff --git a/src/mdictionary/gui/SearchBarWidget.h b/src/mdictionary/gui/SearchBarWidget.h index 4c04bf6..0309bd9 100644 --- a/src/mdictionary/gui/SearchBarWidget.h +++ b/src/mdictionary/gui/SearchBarWidget.h @@ -112,6 +112,8 @@ public Q_SLOTS: */ void updateHistoryButtons(bool prev, bool next, bool list); + void setFocus(); + private Q_SLOTS: //! Clears search word line edit void clearSearchWordToolButtonClicked(); -- 1.7.9.5