PluginBrowser.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 PluginBrowser : public SideBarWidget
  33. {
  34. Q_OBJECT
  35. public:
  36. PluginBrowser( QWidget * _parent );
  37. virtual ~PluginBrowser() = default;
  38. private slots:
  39. void onFilterChanged( const QString & filter );
  40. private:
  41. void addPlugins();
  42. void updateRootVisibility( int index );
  43. void updateRootVisibilities();
  44. QWidget * m_view;
  45. QTreeWidget * m_descTree;
  46. };
  47. class PluginDescWidget : public QWidget
  48. {
  49. Q_OBJECT
  50. public:
  51. typedef Plugin::Descriptor::SubPluginFeatures::Key PluginKey;
  52. PluginDescWidget( const PluginKey & _pk, QWidget * _parent );
  53. QString name() const;
  54. protected:
  55. void enterEvent( QEvent * _e ) override;
  56. void leaveEvent( QEvent * _e ) override;
  57. void mousePressEvent( QMouseEvent * _me ) override;
  58. void paintEvent( QPaintEvent * _pe ) override;
  59. private:
  60. constexpr static int DEFAULT_HEIGHT{24};
  61. PluginKey m_pluginKey;
  62. QPixmap m_logo;
  63. bool m_mouseOver;
  64. };
  65. #endif