GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4LoadedLibraries.cpp
Go to the documentation of this file.
1 // $Id: TGo4LoadedLibraries.cpp 3126 2021-03-30 09:04:24Z 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 fuer 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  QObject::connect(LoadLibBtn, SIGNAL(clicked()), this, SLOT(LoadNewLibrary()));
30  QObject::connect(UnloadLibBtn, SIGNAL(clicked()), this, SLOT(UnloadLibrary()));
31  QObject::connect(RefreshBtn, SIGNAL(clicked()), this, SLOT(RefreshLibs()));
32 
33  RefreshLibs();
34  UnloadLibBtn->hide();
35 }
36 
38 {
39  QFileDialog fd(this, "Load Shared Library ", QString(), "Library (*.so)");
40  fd.setFileMode( QFileDialog::ExistingFiles);
41 
42  if ( fd.exec() != QDialog::Accepted ) return;
43 
44  QStringList list = fd.selectedFiles();
45  QStringList::Iterator it = list.begin();
46  while( it != list.end() ) {
47  gSystem->Load((*it).toLatin1().constData());
48  ++it;
49  }
50 
51  RefreshLibs();
52 }
53 
55 {
56  QTreeWidgetItemIterator it(LoadedLibsD);
57  while(*it) {
58  if ( (*it)->isSelected() )
59  gSystem->Unload((*it)->text(0).toLatin1().constData());
60  it++;
61  }
62 
63  RefreshLibs();
64 }
65 
67 {
68  LoadedLibsD->clear();
69 
70  TObjArray* libs = TString(gInterpreter->GetSharedLibs()).Tokenize(" ,\t\n");
71 
72  if (libs!=0)
73  for (int n=0; n<=libs->GetLast(); n++) {
74  QFileInfo fi(libs->At(n)->GetName());
75 
76  QStringList columns;
77 
78  columns << fi.fileName() << QString::number(fi.size()) << fi.lastModified().toString() << fi.owner() << fi.group();
79 
80  LoadedLibsD->addTopLevelItem(new QTreeWidgetItem(columns));
81  }
82 
83  delete libs;
84 
85  LoadedLibsS->clear();
86 
87  libs = TString(gSystem->GetLinkedLibs()).Tokenize(" ,\t\n");
88 
89  if (libs!=0)
90  for (int n=0; n<=libs->GetLast(); n++) {
91  QStringList columns;
92  columns << libs->At(n)->GetName();
93  LoadedLibsS->addTopLevelItem(new QTreeWidgetItem(columns));
94  }
95  delete libs;
96 }
TGo4LoadedLibraries(QWidget *parent=0)
virtual void LoadNewLibrary()
virtual void UnloadLibrary()