dbusadaptor.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*****************************************************************************
  2. * dbusadaptor.h - QStarDict, a StarDict clone written with using Qt *
  3. * Copyright (C) 2007 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 DBUSADAPTOR_H
  20. #define DBUSADAPTOR_H
  21. #include <QDBusAbstractAdaptor>
  22. namespace QStarDict
  23. {
  24. class MainWindow;
  25. /**
  26. * The DBusAdaptor class represents and QStarDict D-Bus interface.
  27. */
  28. class DBusAdaptor: public QDBusAbstractAdaptor
  29. {
  30. Q_OBJECT
  31. Q_CLASSINFO("D-Bus Interface", "org.qstardict.dbus")
  32. /**
  33. * The main window visible property.
  34. */
  35. Q_PROPERTY(int mainWindowVisible READ mainWindowVisible WRITE setMainWindowVisible)
  36. public:
  37. /**
  38. * Construct a DBusAdaptor.
  39. */
  40. DBusAdaptor(MainWindow *mainWindow);
  41. /**
  42. * Return true if main window is visible, otherwise return
  43. * false.
  44. */
  45. bool mainWindowVisible() const;
  46. /**
  47. * Set visible state of main window.
  48. */
  49. void setMainWindowVisible(bool visible);
  50. public slots:
  51. /**
  52. * Show main window with translation of text.
  53. */
  54. void showTranslation(const QString &text);
  55. /**
  56. * Show popup window with translation of text.
  57. */
  58. void showPopup(const QString &text);
  59. /**
  60. * Return a translation of text in plain text format.
  61. */
  62. QString translate(const QString &text);
  63. /**
  64. * Return a translation of text in HTML format.
  65. */
  66. QString translateHtml(const QString &text);
  67. private:
  68. MainWindow *m_mainWindow;
  69. };
  70. }
  71. #endif // DBUSADAPTOR_H
  72. // vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab cindent textwidth=120 formatoptions=tc