/
_extensionname_plugin.cpp
74 lines (65 loc) · 2.39 KB
/
_extensionname_plugin.cpp
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
69
70
71
72
73
//_extensionname_
//Copyright (C) 2015 _authorname_
//
//This file is part of BrainStim.
//BrainStim is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#include "_extensionname_plugin.h"
#include "_extensionname_.h"
#include "defines.h"
Q_DECLARE_METATYPE(_extensionname_*)
Q_DECLARE_METATYPE(_extensionname_)
_extensionname_Plugin::_extensionname_Plugin(QObject *parent)
{
_extensionname_Object = new _extensionname_(parent);
_extensionname_DiagObject = new _extensionname__Dialog();
strPluginInformation = QString(PLUGIN_INTERNAL_NAME) + " Plugin" + "(v" + PLUGIN_FILE_VERSION_STRING + ")";// +" by " + PLUGIN_AUTHOR_NAME;
strPluginInternalName = PLUGIN_INTERNAL_NAME;
}
_extensionname_Plugin::~_extensionname_Plugin()
{
delete _extensionname_DiagObject;
delete _extensionname_Object;
}
int _extensionname_Plugin::ConfigureScriptEngine(QScriptEngine &engine)
{
QScriptValue _extensionname_Proto = engine.newQObject(_extensionname_Object);
engine.setDefaultPrototype(qMetaTypeId<_extensionname_*>(), _extensionname_Proto);
QScriptValue _extensionname_Ctor = engine.newFunction(_extensionname_::ctor__extensionname_, _extensionname_Proto);
engine.globalObject().setProperty(PLUGIN_SCRIPTOBJECT_NAME, _extensionname_Ctor);
int nMetaType = qRegisterMetaType<_extensionname_>(PLUGIN_SCRIPTOBJECT_CLASS);
//FinalizeScriptObjectScriptContext(engine, _extensionname_Object);
return nMetaType;
}
bool _extensionname_Plugin::ShowGUI()
{
int returnVal;
_extensionname_DiagObject->setWindowTitle(strPluginInformation);
returnVal = _extensionname_DiagObject->exec();
switch (returnVal) {
case QMessageBox::Save:
// Save was clicked
break;
case QMessageBox::Discard:
// Don't Save was clicked
break;
case QMessageBox::Cancel:
// Cancel was clicked
break;
default:
// should never be reached
break;
}
return true;
}