Copyright 2010 Comarch S.A.
*******************************************************************************/
-/*! \file AboutWidget.cpp
-\brief Simple "about" widget - product, company, license info
-
-
-\author Bartosz Szatkowski <bulislaw@linux.com>
-*/
+//! \file AboutWidget.cpp
+//! \brief Simple "about" widget - product, company, license info
+//! \author Bartosz Szatkowski <bulislaw@linux.com>
#include "AboutWidget.h"
Copyright 2010 Comarch S.A.
*******************************************************************************/
-/*! \file AboutWidget.h
-\brief Simple "about" widget - product, company, license info
+//! \file AboutWidget.h
+//! \brief Simple "about" widget - product, company, license info
+//! \author Bartosz Szatkowski <bulislaw@linux.com>
-\author Bartosz Szatkowski <bulislaw@linux.com>
-*/
#ifndef ABOUTWIDGET_H
#define ABOUTWIDGET_H
*******************************************************************************/
//! \file BookmarksWidget.cpp
-//! \brief Bookmarks management widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "BookmarksWidget.h"
*******************************************************************************/
//! \file BookmarksWidget.h
-//! \brief Bookmarks management widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef BOOKMARKSWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file DBusAdapter.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "DBusAdapter.h"
#include <QDebug>
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file DBusAdapter.h
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef DBUSADAPTER_H
#define DBUSADAPTER_H
*******************************************************************************/
//! \file DictManagerWidget.cpp
-//! \brief Dicrionaries management widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "DictManagerWidget.h"
}
void DictManagerWidget::removeButtonClicked() {
+ qDebug()<<dictsHash.count();
if(QMessageBox::question(this, tr("Remove dictionary"),
tr("Do you want to remove selected dictionary?"),
- QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) {
+ QMessageBox::Yes, QMessageBox::Cancel) == QMessageBox::Yes) {
QList<QListWidgetItem*> selected = dictListWidget->selectedItems();
if(selected.count() > 0) {
- refreshDictsList();
emit removeDictionary(dictsHash[selected[0]]);
+ refreshDictsList();
}
}
}
*******************************************************************************/
//! \file DictManagerWidget.h
-//! \brief Dictionary management widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef DICTMANAGERWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file DictTypeSelectDialog.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "DictTypeSelectDialog.h"
*******************************************************************************/
//! \file DictTypeSelectDialog.h
-//! \brief Implements plugin selection dialog
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef DICTTYPESELECTDIALOG_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file HistoryListDialog.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "HistoryListDialog.h"
*******************************************************************************/
//! \file HistoryListDialog.h
-//! \brief Implements history list dialog
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef HISTORYLISTDIALOG_H
//! Implements history list dialog
/*!
Shows history list and allows user to select one word of it.
- */
+ On desktop it is shown as popup.
+*/
class HistoryListDialog : public QDialog
{
Q_OBJECT
/*!
\param words list of history words
\param parent widget
- */
+ */
explicit HistoryListDialog(QStringList words, QWidget* parent = 0);
//! Returns word selected by user
//if nothing was found
if(backboneResult.count() == 0) {
- showNotify(Notify::Info, tr("Can't find any matching words"));
+ showNotification(Notify::Info, tr("Can't find any matching words"));
//show empty list to remove results of old search
Q_EMIT showWordList(searchResult);
Q_EMIT searchTranslations(exactTranslation);
}
else {
- showNotify(Notify::Info,
+ showNotification(Notify::Info,
tr("Can't find exactly matching word"));
}
}
-void MainWindow::showNotify(Notify::NotifyType type, QString text) {
- notifyManager->showNotify(type, text);
+void MainWindow::showNotification(Notify::NotifyType type, QString text) {
+ notifyManager->showNotification(type, text);
}
void MainWindow::connectBackbone() {
this, SIGNAL(setIdle()));
connect(backbone, SIGNAL(notify(Notify::NotifyType,QString)),
- this, SLOT(showNotify(Notify::NotifyType,QString)));
+ this, SLOT(showNotification(Notify::NotifyType,QString)));
}
void MainWindow::connectSearchBar() {
\param type type of notify
\param message notify message
*/
- void showNotify(Notify::NotifyType type, QString message);
+ void showNotification(Notify::NotifyType type, QString message);
private Q_SLOTS:
//! Disables menu
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file MenuTabWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "MenuTabWidget.h"
#include <QDebug>
*******************************************************************************/
//! \file MenuTabWidget.h
-//! \brief Implements menu tab widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef MENUTABWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file MenuWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "MenuWidget.h"
#include <QDebug>
*******************************************************************************/
//! \file MenuWidget.h
-//! \brief Implements custom menu
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef MENUWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file NotifyManager.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "NotifyManager.h"
#include <QMessageBox>
{
}
-void NotifyManager::notifyClosed() {
+
+void NotifyManager::notificationClosed() {
QObject* dialog = QObject::sender();
QHash<QString, QDialog*>::Iterator it;
}
}
-void NotifyManager::showNotify(Notify::NotifyType type, QString text) {
+void NotifyManager::showNotification(Notify::NotifyType type, QString text) {
if(activeNotifies.contains(text)) {
return;
}
activeNotifies.insert(text, mbox);
- connect(mbox, SIGNAL(finished(int)), this, SLOT(notifyClosed()));
+ connect(mbox, SIGNAL(finished(int)), this, SLOT(notificationClosed()));
mbox->exec();
}
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file NotifyManager.h
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef NOTIFYMANAGER_H
#define NOTIFYMANAGER_H
#include <QDialog>
#include "../../includes/Notify.h"
+//! Manages notifications in applications
+/*!
+ Shows notifications to user, assures that couple of the same notification
+ will not be displayed at the same time. It automatically delete
+ notifications after user accept or reject it.
+*/
+
class NotifyManager : public QObject
{
Q_OBJECT
NotifyManager(QObject *parent = 0);
public slots:
- void showNotify(Notify::NotifyType type, QString text);
+ //! Shows notification
+ /*!
+ Displays new notification of passed type containing passed text
+ \param type type of notification
+ \param text text of notification
+ \sa Notify::NotifyType
+ */
+ void showNotification(Notify::NotifyType type, QString text);
+
+ //! Refresh all notifications when stacked widgets changes
void screenChanged();
private slots:
- void notifyClosed();
+ //! Informs that notification was closed and can be deleted
+ void notificationClosed();
private:
QHash<QString, QDialog*> activeNotifies;
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file SearchBarWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "SearchBarWidget.h"
initializeUI();
- _isSearching = false;
+ busy = false;
connect(searchPushButton, SIGNAL(clicked()),
this, SLOT(searchPushButtonClicked()));
historyPrevToolButton->setEnabled(false);
historyNextToolButton->setEnabled(false);
historyShowToolButton->setEnabled(false);
+
setEnabled(true);
}
clearSearchWordToolButton = new QToolButton;
#ifdef Q_WS_MAEMO_5
clearSearchWordToolButton->setIcon(QIcon::fromTheme("general_stop"));
- //tool buttons will have size 2 times smaller
clearSearchWordToolButton->setMaximumSize(
clearSearchWordToolButton->sizeHint().height()/2,
clearSearchWordToolButton->sizeHint().height()/2);
void SearchBarWidget::searchPushButtonClicked() {
- if(_isSearching) {
+ if(busy) {
Q_EMIT stopSearching();
}
else {
void SearchBarWidget::search(QString word) {
- if(!_isSearching && !word.isEmpty()) {
+ if(!busy && !word.isEmpty()) {
completerModel->insertRow(completerModel->rowCount());
QModelIndex index =
completerModel->index(completerModel->rowCount() -1);
}
void SearchBarWidget::searchDelay(QString word) {
- if(!_isSearching && !word.isEmpty()) {
+ if(!busy && !word.isEmpty()) {
searchWordLineEdit->setText(word);
void SearchBarWidget::delaySearchTimeout() {
delayTimer.stop();
- if(!_isSearching) {
+ if(!busy) {
Q_EMIT searchForTranslations(delayString);
}
}
}
void SearchBarWidget::setBusy() {
- if(_isSearching) return;
+ if(busy) return;
searchingProgressBar->show();
searchPushButton->setText(tr("Stop"));
setEnabled(false);
- _isSearching = true;
+ busy = true;
}
void SearchBarWidget::setIdle() {
- if(!_isSearching) return;
+ if(!busy) return;
searchingProgressBar->hide();
searchPushButton->setText(tr("Search"));
setEnabled(true);
- _isSearching = false;
+ busy = false;
Q_EMIT refreshHistoryButtons();
}
void SearchBarWidget::updateHistoryButtons(bool prev, bool next, bool list) {
- if(!_isSearching) {
+ if(!busy) {
historyPrevToolButton->setEnabled(prev);
historyNextToolButton->setEnabled(next);
historyShowToolButton->setEnabled(list);
}
void SearchBarWidget::showHistoryButtonClicked() {
- #ifndef Q_WS_MAEMO_5
+ #ifdef Q_WS_MAEMO_5
+ emit historyShow();
+ #else
QPoint p = historyShowToolButton->pos();
p.setY(p.y());
emit historyShow(mapToGlobal(p));
- #else
- emit historyShow();
#endif
}
*******************************************************************************/
//! \file SearchBarWidget.h
-//! \brief Implements search bar
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
QProgressBar* searchingProgressBar;
- //! generates icon for maemo
+ //! generates icon for maemo (some of icons we use don't have inactive
+ //! pixmaps, so we generate them
+ /*!
+ \param oryginal oryginal icon
+ \param rotation rotation of resulting icon
+ */
QIcon generateIcon(QIcon oryginal, qreal rotation=0);
QVBoxLayout* verticalLayout;
- bool _isSearching;
+ bool busy;
QTimer delayTimer;
QString delayString;
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file SettingsWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "SettingsWidget.h"
#include <QDebug>
setWindowTitle(tr("Settings"));
+ initalizeUI();
+}
+
+void SettingsWidget::initalizeUI() {
verticalLayout = new QVBoxLayout;
setLayout(verticalLayout);
historySizeSpinBox = new QSpinBox;
searchResultSizeSpinBox = new QSpinBox;
+
limitTip = "Limit maximal number of finded words, affect only when "
- "searching in file.";
+ "searching in file";
searchResultSizeSpinBox->setToolTip(limitTip);
- spinBoxesFormLayout = new QFormLayout;
+ spinBoxesFormLayout = new QFormLayout;
spinBoxesFormLayout->addRow(tr("Search result size"),
searchResultSizeSpinBox);
-
spinBoxesFormLayout->addRow(tr("History size"),
historySizeSpinBox);
searchResultSizeSpinBox->setMinimum(0);
+ searchResultSizeSpinBox->setSpecialValueText(tr("Unlimited"));
historySizeSpinBox->setMinimum(1);
+ searchResultSizeSpinBox->setMaximum(500);
+ historySizeSpinBox->setMaximum(50);
+
#ifdef Q_WS_MAEMO_5
verticalLayout->addSpacing(20);
#endif
#ifndef Q_WS_MAEMO_5
_save = false;
#endif
+
settings = guiInterface->settings();
historySizeSpinBox->setValue(
QDialog::hideEvent(e);
#ifndef Q_WS_MAEMO_5
- if(settings && _save) {
+ if(settings && _save) {
#else
- if(settings && _changed &&
- QMessageBox::question(this, tr("Save"), tr("Do you want to save changes?"),
+ if(settings && _changed &&
+ QMessageBox::question(this,
+ tr("Save"),
+ tr("Do you want to save changes?"),
QMessageBox::Save, QMessageBox::Cancel) == QMessageBox::Save) {
#endif
*******************************************************************************/
//! \file DictManagerWidget.h
-//! \brief Settings widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef SETTINGSWIDGET_H
void showEvent(QShowEvent *);
void hideEvent(QHideEvent *);
+private Q_SLOTS:
+ void changed();
+ #ifndef Q_WS_MAEMO_5
+ void save();
+ #endif
+
private:
+ void initalizeUI();
QSpinBox* historySizeSpinBox;
QSpinBox* searchResultSizeSpinBox;
QVBoxLayout* verticalLayout;
QPushButton* closeButton;
QHBoxLayout* footerLayout;
bool _save;
-
- private Q_SLOTS:
- void save();
#endif
-private Q_SLOTS:
- void changed();
+
};
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file TranslationTextEdit.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include <QtGui>
#include "TranslationTextEdit.h"
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file TranslationTextEdit.h
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef TRANSLATIONTEXTEDIT_H
#define TRANSLATIONTEXTEDIT_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file TranslationWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "TranslationWidget.h"
#include <QDebug>
*******************************************************************************/
//! \file TranslationWidget.h
-//! \brief Implements translation widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef TRANSLATIONWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file WelcomeScreenWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "WelcomeScreenWidget.h"
*******************************************************************************/
//! \file WelcomeScreenWidget.h
-//! \brief Implements widget that display welcome screen to user
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef WELCOMESCREENWIDGET_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file WordListProxyStyle.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "WordListProxyStyle.h"
*******************************************************************************/
//! \file WordListProxyStyle.h
-//! \brief Implements custom style which draws checkboxes as stars
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef WORDLISTPROXYSTYLE_H
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file WordListWidget.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include "WordListWidget.h"
-#include <QDebug>
-#include "../../includes/translation.h"
-#include <QMultiHash>
#include "WordListProxyStyle.h"
+#include "../../includes/translation.h"
-#ifdef Q_WS_MAEMO_5
- #include <QMaemo5InformationBox>
-#endif
-
WordListWidget::WordListWidget(QWidget *parent):
QTreeView(parent) {
clear();
searchResult = result;
-
model->setColumnCount(2);
model->setRowCount(result.count());
addWord(i.key(), row++);
}
- resizeColumns();
model->sort(0);
+ resizeColumns();
}
void WordListWidget::wordClicked(QModelIndex index) {
Qt::CheckState(index.data(Qt::CheckStateRole).toInt());
-
//getting index of item which contains word which should be added/removed
//from bookmarks
QModelIndex item = selectedIndexes().at(0);
*******************************************************************************/
//! \file WordListwidget.h
-//! \brief Implements word list widget
//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#ifndef WORDLISTWIDGET_H
#define WORDLISTWIDGET_H
-#include <QWidget>
#include <QtGui>
#include <QStringListModel>
#include "../backbone/backbone.h"
-#include "SearchBarWidget.h"
//! Displays list of words found in dictionaries
/*!
//! Signal is emitted only when star was clicked.
void wordChecked(QModelIndex index);
+ //! clears list
void clear();
private:
void addWord(QString word, int row);
QStandardItemModel* model;
+
//! Describes width of star checkbox in pixels
int checkBoxWidth;
*******************************************************************************/
-//Created by Mateusz Półrola
+//! \file main.cpp
+//! \author Mateusz Półrola <mateusz.polrola@comarch.pl>
#include <QtGui/QApplication>
#include "MainWindow.h"
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
+
+ qDebug()<<QLibraryInfo::location(QLibraryInfo::TranslationsPath);
a.installTranslator(&qtTranslator);
QTranslator myTranslator;