| 59 | bool PluginInfo::isLoaded() const { return m_state == PLUGIN_LOADED; } |
| 60 | |
| 61 | QString PluginInfo::getErrorMessage() const |
| 62 | { |
| 63 | if(!m_errorMsg.isEmpty()) { |
| 64 | return m_errorMsg; |
| 65 | } |
| 66 | |
| 67 | QString errorMsg = ""; |
| 68 | switch(m_state) { |
| 69 | case PLUGIN_FILE_NOT_FOUND: |
| 70 | errorMsg = "File: " + m_filePath + " doesn't exist"; |
| 71 | break; |
| 72 | case PLUGIN_INVALID_LIBRARY: |
| 73 | errorMsg = "File: " + m_filePath + " doesn't have a valid suffix for a loadable library"; |
| 74 | break; |
| 75 | case PLUGIN_LOAD_FAILED: |
| 76 | errorMsg = "Cannot load library " + m_filePath; |
| 77 | break; |
| 78 | case PLUGIN_INSTANCE_FAILED: |
| 79 | errorMsg = "Cannot create QObject instance from loaded library"; |
| 80 | break; |
| 81 | case PLUGIN_INVALID_PLUGIN: |
| 82 | errorMsg = "Loaded library instance is not a Plugin*"; |
| 83 | break; |
| 84 | case PLUGIN_CLONE_FAILED: |
| 85 | errorMsg = "Clone method does not clone the object or clone name is empty"; |
| 86 | break; |
| 87 | default: |
| 88 | errorMsg = "Unknown error!"; |
| 89 | break; |
| 90 | } |
| 91 | |
| 92 | return errorMsg; |
| 93 | } |