00001 // @(#)root/gui:$Id: TQtRootApplication.cxx 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Fons Rademakers 15/01/98 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 ////////////////////////////////////////////////////////////////////////// 00013 // // 00014 // TQtRootApplication // 00015 // // 00016 // This class create the ROOT native GUI version of the ROOT // 00017 // application environment. This to support the Win32 version. // 00018 // Once the native widgets work on Win32 this class can be removed later// 00019 // (since all graphic will go via TVirtualX). // 00020 // // 00021 ////////////////////////////////////////////////////////////////////////// 00022 00023 #include "TQtRootApplication.h" 00024 #include "TSystem.h" 00025 #include "TString.h" 00026 00027 00028 // ClassImp(TQtRootApplication) 00029 00030 //______________________________________________________________________________ 00031 TQtRootApplication::TQtRootApplication(const char *appClassName, 00032 Int_t *argc, char **argv) 00033 { 00034 // An implementation of the TApplicationImp for Qt-based GUI. 00035 00036 fApplicationName = appClassName; 00037 fDisplay = 0; 00038 00039 GetOptions(argc, argv); 00040 00041 if (!fDisplay) 00042 // Set DISPLAY based on utmp (only if DISPLAY is not yet set). 00043 gSystem->SetDisplay(); 00044 } 00045 00046 //______________________________________________________________________________ 00047 TQtRootApplication::~TQtRootApplication() 00048 { 00049 // Delete ROOT application environment. 00050 00051 delete fDisplay; 00052 } 00053 00054 //______________________________________________________________________________ 00055 void TQtRootApplication::GetOptions(Int_t *argc, char **argv) 00056 { 00057 // Handle command line arguments. Arguments handled are removed from the 00058 // argument array. Currently only option "-display xserver" is considered. 00059 00060 if (!argc) return; 00061 00062 int i, j; 00063 for (i = 0; i < *argc; i++) { 00064 if (!strcmp(argv[i], "-display")) { 00065 if (argv[i+1] && strlen(argv[i+1]) && argv[i+1][0] != '-') { 00066 fDisplay = StrDup(argv[i+1]); 00067 argv[i] = 0; 00068 argv[i+1] = 0; 00069 i++; 00070 } 00071 } 00072 } 00073 00074 j = 0; 00075 for (i = 0; i < *argc; i++) { 00076 if (argv[i]) { 00077 argv[j] = argv[i]; 00078 j++; 00079 } 00080 } 00081 00082 *argc = j; 00083 } 00084