QWidgetAction(parent) {
//creating custom tab widget, and sets style sheet to have centered tabs
- tabWidget = new MenuTabWidget(this);
+ tabWidget = new MenuTabWidget();
tabWidget->setStyleSheet("QTabWidget::tab-bar {alignment: center;}");
}
--- /dev/null
+TEMPLATE=subdirs
+SUBDIRS=src
+
+check.target = check
+check.CONFIG = recursive
+check.recurse = tests
+QMAKE_EXTRA_TARGETS += check
--- /dev/null
+/*******************************************************************************
+
+ 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.
+
+*******************************************************************************/
+
+/*! \file GooglePlugin.cpp
+*/
+
+#include "GooglePlugin.h"
+#include <QDebug>
+
+
+GooglePlugin::GooglePlugin(QObject *parent): CommonDictInterface(parent),
+ _langFrom(tr("")), _langTo(tr("")),_name(tr("")),
+ _type(tr("google")), _infoNote(tr("")) {
+
+stopped = false;
+//_icon = QIcon(":/icon/google.png");
+}
+
+GooglePlugin::~GooglePlugin()
+{
+}
+
+QString GooglePlugin::langFrom() const {
+ return _langFrom;
+}
+
+QString GooglePlugin::langTo() const {
+ return _langTo;
+}
+
+QString GooglePlugin::name() const {
+ return _name;
+}
+
+QString GooglePlugin::type() const {
+ return _type;
+}
+
+QString GooglePlugin::infoNote() const {
+ return _infoNote;
+}
+
+DictDialog* GooglePlugin::dictDialog()
+{
+}
+
+CommonDictInterface* GooglePlugin::getNew(const Settings*) const
+{
+}
+
+bool GooglePlugin::isAvailable() const {
+ return true;
+}
+
+QString GooglePlugin::search(QString key)
+{
+}
+
+uint GooglePlugin::hash() const {
+ return _hash;
+}
+
+void GooglePlugin::setHash(uint) {
+ this->_hash=_hash;
+}
+
+Settings* GooglePlugin::settings() {
+ return _settings;
+}
+
+void GooglePlugin::setSettings(Settings*)
+{
+}
+
+QIcon* GooglePlugin::icon() {
+ return &_icon;
+}
+
+QList<Translation*> GooglePlugin::searchWordList(QString word, int limit)
+{
+}
+
+void GooglePlugin::stop() {
+ stopped=true;
+}
+
+
+Q_EXPORT_PLUGIN2(google, GooglePlugin)
--- /dev/null
+/*******************************************************************************
+
+ 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.
+
+*******************************************************************************/
+
+
+/*! \file GooglePlugin.h
+*/
+#ifndef GOOGLEPLUGIN_H
+#define GOOGLEPLUGIN_H
+
+
+#include <QObject>
+#include <QDialog>
+#include <QtPlugin>
+#include <QIcon>
+
+#include "../../../includes/CommonDictInterface.h"
+#include "../../../includes/settings.h"
+
+
+class GooglePlugin : public CommonDictInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(CommonDictInterface)
+public:
+ GooglePlugin(QObject *parent=0);
+ ~GooglePlugin();
+
+ //! returns source language code iso 639-2
+ QString langFrom() const;
+
+ //! returns destination language code iso 639-2
+ QString langTo() const;
+
+ //! returns dictionary name (like "old english" or so)
+ QString name() const;
+
+ //! returns dictionary type (xdxf, google translate, etc)
+ QString type() const;
+
+ //! returns information about dictionary in html (name, authors, etc)
+ QString infoNote() const;
+
+ /*! returns DictDialog object that creates dialogs
+ for adding new dictionary and change plugin tings
+ */
+ DictDialog* dictDialog();
+
+ //! returns new, clean copy of plugin with setting set as in Settings*
+ CommonDictInterface* getNew(const Settings*) const;
+
+ //! returns whether plugin can start searching
+ bool isAvailable() const;
+
+ //! returns a description of a word given by a QString
+ QString search(QString key);
+
+ //! returns a unique hash for a dictionary
+ uint hash() const;
+
+ //! set unique value (unique for every dictionary not plugin)
+ void setHash(uint);
+
+ //! returns current plugin settings
+ Settings* settings();
+
+ //! Sets new settings
+ void setSettings(Settings*);
+
+ //! returns plugin icon
+ QIcon* icon();
+
+public Q_SLOTS:
+ /*! performs search in dictionary
+ \param word word to search in dictionary
+ \param limit limit on number of results
+
+ After finishing search it has to emit
+ \see CommonDictInterface:finalTranslation finalTranslation
+ */
+ QList<Translation*> searchWordList(QString word, int limit=0);
+
+ //! stop current operation
+ void stop();
+
+private:
+ //! language from which we translate
+ QString _langFrom;
+ //! language to which we translate
+ QString _langTo;
+ //! name of a dictionary
+ QString _name;
+ //! type of a dictionary
+ QString _type;
+ //! information about dictionary
+ QString _infoNote;
+ //! path to dictionary file
+ QString path;
+ uint _hash;
+ QIcon _icon;
+ Settings *_settings;
+ bool stopped;
+};
+
+#endif // GOOGLEPLUGIN_H
+
+
--- /dev/null
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-08-03T09:33:52
+#
+#-------------------------------------------------
+
+QT += core xml gui sql
+
+
+TARGET = GooglePlugin
+TEMPLATE = lib
+
+MDICT_PLUGINSDIR = $$[MDICT_PLUGINSDIR]
+
+isEmpty(MDICT_PLUGINSDIR) {
+ MDICT_PLUGINSDIR = .
+}
+
+MDICT_APPNAME = $$[MDICT_APPNAME]
+
+isEmpty(MDICT_APPNAME) {
+ MDICT_APPNAME = mdictionary
+}
+
+
+DESTDIR = $${MDICT_PLUGINSDIR}/$${MDICT_APPNAME}
+
+
+
+SOURCES += \
+ GooglePlugin.cpp \
+
+HEADERS += \
+ GooglePlugin.h \
+ ../../../includes/DictDialog.h \
+ ../../../includes/translation.h \
+ ../../../includes/settings.h \
+ ../../../includes/CommonDictInterface.h \
+
+
+
+
+unix {
+ #VARIABLES
+ isEmpty(PREFIX) {
+ PREFIX = /usr
+ }
+
+ BINDIR = $$PREFIX/bin
+ LIBDIR = $$PREFIX/lib/$${MDICT_APPNAME}
+ DATADIR =$$PREFIX/share
+
+ DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
+ #MAKE INSTALL
+
+ INSTALLS += target dicts
+
+ target.path = $$LIBDIR
+
+ dicts.path = $$LIBDIR
+
+}
+
--- /dev/null
+/*******************************************************************************
+
+ 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.
+
+*******************************************************************************/
+
+#include "test.h"
+#include <QSignalSpy>
+
+void GoogleTest::getNew() {
+
+GooglePlugin test;
+}
+
+QTEST_MAIN(GoogleTest)
--- /dev/null
+/*******************************************************************************
+
+ 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.
+
+*******************************************************************************/
+
+#ifndef TEST_H
+#define TEST_H
+
+#include <QtTest/QtTest>
+#include "../src/GooglePlugin.h"
+
+
+ class GoogleTest: public QObject
+ {
+ Q_OBJECT
+
+
+ private slots:
+ void getNew();
+
+ };
+
+
+#endif // TEST_H
--- /dev/null
+######################################################################
+# Automatically generated by qmake (1.07a) Wed Aug 4 11:35:12 2010
+######################################################################
+
+CONFIG += qtestlib
+QT += sql
+TARGET = GooglrPluginTests
+TEMPLATE = app
+INCLUDEPATH += .
+
+# Input
+HEADERS += test.h \
+ ../src/GooglePlugin.h \
+ ../../../includes/translation.h \
+ ../../../includes/settings.h \
+ ../../../includes/DictDialog.h \
+ ../../../includes/CommonDictInterface.h \
+
+SOURCES += test.cpp \
+ ../src/GooglePlugin.cpp \
+
+check.target = check
+check.commands = ./GooglePluginTests
+QMAKE_EXTRA_TARGETS += check
TEMPLATE = subdirs
-SUBDIRS = xdxf
+SUBDIRS = xdxf google
check.target = check
check.CONFIG = recursive