@@ -22,6 +22,8 socexplorercfg.files = \ | |||
|
22 | 22 | unix{ |
|
23 | 23 | SocExplorer.path = /usr/share/applications/ |
|
24 | 24 | SocExplorer.files = unixcfg/SocExplorer.desktop |
|
25 | PluginConfPath.path = /etc/SocExplorer/plugin.conf.d/ | |
|
26 | PluginConfPath.files = unixcfg/plugins.conf | |
|
25 | 27 | icon.path = /usr/share/SocExplorer |
|
26 | 28 | icon.files = ressources/images/Indiana_Jones_cappello.png |
|
27 | 29 | Wizard.path = /usr/share/qtcreator/templates/wizards/SocExplorerPlugin |
@@ -30,7 +32,7 unix{ | |||
|
30 | 32 | Qt_Creator_Wizard/SocExplorerPlugin/plugin.h \ |
|
31 | 33 | Qt_Creator_Wizard/SocExplorerPlugin/project.pro \ |
|
32 | 34 | Qt_Creator_Wizard/SocExplorerPlugin/wizard.xml |
|
33 | INSTALLS+=Wizard SocExplorer icon | |
|
35 | INSTALLS+=Wizard SocExplorer icon PluginConfPath | |
|
34 | 36 | } |
|
35 | 37 | INSTALLS+=socexplorercfg |
|
36 | 38 |
@@ -4,11 +4,6 contains(QT_MAJOR_VERSION, 5) { | |||
|
4 | 4 | QT += widgets |
|
5 | 5 | QT += printsupport |
|
6 | 6 | } |
|
7 | CONFIG(debug, debug|release) { | |
|
8 | DEBUG_EXT = _d | |
|
9 | } else { | |
|
10 | DEBUG_EXT = | |
|
11 | } | |
|
12 | 7 | |
|
13 | 8 | SOCEXPLORER_SDK_BUILD="SOCEXPLORER_SDK_BUILD" |
|
14 | 9 | DEFINES += SOCEXPLORER_SDK_BUILD |
@@ -57,6 +57,40 QString SocExplorerEngine::configFolder( | |||
|
57 | 57 | return QString(SOCEXPLORER_CONFIG_PATH); |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | QStringList SocExplorerEngine::pluginFolders() | |
|
61 | { | |
|
62 | if(!_self) | |
|
63 | init(); | |
|
64 | QStringList folders; | |
|
65 | QDir pluginFolders(QString(SOCEXPLORER_CONFIG_PATH)+"/plugin.conf.d"); | |
|
66 | if(pluginFolders.exists()) | |
|
67 | { | |
|
68 | pluginFolders.setFilter(QDir::Files | QDir::NoSymLinks); | |
|
69 | QFileInfoList list = pluginFolders.entryInfoList(); | |
|
70 | for (int i = 0; i < list.size(); ++i) | |
|
71 | { | |
|
72 | QFileInfo fileInfo = list.at(i); | |
|
73 | if(fileInfo.suffix()=="conf") | |
|
74 | { | |
|
75 | QFile confFile(fileInfo.absoluteFilePath()); | |
|
76 | if(confFile.open(QIODevice::ReadOnly)) | |
|
77 | { | |
|
78 | while (!confFile.atEnd()) | |
|
79 | { | |
|
80 | QString line = confFile.readLine(); | |
|
81 | QDir plugDir(line.remove("\n")); | |
|
82 | if(plugDir.exists() && !folders.contains(plugDir.absolutePath())) | |
|
83 | { | |
|
84 | folders.append(plugDir.absolutePath()); | |
|
85 | } | |
|
86 | } | |
|
87 | } | |
|
88 | } | |
|
89 | } | |
|
90 | } | |
|
91 | return folders; | |
|
92 | } | |
|
93 | ||
|
60 | 94 | SOCModel *SocExplorerEngine::plugin2Soc(socexplorerplugin *plugin) |
|
61 | 95 | { |
|
62 | 96 | if(!_self) |
@@ -90,8 +90,9 public: | |||
|
90 | 90 | //! Return the configuration folder path, OS dependant. |
|
91 | 91 | SOCEXPLORER_SDK_EXPORT static QString configFolder(); |
|
92 | 92 | //! Return the default plugin folder path, OS dependant. |
|
93 | static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} | |
|
94 | ||
|
93 | //static QString pluginFolder(){return QString(SOCEXPLORER_PLUGINS_INSTALL_PATH);} | |
|
94 | static QStringList pluginFolders(); | |
|
95 | static QString configPath(){return QString(SOCEXPLORER_CONFIG_PATH);} | |
|
95 | 96 | static int addEnumDevice(socexplorerplugin* rootPlugin,int VID,int PID,qint32 baseAddress,const QString& name); |
|
96 | 97 | static QList<SOCModel*>* getSOCs(); |
|
97 | 98 | static QString getDevName(int VID, int PID); |
@@ -99,42 +99,43 void pluginmanagerWDGT::setChildLoadable | |||
|
99 | 99 | |
|
100 | 100 | void pluginmanagerWDGT::addPlugin() |
|
101 | 101 | { |
|
102 | QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)")); | |
|
103 | if(pluginloader::checklibrary(fileName)) | |
|
104 | { | |
|
105 | QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1)); | |
|
106 | } | |
|
107 | this->pluginTable->refreshPluginList(); | |
|
102 | // /!\ TODO update it remove maximum operation from widget | |
|
103 | // QString fileName = QFileDialog::getOpenFileName(this,tr("Open Plugin"), QDir::homePath(), tr("Plugin Files Files (*.dll *.so *.so.*)")); | |
|
104 | // if(pluginloader::checklibrary(fileName)) | |
|
105 | // { | |
|
106 | // QFile::copy(fileName,QString(SocExplorerEngine::pluginFolder())+"/"+ fileName.section('/',-1)); | |
|
107 | // } | |
|
108 | // this->pluginTable->refreshPluginList(); | |
|
108 | 109 | } |
|
109 | 110 | |
|
110 | 111 | |
|
111 | 112 | void pluginmanagerWDGT::removePlugin() |
|
112 | 113 | { |
|
113 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
|
114 | { | |
|
115 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
|
116 | if(item!=NULL) | |
|
117 | { | |
|
118 | QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text()); | |
|
119 | } | |
|
120 | } | |
|
121 | this->pluginTable->refreshPluginList(); | |
|
114 | // for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
|
115 | // { | |
|
116 | // QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
|
117 | // if(item!=NULL) | |
|
118 | // { | |
|
119 | // QFile::remove(QString(SocExplorerEngine::pluginFolder())+"/"+item->text()); | |
|
120 | // } | |
|
121 | // } | |
|
122 | // this->pluginTable->refreshPluginList(); | |
|
122 | 123 | } |
|
123 | 124 | |
|
124 | 125 | |
|
125 | 126 | |
|
126 | 127 | void pluginmanagerWDGT::loadplugin() |
|
127 | 128 | { |
|
128 | for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
|
129 | { | |
|
130 | QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
|
131 | if(item!=NULL) | |
|
132 | { | |
|
133 | QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text(); | |
|
134 | emit this->loadSysDrviver(plugin); | |
|
135 | } | |
|
136 | } | |
|
137 | this->pluginTable->refreshPluginList(); | |
|
129 | // for(int i=0;i<this->pluginTable->selectedItems().count();i++) | |
|
130 | // { | |
|
131 | // QListWidgetItem* item = this->pluginTable->selectedItems().at(i); | |
|
132 | // if(item!=NULL) | |
|
133 | // { | |
|
134 | // QString plugin = QString(SocExplorerEngine::pluginFolder())+"/"+item->text(); | |
|
135 | // emit this->loadSysDrviver(plugin); | |
|
136 | // } | |
|
137 | // } | |
|
138 | // this->pluginTable->refreshPluginList(); | |
|
138 | 139 | } |
|
139 | 140 | |
|
140 | 141 |
@@ -23,19 +23,7 pluginloader::pluginloader() | |||
|
23 | 23 | { |
|
24 | 24 | _cache = new PluginsCache(); |
|
25 | 25 | _folderList = new QStringList(); |
|
26 |
|
|
|
27 | if(!pluginPath.exists()) | |
|
28 | { | |
|
29 | pluginPath.mkpath(QString(SocExplorerEngine::pluginFolder())); | |
|
30 | } | |
|
31 | QFile pluginsFolders(QString(SocExplorerEngine::pluginFolder())+"/plugins.conf"); | |
|
32 | *_folderList << QString(SocExplorerEngine::pluginFolder()); //default place | |
|
33 | if(!pluginsFolders.exists()) | |
|
34 | { | |
|
35 | pluginsFolders.open(QIODevice::WriteOnly); //if file doesn't exist create it | |
|
36 | pluginsFolders.close(); | |
|
37 | } | |
|
38 | *_folderList<< readFoldersList(QStringList()<< QString(SocExplorerEngine::pluginFolder())+"/plugins.conf"); | |
|
26 | _folderList->append(SocExplorerEngine::pluginFolders()); | |
|
39 | 27 | scanFolders(); |
|
40 | 28 | } |
|
41 | 29 |
@@ -15,8 +15,9 unix { | |||
|
15 | 15 | DEFINES += SOCEXPLORER_TRANSLATION_PATH="\"\\\"/etc/SocExplorer/translations"\\\"\" |
|
16 | 16 | SOCEXPLORER_TRANSLATION_INSTALL_PATH = /etc/SocExplorer/translations |
|
17 | 17 | SOCEXPLORER_INSTALL_PATH = /usr/local/SocExplorer |
|
18 | SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH = $$system(echo $HOME) | |
|
19 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $${SOCEXPLORER_ROOT_PLUGINS_INSTALL_PATH}"/.SocExplorer/plugins" | |
|
18 | SOCEXPLORER_PLUGINS_INSTALL_PATH = $$[QT_INSTALL_LIBS]"/SocExplorer/plugins" | |
|
19 | DEFINES += SOCEXPLORER_CONFIG_PATH="\"\\\"/etc/SocExplorer"\\\"\" | |
|
20 | SOCEXPLORER_CONFIG_PATH=/etc/SocExplorer | |
|
20 | 21 | } |
|
21 | 22 | |
|
22 | 23 | isEmpty( SOCEXPLORER_SDK_BUILD ){ |
@@ -32,11 +33,11 isEmpty( SOCEXPLORER_SDK_BUILD ){ | |||
|
32 | 33 | OBJECTS_DIR = obj |
|
33 | 34 | MOC_DIR = moc |
|
34 | 35 | DESTDIR = bin |
|
35 | CONFIG(debug, debug|release) { | |
|
36 | DEBUG_EXT = _d | |
|
37 | } else { | |
|
38 | DEBUG_EXT = | |
|
39 | } | |
|
36 | # CONFIG(debug, debug|release) { | |
|
37 | # DEBUG_EXT = _d | |
|
38 | # } else { | |
|
39 | # DEBUG_EXT = | |
|
40 | # } | |
|
40 | 41 | unix{ |
|
41 | 42 | target.path = $${SOCEXPLORER_PLUGINS_INSTALL_PATH} |
|
42 | 43 | INSTALLS += target |
@@ -50,7 +50,7 | |||
|
50 | 50 | #else |
|
51 | 51 | #ifdef UNIX |
|
52 | 52 | #define SOCEXPLORER_PLUGINS_INSTALL_PATH QDir::homePath()+"/.SocExplorer/plugins" |
|
53 | #define SOCEXPLORER_CONFIG_PATH QDir::homePath()+"/.SocExplorer/config" | |
|
53 | //#define SOCEXPLORER_CONFIG_PATH QDir::homePath()+"/.SocExplorer/config" | |
|
54 | 54 | #define PYMODULES "/etc/SocExplorer/python" |
|
55 | 55 | #endif |
|
56 | 56 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now