PluginBrowser.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * PluginBrowser.h - include file for pluginBrowser
  3. *
  4. * Copyright (c) 2005-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 PLUGIN_BROWSER_H
  25. #define PLUGIN_BROWSER_H
  26. #include <QtCore/QTimer>
  27. #include <QPixmap>
  28. #include "SideBarWidget.h"
  29. #include "Plugin.h"
  30. class QLineEdit;
  31. class QTreeWidget;
  32. class QTreeWidgetItem;
  33. class PluginBrowser : public SideBarWidget
  34. {
  35. Q_OBJECT
  36. public:
  37. PluginBrowser( QWidget * _parent );
  38. virtual ~PluginBrowser() = default;
  39. private slots:
  40. void onFilterChanged( const QString & filter );
  41. private:
  42. void addPlugins();
  43. void updateRootVisibility( int index );
  44. void updateRootVisibilities();
  45. QWidget * m_view;
  46. QTreeWidget * m_descTree;
  47. QTreeWidgetItem * m_lmmsRoot;
  48. QTreeWidgetItem * m_lv2Root;
  49. };
  50. class PluginDescWidget : public QWidget
  51. {
  52. Q_OBJECT
  53. public:
  54. typedef Plugin::Descriptor::SubPluginFeatures::Key PluginKey;
  55. PluginDescWidget( const PluginKey & _pk, QWidget * _parent );
  56. QString name() const;
  57. protected:
  58. void enterEvent( QEvent * _e ) override;
  59. void leaveEvent( QEvent * _e ) override;
  60. void mousePressEvent( QMouseEvent * _me ) override;
  61. void paintEvent( QPaintEvent * _pe ) override;
  62. private:
  63. constexpr static int DEFAULT_HEIGHT{24};
  64. PluginKey m_pluginKey;
  65. QPixmap m_logo;
  66. bool m_mouseOver;
  67. };
  68. #endif