VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtRemoteControlMenuItem

guiThreadVrfRemoteController.cxx

/*******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file guiThreadVrfRemoteController.cxx
//This file defines the generic DT_DLL_VRF_PLUGIN_EXPORT_MACRO. Use that macro when
//you want to export symbols. Also, in your CMakeLists.txt file, make sure to
//define the VRFPLUGIN_EXPORTS define to tell the compiler to define the macro as an
//export
#include <vrvCore/DtDe.h>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QLineEdit>
#include <QApplication>
#include <boost/bind.hpp>
using namespace makVrv;
//New main menu. This menu will be used to hold the Remote Control Console menu item
class DtRemoteControlMenu : public DtMenu
{
public:
DtRemoteControlMenu(DtDe& de)
: DtMenu(de, "DtRemoteControlMenu")
{
}
~DtRemoteControlMenu()
{
}
QMenu* createMenu( DtDe& de, QWidget* parent )
{
QMenu* menu = new QMenu(QObject::tr("Remote Control"), parent);
return menu;
}
};
//This menu item will create and display the remote control console dialog which will be an example of
//how to use the DtCrossThreadVrfRemoteControl (the GUI version of the DtVrfRemoteController)
class DtRemoteControlMenuItem : public DtMenuItem
{
public:
DtRemoteControlMenuItem(DtDe& de)
: DtMenuItem("DtRemoteControlMenuItem")
, myConsole(0)
, myDe(de)
{
}
virtual ~DtRemoteControlMenuItem()
{
delete myConsole;
}
//Build a menu item (via an action).
virtual QAction* createAction(DtDe&, QWidget* parent)
{
return new QAction(tr("Remote Control Console..."), parent);
}
protected:
void on_triggered()
{
QAction* action = dynamic_cast<QAction*>(sender());
QWidget* parent = 0;
if(action)
{
parent = action->parentWidget();
}
if (!myConsole)
{
myConsole = new DtRemoteControlConsole(myDe, parent);
}
myConsole->show();
myConsole->raise();
qApp->setActiveWindow(myConsole);
myConsole->myCommand->setFocus();
}
protected:
DtDe& myDe;
};
void initPluginMenus(DtVrvApplication& app, DtDe& de)
{
//First, register the creators with the menu assember
DtQtMenuAssembler::instance(de).registerMenu(new DtRemoteControlMenu(de));
DtQtMenuAssembler::instance(de).registerMenu(new DtRemoteControlMenuItem(de));
//Now, add the menu to the master mode configuration. mainMenu indicates that
//the example menu is going to be used as a top-level main menu rather than a
//sub-menu. Add it before the Task menu. To leave off the path will
//put the menu at the end of the menu bar
DtMenuPath::mainMenu("DtTaskMenu"));
//Now, register the DtRemoteControlMenuItem as an item of DtRemoteControlMenu
DtMenuPath::mainMenu("DtRemoteControlMenu").item("DtRemoteControlMenuItem"));
}
bool initDeModule(DtDe* de)
{
if(igApp)
{
initPluginMenus(*igApp, *de);
return true;
}
else
{
return false;
}
}
{
info.pluginName = "Cross Thread Vrf Remote Control";
info.pluginDescription = "This example shows how to use the DtCrossThreadVrfRemoteControl class to control the simulation back-ends.";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "150 Cambridge Park Drive 3rd Floor - Cambridge, MA 02140 USA";
info.pluginContactPhone = "(617) 876 8085";
}

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)