web.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*****************************************************************************
  2. * web.h - QStarDict, a StarDict clone written with using Qt *
  3. * Copyright (C) 2008 Alexander Rodin *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License along *
  16. * with this program; if not, write to the Free Software Foundation, Inc., *
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  18. *****************************************************************************/
  19. #ifndef WEB_H
  20. #define WEB_H
  21. #include "../dictplugin.h"
  22. #include <QHash>
  23. class Web: public QObject, public QStarDict::DictPlugin
  24. {
  25. Q_OBJECT
  26. Q_INTERFACES(QStarDict::DictPlugin)
  27. #if QT_VERSION >= 0x050000
  28. Q_PLUGIN_METADATA(IID "org.qstardict.DictPlugin/1.0" FILE "web.json")
  29. #endif
  30. public:
  31. Web(QObject *parent = 0);
  32. QString name() const
  33. { return "web"; }
  34. QString version() const
  35. { return "0.01"; }
  36. QString description() const
  37. { return tr("An experimental plugin for WEB dictionaries.<br><b><font color=red>Warning:</font></b> now this plugin is unstable"); }
  38. QStringList authors() const
  39. { return QStringList("Alexander Rodin <rodin.alexander@gmail.com>"); }
  40. Features features() const
  41. { return Features(SettingsDialog); }
  42. QStringList availableDicts() const;
  43. QStringList loadedDicts() const
  44. { return m_loadedDicts.keys(); }
  45. void setLoadedDicts(const QStringList &dicts);
  46. DictInfo dictInfo(const QString &dict);
  47. bool isTranslatable(const QString &dict, const QString &word);
  48. Translation translate(const QString &dict, const QString &word);
  49. int execSettingsDialog(QWidget *parent);
  50. friend class SettingsDialog;
  51. private:
  52. struct QueryStruct
  53. {
  54. QString query;
  55. QByteArray codec;
  56. };
  57. QHash<QString, QueryStruct> m_loadedDicts;
  58. };
  59. #endif // WEB_H
  60. // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent