projects
/
mdictionary
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
32008e5
)
First Backbone draft ready
author
Bartosz Szatkowski
<bulislaw@linux.com>
Tue, 3 Aug 2010 11:24:27 +0000
(13:24 +0200)
committer
Bartosz Szatkowski
<bulislaw@linux.com>
Tue, 3 Aug 2010 11:24:27 +0000
(13:24 +0200)
trunk/src/base/backbone/backbone.cpp
patch
|
blob
|
history
trunk/src/base/backbone/backbone.h
patch
|
blob
|
history
trunk/src/base/backbone/main.cpp
patch
|
blob
|
history
trunk/src/base/mDictionary.pro
patch
|
blob
|
history
trunk/src/base/mDictionary.pro.user
patch
|
blob
|
history
trunk/src/includes/CommonDictInterface.h
patch
|
blob
|
history
trunk/src/includes/settings.h
patch
|
blob
|
history
trunk/src/includes/translation.h
patch
|
blob
|
history
diff --git
a/trunk/src/base/backbone/backbone.cpp
b/trunk/src/base/backbone/backbone.cpp
index
6ebb152
..
1cf89d2
100644
(file)
--- a/
trunk/src/base/backbone/backbone.cpp
+++ b/
trunk/src/base/backbone/backbone.cpp
@@
-34,8
+34,8
@@
Backbone::~Backbone()
}
}
-Backbone::Backbone(const Backbone &b) {
- dicts = QList<CommonDictInterface* > (b.dicts);
+Backbone::Backbone(const Backbone &b){
+ dicts = QHash<CommonDictInterface*, bool > (b.dicts);
plugins = QList<CommonDictInterface* > (b.plugins);
resultv = QHash<QString, Translation* > (b.resultv);
}
plugins = QList<CommonDictInterface* > (b.plugins);
resultv = QHash<QString, Translation* > (b.resultv);
}
@@
-44,27
+44,32
@@
int Backbone::searchLimit() {
return searchLimitv;
}
return searchLimitv;
}
-QHash<const CommonDictInterface*, bool > Backbone::getDictionaries() {
+QHash<CommonDictInterface*, bool > Backbone::getDictionaries() {
return dicts;
}
return dicts;
}
-QList<const CommonDictInterface* > Backbone::getPlugins() {
+QList<CommonDictInterface* > Backbone::getPlugins() {
return plugins;
}
return plugins;
}
+QList<QString> Backbone::getHistory() {
+ //TODO code needed
+}
+
QHash<QString, Translation*> Backbone::result() {
return resultv;
}
void Backbone::stopSearching() {
QHash<QString, Translation*> Backbone::result() {
return resultv;
}
void Backbone::stopSearching() {
- foreach(CommonDictInterface* dict, dicts)
+ foreach(CommonDictInterface* dict, dicts.keys())
dict->stop();
}
void Backbone::search(QString word) {
//TODO add running searches in new threads
dict->stop();
}
void Backbone::search(QString word) {
//TODO add running searches in new threads
- foreach(CommonDictInterface* dict, dicts)
- dict->search(word, searchLimit());
+ foreach(CommonDictInterface* dict, dicts.keys())
+ if(dicts[dict] == 1)
+ dict->search(word, searchLimit());
}
void Backbone::selectedDictionaries(QList<CommonDictInterface* > activeDicts) {
}
void Backbone::selectedDictionaries(QList<CommonDictInterface* > activeDicts) {
@@
-75,5
+80,17
@@
void Backbone::search(QString word) {
dicts[dict] = 0;
}
dicts[dict] = 0;
}
+ void Backbone::addDictionary(Settings *settings) {
+ CommonDictInterface* dict = settings->type()->getNew(settings);
+ dicts[dict] = 1;
+ }
+
+ void Backbone::quit() {
+ foreach(CommonDictInterface* dict, dicts.keys())
+ dict->stop();
+ Q_EMIT closeOk();
+}
+
+
diff --git
a/trunk/src/base/backbone/backbone.h
b/trunk/src/base/backbone/backbone.h
index
9387819
..
3cd4fc7
100644
(file)
--- a/
trunk/src/base/backbone/backbone.h
+++ b/
trunk/src/base/backbone/backbone.h
@@
-26,13
+26,11
@@
#include <QObject>
#include <QList>
#include <QObject>
#include <QList>
+#include <QHash>
#include "../../includes/CommonDictInterface.h"
#include "../../includes/settings.h"
#include "../../includes/translation.h"
#include "../../includes/CommonDictInterface.h"
#include "../../includes/settings.h"
#include "../../includes/translation.h"
-uint qHash(CommonDictInterface* dict) {
- return dict->hash();
-}
//! Inner part of dictionary - glues together GUI and plugins
class Backbone : public QObject
//! Inner part of dictionary - glues together GUI and plugins
class Backbone : public QObject
@@
-45,13
+43,13
@@
public:
Backbone(const Backbone& b);
//! \return all loadded dictionaries with activity state flag
Backbone(const Backbone& b);
//! \return all loadded dictionaries with activity state flag
- QHash<const CommonDictInterface*, bool > getDictionaries();
+ QHash<CommonDictInterface*, bool > getDictionaries();
//! \return all loadded plugins
//! \return all loadded plugins
- QList<const CommonDictInterface* > getPlugins();
+ QList<CommonDictInterface* > getPlugins();
//! \return history of performed searches
//! \return history of performed searches
- QList<const QString> getHistory(); //TODO implementation needed (in future)
+ QList<QString> getHistory(); //TODO implementation needed (in future)
//! \return return search fesult
QHash<QString, Translation*> result();
//! \return return search fesult
QHash<QString, Translation*> result();
diff --git
a/trunk/src/base/backbone/main.cpp
b/trunk/src/base/backbone/main.cpp
index
f195704
..
c0d3099
100644
(file)
--- a/
trunk/src/base/backbone/main.cpp
+++ b/
trunk/src/base/backbone/main.cpp
@@
-1,11
+1,14
@@
#include <QtGui/QApplication>
#include "backbone.h"
#include <QtGui/QApplication>
#include "backbone.h"
+uint qHash(CommonDictInterface* dict) {
+ return dict->hash();
+}
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
- backbone w;
- w.show();
+ Backbone w;
return a.exec();
}
return a.exec();
}
diff --git
a/trunk/src/base/mDictionary.pro
b/trunk/src/base/mDictionary.pro
index
814e660
..
89e3adb
100644
(file)
--- a/
trunk/src/base/mDictionary.pro
+++ b/
trunk/src/base/mDictionary.pro
@@
-15,4
+15,7
@@
SOURCES += \
backbone/backbone.cpp
HEADERS += \
backbone/backbone.cpp
HEADERS += \
- backbone/backbone.h
+ backbone/backbone.h \
+ ../includes/translation.h \
+ ../includes/settings.h \
+ ../includes/CommonDictInterface.h
diff --git
a/trunk/src/base/mDictionary.pro.user
b/trunk/src/base/mDictionary.pro.user
index
cb903d6
..
e1335af
100644
(file)
--- a/
trunk/src/base/mDictionary.pro.user
+++ b/
trunk/src/base/mDictionary.pro.user
@@
-15,7
+15,7
@@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
- <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
+ <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">2</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
@@
-46,7
+46,7
@@
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt w PATH Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt w PATH Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bulislaw/devel/mdictionary/trunk/src/base/mDictionary-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bulislaw/devel/mDictionary-build</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">3</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
@@
-114,7
+114,7
@@
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.6.3 OpenSource Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt 4.6.3 OpenSource Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
- <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bulislaw/devel/mdictionary/trunk/src/base/mDictionary-build-desktop</value>
+ <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/bulislaw/devel/mDictionary-build</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
diff --git
a/trunk/src/includes/CommonDictInterface.h
b/trunk/src/includes/CommonDictInterface.h
index
6310ba7
..
9cc4da4
100644
(file)
--- a/
trunk/src/includes/CommonDictInterface.h
+++ b/
trunk/src/includes/CommonDictInterface.h
@@
-20,13
+20,17
@@
*******************************************************************************/
// Created by Bartosz Szatkowski
*******************************************************************************/
// Created by Bartosz Szatkowski
+
+
+#ifndef COMMONDICTINTERFACE_H
+#define COMMONDICTINTERFACE_H
+
#include <QString>
#include <QDialog>
#include <QObject>
#include <QList>
#include <QString>
#include <QDialog>
#include <QObject>
#include <QList>
-#include "CommonDictInterface.h"
#include "translation.h"
#include "translation.h"
-#include "settings.h"
+class Settings;
@@
-34,7
+38,7
@@
class CommonDictInterface : public QObject {
Q_OBJECT
public:
class CommonDictInterface : public QObject {
Q_OBJECT
public:
- CommonDictInterface(const QObject *parent = 0) = 0;
+ CommonDictInterface(const QObject *parent = 0) ;
//! returns source language code iso 639-2
virtual QString langFrom() const = 0;
//! returns source language code iso 639-2
virtual QString langFrom() const = 0;
@@
-64,6
+68,8
@@
class CommonDictInterface : public QObject {
//! returns whether plugin can start searching
virtual bool isAvailable() const = 0;
//! returns whether plugin can start searching
virtual bool isAvailable() const = 0;
+ virtual uint hash() const = 0;
+
public Q_SLOTS:
/*! performes search in dictionary
\param word word to search in dictionary
public Q_SLOTS:
/*! performes search in dictionary
\param word word to search in dictionary
@@
-84,4
+90,5
@@
class CommonDictInterface : public QObject {
//! emited after dictionary is ready to use afer being loaded
void loaded(CommonDictInterface*);
//! emited after dictionary is ready to use afer being loaded
void loaded(CommonDictInterface*);
-}
+};
+#endif
diff --git
a/trunk/src/includes/settings.h
b/trunk/src/includes/settings.h
index
4313692
..
14a0c2d
100644
(file)
--- a/
trunk/src/includes/settings.h
+++ b/
trunk/src/includes/settings.h
@@
-20,23
+20,28
@@
*******************************************************************************/
//Created by Bartosz Szatkowski
*******************************************************************************/
//Created by Bartosz Szatkowski
+
+#ifndef SETTINGS_H
+#define SETTINGS_H
+
#include <QString>
#include "CommonDictInterface.h"
//! Plugin specific configuration
class Settings {
public:
#include <QString>
#include "CommonDictInterface.h"
//! Plugin specific configuration
class Settings {
public:
-<<<<<<< HEAD
//! \retrun value fo given key
//! \param key
//! \retrun value fo given key
//! \param key
- QString value(const QString key) const = 0;
+ virtual QString value(const QString key) const = 0;
//! sets key to value
//! sets key to value
- void setValue(const QString key, const QString value) = 0;
+ virtual void setValue(const QString key, const QString value) = 0;
//! \return dict CommonDictInterface
//! \return dict CommonDictInterface
- CommonDictInterface type() const = 0;
+ virtual CommonDictInterface* type() const = 0;
//! sets settings type to given dictionary
//! sets settings type to given dictionary
- void setType(const CommonDictInterface) = 0;
-}
+ virtual void setType(const CommonDictInterface*) = 0;
+};
+
+#endif
diff --git
a/trunk/src/includes/translation.h
b/trunk/src/includes/translation.h
index
a56fa11
..
0ef07f2
100644
(file)
--- a/
trunk/src/includes/translation.h
+++ b/
trunk/src/includes/translation.h
@@
-20,18
+20,26
@@
*******************************************************************************/
//Created by Bartosz Szatkowski
*******************************************************************************/
//Created by Bartosz Szatkowski
+
+#ifndef TRANSLATION_H
+#define TRANSLATION_H
+
#include <QString>
#include <QString>
+
+
//! Keeping raw form of translation to be parsed only when needed
class Translation {
public:
//! \return word to be translated
//! Keeping raw form of translation to be parsed only when needed
class Translation {
public:
//! \return word to be translated
- QString key() const = 0;
+ virtual QString key() const = 0;
- //! \returns dictionary information (plugin name, languages, <logo> etc)\
- //! to be displayed in translation table header
- QString dictionaryInfo() const = 0;
+ /*! \returns dictionary information (plugin name, languages, <logo> etc)\
+ to be displayed in translation table header */
+ virtual QString dictionaryInfo() const = 0;
//! \return parsed raw format into html
//! \return parsed raw format into html
- QString toHtml() const = 0;
-}
+ virtual QString toHtml() const = 0;
+};
+
+#endif