-
-
Notifications
You must be signed in to change notification settings - Fork 421
Expand file tree
/
Copy pathcode_generator_plugin.cpp
More file actions
68 lines (56 loc) · 1.73 KB
/
code_generator_plugin.cpp
File metadata and controls
68 lines (56 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "code_generator_plugin.h"
#include "code_generator_widget.h"
#include "exception.h"
#include "messagebox.h"
#include "python_daos_generator.h"
CodeGeneratorPlugin::CodeGeneratorPlugin(void)
{
this->widget = new CodeGeneratorWidget();
this->generator = new PythonDAOsGenerator();
((CodeGeneratorWidget*)this->widget)->setGenerator((BaseCodeGenerator *) this->generator);
configurePluginInfo(
getPluginTitle(),
getPluginVersion(),
getPluginAuthor(),
getPluginDescription(),
GlobalAttributes::PLUGINS_DIR +
GlobalAttributes::DIR_SEPARATOR +
QString("code_generator") +
GlobalAttributes::DIR_SEPARATOR + QString("code_generator.png")
);
}
CodeGeneratorPlugin::~CodeGeneratorPlugin(void)
{
delete ((CodeGeneratorWidget*)this->widget);
this->widget = 0;
}
QString CodeGeneratorPlugin::getPluginTitle(void)
{
return(trUtf8("CodeGenerator"));
}
QString CodeGeneratorPlugin::getPluginVersion(void)
{
return(QString("0.1"));
}
QString CodeGeneratorPlugin::getPluginAuthor(void)
{
return(QString("Riccardo Campisano"));
}
QString CodeGeneratorPlugin::getPluginDescription(void)
{
return(trUtf8("This plugin automatically gerate code."));
}
void CodeGeneratorPlugin::showPluginInfo(void)
{
plugin_info_frm->show();
}
void CodeGeneratorPlugin::executePlugin(ModelWidget *model)
{
if(!model)
throw Exception(trUtf8("This plugin must be executed with at least one model opened!"),ERR_CUSTOM,__PRETTY_FUNCTION__,__FILE__,__LINE__);
((CodeGeneratorWidget*)this->widget)->show(model->getDatabaseModel(), model->getOperationList());
}
QKeySequence CodeGeneratorPlugin::getPluginShortcut(void)
{
return(QKeySequence(QString("Ctrl+Alt+G")));
}