Added creation of inactive and rotated icons from standard hildon methods. Added...
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 11 Aug 2010 08:04:30 +0000 (10:04 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 11 Aug 2010 08:04:30 +0000 (10:04 +0200)
trunk/src/base/gui/MainWindow.cpp
trunk/src/base/gui/MainWindow.h
trunk/src/base/gui/MenuTabWidget.cpp
trunk/src/base/gui/SearchBarWidget.cpp
trunk/src/base/gui/SearchBarWidget.h

index 4752e8e..29e9452 100644 (file)
@@ -53,10 +53,10 @@ MainWindow::MainWindow(Backbone *backbone, QWidget *parent):
     connect(this, SIGNAL(search(QString)),
             searchBarWidget, SLOT(search(QString)));
 
-    connect(searchBarWidget, SIGNAL(searchForTranslations(QString)),
+    connect(searchBarWidget, SIGNAL(busy()),
             wordListWidget, SLOT(lockList()));
 
-    connect(searchBarWidget, SIGNAL(stopSearching()),
+    connect(searchBarWidget, SIGNAL(idle()),
             wordListWidget, SLOT(unlockList()));
 
     connect(wordListWidget, SIGNAL(selectedWord(QString)),
@@ -65,6 +65,12 @@ MainWindow::MainWindow(Backbone *backbone, QWidget *parent):
     connect(wordListWidget, SIGNAL(clicked(QModelIndex)),
             searchBarWidget, SLOT(setBusy()));
 
+    connect(searchBarWidget, SIGNAL(idle()),
+            this, SLOT(enableMenu()));
+
+    connect(searchBarWidget, SIGNAL(busy()),
+            this, SLOT(disableMenu()));
+
 
     ui->centralWidget->layout()->addWidget(wordListWidget);
     ui->centralWidget->layout()->addWidget(searchBarWidget);
@@ -102,6 +108,12 @@ void MainWindow::searchExactWord(QString word) {
     emit search(word);
 }
 
-void MainWindow::enableMenu(bool enabled) {
-    ui->menuBar->setVisible(enabled);
+void MainWindow::enableMenu() {
+    if(!ui->menuBar->actions().contains(menuWidget)) {
+        ui->menuBar->addAction(menuWidget);
+    }
+}
+
+void MainWindow::disableMenu() {
+    ui->menuBar->removeAction(menuWidget);
 }
index be80f29..9de028f 100644 (file)
@@ -61,7 +61,9 @@ protected:
     void closeEvent(QCloseEvent *);
 
 private Q_SLOTS:
-    void enableMenu(bool);
+    void enableMenu();
+
+    void disableMenu();
 
 private:
     Backbone* backbone;
index 620a2aa..3f90967 100644 (file)
@@ -29,7 +29,8 @@ MenuTabWidget::MenuTabWidget(QWidget *parent) :
     setMinimumHeight(400);
 }
 
-void MenuTabWidget::hideEvent(QHideEvent *) {
+
+void MenuTabWidget::hideEvent(QHideEvent *e) {
     //just set parent to null, and allow event to by handled by default handler
     setParent(NULL);
- }
+}
index 3c66688..94b0045 100644 (file)
@@ -80,6 +80,13 @@ SearchBarWidget::~SearchBarWidget() {
 QIcon SearchBarWidget::generateIcon(QIcon oryginal, qreal rotation) {
     QPixmap p = oryginal.pixmap(64);
 
+    if(rotation != 0) {
+        QMatrix m;
+        m.rotate(rotation);
+
+        p = p.transformed(m);
+    }
+
     QIcon newIcon;
     newIcon.addPixmap(p);
 
@@ -126,20 +133,8 @@ void SearchBarWidget::initializeUI() {
 
     historyShowToolButton = new QToolButton();
     historyShowToolButton->setIcon(
-            generateIcon(QIcon::fromTheme("general_back")));
-
-
-    QPixmap p = historyShowToolButton->icon().pixmap(256);
-    qDebug()<<p.size();
-    QMatrix m;
-    m.rotate(90);
-
-    QPixmap p2 = p.transformed(m);
-    qDebug()<<p2.size();
-
+            generateIcon(QIcon::fromTheme("general_back"), 90));
 
-    QIcon temp(p2);
-    historyShowToolButton->setIcon(temp);
 
 
     searchingProgressBar = new QProgressBar();
@@ -203,6 +198,7 @@ void SearchBarWidget::setBusy() {
     searchPushButton->setText(tr("Stop"));
     setEnabled(false);
     _isSearching = true;
+    emit busy();
 }
 
 void SearchBarWidget::setIdle() {
@@ -211,6 +207,7 @@ void SearchBarWidget::setIdle() {
     searchPushButton->setText(tr("Search"));
     setEnabled(true);
     _isSearching = false;
+    emit idle();
 }
 
 void SearchBarWidget::historyNextToolButtonClicked() {
index 37ab63e..fbceb03 100644 (file)
@@ -52,6 +52,10 @@ Q_SIGNALS:
     //! Request to stop all active searchings
     void stopSearching();
 
+    void busy();
+
+    void idle();
+
 public Q_SLOTS:
     //! Enable or disable search word line edit and history buttons
     /*!