Added icon and rounded corners
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 31 Aug 2010 12:10:43 +0000 (14:10 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Tue, 31 Aug 2010 12:10:43 +0000 (14:10 +0200)
data/icons/gui.qrc
trunk/src/desktopWidget/MainWidget.cpp
trunk/src/desktopWidget/MainWidget.h
trunk/src/desktopWidget/desktopWidget.pro

index f181519..6fe251e 100644 (file)
@@ -6,5 +6,6 @@
         <file>96x96/staron.png</file>
         <file>16x16/staroff.png</file>
         <file>16x16/staron.png</file>
+        <file>64x64/mdictionary.png</file>
     </qresource>
 </RCC>
index 061298d..fe2cace 100644 (file)
 #include <QList>
 #include <QDebug>
 
+
 MainWidget::MainWidget(QWidget *parent):
     QWidget(parent)
 {
+    setAttribute(Qt::WA_TranslucentBackground);
+
     QCoreApplication::instance()->setApplicationName(
             "mDictionary desktop widget");
 
@@ -68,24 +71,34 @@ MainWidget::MainWidget(QWidget *parent):
     layout = new QVBoxLayout;
     setLayout(layout);
 
-    title = new QLabel("mDictionary");
+    title = new QLabel("<b>mDictionary</b>");
+
+
     layout->addWidget(title,0, Qt::AlignHCenter);
 
 
     searchStringLineEdit = new QLineEdit;
     searchButton = new QPushButton(tr("Search"));
 
+    logo = new QLabel;
+    logo->setPixmap(QPixmap(":/icons/64x64/mdictionary.png").scaledToHeight(searchButton->sizeHint().height()));
+
     horizontalLayout = new QHBoxLayout;
+    horizontalLayout->addWidget(logo);
     horizontalLayout->addWidget(searchStringLineEdit);
     horizontalLayout->addWidget(searchButton);
 
     layout->addLayout(horizontalLayout);
 
+
+
     connect(searchButton, SIGNAL(clicked()),
             this, SLOT(search()));
 }
 
 void MainWidget::search() {
+    if(searchStringLineEdit->text().isEmpty()) return;
+
     QDBusMessage message =
             QDBusMessage::createMethodCall("com.comarch.mdictionary",
                                            "/mainWindow",
@@ -98,3 +111,15 @@ void MainWidget::search() {
 
     QDBusConnection::sessionBus().send(message);
 }
+
+void MainWidget::paintEvent(QPaintEvent *event) {
+
+    QPainter p(this);
+    p.setBrush(QColor(0, 0, 0, 255));
+
+    p.setPen(Qt::NoPen);
+
+    p.drawRoundedRect(rect(), 25, 25);
+
+    p.end();
+}
index 2ee6fdd..4ee0ff0 100644 (file)
@@ -27,6 +27,7 @@
 #include <QWidget>
 #include <QtGui>
 #include <QtDBus/QDBusConnection>
+#include <QPushButton>
 
 class MainWidget : public QWidget
 {
@@ -37,10 +38,14 @@ public:
 private slots:
     void search();
 
+protected:
+    void paintEvent(QPaintEvent *);
+
 private:
     QLineEdit* searchStringLineEdit;
     QPushButton* searchButton;
     QLabel* title;
+    QLabel*logo;
     QVBoxLayout* layout;
     QHBoxLayout* horizontalLayout;
 };
index 8344634..6aed979 100644 (file)
@@ -38,3 +38,6 @@ SOURCES += \
 
 HEADERS += \
     MainWidget.h
+
+RESOURCES += \
+    ../../../data/icons/gui.qrc