/src/libtomahawk/ContextMenu.h

http://github.com/tomahawk-player/tomahawk · C Header · 111 lines · 69 code · 23 blank · 19 comment · 0 complexity · f9f869cecfa69eb544be98b24ca326bc MD5 · raw file

  1. /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2. *
  3. * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4. * Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
  5. * Copyright 2013, Teo Mrnjavac <teo@kde.org>
  6. *
  7. * Tomahawk is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * Tomahawk is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef CONTEXTMENU_H
  21. #define CONTEXTMENU_H
  22. #include <QSignalMapper>
  23. #include <QMenu>
  24. #include "Typedefs.h"
  25. #include "DllMacro.h"
  26. namespace Tomahawk
  27. {
  28. class DLLEXPORT ContextMenu : public QMenu
  29. {
  30. Q_OBJECT
  31. public:
  32. enum MenuActions
  33. {
  34. ActionPlay = 1,
  35. ActionQueue = 2,
  36. ActionDelete = 4,
  37. ActionCopyLink = 8,
  38. ActionLove = 16,
  39. ActionStopAfter = 32,
  40. ActionPage = 64,
  41. ActionTrackPage = 128,
  42. ActionArtistPage = 256,
  43. ActionAlbumPage = 512,
  44. ActionEditMetadata = 1024,
  45. ActionPlaylist = 2048,
  46. ActionSend = 4096,
  47. ActionMarkListened = 8192,
  48. ActionDownload = 16384,
  49. ActionOpenFileManager = 32768
  50. };
  51. explicit ContextMenu( QWidget* parent = 0 );
  52. virtual ~ContextMenu();
  53. int supportedActions() const { return m_supportedActions; }
  54. void setSupportedActions( int actions ) { m_supportedActions = actions; }
  55. void setPlaylistInterface( const Tomahawk::playlistinterface_ptr& plInterface );
  56. void setQuery( const Tomahawk::query_ptr& query );
  57. void setQueries( const QList<Tomahawk::query_ptr>& queries );
  58. void setArtist( const Tomahawk::artist_ptr& artist );
  59. void setArtists( const QList<Tomahawk::artist_ptr>& artists );
  60. void setAlbum( const Tomahawk::album_ptr& album );
  61. void setAlbums( const QList<Tomahawk::album_ptr>& albums );
  62. void clear();
  63. unsigned int itemCount() const;
  64. signals:
  65. void triggered( int action );
  66. private slots:
  67. void onTriggered( int action );
  68. void copyLink();
  69. void openPage( MenuActions action );
  70. void addToQueue();
  71. void addToPlaylist( int playlistIdx );
  72. void sendToSource( int sourceIdx );
  73. void onSocialActionsLoaded();
  74. private:
  75. QSignalMapper* m_sigmap;
  76. QSignalMapper* m_playlists_sigmap;
  77. QSignalMapper* m_sources_sigmap;
  78. int m_supportedActions;
  79. QAction* m_loveAction;
  80. QList< Tomahawk::playlist_ptr > m_playlists;
  81. QList< Tomahawk::query_ptr > m_queries;
  82. QList< Tomahawk::artist_ptr > m_artists;
  83. QList< Tomahawk::album_ptr > m_albums;
  84. QList< Tomahawk::source_ptr > m_sources;
  85. Tomahawk::playlistinterface_ptr m_interface;
  86. };
  87. }; // ns
  88. #endif