#include <QTime>
#include <QDir>
#include <QThread>
+#include <QDebug>
#include <QSettings>
#include <QFutureWatcher>
+#include <QMultiMap>
#include "../../include/CommonDictInterface.h"
#include "../../include/settings.h"
#include "../../include/translation.h"
* search_bookmarks - true/false, whether search in bookmarks
Searching schema:
- At first GUI should ask for list of words matching given pattern,
+ At first GUI should ask for a list of words matching a given pattern,
then each Translation object is capable of finding its own final translation
List of words:
Q_OBJECT
public:
- /*!\param pluginPath path to plugins (leave blank for default)
- \param configPath path to folder with configuration files
- \param dry dry run is mode without paying attention to configuration etc
+ /*! \param pluginPath path to plugins (leave blank for default)
+ \param configPath path to folder with configuration files
+ \param dry dry run is mode without paying attention to configuration etc
mainly for testing
*/
Backbone(QString pluginPath="", QString configPath="",
//! \return history of performed searches
History* history();
- //! \return return search fesult
+ //! \return search fesult
QMultiHash<QString, Translation*> result();
//! \return maximum number of words that plugin could find
void stopSearching();
/*! searches for a word translation
- \param word to be translated
+ \param word word to be translated
*/
void search(QString word);
/*! sets active dictionaries (searches are performed only in active dicts)
\param List of dictionaries to be activated
*/
- void selectedDictionaries(QList<CommonDictInterface* >);
+ void selectedDictionaries(QList<CommonDictInterface*>);
- /*! adds new dictionary and activates it
+ /*! adds a new dictionary and activates it
\param dict dictionary to be added
\param active decides whether searches are perfomed in given dictionaries
*/
void quit();
- /*! Fired by FutureWatcher when list of words is ready (after calling search)
+ /*! Fired by FutureWatcher when a list of words is ready (after calling search),
fetch Future<...> to final result
*/
void translationReady();
*/
void xmlTranslationReady();
- /*! Removes given dictionary
+ /*! Removes a given dictionary
\param dict dictionary to be deleted
*/
void removeDictionary(CommonDictInterface* dict);
/*! adds bookmarks to given translations (translation object is fetched and
added to bookmarks data base (key and translation stored in db))
- \param translation translation object to be stored in db
+ \param translations list of Translation objects to be stored in db
*/
- void addBookmark(QList<Translation*> translations) {
- foreach(Translation* translation, translations)
- //_bookmarks.add(translation);
- QtConcurrent::run(_bookmarks, &Bookmarks::add, translation);
- }
+ void addBookmark(QList<Translation*> translations);
/*! Removes bookmarks to given translations
- \param translation remove bookmark to this translation
+ \param translations remove bookmark to these translations
*/
void removeBookmark(QList<Translation*> translations) {
foreach(Translation* translation, translations)
}
- /*! Searching a list of bookmarks may take some time, so I moved it to
+ /*! Searching a list of bookmarks may take some time, so it's moved to a
new thread (to avoid GUI blocking), further it's consistent with ordinary
searching a list of words (\see search)
*/
_innerBookmarks = QtConcurrent::run(_bookmarks,
&Bookmarks::list);
_bookmarkSearchWatcher.setFuture(_innerBookmarks);
- }
-
+ Q_EMIT bookmarkMode();
+ qDebug()<<"1";
+ }
/*! Sets settings for backbone: history_size, search_limit,
searching backends (search_bookmarks, search_dictionaries)
*/
void setSettings(Settings* settings);
-
/*! \return corresponding settings object with history_size, search_limit,
searching backends (search_bookmarks, search_dictionaries)
*/
/*! emitted by direct connection to plugins notifying signals
\param Notify::NotifyType GUI may decide to show different types in
different ways
- \param QString text of the notification
+ \param text of the notification
*/
void notify(Notify::NotifyType, QString);
+ void bookmarkReady();
+
+ void bookmarkMode();
+
private Q_SLOTS:
void bookmarksListReady();