14 : QAbstractTableModel ( parent ),
16{ tr (
"Name" ), tr (
"Folder" ), tr (
"Access" ), tr (
"Status" ) }
24 : QAbstractTableModel ( parent ),
25 IncludedFiles ( FileList ),
27{ tr (
"Name" ), tr (
"Folder" ), tr (
"Access" ), tr (
"Status" ) }
37 if ( !parent.isValid() )
39 return IncludedFiles.size();
48 return Headers.size();
53 if ( index.isValid() )
55 if ( role == Qt::DisplayRole ) {
57 IncludedFiles.at ( index.row() ).at ( index.column() ) );
59 if ( role == Qt::ForegroundRole )
61 if ( IncludedFiles.at ( index.row() ).at (
66 if ( role == Qt::BackgroundRole )
68 if ( IncludedFiles.at ( index.row() ).at (
81 if ( role == Qt::DisplayRole )
83 if ( orientation == Qt::Horizontal )
85 return Headers.at ( section );
88 if ( orientation == Qt::Vertical )
102 return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
110 QString TDAQ_DB_REPOSITORY = getenv (
"TDAQ_DB_REPOSITORY" );
111 if(TDAQ_DB_REPOSITORY.isEmpty() ==
false) {
112 QString TDAQ_DB_USER_REPOSITORY = getenv (
"TDAQ_DB_USER_REPOSITORY" );
113 FolderPathList = TDAQ_DB_USER_REPOSITORY.split (
":", Qt::SkipEmptyParts );
117 QString DUNEDAQ_DB_PATH = getenv (
"DUNEDAQ_DB_PATH" );
118 FolderPathList = DUNEDAQ_DB_PATH.split (
":", Qt::SkipEmptyParts );
121 for ( QString & PathName : FolderPathList )
123 if ( !PathName.endsWith (
"/" ) )
125 PathName.append (
"/" );
132 connect (
this, SIGNAL ( FileCacheReady ( QList<QStringList> & ) ), &
confaccessor::ref(),
133 SLOT ( GetFileCache ( QList<QStringList> & ) ) );
138 QFileInfo FileInfo ( FileName );
140 if ( FileInfo.isRelative() )
143 for (
const QString & Folder : FolderPathList )
145 QDir TdaqFolder ( Folder );
147 if ( TdaqFolder.exists ( FileName ) )
149 FileName = TdaqFolder.path() +
"/" + FileName;
155 FileName = FileInfo.absoluteFilePath();
164 return IncludedFiles;
173 for ( QString
const & source : sources )
175 QFileInfo srcinfo ( source );
176 QString fn = srcinfo.filePath();
177 QString dn = GetFullFileName(fn).remove(QRegularExpression(
"/[a-zA-Z0-9_-]*.data.xml"));
180 auto file = GetFullFileName(fn).toStdString();
181 for (
auto ufile: updated) {
183 modified =
"Modified";
188 IncludedFiles.append ( QStringList{ srcinfo.fileName(),
195 if ( IncludedFiles.size() )
197 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 QColor FileReadOnlyForeground
static QColor FileReadOnlyBackground
static std::list< std::string > uncommitted_files()
static bool check_file_rw(const QString &FileName)
static QString dbfullname()
static confaccessor & ref()
static QStringList inclusions(QStringList const &candidates, QStringList files={ })