GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4LoadedLibraries.cpp
Go to the documentation of this file.
1// $Id$
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
24TGo4LoadedLibraries::TGo4LoadedLibraries(QWidget *parent) : QDialog(parent)
25{
26 setObjectName("Go4LoadedLibraries");
27 setupUi(this);
28 QObject::connect(LoadLibBtn, &QPushButton::clicked, this, &TGo4LoadedLibraries::LoadNewLibrary);
29 QObject::connect(UnloadLibBtn, &QPushButton::clicked, this, &TGo4LoadedLibraries::UnloadLibrary);
30 QObject::connect(RefreshBtn, &QPushButton::clicked, this, &TGo4LoadedLibraries::RefreshLibs);
31
33 UnloadLibBtn->hide();
34}
35
37{
38 QFileDialog fd(this, "Load Shared Library ", QString(), "Library (*.so)");
39 fd.setFileMode( QFileDialog::ExistingFiles);
40
41 if (fd.exec() != QDialog::Accepted) return;
42
43 QStringList list = fd.selectedFiles();
44 for(auto &lib : list)
45 gSystem->Load(lib.toLatin1().constData());
46
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
60}
61
63{
64 LoadedLibsD->clear();
65
66 TObjArray *libs = TString(gInterpreter->GetSharedLibs()).Tokenize(" ,\t\n");
67
68 if (libs)
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)
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
92 delete libs;
93}
TGo4LoadedLibraries(QWidget *parent=nullptr)