GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4LoadedLibraries.cpp
Go to the documentation of this file.
1 // $Id: TGo4LoadedLibraries.cpp 1134 2014-01-22 14:53:40Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4LoadedLibraries.h"
15 
16 #include <QFileDialog>
17 #include <QDateTime>
18 
19 #include "TSystem.h"
20 #include "TString.h"
21 #include "TInterpreter.h"
22 #include "TObjArray.h"
23 
25  : QDialog( parent )
26 {
27  setObjectName("Go4LoadedLibraries");
28  setupUi(this);
29  RefreshLibs();
30  UnloadLibBtn->hide();
31 }
32 
34 {
35  QFileDialog fd(this, "Load Shared Library ", QString(), "Library (*.so)");
36  fd.setFileMode( QFileDialog::ExistingFiles);
37 
38  if ( fd.exec() != QDialog::Accepted ) return;
39 
40  QStringList list = fd.selectedFiles();
41  QStringList::Iterator it = list.begin();
42  while( it != list.end() ) {
43  gSystem->Load((*it).toLatin1().constData());
44  ++it;
45  }
46 
47  RefreshLibs();
48 }
49 
51 {
52  QTreeWidgetItemIterator it(LoadedLibsD);
53  while(*it) {
54  if ( (*it)->isSelected() )
55  gSystem->Unload((*it)->text(0).toLatin1().constData());
56  it++;
57  }
58 
59  RefreshLibs();
60 }
61 
63 {
64  LoadedLibsD->clear();
65 
66  TObjArray* libs = TString(gInterpreter->GetSharedLibs()).Tokenize(" ,\t\n");
67 
68  if (libs!=0)
69  for (int n=0; n<=libs->GetLast(); n++) {
70  QFileInfo fi(libs->At(n)->GetName());
71 
72  QStringList columns;
73 
74  columns << fi.fileName() << QString::number(fi.size()) << fi.lastModified().toString() << fi.owner() << fi.group();
75 
76  LoadedLibsD->addTopLevelItem(new QTreeWidgetItem(columns));
77  }
78 
79  delete libs;
80 
81  LoadedLibsS->clear();
82 
83  libs = TString(gSystem->GetLinkedLibs()).Tokenize(" ,\t\n");
84 
85  if (libs!=0)
86  for (int n=0; n<=libs->GetLast(); n++) {
87  QStringList columns;
88  columns << libs->At(n)->GetName();
89  LoadedLibsS->addTopLevelItem(new QTreeWidgetItem(columns));
90  }
91  delete libs;
92 }
TGo4LoadedLibraries(QWidget *parent=0)
virtual void LoadNewLibrary()
virtual void UnloadLibrary()