VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VR-Forces GUI Interface

Table of Contents

One of the first things that is done when starting VR-Forces is the creation of the user interface.

The user interface is seeded from the default_guiConfiguration.gui file in the vrfGui Settings directory. This file contains sections for the main menu, dock widgets available, tool bars and right click menus. The structure of this file is like a file structure.

Main Menu Configuration

The main menu is configured from the default_guiConfiguration.gui file. Each menu will have its own section in the file:

<mainmenu menuname="DtFileMenu" sortoptions="NoSort">
<menuitem itemname="DtNewScenarioMenuItem"/>
<menuitem itemname="DtLoadScenarioMenuItem"/>
<menuitem itemname="DtReinitializeScenarioMenuItem"/>
<menu menuname="DtRecentScenariosMenu"/>
<menuitem itemname="DtShowScenarioDescriptionDialogItem"/>
<menuitem itemname="DtLoadBatchScenarioMenuItem"/>
<separator separatorname="DtSaveItemSeparator"/>
<menuitem itemname="DtSaveScenarioAsMenuItem"/>
<menuitem itemname="DtSaveScenarioMenuItem"/>
<menuitem itemname="DtSnapshotScenarioMenuItem"/>
<separator separatorname="DtLaydownItemSeparator"/>
<menuitem itemname="DtImportVRFScenarioMenuItem"/>
<menuitem itemname="DtImportScenarioMenuItem"/>
<menuitem itemname="DtExportScenarioMenuItem"/>
<separator separatorname="DtCloseItemSeparator"/>
<menuitem itemname="DtCloseScenarioMenuItem"/>
<separator separatorname="DtOverlaySeparator"/>
<menu menuname="DtOverlayFileMenu">
<menuitem itemname="DtLoadOverlayMenuItem"/>
<menuitem itemname="DtSaveOverlayMenuItem"/>
<menuitem itemname="DtSaveOverlayAsShapeFiles"/>
<menuitem itemname="DtImportShapeFileOntoOverlay"/>
</menu>
<separator separatorname="DtSessionItemSeparator"/>
<menuitem itemname="DtJoinSessionMenuItem"/>
<menuitem itemname="DtResignFromSessionMenuItem"/>
<separator separatorname="DtNewTerrainItemSeparator"/>
<menu menuname="DtTerrainFileMenu">
<menuitem itemname="DtNewTerrainItem"/>
<menuitem itemname="DtOpenTerrainItem"/>
<menuitem itemname="DtPrintTerrainItem"/>
<menuitem itemname="DtSaveTerrainItem"/>
<menuitem itemname="DtSaveTerrainAsItem"/>
<menuitem itemname="DtSaveTerrainAsImageItem"/>
<separator separatorname="DtExportPropsToShapefileItemSeparator"/>
<menuitem itemname="DtImportPropsFromShapefileItem"/>
<menuitem itemname="DtExportPropsToShapefileItem"/>
<separator separatorname="DtCloseTerrainItemSeparator"/>
<menuitem itemname="DtCloseTerrainItem"/>
</menu>
<separator separatorname="DtTerrainSeparator"/>
<menuitem itemname="DtNewStealthWindowItem"/>
<menuitem itemname="DtNewPlanViewWindowItem"/>
<separator separatorname="DtNewWindowSeparator"/>
<menuitem itemname="DtCheckpointManagerMenuItem"/>
<menuitem itemname="DtDeleteCheckpointsScenarioMenuItem"/>
<separator separatorname="DtDeleteCheckpointsScenarioMenuItemSeparator"/>
<menuitem itemname="DtLoadObjectTagsMenuItem"/>
<separator separatorname="ExitSeparator"/>
<menuitem itemname="DtExitItem"/>
</mainmenu>

In the code, this file will translate into makVrv::DtMenuPath objects that are added to the master mode menu configuration. The menu paths are comprised of DtMenu and DtMenuItem classes (Interface Manipulation), Menu Manipulation). In changing the menu system (removing, reorganizing, adding) you can either hand edit the default_guiConfigutation.gui file, create your own and reference it on the command line, or, follow the examples and manipulate the menus in code.

Dock Widget and Toolbar Configuration

The same methodology applies to the dock widgets (those widgets that appear on the left, right, top or bottom main window dock panel) and the tool bars. The class names are a bit different, but the flow is the same (with the dock widgets appearing in the masterModePageConfiguration and the tool bars in the masterModeToolbarConfiguration):

<pagecollection pagecollectionname="DtVrfObjectListPanel" title="Objects List" location="0" visible="True" index="-1" show="DtVrfOrganizedObjectListPanelPage" closable="True" floatable="True" movable="True">
<pageitem pageitemname="DtVrfOrganizedObjectListPanelPage"/>
<pageitem pageitemname="DtVrfEmbarkationHierarchyPage"/>
<pageitem pageitemname="DtVrfTacticalGraphicOverlayListPage"/>
<pageitem pageitemname="DtSelectionGroupWidget"/>
</pagecollection>
<toolbar toolbarname="DtDisplaySettingsToolbar" visible="True" floating="False">
<widget widgetname="DtEntityLabelsWidget"/>
<item itemname="Dt2dIconDynamicScalingItem"/>
<item itemname="DtRotate2DIconsToHeadingItem"/>
<item itemname="DtTacticalGraphicsItem"/>
<item itemname="DtTacticalGraphicsShowOnlyActiveItem"/>
<item itemname="DtTacticalGraphicsLabelsItem"/>
<item itemname="DtRadioCommunicationsMenuItem"/>
<item itemname="DtEntityHatLinesItem"/>
<item itemname="DtFireDetonateLinesItem"/>
<item itemname="DtEmitterVolumeItem"/>
<item itemname="DtShowNavigationAreasMenuItem"/>
</toolbar>

Each item (menu item, page item, toolbar item) is registered with the applicable assembler (makVrv::DtQtMenuAssembler, makVrv::DtQtToolbarAssembler, makVrv::DtQtPageAssembler). When thinking about overriding items in the menus, pages or toolbars, the appropriate place to replace this would be in the plugins initDeModule (see Plugin Architecture)

Object Information Dialogs

Information dialogs are oranized much the same way as menus, pages and toolbars. There are makVrf::DtInformationPagePath, makVrf::DtInformationPageConfiguration and makVrf::makVrfGuiObjectInformationQt::DtInformationPageAssembler classes to allow for the creation of page information dialogs in the default_guiConfiguration.gui file or in code:

<pagecollection pagecollectionname="DtEntityInformation" title="Entity Information" location="9" visible="True" index="-1" show="DtTaskStatePage" closable="True" floatable="True" movable="True">
<section sectionname="DtEntityCompactData" maximumHeightIsMinimumHeight="true">
<informationitem informationitemname="DtEntityIcon" row="0" col="0" rowspan="2" width="50"/>
<informationitem informationitemname="DtStateMarkingText" row="0" col="1"/>
<pageitem pageitemname="DtInformationIconBar" row="1" col="1" width="20">
<informationitem informationitemname="DtEmbarkedOnItem"/>
<informationitem informationitemname="DtLaunchNavigationLab" width="18" keywords="noselect"/>
</pageitem>
<informationitem informationitemname="DtCreatePaletteName" row="0" col="2"/>
<pageitem pageitemname="DtSensorInformationPage" row="1" col="2"/>
<informationitem informationitemname="DtEntitySpeed" row="0" col="3" width="128"/>
<informationitem informationitemname="DtEntityAltitude" row="1" col="3" width="128"/>
<informationitem informationitemname="DtEntityTrueAirSpeed" row="2" col="3" width="128" keywords="noselect;keepalive"/>
<pageitem pageitemname="DtTaskStatePage" row="0" col="4" width="128"/>
<informationitem informationitemname="DtObjectConsoleInformationStatusItem" row="1" col="4"/>
</section>
<section sectionname="DtEntityExpandedData" collapsible="True" tabbed="small" collapsed="True" title="Detailed Information">
<pageitem pageitemname="DtTaskStatePage" keywords="behaviorGraphEnabled"/>
<pageitem pageitemname="DtEntityInformationPage">
<informationitem informationitemname="DtEntityLocation"/>
<informationitem informationitemname="DtEntitySpeed"/>
<informationitem informationitemname="DtEntityTrueAirSpeed"/>
<informationitem informationitemname="DtEntityIndicatedAirSpeed"/>
<informationitem informationitemname="DtEntityMachAirSpeed"/>
...
</pageitem>
<pageitem pageitemname="DtEntityAttributesPage"/>
<pageitem pageitemname="DtAirBaseFacilitiesPage">
<informationitem informationitemname="DtAirBaseHasNightSupport"/>
<informationitem informationitemname="DtAirBaseORPAircraftCapacity"/>
<!-- For showing apron capacity as an aircraft country
<informationitem informationitemname="DtAirBaseApronAircraftCapacity"/> -->
<informationitem informationitemname="DtAirBaseApronArea"/>
<informationitem informationitemname="DtAirBaseRepairHangarAircraftCapacity"/>
<informationitem informationitemname="DtAirBaseMunitionStorageCapacity"/>
<informationitem informationitemname="DtAirBaseBarracksCapacity"/>
</pageitem>
<pageitem pageitemname="DtAirBaseSuppliesAndPersonnelPage"/>
<pageitem pageitemname="DtAirBaseReadinessPage"/>
<pageitem pageitemname="DtAirBaseFlightStatusPage"/>
<pageitem pageitemname="DtResourceInformationPage"/>
<pageitem pageitemname="DtSensorInformationPage"/>
<pageitem pageitemname="DtEmitterInformationPage">
<informationitem informationitemname="DtEmitterBeamFunction"/>
<informationitem informationitemname="DtEmitterBeamType"/>
<informationitem informationitemname="DtEmitterBeamEventId"/>
<informationitem informationitemname="DtEmitterBeamAzimuthCenter"/>
<informationitem informationitemname="DtEmitterBeamAzimuthSweep"/>
...
</pageitem>
<pageitem pageitemname="DtActiveSonarInformationPage">
<informationitem informationitemname="DtActiveSonarBeamActiveEmissionParameter"/>
<informationitem informationitemname="DtActiveSonarBeamScanPattern"/>
<informationitem informationitemname="DtActiveSonarBeamIdentifier"/>
<informationitem informationitemname="DtActiveSonarBeamAzimuthCenter"/>
<informationitem informationitemname="DtActiveSonarBeamAzimuthWidth"/>
<informationitem informationitemname="DtActiveSonarBeamElevationCenter"/>
<informationitem informationitemname="DtActiveSonarBeamElevationWidth"/>
<informationitem informationitemname="DtActiveSonarBeamEventIdentifier"/>
<informationitem informationitemname="DtActiveSonarBeamIdentifier"/>
</pageitem>
<pageitem pageitemname="DtPropulsionNoiseInformationPage">
<informationitem informationitemname="DtPropulsionNoiseCurrentShaftRPM"/>
<informationitem informationitemname="DtPropulsionNoiseOrderedShaftRPM"/>
<informationitem informationitemname="DtPropulsionNoiseShaftRPMRateOfChange"/>
</pageitem>
<pageitem pageitemname="DtEmbarkedPage"/>
<pageitem pageitemname="DtIffPage">
<informationitem informationitemname="DtIffSystemName"/>
<informationitem informationitemname="DtIffSystemType"/>
<informationitem informationitemname="DtIffSystemInformation"/>
<informationitem informationitemname="DtIffRRBCode"/>
<informationitem informationitemname="DtIffMode1"/>
<informationitem informationitemname="DtIffMode2"/>
<informationitem informationitemname="DtIffMode3"/>
<informationitem informationitemname="DtIffMode4"/>
<informationitem informationitemname="DtIffMode5"/>
<informationitem informationitemname="DtIffMode6"/>
</pageitem>
<pageitem pageitemname="DtLaserDesignatorPage">
<informationitem informationitemname="DtLaserDesignatorCode"/>
<informationitem informationitemname="DtLaserDesignatorDesignatedEntityMarkingText"/>
<informationitem informationitemname="DtLaserDesignatorId"/>
...
</pageitem>
<pageitem pageitemname="DtSystemsInformationPage"/>
</section>
<section sectionname="DtObjectConsoleSection" title="Object Console" collapsible="true" collapsed="true" maximumHeightIsMinimumHeight="false">
<pageitem pageitemname="DtObjectConsoleInformationWidget"/>
</section>
</pagecollection>

Each information page contains a section of data (which is optionally collapsible) and tabs to represent pages of that section. Each page can have a number of information items that will be placed into a tree widget shich show a title and value for that data item. The first section of this example:

<section sectionname="DtEntityCompactData" maximumHeightIsMinimumHeight="true">

Is a special section, that, rather than showing items as they might be in a tree widget (two columns) show them as a widget with a label and value. Each information item can be show itself either in a tree widget or a QWidget with a QLabel. Items can also show icons or be buttons:

QWidget* DtLaunchNavigationLab::widgetRepresentation(QWidget* p, DtStateView<DtVrlinkSimulatedBaseState>* s)
{
if (!myContainer)
{
DtItemUpdateFunction::widgetRepresentation(p, s);
int width = 18;
myDefaultText->setFixedSize(width, width);
myContainer->setFixedSize(width, width);
((QPushButton*)myDefaultText)->setIconSize(QSize(width - 2, width - 2));
DtWidgetIconStyleManager::instance(myHandlerDe).manageWidget(myDefaultText, pixmapFile().c_str());
myDefaultText->setToolTip(QObject::tr("Press to launch navigation lab"));
const DtVrlinkSimulatedEntityState* es =
dynamic_cast<const DtVrlinkSimulatedEntityState*>(&s->state());
bool visible = false;
if (es)
{
//Write lock because getNavDataPath is non-const.
DtSharedModelSet::WriteSettingsLock settings(makVrv::DtSharedSettingsManager::instance(myHandlerDe));
visible = (settings->getNavDataPath(DtEntityType(s->state().myEntityType.c_str())).length() != 0);
}
else
{
myContainer->setVisible(true);
return myContainer;
}
myContainer->setVisible(visible);
if (visible)
{
DtUUID uuid(DtVrfStateViewCollectionManager::instance(myHandlerDe).objectUUID(s->id()));
DtNavigationAreasManager::SimObjectNavigationArea area =
DtNavigationAreasManager::instance(myHandlerDe).simObjectNavAreas()[uuid];
if (!area.profiles.size())
{
request.setEntityUuid(uuid);
DtGuiThreadVrfRemoteController::instance(myHandlerDe).sendMessage(request, DtSimSendToAll);
}
}
}
return myContainer;
}

When the item has a widgetRepresentation and it is not added to a makVrf::makVrfGuiObjectInformationQt::DtInformationDialogPage, it will display as the widget representation. By default it will show as a QLabel which contains the title and value of the item as if it were displayed on the information dialog page. The Add Entity Info Page Add State Property show how to add dialog items. Each of the pageitem items are a subclass of makVrf::makVrfGuiObjectInformationQt::DtInformationDialogPage. The dialog pages have a few methods that need to be implemented to be added as a page to the sysytem, which will include an unique page class name, title and icon to show on the tab:

DtInformationDialogPageLogic* DtLaserDesignatorPage::createLogic()
{
return new DtLaserDesignatorPageLogic(myDe, this);
}
void DtLaserDesignatorPage::activate()
{
if (!myLogic)
{
myLogic = createLogic();
}
DtInformationDialogPage::activate();
}
void DtLaserDesignatorPage::deactivate()
{
DtInformationDialogPage::deactivate();
}
QIcon DtLaserDesignatorPage::icon()
{
return QIcon((myDe.dePathConfiguration().dataPath() + "/Icons/DisplayLaserDesignators.svg").c_str());
}
DtQIconConfigurations DtLaserDesignatorPage::qIconConfigurations() const
{
DtQIconConfigurations result;
result.addConfiguration(DtQIconConfiguration("DisplayLaserDesignators.svg"));
return result;
}
QString DtLaserDesignatorPage::title()
{
return tr("Laser Designator");
}
const std::string& DtLaserDesignatorPage::thePageClassName()
{
static std::string theName = "DtLaserDesignatorPage";
return theName;
}

When adding your own page to an existing dialog it is important to implement these methods for an appropriate look.

How Information Dialogs Are Selected

Information dialogs are added to the makVrf::makVrfGuiObjectInformationQt::DtInformationDialogManager class:

addDialogCreator(DtElementEntry::Entity, "DtEntityInformation");
addDialogCreator(DtElementEntry::Aggregate, "DtAggregateInformation");
addDialogCreator(DtElementEntry::Environmental, "DtEnvironmentalInformation");
addDialogCreator(DtElementEntry::GraphicPoint, "DtEnvironmentalInformation");
addDialogCreator(DtElementEntry::GraphicShape, "DtEnvironmentalInformation");
addDialogCreator(SpotReportsElementType, "DtSpotReportInformation");
addDialogCreator(TDLMessageDataElementType, "DtTDLMessageInformation");
addDialogCreator(DtElementEntry::LaserDesignator, "DtLaserDesignatorInformation");
addDialogCreator(DtIndirectArtilleryType, "DtIndirectFireInformation");
addDialogCreator(DtTerrainProfileLineType, "DtTerrainProfileLineInformation");
addDialogCreator(DtScenarioEventsType, "DtScenarioEventInformation");
addDialogCreator(DtNavigationAreaObjectType, "DtNavigationAreaInformation");
addDialogCreator(DtEntityType(11, 2, -1, -1, -1, -1, -1), "DtAircraftAggregateInformation");
addDialogCreator(DtEngineeringObjectPointTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtFightingPositionInfantryObjectTypes, "DtFightingPositionObjectInformation");
addDialogCreator(DtFightingPositionVehicleObjectTypes, "DtFightingPositionObjectInformation");
addDialogCreator(DtEngineeringObjectLineTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtEngineeringObjectAreaTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtEngineeringObjectFixedSizeAreaTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtGlobalPlanEntityType, "DtGlobalPlanInformation");
addDialogCreator(DtLocalWeatherObjectTypeBox, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeArea, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeEllipse, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeCircle, "DtWeatherInformation");
addDialogCreator(DtCloudLayerObjectTypeGeneric, "DtCloudLayerInformation");
addDialogCreator(DtRunwayType, "DtRunwayInformation");
addDialogCreator(DtAerodromeType, "DtAerodromeInformation");

The dialogs shown match the main page collection name in the default_guiConfiguration.gui file. If you want to override or add a new selection to show for a dialog, you would add your dialog creator to the dialog manager.

Last Clicked Object and Command Panel Information Sections

The information sections on the Last Clicked Object and Command Panel dialogs are known as selected object information creators:

addDialogCreator(DtElementEntry::Entity, "DtEntityInformation");
addDialogCreator(DtElementEntry::Aggregate, "DtAggregateInformation");
addDialogCreator(DtElementEntry::Environmental, "DtEnvironmentalInformation");
addDialogCreator(DtElementEntry::GraphicPoint, "DtEnvironmentalInformation");
addDialogCreator(DtElementEntry::GraphicShape, "DtEnvironmentalInformation");
addDialogCreator(SpotReportsElementType, "DtSpotReportInformation");
addDialogCreator(TDLMessageDataElementType, "DtTDLMessageInformation");
addDialogCreator(DtElementEntry::LaserDesignator, "DtLaserDesignatorInformation");
addDialogCreator(DtIndirectArtilleryType, "DtIndirectFireInformation");
addDialogCreator(DtTerrainProfileLineType, "DtTerrainProfileLineInformation");
addDialogCreator(DtScenarioEventsType, "DtScenarioEventInformation");
addDialogCreator(DtNavigationAreaObjectType, "DtNavigationAreaInformation");
addDialogCreator(DtEntityType(11, 2, -1, -1, -1, -1, -1), "DtAircraftAggregateInformation");
addDialogCreator(DtEngineeringObjectPointTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtFightingPositionInfantryObjectTypes, "DtFightingPositionObjectInformation");
addDialogCreator(DtFightingPositionVehicleObjectTypes, "DtFightingPositionObjectInformation");
addDialogCreator(DtEngineeringObjectLineTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtEngineeringObjectAreaTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtEngineeringObjectFixedSizeAreaTypes, "DtEngineeringObjectInformation");
addDialogCreator(DtGlobalPlanEntityType, "DtGlobalPlanInformation");
addDialogCreator(DtLocalWeatherObjectTypeBox, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeArea, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeEllipse, "DtWeatherInformation");
addDialogCreator(DtLocalWeatherObjectTypeCircle, "DtWeatherInformation");
addDialogCreator(DtCloudLayerObjectTypeGeneric, "DtCloudLayerInformation");
addDialogCreator(DtRunwayType, "DtRunwayInformation");
addDialogCreator(DtAerodromeType, "DtAerodromeInformation");

These small sections are also in the default_guiConfiguration.gui file

<pagecollection pagecollectionname="DtEntityInformationSelectedStatus">
<section sectionname="DtEntityInformationSelectedStatusCompactData">
<informationitem informationitemname="DtEntityIcon" row="0" col="0" rowspan="2" width="50"/>
<informationitem informationitemname="DtStateMarkingText" row="0" col="1" width="-1" keywords="noselect"/>
<informationitem informationitemname="DtShowInformationDialog" row="0" col="2" width="20" keywords="right"/>
<informationitem informationitemname="DtCreatePaletteName" row="1" col="1" width="-1" keywords="noselect"/>
<informationitem informationitemname="DtEntityStateHasPlan" row="1" col="2" width="20" keywords="noselect;right"/>
<informationitem informationitemname="DtEntitySpeed" row="2" col="1" width="-1" keywords="noselect"/>
<informationitem informationitemname="DtEntityEdit" row="2" col="2" width="20" keywords="right"/>
<informationitem informationitemname="DtEntityStateInSyncMatrix" row="3" col="2" width="20" keywords="noselect;right"/>
<informationitem informationitemname="DtEntityAltitude" row="3" col="1" width="-1" keywords="noselect"/>
<informationitem informationitemname="DtEntityTrueAirSpeed" row="4" col="1" width="-1" keywords="noselect;keepalive"/>
<informationitem informationitemname="DtEntityMachAirSpeed" row="5" col="1" width="-1" keywords="noselect"/>
<informationitem informationitemname="DtRangeAndBearingToSelectedBullseye" row="6" col="1" width="-1" keywords="noselect;keepalive"/>
<pageitem pageitemname="DtInformationIconBar" row="7" col="0" colspan="3" width="-1">
<informationitem informationitemname="DtEntityStateSuppressionLevel" keywords="disableifinactive"/>
<informationitem informationitemname="DtEntityStateUnderFire" keywords="disableifinactive"/>
<informationitem informationitemname="DtEmbarkedOnItem" keywords="disableifinactive"/>
<informationitem informationitemname="DtObjectConsoleInformationStatusItem" keywords="icononly;disableifinactive"/>
</pageitem>
<pageitem pageitemname="DtTaskStatePage" row="8" col="0" colspan="3" width="-1" break="2"/>
<pageitem pageitemname="DtAvailableTaskPage" row="9" col="0" colspan="3" width="-1" height ="40" break="2" keywords="noselect"/>
<pageitem pageitemname="DtAvailableSetPage" row="10" col="0" colspan="3" width="-1" keywords="noselect"/>
</section>
</pagecollection>

Each item displayed will use the widgetRepresentation to display information in the small section.


Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)