changeset 1285:abd52bd8d435 plugin-path-config

Toward allowing the user to see (at least, and maybe change) the plugin path
author Chris Cannam
date Fri, 11 May 2018 16:59:14 +0100
parents 51e6125627fa
children e327bbf4bf57
files files.pri widgets/PluginPathConfigurator.cpp widgets/PluginPathConfigurator.h
diffstat 3 files changed, 161 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 \
--- /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 <QPushButton>
+#include <QLabel>
+
+#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("<b>%1</b>").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()
+{
+    //!!!
+}
--- /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 <QFrame>
+#include <QGridLayout>
+#include <QStringList>
+
+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
+
+