forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TQtRootApplication.cxx
84 lines (67 loc) · 2.8 KB
/
TQtRootApplication.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// @(#)root/gui:$Id$
// Author: Fons Rademakers 15/01/98
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
//////////////////////////////////////////////////////////////////////////
// //
// TQtRootApplication //
// //
// This class create the ROOT native GUI version of the ROOT //
// application environment. This to support the Win32 version. //
// Once the native widgets work on Win32 this class can be removed later//
// (since all graphic will go via TVirtualX). //
// //
//////////////////////////////////////////////////////////////////////////
#include "TQtRootApplication.h"
#include "TSystem.h"
#include "TString.h"
// ClassImp(TQtRootApplication);
////////////////////////////////////////////////////////////////////////////////
/// An implementation of the TApplicationImp for Qt-based GUI.
TQtRootApplication::TQtRootApplication(const char *appClassName,
Int_t *argc, char **argv)
{
fApplicationName = appClassName;
fDisplay = 0;
GetOptions(argc, argv);
if (!fDisplay)
// Set DISPLAY based on utmp (only if DISPLAY is not yet set).
gSystem->SetDisplay();
}
////////////////////////////////////////////////////////////////////////////////
/// Delete ROOT application environment.
TQtRootApplication::~TQtRootApplication()
{
delete fDisplay;
}
////////////////////////////////////////////////////////////////////////////////
/// Handle command line arguments. Arguments handled are removed from the
/// argument array. Currently only option "-display xserver" is considered.
void TQtRootApplication::GetOptions(Int_t *argc, char **argv)
{
if (!argc) return;
int i, j;
for (i = 0; i < *argc; i++) {
if (!strcmp(argv[i], "-display")) {
if (argv[i+1] && strlen(argv[i+1]) && argv[i+1][0] != '-') {
fDisplay = StrDup(argv[i+1]);
argv[i] = 0;
argv[i+1] = 0;
i++;
}
}
}
j = 0;
for (i = 0; i < *argc; i++) {
if (argv[i]) {
argv[j] = argv[i];
j++;
}
}
*argc = j;
}