//! Implements widget for maemo that allows user to search quickly right from home screen using mdictionary.
/*!
Shows tool button with logo of mDictionary which can start application.
- In line edit user inputs word, and using button next to it or by pressing enter, widget runs mDictionary which immediately starts searching for given word.
+ In line edit user inputs word, and using button next to it or by pressing enter, widget runs mDictionary which immediately starts searching for a given word.
If mDictionary is already running in background it will show the program.
*/
class HomeWidget : public QWidget
QMap<QChar, QRegExp> letters;
QRegExp noLetter;
- //! removes accents from letters in searched word (e.g. ą -> a, ł -> l)
+ //! removes accents from letters in a word searched for (e.g. ą -> a, ł -> l)
QString removeAccents(QString string) {
string = string.toLower();
QString normalized = string.normalized(QString::NormalizationForm_KD);
public Q_SLOTS:
- /*! performs search in dictionary
- \param word word to search in dictionary
+ /*! performs search in a dictionary
+ \param word word to search for in a dictionary
\param limit limit on number of results,
if limit=0 all matching words are returned
virtual void retranslate() {}
Q_SIGNALS:
- //! emitted after change in dictionary settings
+ //! emitted after change in a dictionary settings
void settingsChanged();
/*! emitted to backbone when it's needed to inform user about something
protected:
-//! removes accents from letters in searched word (e.g. ą -> a, ł -> l)
+//! removes accents from letters in a word searched for (e.g. ą -> a, ł -> l)
QString removeAccents(QString string) {
if(settings()->value("strip_accents") == "true")
return AccentsNormalizer::removeAccents(string);
virtual QList<CommonDictInterface*> getPlugins() = 0;
//! Indicates if GUI is in exact search mode.
- /*! When GUI is in exact search mode it searches for word, and
+ /*! When GUI is in exact search mode it searches for a word, and
if it finds exactly matching translation it directly displays it, without
displaying matching word list. This mode should be
- used for browsing search history and searching words from application
+ used for browsing search history and searching for words from application
arguments.
\returns flag indicating if GUI is in exact search mode
*/
public Q_SLOTS:
- //! Searches in exact mode for given word
+ //! Searches in exact mode for a given word
/*!
GUI will be automatically set into exact search mode, and after search or
break it will be unset from exact search mode.
- \param word which will be searched in dictionaries
+ \param word which will be searched for in dictionaries
*/
virtual void searchExact(QString word) = 0;
//! Shows translation of next word in history
/*!
It will work only if there is next word available in history.
- Translation of word is searched with searchExact() function
+ Translation of a word is searched for with searchExact() function
\sa searchExact()
*/
virtual void historyNext() = 0;
//! Shows translation of previous word in history
/*!
It will work only if there is previous word available in history.
- Translation of word is searched with searchExact() function
+ Translation of word is searched for with searchExact() function
\sa searchExact()
*/
virtual void historyPrev() = 0;
//! all ongoing searches
void quit();
- //! Emitted when user wants to search for list of words matching given word
+ //! Emitted when user wants to search for a list of words matching a given word
/*! \param word word which will be matched, it can contain wildcards
*/
void searchWordList(QString word);
//! Emitted when user wants to see translation of words.
- /*! \param list of translations for given word which will be received
+ /*! \param list of translations for a given word which will be received
in wordListReady() slot
\sa wordListReady()
*/
void showWordList(QHash<QString, QList<Translation*> >);
//! Emitted after receiving translation strings in translationsReady() slot,
- //! will display translation of given word
+ //! will display translation of a given word
/*! \param list of translations from different dictionaries
in dictionaries
*/
/*! Translation is kind of GoF proxy, it stores key:translation pair and
- provides it in lazy way -> key is available always, but translation is fetched
+ provides it in a lazy way -> key is available always, but translation is fetched
as late as possible*/
class Translation {
public:
class BookmarkTranslation;
-/*! Bookmarks are way to store words that You think You will need to search
+/*! Bookmarks are a way to store words that You think You will need to search
for often.
When You add bookmark (by clicking on "star" in words list) You add it to
*/
QList<Translation*> list();
- /*! Searches in bookmarks for given word (wildcards may apply '*' and '?')
+ /*! Searches in bookmarks for a given word (wildcards may apply '*' and '?')
\param word to search for
\return list of matching Translation objects
*/
QList<Translation*> searchWordList(QString word);
- /*! Searches for final translation of given word
+ /*! Searches for final translation of a given word
\return word translation list in text format xml or html to be formatted
and displayed
\param word word to search for
void clear();
- /*! \return true if given word is already in bookmarks
+ /*! \return true if a given word is already in bookmarks
\param word to check
*/
bool inBookmarks(QString word);
void History::add(QString word) {
if(currentElement != -1) {
- //we search the same word so we don't add it again
+ //we search for the same word so we don't add it again
if(_history[currentElement] == word)
return;
}
// For convienence this function is called for each change in dictionaries
// and each call dumps configuration for all dictionaries into file.
- // Maybe better way would be to store new/changed configuration but
+ // Maybe a better way would be to store new/changed configuration but
// parsing settings file and figuring out what was changed, in my opinion,
// would take more time
_history->setMaxSize(_historyLen);
new searches and threads, merging search results from multiple dictionaries.
Each plugin may live in multiple instances - each with its own dictionary,
- backbone must provide way to create them at start (with specific Settings) and
+ backbone must provide a way to create them at start (with specific Settings) and
distinguish each ditionary.
Backbone also manages bookmarks and history: providing interface to GUI.
*/
void search(QString word);
- /*! sets active dictionaries (searches are performed only in active dicts
+ /*! sets active dictionaries (searches are performed only in active dicts)
\param List of dictionaries to be activated
*/
void selectedDictionaries(QList<CommonDictInterface* >);
}
- /*! Searching for list of bookmarks may take some time, so I moved it to
+ /*! Searching a list of bookmarks may take some time, so I moved it to
new thread (to avoid GUI blocking), further it's consistent with ordinary
- searching for list of words (\see search)
+ searching a list of words (\see search)
*/
void fetchBookmarks() {
_result.clear();
void addInternalDictionary(CommonDictInterface*, bool);
void savePrefs(QSettings*);
- CommonDictInterface* plugin(QString type); // searches for plugin of given type
+ CommonDictInterface* plugin(QString type); // searches for plugin of a given type
QList<CommonDictInterface*> activeDicts();
bool containsDict(uint hash) const;
int _dictNum;
explicit DBusAdapter(MainWindow* w);
public slots:
- //! Search for given word
+ //! Searches for a given word
void search(QString word);
//! Shows application in foreground, can be used to trun on mdictionary
void MainWindow::connectBookmarksWidget() {
#ifdef Q_WS_MAEMO_5
- //after removing bookmarks we search for them once again to clear word list
+ //after removing bookmarks we search for them once again to clear the words list
connect(bookmarksWidget, SIGNAL(removeAllBookmarks()),
this, SLOT(removeBookmarks()));
Creates all of GUI subcomponents, and connects all GUI interface signals
with suitable backbone signals and slots.
Only this class has direct access to backbone object.
- It manages all requests of subcomponents e. g. searching of given word,
+ It manages all requests of subcomponents e. g. searching for a given word,
displaying history, removing dictionary.
It also provides data from backbone to subcomponents e. g. result of search.
*/
QList<CommonDictInterface*> getPlugins();
//! Indicates if GUI is in exact search mode.
- /*! When GUI is in exact search mode it searches for word, and if it
+ /*! When GUI is in exact search mode it searches for a word, and if it
finds exactly matching translation it displays matching words list
and then directly displays translation of first exactly matched word.
This mode is used for browsing search history and searching words
public Q_SLOTS:
- //! Searches in exact mode for given word
+ //! Searches in exact mode for a given word
/*!
GUI will be automatically set into exact search mode, and after search or
when user breaks the search it will be unset from exact search mode.
- \param word which will be searched in dictionaries
+ \param word which will be searched for in dictionaries
\sa search()
*/
void searchExact(QString);
- //! Searches for given word
+ //! Searches for a given word
/*!
- It sets passed word in line edit of search bar and searches for given word.
- \param word which will be searched in dictionaries
+ It sets passed word in line edit of a search bar and searches for a given word.
+ \param word which will be searched for in dictionaries
\sa SearchBarWidget
\sa searchExact()
*/
void search(QString);
- //! Starts searching for given word after 500 ms delay
+ //! Starts searching for a given word after 500 ms delay
/*!
After time's up it sets passed word in line edit of search bar and searches
- for given word.
- \param word which will be searched in dictionaries
+ for a given word.
+ \param word which will be searched for in dictionaries
\sa SearchBarWidget
\sa searchExact()
\sa search()
Checks if received list is empty, in that case it displays suitable
information. Otherwise it merges results of the same key word and emits
signal to display word list.
- If GUI is in exact search mode it will search for exact word in received
+ If GUI is in exact search mode it will search for an exact word in received
list and if any of found words match exactly the word passed to
searchExact() method.
\sa isInExactSearch()
//! Shows translation of next word in history
/*!
It will work only if there is next word available in history.
- Translation of word is searched with searchDelay() function.
+ Translation of word is searched for with searchDelay() function.
On maemo search is in normal mode, on desktop in exact search mode.
\sa searchDelay()
\sa searchExact()
//! Shows translation of previous word in history
/*!
It will work only if there is available previous word in history.
- Translation of word is searched with searchDelay() function.
+ Translation of word is searched for with searchDelay() function.
On maemo search is in normal mode, on desktop in exact search mode.
\sa searchDelay()
\sa searchExact()
~SearchBarWidget();
Q_SIGNALS:
- //! Requests to search for list of words matching word passed as
+ //! Requests to search for a list of words matching word passed as
//! parameter
void searchForTranslations(QString);
*/
void setIdle();
- //! Searches for given word
+ //! Searches for a given word
/*!
Sets word as text in search word line edit
*/
void search(QString word);
- //! Starts to search for given word after 500 ms delay
+ //! Starts to search for a given word after 500 ms delay
/*!
Sets word as text in search word line edit, and waits 500 ms to start
search. If in the meantime this slot is called again it will stop previous
static QMap<QString, QString> languages;
public slots:
- /*! performs search in dictionary
- \param word word to search in dictionary
+ /*! performs search in a dictionary
+ \param word word to search for in a dictionary
\param limit limit on number of results
After finishing search it has to emit
return _bookmark;
}
- //! returns coresponding dict object
+ //! returns corresponding dict object
uint dict() const {return _dictHash;}
private:
cacheToolTip = tr("Optimize for quicker searches (may take some time)");
- accentsToolTip = tr("Strip accents (searching takes more time, but spelling don't have to be exact)");
+ accentsToolTip = tr("Strip accents (searching takes more time, but spelling doesn't have to be exact)");
initializeUI();
//! returns current plugin settings
Settings* settings();
- //! returns words count in dictionary
+ //! returns words count in a dictionary
long wordsCount();
//! Sets new settings
public Q_SLOTS:
- /*! performs search in dictionary
- \param word word to search in dictionary
+ /*! performs search in a dictionary
+ \param word word to search for in a dictionary
\param limit limit on number of results
After finishing search it has to emit
QIcon _icon;
QSqlDatabase db;
QString db_name;
- //! number of words in dictionary
+ //! number of words in a dictionary
long _wordsCount;
//! indicates if search is stopped
volatile bool stopped;