text: #include "VSTListItem.h"
  
  #include <qtoolbutton.h>
  #include <qboxlayout.h>
  #include <qlabel.h>
  
  #include "VSTeditor.h"
  
  VSTListItem::VSTListItem(std::weak_ptr<VSTplugin> plugin) : plugin(plugin) {
  	ui.setupUi(this);
  
  	if (auto p = plugin.lock()) {
  		ui.label->setText(p->name);
  		ui.label->setAttribute(Qt::WA_TranslucentBackground);
  
  		ui.buttonEdit->setEnabled(p->flags() & effFlagsHasEditor);
  
  		QWidget::connect(ui.buttonEdit, &QToolButton::clicked, this, &VSTListItem::buttonEditClicked);
  		QWidget::connect(ui.buttonEditName, &QToolButton::clicked, this, [=]() {
  			emit editName();
  			});
  	}
  };
  
  void VSTListItem::buttonEditClicked() {
  	if (auto p = plugin.lock()) {
  		if (p->editor) {
  			p->editor->raise();
  		}
  		else {
  			auto editor = new VSTeditor(plugin);
  			editor->show();
  		}
  	}
  }