In settings widget on maemo add info button next to spin boxes
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 8 Sep 2010 06:56:22 +0000 (08:56 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Wed, 8 Sep 2010 06:56:22 +0000 (08:56 +0200)
src/mdictionary/gui/AboutWidget.cpp
src/mdictionary/gui/MainWindow.cpp
src/mdictionary/gui/SettingsWidget.cpp
src/mdictionary/gui/SettingsWidget.h
src/mdictionary/gui/SpinBox.cpp [new file with mode: 0644]
src/mdictionary/gui/SpinBox.h [new file with mode: 0644]
src/mdictionary/mdictionary.pro

index a10bc20..1a4763a 100644 (file)
@@ -31,7 +31,9 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
     comarchNote = "<center>Maemo/Meego Multilingual Dictionary</center>";
     comarchNote += "<center>Copyright 2006-2010, Comarch S.A. <br>";
     comarchNote += "<a href=\"http://mdictionary.garage.maemo.org\">"
-                   "http://mdictionary.garage.maemo.org</a></center>";
+                   "http://mdictionary.garage.maemo.org</a>";
+    comarchNote += "<br/><font size=\"small\"><a href=\"https://garage.maemo.org/tracker/?func=add&group_id=58&atid=305\">"
+                   "Report bug</a></font></center>";
     licenseNote = QString("<br><p><font size=\"small\">This program is free"
                   "software: you can redistribute it and/or modify\n"
                   "it under the terms of the GNU General Public License as"
@@ -56,11 +58,13 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
     setWindowTitle(tr("About"));
     mainLayout = new QVBoxLayout;
 
+    /*on desktop we place all content in scroll area, on maemo by default all
+    widgets that are in menu are placed in scroll area created by menu, so we
+    don't have to do it here*/
     #ifndef Q_WS_MAEMO_5
         scrollLayout = new QVBoxLayout;
         scroll = new QScrollArea;
         w = new QWidget(this);
-
     #endif
 
 
@@ -88,7 +92,7 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
     mainLayout->addWidget(mainLabel, 0, Qt::AlignHCenter);
     mainLayout->addWidget(licenseLabel, 0, Qt::AlignHCenter);
 
-
+    //add content to scroll area, and remove fram from it
     #ifndef Q_WS_MAEMO_5
         w->setLayout(mainLayout);
         scroll->setWidget(w);
@@ -102,9 +106,4 @@ AboutWidget::AboutWidget(GUIInterface *parent): QDialog(parent)
     #else
         setLayout(mainLayout);
     #endif
-
-
-
-
-
 }
index f2fab3c..71fe167 100644 (file)
@@ -160,6 +160,9 @@ void MainWindow::initializeMenuWidgets() {
     settingsWidget = new SettingsWidget(this);
     settingsWidget->hide();
 
+    connect(settingsWidget, SIGNAL(notify(Notify::NotifyType,QString)),
+            this, SLOT(showNotification(Notify::NotifyType,QString)));
+
     bookmarksWidget = new BookmarksWidget(this);
     bookmarksWidget->hide();
 
index 1056644..6bd634e 100644 (file)
@@ -39,29 +39,60 @@ void SettingsWidget::initalizeUI() {
     verticalLayout = new QVBoxLayout;
     setLayout(verticalLayout);
 
-    historySizeSpinBox = new QSpinBox;
-    searchResultSizeSpinBox = new QSpinBox;
-    limitTip = tr("Limits maximum number of found words, affects only when "
-                "searching in file.");
-    searchResultSizeSpinBox->setToolTip(limitTip);
+    historySizeLayout = new QHBoxLayout;
 
+    historySizeSpinBox = new SpinBox;
+    historySizeSpinBox->setMinimum(1);
+    historySizeSpinBox->setMaximum(50);
 
-    spinBoxesFormLayout = new QFormLayout;
-    spinBoxesFormLayout->addRow(tr("Search result size"),
-                                searchResultSizeSpinBox);
-    spinBoxesFormLayout->addRow(tr("History size"),
-                                historySizeSpinBox);
+    historySizeToolTip = tr("Limits maximum number of words saved in history");
+
+    #ifdef Q_WS_MAEMO_5
+        historySizeInfoToolButton = new QToolButton;
+        historySizeInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
+    #endif
+
+    historySizeLayout->addWidget(historySizeSpinBox);
+    #ifdef Q_WS_MAEMO_5
+        historySizeLayout->addWidget(historySizeInfoToolButton);
+    #endif
 
+
+
+
+    searchResultLayout = new QHBoxLayout;
+
+    searchResultSizeSpinBox = new SpinBox;
     searchResultSizeSpinBox->setMinimum(0);
+    searchResultSizeSpinBox->setMaximum(500);
     searchResultSizeSpinBox->setSpecialValueText(tr("Unlimited"));
-    historySizeSpinBox->setMinimum(1);
 
-    searchResultSizeSpinBox->setMaximum(500);
-    historySizeSpinBox->setMaximum(50);
+    searchResultSizeToolTip = tr("Limits maximum number of found words, affects"
+                                 "only when searching in file.");
+
+    #ifdef Q_WS_MAEMO_5
+        searchResultSizeInfoToolButton = new QToolButton;
+        searchResultSizeInfoToolButton->setIcon(QIcon::fromTheme("general_information"));
+    #endif
 
+    searchResultLayout->addWidget(searchResultSizeSpinBox);
     #ifdef Q_WS_MAEMO_5
-        verticalLayout->addSpacing(20);
+        searchResultLayout->addWidget(searchResultSizeInfoToolButton);
     #endif
+
+
+
+
+
+    spinBoxesFormLayout = new QFormLayout;
+    spinBoxesFormLayout->addRow(tr("Search result size"),
+                                searchResultLayout);
+    spinBoxesFormLayout->addRow(tr("History size"),
+                                historySizeLayout);
+
+
+
+
     verticalLayout->addLayout(spinBoxesFormLayout);
 
 
@@ -86,6 +117,18 @@ void SettingsWidget::initalizeUI() {
             SLOT(changed()));
 
 
+#ifdef Q_WS_MAEMO_5
+        connect(searchResultSizeInfoToolButton, SIGNAL(clicked()),
+                this, SLOT(showSearchResultSizeInfo()));
+
+        connect(historySizeInfoToolButton, SIGNAL(clicked()),
+                this, SLOT(showHistorySizeInfo()));
+#else
+        historySizeSpinBox->setToolTip(historySizeToolTip);
+        searchResultSizeSpinBox->setToolTip(searchResultSizeToolTip);
+#endif
+
+
     settings = 0;
 
     #ifndef Q_WS_MAEMO_5
@@ -186,3 +229,14 @@ void SettingsWidget::changed() {
         hide();
     }
 #endif
+
+
+#ifdef Q_WS_MAEMO_5
+    void SettingsWidget::showHistorySizeInfo() {
+        Q_EMIT notify(Notify::Warning, historySizeToolTip);
+    }
+
+    void SettingsWidget::showSearchResultSizeInfo() {
+        Q_EMIT notify(Notify::Warning, searchResultSizeToolTip);
+    }
+#endif
index 7cc5ce4..55ad2d0 100644 (file)
@@ -30,6 +30,7 @@
 #include <QPushButton>
 #include "../../include/GUIInterface.h"
 #include "../../include/settings.h"
+#include "SpinBox.h"
 
 //! Implements applications settings widget
 /*!
@@ -51,6 +52,8 @@ public:
       */
     explicit SettingsWidget(GUIInterface *parent = 0);
 
+Q_SIGNALS:
+    void notify(Notify::NotifyType, QString);
 
 protected:
     void showEvent(QShowEvent *);
@@ -61,22 +64,37 @@ private Q_SLOTS:
     #ifndef Q_WS_MAEMO_5
         void save();
     #endif
+    #ifdef Q_WS_MAEMO_5
+        void showSearchResultSizeInfo();
+        void showHistorySizeInfo();
+    #endif
 
 private:
     void initalizeUI();
-    QSpinBox* historySizeSpinBox;
-    QSpinBox* searchResultSizeSpinBox;
+    SpinBox* historySizeSpinBox;
+    SpinBox* searchResultSizeSpinBox;
     QVBoxLayout* verticalLayout;
     QFormLayout* spinBoxesFormLayout;
+    QHBoxLayout* historySizeLayout;
+    QHBoxLayout* searchResultLayout;
+
+    #ifdef Q_WS_MAEMO_5
+        QToolButton* historySizeInfoToolButton;
+        QToolButton* searchResultSizeInfoToolButton;
+    #endif
 
     QLabel* checkBoxesLabel;
     QCheckBox* searchInDictionariesCheckBox;
     QCheckBox* searchInBookmarksCheckBox;
 
+
     GUIInterface* guiInterface;
     Settings* settings;
     bool _changed;
-    QString limitTip;
+
+    QString searchResultSizeToolTip;
+    QString historySizeToolTip;
+
     #ifndef Q_WS_MAEMO_5
         QPushButton* closeButton;
         QHBoxLayout* footerLayout;
diff --git a/src/mdictionary/gui/SpinBox.cpp b/src/mdictionary/gui/SpinBox.cpp
new file mode 100644 (file)
index 0000000..5f21c1a
--- /dev/null
@@ -0,0 +1,31 @@
+/*******************************************************************************
+
+    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 "SpinBox.h"
+
+SpinBox::SpinBox(QWidget *parent) :
+    QSpinBox(parent)
+{
+    QLineEdit* le = lineEdit();
+    le->setEnabled(false);
+}
diff --git a/src/mdictionary/gui/SpinBox.h b/src/mdictionary/gui/SpinBox.h
new file mode 100644 (file)
index 0000000..7b4f3ed
--- /dev/null
@@ -0,0 +1,41 @@
+/*******************************************************************************
+
+    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 SPINBOX_H
+#define SPINBOX_H
+
+#include <QtGui>
+
+class SpinBox : public QSpinBox
+{
+    Q_OBJECT
+public:
+    explicit SpinBox(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // SPINBOX_H
index b1d7a32..9dd0c8e 100644 (file)
@@ -34,7 +34,8 @@ SOURCES += gui/main.cpp \
     gui/AboutWidget.cpp \
     gui/TranslationTextEdit.cpp \
     gui/DBusAdapter.cpp \
-    gui/NotifyManager.cpp
+    gui/NotifyManager.cpp \
+    gui/SpinBox.cpp
 
 HEADERS += gui/MainWindow.h \
     backbone/ConfigGenerator.h \
@@ -64,7 +65,8 @@ HEADERS += gui/MainWindow.h \
     ../include/AccentsNormalizer.h \
     ../include/DictDialog.h \
     gui/DBusAdapter.h \
-    gui/NotifyManager.h
+    gui/NotifyManager.h \
+    gui/SpinBox.h
 
 RESOURCES += ../../data/gui.qrc