|
| 1 | +/* |
| 2 | +# PostgreSQL Database Modeler (pgModeler) |
| 3 | +# |
| 4 | +# Copyright 2006-2019 - Raphael Araújo e Silva <[email protected]> |
| 5 | +# |
| 6 | +# This program is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU General Public License as published by |
| 8 | +# the Free Software Foundation version 3. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | +# |
| 15 | +# The complete text of GPLv3 is at LICENSE file on source code root directory. |
| 16 | +# Also, you can get the complete GNU General Public License at <http://www.gnu.org/licenses/> |
| 17 | +*/ |
| 18 | + |
| 19 | +#include "dummy.h" |
| 20 | +#include "exception.h" |
| 21 | +#include "messagebox.h" |
| 22 | +#include "mainwindow.h" |
| 23 | + |
| 24 | +Dummy::Dummy(void) |
| 25 | +{ |
| 26 | + configurePluginInfo(getPluginTitle(), |
| 27 | + getPluginVersion(), |
| 28 | + getPluginAuthor(), |
| 29 | + getPluginDescription(), |
| 30 | + |
| 31 | + GlobalAttributes::PluginsDir + |
| 32 | + GlobalAttributes::DirSeparator + |
| 33 | + QString("dummy") + |
| 34 | + GlobalAttributes::DirSeparator + QString("dummy.png")); |
| 35 | +} |
| 36 | + |
| 37 | +QString Dummy::getPluginTitle(void) |
| 38 | +{ |
| 39 | + return(trUtf8("Dummy")); |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +QString Dummy::getPluginVersion(void) |
| 44 | +{ |
| 45 | + return(QString("0.1")); |
| 46 | +} |
| 47 | + |
| 48 | +QString Dummy::getPluginAuthor(void) |
| 49 | +{ |
| 50 | + return(QString("Raphael A. Silva")); |
| 51 | +} |
| 52 | + |
| 53 | +QString Dummy::getPluginDescription(void) |
| 54 | +{ |
| 55 | + return(trUtf8("A dummy plugin only to test the pgModeler plugin structure.")); |
| 56 | +} |
| 57 | + |
| 58 | +void Dummy::showPluginInfo(void) |
| 59 | +{ |
| 60 | + plugin_info_frm->show(); |
| 61 | +} |
| 62 | + |
| 63 | +void Dummy::executePlugin(ModelWidget *) |
| 64 | +{ |
| 65 | + Messagebox msgbox; |
| 66 | + msgbox.show(trUtf8("Plugin successfully loaded!"), |
| 67 | + trUtf8("Plugin successfully loaded! Check the <a href='http://www.pgmodeler.com.br/wiki/doku.php?id=plugins'>plugins wiki page</a> to know how to create your own plugins."), |
| 68 | + Messagebox::InfoIcon); |
| 69 | +} |
| 70 | + |
| 71 | +void Dummy::setMainWindow(QMainWindow *main_window) |
| 72 | +{ |
| 73 | + this->main_window = main_window; |
| 74 | + |
| 75 | + /* The sample code below shows how to interact with the exposed main window by adding |
| 76 | + * a tool button to the bottom widgets bar. |
| 77 | + * |
| 78 | + * You can use this basic approach to add more UI elements to it. |
| 79 | + * To do so, open the design file mainwindow.ui to see the name of the widgets you |
| 80 | + * need to handle */ |
| 81 | + |
| 82 | + //MainWindow *mw = dynamic_cast<MainWindow *>(main_window); |
| 83 | + //QToolButton *tb = new QToolButton(mw->tool_btns_bar_wgt); |
| 84 | + //mw->tool_btns_bar_wgt->layout()->addWidget(tb); |
| 85 | + //tb->setText("This is a test button"); |
| 86 | + //connect(tb, &QToolButton::clicked, [&](){ |
| 87 | + // Messagebox msgbox; |
| 88 | + // msgbox.show(trUtf8("Alert"), trUtf8("This is a message box triggered by the click signal emitted by the test button!"), Messagebox::AlertIcon); |
| 89 | + //}); |
| 90 | +} |
| 91 | + |
| 92 | +QKeySequence Dummy::getPluginShortcut(void) |
| 93 | +{ |
| 94 | + return(QKeySequence(QString("Ctrl+J"))); |
| 95 | +} |
0 commit comments