Clipboard.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Clipboard.h - the clipboard for clips, notes etc.
  3. *
  4. * Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef CLIPBOARD_H
  25. #define CLIPBOARD_H
  26. #include <QtCore/QMap>
  27. #include <QDomElement>
  28. class QMimeData;
  29. namespace Clipboard
  30. {
  31. enum class MimeType
  32. {
  33. StringPair,
  34. Default
  35. };
  36. // Convenience Methods
  37. const QMimeData * getMimeData();
  38. bool hasFormat( MimeType mT );
  39. // Helper methods for String data
  40. void copyString( const QString & str, MimeType mT );
  41. QString getString( MimeType mT );
  42. // Helper methods for String Pair data
  43. void copyStringPair( const QString & key, const QString & value );
  44. QString decodeKey( const QMimeData * mimeData );
  45. QString decodeValue( const QMimeData * mimeData );
  46. inline const char * mimeType( MimeType type )
  47. {
  48. switch( type )
  49. {
  50. case MimeType::StringPair:
  51. return "application/x-lmms-stringpair";
  52. break;
  53. case MimeType::Default:
  54. default:
  55. return "application/x-lmms-clipboard";
  56. break;
  57. }
  58. }
  59. } ;
  60. #endif