Skip to content

Commit

Permalink
Created an empty Pendulum window.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jun 22, 2017
1 parent 3215407 commit 1e4fce4
Show file tree
Hide file tree
Showing 12 changed files with 10,612 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -811,6 +811,7 @@ SET(PLUGINS
organisation/PMRWindow
organisation/PMRWorkspacesWindow

simulation/PendulumWindow
simulation/SimulationExperimentView

solver/CVODESolver
Expand Down
21 changes: 21 additions & 0 deletions src/plugins/simulation/PendulumWindow/CMakeLists.txt
@@ -0,0 +1,21 @@
PROJECT(PendulumWindowPlugin)

# Add the plugin

ADD_PLUGIN(PendulumWindow
SOURCES
../../i18ninterface.cpp
../../plugininfo.cpp
../../plugininterface.cpp
../../windowinterface.cpp

src/pendulumwindowplugin.cpp
src/pendulumwindowwindow.cpp
HEADERS_MOC
src/pendulumwindowplugin.h
src/pendulumwindowwindow.h
UIS
src/pendulumwindowwindow.ui
PLUGINS
ZincWidget
)
22 changes: 22 additions & 0 deletions src/plugins/simulation/PendulumWindow/i18n/PendulumWindow_fr.ts
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="fr_FR" sourcelanguage="en_GB">
<context>
<name>OpenCOR::PendulumWindow::PendulumWindowPlugin</name>
<message>
<source>Pendulum</source>
<translation>Pendule</translation>
</message>
<message>
<source>Show/hide the Pendulum window</source>
<translation>Montrer/cacher la fenêtre Pendule</translation>
</message>
</context>
<context>
<name>PendulumWindowWindow</name>
<message>
<source>Pendulum</source>
<translation>Pendule</translation>
</message>
</context>
</TS>
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file alias="${PLUGIN_NAME}_fr">${PROJECT_BUILD_DIR}/${PLUGIN_NAME}_fr.qm</file>
</qresource>
</RCC>
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/PendulumWindow">
<file>data.csv</file>
</qresource>
</RCC>
10,002 changes: 10,002 additions & 0 deletions src/plugins/simulation/PendulumWindow/res/data.csv

Large diffs are not rendered by default.

184 changes: 184 additions & 0 deletions src/plugins/simulation/PendulumWindow/src/pendulumwindowplugin.cpp
@@ -0,0 +1,184 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR 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.
OpenCOR 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/>.
*******************************************************************************/

//==============================================================================
// Pendulum window plugin
//==============================================================================

#include "coreguiutils.h"
#include "pendulumwindowplugin.h"
#include "pendulumwindowwindow.h"

//==============================================================================

#include <QMainWindow>

//==============================================================================

namespace OpenCOR {
namespace PendulumWindow {

//==============================================================================

PLUGININFO_FUNC PendulumWindowPluginInfo()
{
Descriptions descriptions;

descriptions.insert("en", QString::fromUtf8("a plugin to test the pendulum model."));
descriptions.insert("fr", QString::fromUtf8("une extension pour tester le modèle du pendule."));

return new PluginInfo(PluginInfo::Simulation, true, false,
QStringList() << "ZincWidget",
descriptions);
}

//==============================================================================
// I18n interface
//==============================================================================

void PendulumWindowPlugin::retranslateUi()
{
// Retranslate our Pendulum window action

retranslateAction(mPendulumWindowAction,
tr("Pendulum"),
tr("Show/hide the Pendulum window"));

// Retranslate our Pendulum window

mPendulumWindowWindow->retranslateUi();
}

//==============================================================================
// Plugin interface
//==============================================================================

bool PendulumWindowPlugin::definesPluginInterfaces()
{
// We don't handle this interface...

return false;
}

//==============================================================================

bool PendulumWindowPlugin::pluginInterfacesOk(const QString &pFileName,
QObject *pInstance)
{
Q_UNUSED(pFileName);
Q_UNUSED(pInstance);

// We don't handle this interface...

return false;
}

//==============================================================================

void PendulumWindowPlugin::initializePlugin()
{
// Create an action to show/hide our web browser window

mPendulumWindowAction = Core::newAction(true, Core::mainWindow());

// Create our web browser window

mPendulumWindowWindow = new PendulumWindowWindow(Core::mainWindow());
}

//==============================================================================

void PendulumWindowPlugin::finalizePlugin()
{
// We don't handle this interface...
}

//==============================================================================

void PendulumWindowPlugin::pluginsInitialized(const Plugins &pLoadedPlugins)
{
Q_UNUSED(pLoadedPlugins);

// We don't handle this interface...
}

//==============================================================================

void PendulumWindowPlugin::loadSettings(QSettings *pSettings)
{
Q_UNUSED(pSettings);

// We don't handle this interface...
}

//==============================================================================

void PendulumWindowPlugin::saveSettings(QSettings *pSettings) const
{
Q_UNUSED(pSettings);

// We don't handle this interface...
}

//==============================================================================

void PendulumWindowPlugin::handleUrl(const QUrl &pUrl)
{
Q_UNUSED(pUrl);

// We don't handle this interface...
}

//==============================================================================
// Window interface
//==============================================================================

Qt::DockWidgetArea PendulumWindowPlugin::windowDefaultDockArea() const
{
// Return our default dock area

return Qt::RightDockWidgetArea;
}

//==============================================================================

QAction * PendulumWindowPlugin::windowAction() const
{
// Return our window action

return mPendulumWindowAction;
}

//==============================================================================

QDockWidget * PendulumWindowPlugin::windowWidget() const
{
// Return our window widget

return mPendulumWindowWindow;
}

//==============================================================================

} // namespace PendulumWindow
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
77 changes: 77 additions & 0 deletions src/plugins/simulation/PendulumWindow/src/pendulumwindowplugin.h
@@ -0,0 +1,77 @@
/*******************************************************************************
Copyright (C) The University of Auckland
OpenCOR 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.
OpenCOR 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/>.
*******************************************************************************/

//==============================================================================
// Pendulum window plugin
//==============================================================================

#pragma once

//==============================================================================

#include "i18ninterface.h"
#include "plugininfo.h"
#include "plugininterface.h"
#include "windowinterface.h"

//==============================================================================

namespace OpenCOR {
namespace PendulumWindow {

//==============================================================================

PLUGININFO_FUNC PendulumWindowPluginInfo();

//==============================================================================

class PendulumWindowWindow;

//==============================================================================

class PendulumWindowPlugin : public QObject, public I18nInterface,
public PluginInterface, public WindowInterface
{
Q_OBJECT

Q_PLUGIN_METADATA(IID "OpenCOR.PendulumWindowPlugin" FILE "pendulumwindowplugin.json")

Q_INTERFACES(OpenCOR::I18nInterface)
Q_INTERFACES(OpenCOR::PluginInterface)
Q_INTERFACES(OpenCOR::WindowInterface)

public:
#include "i18ninterface.inl"
#include "plugininterface.inl"
#include "windowinterface.inl"

private:
QAction *mPendulumWindowAction;

PendulumWindowWindow *mPendulumWindowWindow;
};

//==============================================================================

} // namespace PendulumWindow
} // namespace OpenCOR

//==============================================================================
// End of file
//==============================================================================
@@ -0,0 +1,3 @@
{
"Keys": [ "PendulumWindowPlugin" ]
}

0 comments on commit 1e4fce4

Please sign in to comment.