![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2009 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: trayIconMgr.h,v $ $Revision: 1.14 $ $State: Exp $ 00007 *********************************************************************/ 00008 00009 #ifndef trayIconMgr_H_ 00010 #define trayIconMgr_H_ 00011 00014 00015 #include "rtiMsConfig.h" 00016 #include "assistantMgr.h" 00017 #include "rtiAssistantClient.h" 00018 #include <qicon.h> 00019 #include <qsystemtrayicon.h> 00020 #include <vlutil/vlSmartPointers.h> 00021 #include <vlutil/vlPrint.h> 00022 #include <map> 00023 00024 class DtRtiAssistantServer; 00025 class DtRtiAssistantPeer; 00026 class DtAssistantComponentMenu; 00027 class DtAssistantNotifyDialog; 00028 class DtConsoleDialog; 00029 class DtFileConsoleWidget; 00030 class DtAssistantViewLogNowDialog; 00031 class DtAboutBox; 00032 class DtAssistantComponentMgr; 00033 class DtAssistantPreferencesInfoMgr; 00034 class DtAssistantConnectionInfoMgr; 00035 class DtAssistantNotifyMsg; 00036 class DtAssistantShowDialogMsg; 00037 class DtAssistantNotifyObserveMsg; 00038 class QMenu; 00039 class QAction; 00040 class QProcess; 00041 00046 class DT_DLL_ASSISTANTAPP DtAssistantTrayIconMgr : public DtAssistantMgr 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 00053 DtAssistantTrayIconMgr( DtBoost::shared_ptr<DtRtiAssistantServer> server, 00054 DtBoost::shared_ptr<DtRtiAssistantPeer> peer, 00055 DtBoost::shared_ptr<DtAssistantPreferencesInfoMgr> prefMgr, 00056 DtBoost::shared_ptr<DtAssistantComponentMgr> compMgr, 00057 DtBoost::shared_ptr<DtAssistantConnectionInfoMgr> connInfoMgr ); 00058 00060 virtual ~DtAssistantTrayIconMgr(); 00061 00062 private: 00063 00065 DtAssistantTrayIconMgr(DtAssistantTrayIconMgr const& ); 00066 00068 DtAssistantTrayIconMgr& operator= (DtAssistantTrayIconMgr const& ); 00069 00070 public: 00071 00073 virtual void startShutdown(); 00074 00077 void setConnectionsPage( int pageNum ); 00078 00080 void enableComponentLatencyTest( int id ); 00081 00083 void disableComponentLatencyTest( int id ); 00084 00085 protected: 00086 00088 00089 00091 static void processNotifyMsg(const DtAssistantNotifyMsg& msg, void* usr); 00092 00094 virtual void processNotifyMsg(const DtAssistantNotifyMsg& msg); 00095 00097 static void processShowDialogMsg(const DtAssistantShowDialogMsg& msg, void* usr); 00098 00100 virtual void processShowDialogMsg(const DtAssistantShowDialogMsg& msg); 00101 00103 static void processNotifyObserveMsg(const DtAssistantNotifyObserveMsg& msg, void* usr); 00104 00107 virtual void processNotifyObserveMsg(const DtAssistantNotifyObserveMsg& msg); 00108 00110 00112 virtual void loadBrowserPage(const QString &page); 00113 00115 virtual QString createWebSpyUrl( const MAKRti::DtString& host, int port, int id = -1 ); 00116 00118 void enableComponentWebSpy( DtAssistantComponentMenu* menu, const MAKRti::DtString& host, int port, 00119 int webSpyId = -1 ); 00120 00122 void disableComponentWebSpy( DtAssistantComponentMenu* menu ); 00123 00125 void enableComponentLog( DtAssistantComponentMenu* menu, const MAKRti::DtString& logName, 00126 MAKRti::DtNotifyLevelType level ); 00127 00129 void disableComponentLog( DtAssistantComponentMenu* menu ); 00130 00131 signals: 00132 00134 void shutdown(); 00135 00137 void displayActiveWarningDialogs(); 00138 00140 void showLatencyTestDialog( int ); 00141 00143 void displayFederateInfoDialog( int ); 00144 00146 void showConfigDialog(); 00147 00149 void showFederationsDialog(); 00150 00152 void showNetworkComponentsDialog(); 00153 00155 void showConnectionsConfiguration( int pageNum ); 00156 00157 public slots: 00158 00160 void addComponent( int id ); 00161 00163 void renameComponent( int id ); 00164 00166 void removeComponent( int id ); 00167 00169 void processComponentUpdate( int id ); 00170 00172 void sendComponentUpdateNotifyLevel( int id, MAKRti::DtNotifyLevelType level ); 00173 00175 void sendComponentEnableLogging( int id ); 00176 00178 void sendComponentExit( int id ); 00179 00182 void showNotifyConsole(); 00183 00185 void showComponentConsole( int id ); 00186 00188 void showVersionsWebpage(); 00189 00191 void showAboutDialog(); 00192 00194 void showHelpDialog(); 00195 00197 void processHelpDialogClose(); 00198 00200 void showComponentWebSpy( int id ); 00201 00204 void showComponentWebSpy( const MAKRti::DtString& host, int port, 00205 int webSpyId ); 00206 00208 void notification( const MAKRti::DtString& message, 00209 MAKRti::DtNotifyLevelType notifyLevel, int sourceCompId = -1, 00210 bool logOnly = false, bool forward = true); 00211 00213 void notification( const MAKRti::DtString& message, 00214 MAKRti::DtNotifyLevelType notifyLevel, const MAKRti::DtString& source, 00215 bool logOnly = false, bool forward = true); 00216 00220 void showNotifyIcon(); 00221 00223 void clearNotifyIcon(); 00224 00227 void showWarningIcon(); 00228 00231 void clearWarningIcon(); 00232 00234 void processTrayIconActivation( QSystemTrayIcon::ActivationReason reason ); 00235 00238 void setLogUpdateInterval( unsigned int interval ); 00239 00242 void setShowViewLogPrompt( bool viewPrompt ); 00243 00246 void setAlwaysViewLog( bool alwaysView ); 00247 00249 void setEnableNotifications( bool enable ); 00250 00252 void disableComponentLog( int compId ); 00253 00256 void setObservingNotifications( bool isObserving ); 00257 00259 void sendNotifyObserveMsg(); 00260 00262 void pruneStaleNotifyObservers(); 00263 00264 #ifdef DtDIAGNOSTIC 00265 00266 void showMsgDump(); 00267 #endif 00268 00269 00270 protected: 00271 00272 typedef std::map< int, DtAssistantComponentMenu*> DtIdToMenuMap; 00273 typedef std::map< int, DtConsoleDialog*> DtIdToFileConsoleMap; 00274 typedef std::map< int, QString> DtIdToWebSpyUrlMap; 00275 00277 DtBoost::shared_ptr<DtAssistantPreferencesInfoMgr> myPrefMgr; 00278 00280 DtBoost::shared_ptr<DtAssistantComponentMgr> myCompMgr; 00281 00283 DtBoost::shared_ptr<DtAssistantConnectionInfoMgr> myConnInfoMgr; 00284 00286 QSystemTrayIcon* myTrayIcon; 00287 00289 QMenu* myMenu; 00290 00292 QAction* myShowNotifyHistoryAction; 00293 00295 QAction* myVersionsWebSiteAction; 00296 00299 QAction* myShowPreferencesAction; 00300 00302 QAction* myShowFederationsAction; 00303 00305 QAction* myShowAboutAction; 00306 00308 QAction* myShowRtiNetworkComponentAction; 00309 00311 QAction* myShowHelpAction; 00312 00314 DtIdToMenuMap myCompMenus; 00315 00317 QAction* myLrcSeparator; 00318 00320 QAction* myShutdownAllAction; 00321 00323 DtAssistantNotifyDialog* myNotifyDialog; 00324 00327 DtConsoleDialog* myNotifyConsole; 00328 00330 DtIdToFileConsoleMap myComponentConsoles; 00331 00334 DtAssistantViewLogNowDialog* myViewLogNowDialog; 00335 00337 DtAboutBox* myAboutDialog; 00338 00340 QProcess* myHelpAssistant; 00341 00343 QString myWebSpyUrl; 00344 00346 DtIdToWebSpyUrlMap myCompWebSpyUrl; 00347 00350 std::set< int > myViewLogCompIds; 00351 00353 bool myDisplayNotifyIcon; 00354 00357 unsigned myDisplayWarningCount; 00358 00360 unsigned int myLogUpdateInterval; 00361 00364 bool myShowViewLogPrompt; 00365 00368 bool myAlwaysViewLog; 00369 00371 bool myEnableNotifications; 00372 00374 int myConnectionsPage; 00375 00378 std::map<int, MAKRti::DtString> myLastNotifyNames; 00379 00381 bool myObservingNotifications; 00382 00384 std::map< DtAssistantInfo, bool > myNotifyObservers; 00385 00386 #ifdef _WIN32 00387 00388 bool myShowingMsgDump; 00389 std::streambuf* myOriginalRdbuf; 00390 DtWindowsConsolePrinter *myWinConsole; 00391 std::ofstream* myConsoleStream; 00392 #endif 00393 00394 00395 }; 00396 00397 #endif