Fixed closing menu, added bookmarks operations in different thread
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 18 Aug 2010 11:19:43 +0000 (13:19 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 18 Aug 2010 11:19:43 +0000 (13:19 +0200)
trunk/src/base/backbone/backbone.h
trunk/src/base/gui/AboutWidget.cpp
trunk/src/base/gui/BookmarksWidget.cpp [new file with mode: 0644]
trunk/src/base/gui/BookmarksWidget.h [new file with mode: 0644]
trunk/src/base/gui/MainWindow.cpp
trunk/src/base/gui/MenuWidget.cpp
trunk/src/base/gui/SettingsWidget.cpp
trunk/src/base/gui/WelcomeScreenWidget.cpp [new file with mode: 0644]
trunk/src/base/gui/WelcomeScreenWidget.h [new file with mode: 0644]
trunk/src/base/gui/WordListWidget.cpp
trunk/src/base/gui/mdictionary.png [new file with mode: 0755]

index 947dcbe..21cb3df 100644 (file)
@@ -148,8 +148,8 @@ public Q_SLOTS:
       */
     void addBookmark(QList<Translation*> translations) {
         foreach(Translation* translation, translations)
-            _bookmarks.add(translation);
-            //QtConcurrent::run(&bookmarks, &Bookmarks::add, translation);
+            //_bookmarks.add(translation);
+            QtConcurrent::run(_bookmarks, &Bookmarks::add, translation);
     }
 
 
index ddd6cdd..3da5fe9 100644 (file)
@@ -4,6 +4,7 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
 {
     QString infoNote, licenseNote, comarchNote;
     infoNote = "<center><h2><u>mDictionary</u></h2></center>";
+    infoNote += "<br><a href=\"http://mdictionary.garage.maemo.org/\"/>";
     infoNote += "<center>Meamo/Meego Mulitlingual Dictionary</center>";
     comarchNote = "<center>Copyright 2006-2010, Comarch S.A. </center>";
     licenseNote = "<br /><p><font size=\"small\">This program is free software: you can redistribute it and/or modify\n"
diff --git a/trunk/src/base/gui/BookmarksWidget.cpp b/trunk/src/base/gui/BookmarksWidget.cpp
new file mode 100644 (file)
index 0000000..7bbe036
--- /dev/null
@@ -0,0 +1,46 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "BookmarksWidget.h"
+
+BookmarksWidget::BookmarksWidget(GUIInterface *parent) :
+    QDialog(parent)
+{
+    setWindowTitle(tr("Bookmarks"));
+
+    verticalLayout = new QVBoxLayout;
+    setLayout(verticalLayout);
+
+    showAllBookmarksPushButton = new QPushButton(tr("Show all bookmarks"));
+    removeAllBookmarksPushButton =
+            new QPushButton(tr("Remove all bookmarks"));
+
+    verticalLayout->addWidget(showAllBookmarksPushButton);
+    verticalLayout->addWidget(removeAllBookmarksPushButton);
+
+    connect(showAllBookmarksPushButton, SIGNAL(clicked()),
+            this, SIGNAL(showAllBookmarks()));
+
+    connect(removeAllBookmarksPushButton, SIGNAL(clicked()),
+            this, SIGNAL(removeAllBookmarks()));
+}
diff --git a/trunk/src/base/gui/BookmarksWidget.h b/trunk/src/base/gui/BookmarksWidget.h
new file mode 100644 (file)
index 0000000..87b909c
--- /dev/null
@@ -0,0 +1,48 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef BOOKMARKSWIDGET_H
+#define BOOKMARKSWIDGET_H
+
+#include <QDialog>
+#include <QtGui>
+#include "../../includes/GUIInterface.h"
+
+class BookmarksWidget : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit BookmarksWidget(GUIInterface *parent = 0);
+
+Q_SIGNALS:
+    void showAllBookmarks();
+    void removeAllBookmarks();
+
+private:
+    QPushButton* showAllBookmarksPushButton;
+    QPushButton* removeAllBookmarksPushButton;
+    QVBoxLayout* verticalLayout;
+
+};
+
+#endif // BOOKMARKSWIDGET_H
index cb6000d..cfe8306 100644 (file)
@@ -167,6 +167,7 @@ void MainWindow::wordListReady() {
         int i = ui->centralWidget->layout()->indexOf(welcomeScreenWidget);
         QBoxLayout* l = (QBoxLayout*)(ui->centralWidget->layout());
         l->removeWidget(welcomeScreenWidget);
+        welcomeScreenWidget->deleteLater();
         l->insertWidget(0, wordListWidget);
         qDebug()<<"changed";
     }
@@ -469,7 +470,8 @@ void MainWindow::connectMenu() {
 
 
 void MainWindow::showAllBookmarks() {
-    qDebug()<<"asdas";
+    menuWidget->hideMenu();
+    backbone->fetchBookmarks();
 }
 
 void MainWindow::connectBookmarksWidget() {
@@ -477,8 +479,5 @@ void MainWindow::connectBookmarksWidget() {
             backbone, SLOT(removeAllBookmark()));
 
     connect(bookmarksWidget, SIGNAL(showAllBookmarks()),
-            menu, SLOT(hide()));
-
-    connect(menu, SIGNAL(aboutToHide()),
             this, SLOT(showAllBookmarks()));
 }
index cbf8138..fa6210b 100644 (file)
@@ -67,5 +67,5 @@ QWidget* MenuWidget::createWidget(QWidget *) {
 }
 
 void MenuWidget::hideMenu() {
-    tabWidget->hide();
+    tabWidget->parentWidget()->hide();
 }
index ddfec75..5b34ee5 100644 (file)
@@ -46,7 +46,7 @@ SettingsWidget::SettingsWidget(GUIInterface *parent) :
                                 historySizeSpinBox);
 
     searchResultSizeSpinBox->setMinimum(1);
-    historySizeSpinBox->setMaximum(1);
+    historySizeSpinBox->setMinimum(1);
 
     #ifdef Q_WS_MAEMO_5
         verticalLayout->addSpacing(20);
diff --git a/trunk/src/base/gui/WelcomeScreenWidget.cpp b/trunk/src/base/gui/WelcomeScreenWidget.cpp
new file mode 100644 (file)
index 0000000..a2c69b7
--- /dev/null
@@ -0,0 +1,52 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#include "WelcomeScreenWidget.h"
+
+WelcomeScreenWidget::WelcomeScreenWidget(QWidget *parent) :
+    QScrollArea(parent)
+{
+    QString infoNote, licenseNote, comarchNote;
+    infoNote = "<center><h2>Welcome in mDictionary!</h2></center>";
+
+
+    mainLayout = new QVBoxLayout(this);
+    setLayout(mainLayout);
+
+    imageLabel = new QLabel(this);
+    mainLabel = new QLabel(infoNote, this);
+
+    mainLayout->addWidget(imageLabel, 0, Qt::AlignCenter);
+    mainLayout->addWidget(mainLabel, 0, Qt::AlignCenter);
+
+    QImage img(":/icons/mdictionary.png");
+    imageLabel->setPixmap(QPixmap::fromImage(img));
+    imageLabel->resize(imageLabel->pixmap()->size());
+
+
+    //mainLabel->setWordWrap(true);
+
+    #ifdef Q_WS_MAEMO_5
+        mainLayout->addSpacing(20);
+    #endif
+}
diff --git a/trunk/src/base/gui/WelcomeScreenWidget.h b/trunk/src/base/gui/WelcomeScreenWidget.h
new file mode 100644 (file)
index 0000000..8a06634
--- /dev/null
@@ -0,0 +1,42 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+//Created by Mateusz Półrola
+
+#ifndef WELCOMESCREENWIDGET_H
+#define WELCOMESCREENWIDGET_H
+
+#include <QWidget>
+#include <QScrollArea>
+#include <QtGui>
+
+class WelcomeScreenWidget : public QScrollArea
+{
+    Q_OBJECT
+public:
+    explicit WelcomeScreenWidget(QWidget *parent = 0);
+
+private:
+    QVBoxLayout* mainLayout;
+    QLabel* mainLabel, * licenseLabel, *imageLabel;
+};
+
+#endif // WELCOMESCREENWIDGET_H
index df8902c..60cf791 100644 (file)
@@ -109,6 +109,8 @@ void WordListWidget::wordChecked(QModelIndex index) {
     QModelIndex item = selectedIndexes().at(0);
     if(!item.isValid()) return;
 
+    repaint();
+
     if(state == Qt::Checked) {
         emit addBookmark(searchResult[item.data().toString()]);
     }
diff --git a/trunk/src/base/gui/mdictionary.png b/trunk/src/base/gui/mdictionary.png
new file mode 100755 (executable)
index 0000000..3768425
Binary files /dev/null and b/trunk/src/base/gui/mdictionary.png differ