baseplugin.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*****************************************************************************
  2. * baseplugin.h - QStarDict, a dictionary for learning foreign languages *
  3. * Copyright (C) 2008-2019 Alexander Rodin *
  4. * Copyright (C) 2016 Sergey Ili'nykh *
  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 BASEPLUGIN_H
  21. #define BASEPLUGIN_H
  22. #include <QtPlugin>
  23. #include <QStringList>
  24. #include <QDir>
  25. #include <QCoreApplication>
  26. #include <QVariant>
  27. #include <QIcon>
  28. #include "metadata.h"
  29. #include "pluginserver.h"
  30. namespace QStarDict
  31. {
  32. /**
  33. * This is a base class for all dictionary plugins classes.
  34. */
  35. class BasePlugin
  36. {
  37. public:
  38. /**
  39. * Accessor to QStarDict internals
  40. */
  41. PluginServer *qsd; // QStarDict API accessor
  42. /**
  43. * Destructor.
  44. */
  45. virtual ~BasePlugin() { }
  46. virtual QIcon pluginIcon() const = 0;
  47. };
  48. class ConfigurablePlugin
  49. {
  50. public:
  51. virtual ~ConfigurablePlugin() {}
  52. /**
  53. * Run a settings dialog and return QDialog::DialogCode.
  54. */
  55. virtual int execSettingsDialog(QWidget *parent = 0) = 0;
  56. };
  57. } // namespace QStarDict
  58. Q_DECLARE_INTERFACE(QStarDict::BasePlugin, "org.qstardict.BasePlugin/1.0")
  59. Q_DECLARE_INTERFACE(QStarDict::ConfigurablePlugin, "org.qstardict.ConfigurablePlugin/1.0")
  60. #endif // BASEPLUGIN_H
  61. // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent