Skip to content

Commit bf1aa84

Browse files
committed
Update format and comments
1 parent 7419b2d commit bf1aa84

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

examples/plugin_text/PluginDefinition.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
#include "TextModel.hpp"
44

5-
Plugin *Plugin::_this_plugin = nullptr;
5+
Plugin* Plugin::_this_plugin = nullptr;
66

77
Plugin::
88
Plugin()
99
{ _this_plugin = this; }
1010

1111
void
1212
Plugin::
13-
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> &reg)
13+
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> & reg)
1414
{
1515
assert(reg);
1616

examples/plugin_text/PluginDefinition.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class DLL_EXPORT Plugin
3333
{ return PLUGIN_NAME; };
3434

3535
void
36-
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> &reg) override;
36+
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> & reg) override;
3737

3838
private:
39-
static Plugin *_this_plugin;
39+
static Plugin* _this_plugin;
4040
};

include/QtNodes/internal/PluginInterface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PluginInterface
1919

2020
virtual
2121
void
22-
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> &reg) = 0;
22+
registerDataModels(std::shared_ptr<QtNodes::NodeDelegateModelRegistry> & reg) = 0;
2323

2424
};
2525

include/QtNodes/internal/PluginsManager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class NodeDelegateModelRegistry;
1818
*
1919
* @code {.cpp}
2020
* PluginsManager *pluginsManager = PluginsManager::instance();
21-
* std::shared_ptr<NodeDelegateModelRegistry> registry = pluginsManager->createRegistry();
21+
* std::shared_ptr<NodeDelegateModelRegistry> registry = pluginsManager->registry();
2222
* pluginsManager->loadPlugins(R"(./nodes)");
2323
* for (auto plugin : pluginsManager->pluginList())
2424
* {

src/PluginsManager.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ loadPlugins(const QString &folderPath)
6161
}
6262
pluginsDir.cd(folderPath);
6363

64-
QFileInfoList pluginsInfo = pluginsDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
64+
QFileInfoList pluginsInfo = pluginsDir.entryInfoList(
65+
QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
6566

6667
for (QFileInfo fileInfo : pluginsInfo)
6768
{
68-
if(fileInfo.isFile())
69+
if (fileInfo.isFile())
6970
{
7071
qDebug() << "plugin path: " << fileInfo.absoluteFilePath();
7172
loadPluginFromPath(fileInfo.absoluteFilePath());
@@ -114,7 +115,7 @@ loadPluginFromPath(const QString & filePath)
114115
}
115116
else
116117
{
117-
qDebug() << "loadPlugin:" << filePath << loader->errorString();
118+
qCritical() << "loadPlugin:" << filePath << loader->errorString();
118119
}
119120
return -1;
120121
}
@@ -124,11 +125,11 @@ int
124125
PluginsManager::
125126
unloadPluginFromPath(const QString & filePath)
126127
{
127-
QPluginLoader *loader = _loaders.value(filePath);
128-
PluginInterface *plugin = qobject_cast<PluginInterface *>(loader->instance());
128+
QPluginLoader* loader = _loaders.value(filePath);
129+
PluginInterface* plugin = qobject_cast<PluginInterface*>(loader->instance());
129130
if (plugin)
130131
{
131-
// TODO: 待验证
132+
// TODO: Verification required
132133
_plugins.erase(std::remove(_plugins.begin(), _plugins.end(), plugin), _plugins.end());
133134
}
134135

0 commit comments

Comments
 (0)