swac.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*****************************************************************************
  2. * This file is a part of QStarDict, a StarDict clone written using Qt *
  3. * swac.cpp - Plugin for words audio collections SWAC *
  4. * Copyright (C) 2008 Nicolas Vion <nico@picapo.net> *
  5. * *
  6. * This program is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 2 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program is distributed in the hope that it will be useful, *
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  14. * GNU General Public License for more details. *
  15. * *
  16. * You should have received a copy of the GNU General Public License along *
  17. * with this program; if not, write to the Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  19. *****************************************************************************/
  20. #ifndef SWAC_H
  21. #define SWAC_H
  22. #include "../dictplugin.h"
  23. #include <QSqlDatabase>
  24. #include <QSqlQuery>
  25. class Swac: public QObject, public QStarDict::DictPlugin
  26. {
  27. Q_OBJECT
  28. Q_INTERFACES(QStarDict::DictPlugin)
  29. #if QT_VERSION >= 0x050000
  30. Q_PLUGIN_METADATA(IID "org.qstardict.DictPlugin/1.0" FILE "swac.json")
  31. #endif
  32. public:
  33. Swac(QObject *parent = 0);
  34. ~Swac();
  35. QString name() const
  36. { return "swac"; }
  37. QString version() const
  38. { return "0.1"; }
  39. QString description() const
  40. { return tr("An experimental plugin for words audio collections (SWAC).<br>For more information about SWAC, please, visit the <a href='http://shtooka.net/'>Shtooka Project Homepage</a>."); }
  41. QStringList authors() const
  42. { return QStringList("Nicolas Vion <nico@picapo.net>"); }
  43. Features features() const
  44. { return Features(SearchSimilar | SettingsDialog); }
  45. QStringList availableDicts() const;
  46. QStringList loadedDicts() const
  47. { return m_loadedDicts; }
  48. void setLoadedDicts(const QStringList &dicts);
  49. DictInfo dictInfo(const QString &dict);
  50. bool isTranslatable(const QString &dict, const QString &word);
  51. Translation translate(const QString &dict, const QString &word);
  52. QStringList findSimilarWords(const QString &dict, const QString &word);
  53. int execSettingsDialog(QWidget *parent);
  54. // friend class SettingsDialog;
  55. private:
  56. QSqlQuery search(const QString &dict, const QString &word, const QString &fields, const int limit);
  57. QSqlDatabase *db;
  58. QStringList m_loadedDicts;
  59. };
  60. #endif
  61. // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent textwidth=120 formatoptions=tc