Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4LoadedLibraries.h"
00015
00016 #include <QFileDialog>
00017 #include <QDateTime>
00018
00019 #include "TSystem.h"
00020 #include "TString.h"
00021 #include "TInterpreter.h"
00022 #include "TObjArray.h"
00023
00024 TGo4LoadedLibraries::TGo4LoadedLibraries( QWidget* parent )
00025 : QDialog( parent )
00026 {
00027 setObjectName("Go4LoadedLibraries");
00028 setupUi(this);
00029 RefreshLibs();
00030 UnloadLibBtn->hide();
00031 }
00032
00033 void TGo4LoadedLibraries::LoadNewLibrary()
00034 {
00035 QFileDialog fd(this, "Load Shared Library ", QString(), "Library (*.so)");
00036 fd.setFileMode( QFileDialog::ExistingFiles);
00037
00038 if ( fd.exec() != QDialog::Accepted ) return;
00039
00040 QStringList list = fd.selectedFiles();
00041 QStringList::Iterator it = list.begin();
00042 while( it != list.end() ) {
00043 gSystem->Load((*it).toLatin1().constData());
00044 ++it;
00045 }
00046
00047 RefreshLibs();
00048 }
00049
00050 void TGo4LoadedLibraries::UnloadLibrary()
00051 {
00052 QTreeWidgetItemIterator it(LoadedLibsD);
00053 while(*it) {
00054 if ( (*it)->isSelected() )
00055 gSystem->Unload((*it)->text(0).toLatin1().constData());
00056 it++;
00057 }
00058
00059 RefreshLibs();
00060 }
00061
00062 void TGo4LoadedLibraries::RefreshLibs()
00063 {
00064 LoadedLibsD->clear();
00065
00066 TObjArray* libs = TString(gInterpreter->GetSharedLibs()).Tokenize(" ,\t\n");
00067
00068 if (libs!=0)
00069 for (int n=0; n<=libs->GetLast(); n++) {
00070 QFileInfo fi(libs->At(n)->GetName());
00071
00072 QStringList columns;
00073
00074 columns << fi.fileName() << QString::number(fi.size()) << fi.lastModified().toString() << fi.owner() << fi.group();
00075
00076 LoadedLibsD->addTopLevelItem(new QTreeWidgetItem(columns));
00077 }
00078
00079 delete libs;
00080
00081 LoadedLibsS->clear();
00082
00083 libs = TString(gSystem->GetLinkedLibs()).Tokenize(" ,\t\n");
00084
00085 if (libs!=0)
00086 for (int n=0; n<=libs->GetLast(); n++) {
00087 QStringList columns;
00088 columns << libs->At(n)->GetName();
00089 LoadedLibsS->addTopLevelItem(new QTreeWidgetItem(columns));
00090 }
00091 delete libs;
00092 }