diff options
author | Florian Jung <flo@windfisch.org> | 2012-09-02 18:37:06 +0000 |
---|---|---|
committer | Florian Jung <flo@windfisch.org> | 2012-09-02 18:37:06 +0000 |
commit | 00d38a64c11bfc363fd762a351225f3e4902d44e (patch) | |
tree | 420fd5f8bda0c8046c02bdf0b6474f59fc31c39c /muse2/muse/plugin.h | |
parent | 58136c7acf8f5f3281fe8e339aeaca251f2d1b7f (diff) |
plugins can now be grouped
Diffstat (limited to 'muse2/muse/plugin.h')
-rw-r--r-- | muse2/muse/plugin.h | 75 |
1 files changed, 62 insertions, 13 deletions
diff --git a/muse2/muse/plugin.h b/muse2/muse/plugin.h index 39da5edf..ee37c34f 100644 --- a/muse2/muse/plugin.h +++ b/muse2/muse/plugin.h @@ -27,8 +27,13 @@ #include <list> #include <vector> +#include <QSet> +#include <QMap> +#include <QPair> +#include <QMouseEvent> #include <QDialog> +#include <QTabBar> #include <QFileInfo> #include <QMainWindow> #include <QUiLoader> @@ -71,6 +76,7 @@ class Xml; class MidiController; + //--------------------------------------------------------- // Plugin //--------------------------------------------------------- @@ -119,7 +125,7 @@ class Plugin { unsigned long id() const { return _uniqueID; } QString maker() const { return _maker; } QString copyright() const { return _copyright; } - QString lib(bool complete = true) { return complete ? fi.completeBaseName() : fi.baseName(); } // ddskrjo const + QString lib(bool complete = true) const { return complete ? fi.completeBaseName() : fi.baseName(); } // ddskrjo const QString dirPath(bool complete = true) const { return complete ? fi.absolutePath() : fi.path(); } QString filePath() const { return fi.filePath(); } QString fileName() const { return fi.fileName(); } @@ -188,6 +194,22 @@ class Plugin { typedef std::list<Plugin>::iterator iPlugin; + +class PluginGroups : public QMap< QPair<QString, QString>, QSet<int> > +{ + public: + QSet<int>& get(QString a, QString b) { return (*this)[(QPair<QString,QString>(a,b))]; } + QSet<int>& get(const Plugin& p) { return (*this)[(QPair<QString,QString>(p.lib(),p.label()))]; } + + void shift_left(int first, int last); + void shift_right(int first, int last); + void erase(int index); + + private: + void replace_group(int old, int now); +}; + + //--------------------------------------------------------- // PluginList //--------------------------------------------------------- @@ -529,6 +551,10 @@ class PluginGui : public QMainWindow { void updateValues(); }; + + + + //--------------------------------------------------------- // PluginDialog //--------------------------------------------------------- @@ -538,14 +564,6 @@ enum { SEL_SM, SEL_S, SEL_M, SEL_ALL }; class PluginDialog : public QDialog { Q_OBJECT - QTreeWidget* pList; - QRadioButton* allPlug; - QRadioButton* onlyM; - QRadioButton* onlyS; - QRadioButton* onlySM; - QPushButton *okB; - void saveSettings(); - public: PluginDialog(QWidget* parent=0); static MusECore::Plugin* getPlugin(QWidget* parent); @@ -554,25 +572,56 @@ class PluginDialog : public QDialog { public slots: void accept(); void reject(); - void fillPlugs(QAbstractButton*); - void fillPlugs(); private slots: void enableOkB(); + void pluginTypeSelectionChanged(QAbstractButton*); + void tabChanged(int); + void tabMoved(int,int); + void fillPlugs(); + + void newGroup(); + void delGroup(); + void renameGroup(); + void plistContextMenu(const QPoint&); + void groupMenuEntryToggled(int i); private: - QComboBox *sortBox; + QComboBox* sortBox; + QTabBar* tabBar; + QTreeWidget* pList; + QRadioButton* allPlug; + QRadioButton* onlyM; + QRadioButton* onlyS; + QRadioButton* onlySM; + QPushButton *okB; + + QAction* newGroupAction; + QAction* delGroupAction; + QAction* renGroupAction; + + + void saveSettings(); + static int selectedPlugType; + static int selectedGroup; // 0 means "show all" static QStringList sortItems; static QRect geometrySave; static QByteArray listSave; - }; + + QSet<int>* group_info; //holds the group-set of the plugin which shall be affected by the plistContextMenu. +}; } namespace MusEGlobal { extern MusECore::PluginList plugins; +extern MusECore::PluginGroups plugin_groups; +extern QList<QString> plugin_group_names; + +void writePluginGroupConfiguration(int level, MusECore::Xml& xml); +void readPluginGroupConfiguration(MusECore::Xml& xml); } #endif |