# HG changeset patch # User Chris Cannam # Date 1526054354 -3600 # Node ID abd52bd8d435c755124723f5e96c0ec21099eb83 # Parent 51e6125627fac189f3c57fcc4d960a0841a21380 Toward allowing the user to see (at least, and maybe change) the plugin path diff -r 51e6125627fa -r abd52bd8d435 files.pri --- a/files.pri Tue May 08 14:27:54 2018 +0100 +++ b/files.pri Fri May 11 16:59:14 2018 +0100 @@ -74,6 +74,7 @@ widgets/Panner.h \ widgets/PluginParameterBox.h \ widgets/PluginParameterDialog.h \ + widgets/PluginPathConfigurator.h \ widgets/ProgressDialog.h \ widgets/PropertyBox.h \ widgets/PropertyStack.h \ @@ -156,6 +157,7 @@ widgets/Panner.cpp \ widgets/PluginParameterBox.cpp \ widgets/PluginParameterDialog.cpp \ + widgets/PluginPathConfigurator.cpp \ widgets/ProgressDialog.cpp \ widgets/PropertyBox.cpp \ widgets/PropertyStack.cpp \ diff -r 51e6125627fa -r abd52bd8d435 widgets/PluginPathConfigurator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/PluginPathConfigurator.cpp Fri May 11 16:59:14 2018 +0100 @@ -0,0 +1,106 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#include "PluginPathConfigurator.h" + +#include +#include + +#include "IconLoader.h" +#include "WidgetScale.h" + +PluginPathConfigurator::PluginPathConfigurator(QWidget *parent) : + QFrame(parent) +{ + setFrameStyle(StyledPanel | Sunken); + m_layout = new QGridLayout; + setLayout(m_layout); + populate(); +} + +PluginPathConfigurator::~PluginPathConfigurator() +{ +} + +void +PluginPathConfigurator::setPath(QStringList directories, QString envVariable) +{ + m_path = directories; + m_var = envVariable; + populate(); +} + +void +PluginPathConfigurator::populate() +{ + QLabel *header = new QLabel; + header->setText(QString("%1").arg(tr("Location"))); + m_layout->addWidget(header, 0, 3); + + for (int i = 0; i < m_path.size(); ++i) { + + int col = 0; + int row = i + 1; + QString dir = m_path[i]; + + if (i > 0) { + QPushButton *up = new QPushButton; + up->setIcon(IconLoader().load("up")); + up->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); + connect(up, SIGNAL(clicked()), this, SLOT(upClicked())); + m_layout->addWidget(up, row, col); + } + ++col; + + if (i + 1 < m_path.size()) { + QPushButton *down = new QPushButton; + down->setIcon(IconLoader().load("down")); + down->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); + connect(down, SIGNAL(clicked()), this, SLOT(downClicked())); + m_layout->addWidget(down, row, col); + } + ++col; + + QPushButton *del = new QPushButton; + del->setIcon(IconLoader().load("datadelete")); + del->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); + connect(del, SIGNAL(clicked()), this, SLOT(deleteClicked())); + m_layout->addWidget(del, row, col); + ++col; + + QLabel *dirLabel = new QLabel; + dirLabel->setText(dir); + m_layout->addWidget(dirLabel, row, col); + m_layout->setColumnStretch(col, 10); + ++col; + } +} + +void +PluginPathConfigurator::upClicked() +{ + //!!! +} + +void +PluginPathConfigurator::downClicked() +{ + //!!!! +} + +void +PluginPathConfigurator::deleteClicked() +{ + //!!! +} diff -r 51e6125627fa -r abd52bd8d435 widgets/PluginPathConfigurator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/widgets/PluginPathConfigurator.h Fri May 11 16:59:14 2018 +0100 @@ -0,0 +1,53 @@ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Sonic Visualiser + An audio file viewer and annotation editor. + Centre for Digital Music, Queen Mary, University of London. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. See the file + COPYING included with this distribution for more information. +*/ + +#ifndef SV_PLUGIN_PATH_CONFIGURATOR_H +#define SV_PLUGIN_PATH_CONFIGURATOR_H + +#include +#include +#include + +class PluginPathConfigurator : public QFrame +{ + Q_OBJECT + +public: + PluginPathConfigurator(QWidget *parent = 0); + ~PluginPathConfigurator(); + + void setPath(QStringList directories, QString envVariable); + QStringList getPath() const; + +signals: + void pathChanged(QStringList); + +private slots: + void upClicked(); + void downClicked(); + void deleteClicked(); + +private: + QGridLayout *m_layout; + + QStringList m_path; + QString m_var; + + void populate(); + +}; + +#endif + +