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