13 : QAbstractTableModel ( parent ),
15{ tr (
"Name" ), tr (
"Folder" ), tr (
"Permission" ) }
23 : QAbstractTableModel ( parent ),
24 IncludedFiles ( FileList ),
26{ tr (
"Name" ), tr (
"Folder" ), tr (
"Permission" ) }
36 if ( !parent.isValid() )
38 return IncludedFiles.size();
47 return Headers.size();
52 if ( index.isValid() )
54 if ( role == Qt::DisplayRole )
56 IncludedFiles.at ( index.row() ).at ( index.column() ) );
65 if ( role == Qt::DisplayRole )
67 if ( orientation == Qt::Horizontal )
69 return Headers.at ( section );
72 if ( orientation == Qt::Vertical )
83 if ( IncludedFiles.at ( index.row() ).at (
static_cast<int>
86 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
89 return Qt::ItemIsSelectable;
94 QString TDAQ_DB_REPOSITORY = getenv (
"TDAQ_DB_REPOSITORY" );
95 if(TDAQ_DB_REPOSITORY.isEmpty() ==
false) {
96 QString TDAQ_DB_USER_REPOSITORY = getenv (
"TDAQ_DB_USER_REPOSITORY" );
97 FolderPathList = TDAQ_DB_USER_REPOSITORY.split (
":", QString::SkipEmptyParts );
101 QString DUNEDAQ_DB_PATH = getenv (
"DUNEDAQ_DB_PATH" );
102 FolderPathList = DUNEDAQ_DB_PATH.split (
":", QString::SkipEmptyParts );
105 for ( QString & PathName : FolderPathList )
107 if ( !PathName.endsWith (
"/" ) )
109 PathName.append (
"/" );
116 connect (
this, SIGNAL ( FileCacheReady ( QList<QStringList> & ) ), &
confaccessor::ref(),
117 SLOT ( GetFileCache ( QList<QStringList> & ) ) );
122 QFileInfo FileInfo ( FileName );
124 if ( FileInfo.isRelative() )
127 for (
const QString & Folder : FolderPathList )
129 QDir TdaqFolder ( Folder );
131 if ( TdaqFolder.exists ( FileName ) )
133 FileName = TdaqFolder.path() +
"/" + FileName;
144 return IncludedFiles;
152 for ( QString
const & source : sources )
155 QFileInfo srcinfo ( source );
156 QString fn = srcinfo.filePath();
158 for ( QString
const & path : FolderPathList )
160 if ( fn.startsWith ( path ) )
162 fn = fn.replace ( 0, path.size(),
"" );
170 if ( IncludedFiles.size() )
172 emit FileCacheReady ( IncludedFiles );
int columnCount(const QModelIndex &parent) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Qt::ItemFlags flags(const QModelIndex &index) const
FileModel(QObject *parent=nullptr)
Including QT Headers.
int rowCount(const QModelIndex &parent) const
QList< QStringList > GetFilesInfo() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QString GetFullFileName(QString &FileName)
QString find_db_repository_dir()
static MainWindow * findthis()
static bool check_file_rw(const QString &FileName)
static QString dbfullname()
static confaccessor & ref()
static QStringList inclusions(QStringList const &candidates, QStringList files={ })