Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Gueudelot committed Jun 6, 2018
2 parents d93153d + 9a3c798 commit e2aaa37
Show file tree
Hide file tree
Showing 145 changed files with 2,577 additions and 1,333 deletions.
7 changes: 4 additions & 3 deletions app/Model/admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class AdminTableInfo: public QObject
Q_PROPERTY(bool clearable READ clearable NOTIFY dataChanged)

public:
explicit AdminTableInfo(QObject* parent = nullptr);
explicit AdminTableInfo(QJsonObject json, QObject* parent = nullptr);
// Constructors
AdminTableInfo(QObject* parent = nullptr);
AdminTableInfo(QJsonObject json, QObject* parent = nullptr);

// Getters
inline QString section() { return mSection; }
Expand Down Expand Up @@ -69,7 +70,7 @@ class Admin : public QObject
Q_PROPERTY(QVariantList wtTables READ wtTables NOTIFY tablesChanged)

public:
explicit Admin(QObject* parent = nullptr);
Admin(QObject* parent = nullptr);

// Getters
inline bool serverStatusAutoRefresh() { return mServerStatusAutoRefresh; }
Expand Down
2 changes: 1 addition & 1 deletion app/Model/analysis/analyseslistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ QVariant AnalysesListModel::data(const QModelIndex& index, int role) const
else if (role == Status)
return analysis->status();
else if (role == UpdateDate)
return analysis->updateDate().toString("yyyy-MM-dd");
return analysis->updateDate().toString("yyyy-MM-dd HH:mm");
else if (role == SearchField)
return analysis->searchField();
return QVariant();
Expand Down
4 changes: 2 additions & 2 deletions app/Model/analysis/analysesmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ FilteringAnalysis* AnalysesManager::getOrCreateFilteringAnalysis(int id)
return mFilteringAnalyses[id];
}
// else
FilteringAnalysis* newAnalysis = new FilteringAnalysis(id);
FilteringAnalysis* newAnalysis = new FilteringAnalysis(id, this);
mFilteringAnalyses.insert(id, newAnalysis);
return newAnalysis;
}
Expand All @@ -257,7 +257,7 @@ PipelineAnalysis* AnalysesManager::getOrCreatePipelineAnalysis(int id)
return mPipelineAnalyses[id];
}
// else
PipelineAnalysis* newAnalysis = new PipelineAnalysis(id);
PipelineAnalysis* newAnalysis = new PipelineAnalysis(id, this);
mPipelineAnalyses.insert(id, newAnalysis);
return newAnalysis;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Model/analysis/analysesmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AnalysesManager : public QObject
Q_PROPERTY(QString pipelineType READ pipelineType)
public:
// Constructors
explicit AnalysesManager(QObject* parent=nullptr);
AnalysesManager(QObject* parent=nullptr);

// Getters
inline PipelineAnalysis* newPipeline() const { return mNewPipeline; }
Expand Down
3 changes: 2 additions & 1 deletion app/Model/analysis/analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ QHash<QString, bool> Analysis::initStatusAnimatedMap()
}


Analysis::Analysis(QObject* parent) : QObject(parent)
Analysis::Analysis(QObject* parent) : RegovarResource(parent)
{
mMenuModel = new RootMenu(this);
connect(this, &Analysis::dataChanged, this, &Analysis::updateSearchField);
}


Expand Down
48 changes: 11 additions & 37 deletions app/Model/analysis/analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,42 @@
#define ANALYSIS_H

#include <QtCore>
#include "Model/framework/regovarresource.h"
#include "Model/mainmenu/rootmenu.h"




class Analysis : public QObject
class Analysis : public RegovarResource
{
Q_OBJECT
Q_PROPERTY(RootMenu* menuModel READ menuModel NOTIFY menuModelChanged)
// Regovar resource attributes
Q_PROPERTY(bool loaded READ loaded NOTIFY dataChanged)
Q_PROPERTY(QDateTime updateDate READ updateDate NOTIFY dataChanged)
Q_PROPERTY(QDateTime createDate READ createDate NOTIFY dataChanged)
// Analysis attributes
Q_PROPERTY(int id READ id WRITE setId NOTIFY dataChanged)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY dataChanged)
Q_PROPERTY(QString comment READ comment WRITE setComment NOTIFY dataChanged)
Q_PROPERTY(QString type READ type NOTIFY dataChanged)
Q_PROPERTY(Project* project READ project WRITE setProject NOTIFY dataChanged)
Q_PROPERTY(QString status READ status NOTIFY statusChanged)
Q_PROPERTY(QString searchField READ searchField NOTIFY dataChanged)
// TODO: Indicators

public:
// enum value returned by the server as analysis type
static QString FILTERING;
static QString PIPELINE;

// Constructors
explicit Analysis(QObject *parent = nullptr);
Analysis(QObject *parent = nullptr);

// Getters
inline RootMenu* menuModel() const { return mMenuModel; }
inline bool loaded() const { return mLoaded; }
inline QDateTime updateDate() const { return mUpdateDate; }
inline QDateTime createDate() const { return mCreateDate; }

inline int id() { return mId; }
inline QString name() { return mName; }
inline QString comment() { return mComment; }
inline QString type() { return mType; }

inline int id() const { return mId; }
inline QString name() const { return mName; }
inline QString comment() const { return mComment; }
inline QString type() const { return mType; }
inline Project* project() const { return mProject; }
inline QString status() const { return mStatus; }
inline QString searchField() const { return mSearchField; }

// Setters
inline void setId(int id) { mId = id; emit dataChanged(); }
Expand All @@ -53,18 +46,7 @@ class Analysis : public QObject
inline void setProject(Project* project) { mProject = project; emit dataChanged(); }
inline void setStatus(QString status) { mStatus = status; emit statusChanged(); }

// Methods
//! Set model with provided json data
Q_INVOKABLE virtual bool loadJson(QJsonObject json, bool full_init=true) = 0;
//! Export model data into json object
Q_INVOKABLE virtual QJsonObject toJson() = 0;
//! Save subject information onto server
Q_INVOKABLE virtual void save() = 0;
//! Load Subject information from server
Q_INVOKABLE virtual void load(bool forceRefresh=true) = 0;



// Static Methods
Q_INVOKABLE static QString statusLabel(QString status);
Q_INVOKABLE static QString statusIcon(QString status);
Q_INVOKABLE static bool statusIconAnimated(QString status);
Expand All @@ -73,29 +55,21 @@ class Analysis : public QObject

Q_SIGNALS:
void menuModelChanged();
void dataChanged();
void statusChanged();


public Q_SLOTS:
virtual void updateSearchField();

virtual void updateSearchField() override;

protected:
RootMenu* mMenuModel = nullptr;
// Regovar resource
bool mLoaded = false;
QDateTime mUpdateDate;
QDateTime mCreateDate;
QDateTime mLastInternalLoad = QDateTime::currentDateTime();
// Analysis attribute
int mId = -1;
QString mName;
QString mComment;
QString mType;
Project* mProject = nullptr;
QString mStatus; // status of the analysis (server side)
QString mSearchField = "";

static QHash<QString, QString> sStatusLabelMap;
static QHash<QString, QString> sStatusIconMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class AdvancedFilterModel : public QObject
Q_ENUM(ConditionType)

// Constructor
explicit AdvancedFilterModel(QObject* parent=nullptr);
explicit AdvancedFilterModel(FilteringAnalysis* parent);
explicit AdvancedFilterModel(QJsonArray filterJson, FilteringAnalysis* parent);
AdvancedFilterModel(QObject* parent=nullptr);
AdvancedFilterModel(FilteringAnalysis* parent);
AdvancedFilterModel(QJsonArray filterJson, FilteringAnalysis* parent);

// Getters
inline QString qmlId() const { return mQmlId; }
Expand Down Expand Up @@ -129,9 +129,9 @@ class NewAdvancedFilterModel: public AdvancedFilterModel

public:
// Constructor
explicit NewAdvancedFilterModel(QObject* parent=nullptr);
explicit NewAdvancedFilterModel(FilteringAnalysis* parent);
explicit NewAdvancedFilterModel(QJsonArray filterJson, FilteringAnalysis* parent);
NewAdvancedFilterModel(QObject* parent=nullptr);
NewAdvancedFilterModel(FilteringAnalysis* parent);
NewAdvancedFilterModel(QJsonArray filterJson, FilteringAnalysis* parent);

// Getters
inline QString fieldType() const { return (mField != nullptr) ? mField->type() : ""; }
Expand Down
5 changes: 3 additions & 2 deletions app/Model/analysis/filtering/advancedfilters/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class Set : public QObject
Q_PROPERTY(QString label READ label NOTIFY setChanged)

public:
explicit Set(QObject* parent = nullptr);
explicit Set(QString type, QString id, QString label);
// Constructors
Set(QObject* parent = nullptr);
Set(QString type, QString id, QString label);

// Getters
//inline FilteringAnalysis* analysis() const { return mAnalysis; }
Expand Down
9 changes: 4 additions & 5 deletions app/Model/analysis/filtering/annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ class Annotation : public QObject
Q_PROPERTY(int order READ order)

public:
explicit Annotation(QObject* parent = nullptr);
explicit Annotation(QObject* parent, QString uid, QString dbUid, QString name, QString description,
QString type, QJsonObject meta, QString version, QString dbName, int order=-1);
// Annotation(const Annotation &other);
// ~Annotation();
// Constructors
Annotation(QObject* parent = nullptr);
Annotation(QObject* parent, QString uid, QString dbUid, QString name, QString description,
QString type, QJsonObject meta, QString version, QString dbName, int order=-1);

// Getters
inline QString uid() { return mUid; }
Expand Down
2 changes: 1 addition & 1 deletion app/Model/analysis/filtering/annotationstreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AnnotationsTreeModel : public TreeModel
};

// Constructor
explicit AnnotationsTreeModel(FilteringAnalysis* analysis=nullptr);
AnnotationsTreeModel(FilteringAnalysis* analysis=nullptr);

// Getters
inline bool isLoading() const { return mIsLoading; }
Expand Down
4 changes: 2 additions & 2 deletions app/Model/analysis/filtering/documentstreeitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ class DocumentsTreeItem : public TreeItem

public:
// Constructors
explicit DocumentsTreeItem(TreeItem* parent=nullptr);
explicit DocumentsTreeItem(QHash<int, QVariant> columnData, TreeItem* parent=nullptr);
DocumentsTreeItem(TreeItem* parent=nullptr);
DocumentsTreeItem(QHash<int, QVariant> columnData, TreeItem* parent=nullptr);



Expand Down
2 changes: 1 addition & 1 deletion app/Model/analysis/filtering/documentstreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DocumentsTreeModel : public TreeModel
};

// Constructor
explicit DocumentsTreeModel(FilteringAnalysis* parent=nullptr);
DocumentsTreeModel(FilteringAnalysis* parent=nullptr);
QHash<int, QByteArray> roleNames() const override;


Expand Down
5 changes: 3 additions & 2 deletions app/Model/analysis/filtering/fieldcolumninfos.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class FieldColumnInfos : public QObject
Q_PROPERTY(float width READ width WRITE setWidth NOTIFY widthChanged)

public:
explicit FieldColumnInfos(QObject *parent = nullptr);
explicit FieldColumnInfos(Annotation* annotation, bool isDisplayed, QString sortFilter="", QObject *parent = nullptr);
// Constructors
FieldColumnInfos(QObject *parent = nullptr);
FieldColumnInfos(Annotation* annotation, bool isDisplayed, QString sortFilter="", QObject *parent = nullptr);

// Getters
inline QString uid() { return !mUIUid.isEmpty() ? mUIUid : mAnnotation != nullptr ? mAnnotation->uid() : ""; }
Expand Down
34 changes: 22 additions & 12 deletions app/Model/analysis/filtering/filteringanalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ FilteringAnalysis::FilteringAnalysis(QObject *parent) : Analysis(parent)
mLoadingStatus = Empty;


connect(this, SIGNAL(loadingStatusChanged(LoadingStatus,LoadingStatus)),
this, SLOT(asynchLoadingCoordination(LoadingStatus,LoadingStatus)));
connect(this, &FilteringAnalysis::loadingStatusChanged, this, &FilteringAnalysis::asynchLoadingCoordination);


// Init model
Expand Down Expand Up @@ -584,13 +583,13 @@ void FilteringAnalysis::raiseNewInternalLoadingStatus(LoadingStatus newStatus)
void FilteringAnalysis::resetSets()
{
mSets.clear();
// add samples first
// Add samples first
for (Sample* sample: mSamples)
{
mSets.append(new Set(QString("sample"), QString::number(sample->id()), sample->nickname()));
}

// add sample's attributes
// Add sample's attributes
for (QObject* o: mAttributes)
{
Attribute* attribute = qobject_cast<Attribute*>(o);
Expand All @@ -601,23 +600,33 @@ void FilteringAnalysis::resetSets()
}
}

// add filters
// Add filters
for (QObject* o: mFilters)
{
SavedFilter* filter = qobject_cast<SavedFilter*>(o);
mSets.append(new Set("filter", QString::number(filter->id()), filter->name()));
}

// add panels
for (QString& panelId: mPanelsUsed)
// Add all panel's head version by default
for (int idx=0; idx < regovar->panelsManager()->panels()->proxy()->rowCount(); idx++)
{
PanelVersion* panel = regovar->panelsManager()->getPanelVersion(panelId);
if (panel != nullptr)
{
mSets.append(new Set("panel", panel->id(), panel->fullname() ));
}
QModelIndex i1 = regovar->panelsManager()->panels()->proxy()->getModelIndex(idx);
// TODO: fix get panel sorted by name
QModelIndex i2 = regovar->panelsManager()->panels()->proxy()->mapToSource(i1);
PanelVersion* version =regovar->panelsManager()->panels()->getAt(i1.row());
mSets.append(new Set("panel", version->id(), version->fullname()));
}

// TODO: add panels used
// for (QString& panelId: mPanelsUsed)
// {
// PanelVersion* panel = regovar->panelsManager()->getPanelVersion(panelId);
// if (panel != nullptr)
// {
// mSets.append(new Set("panel", panel->id(), panel->fullname() ));
// }
// }

emit setsChanged();
}

Expand Down Expand Up @@ -1013,6 +1022,7 @@ void FilteringAnalysis::processPushNotification(QString action, QJsonObject data
}



/// Save on local computer, Tableariant columns settings (order of columns displayed and width)
void FilteringAnalysis::saveSettings()
{
Expand Down
14 changes: 6 additions & 8 deletions app/Model/analysis/filtering/filteringanalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class FilteringAnalysis : public Analysis
};

// Constructor
explicit FilteringAnalysis(QObject* parent = nullptr);
explicit FilteringAnalysis(int id, QObject* parent = nullptr);
FilteringAnalysis(QObject* parent = nullptr);
FilteringAnalysis(int id, QObject* parent = nullptr);

// Getters
inline QString refName() const { return mRefName; }
Expand Down Expand Up @@ -129,10 +129,10 @@ class FilteringAnalysis : public Analysis


// Analysis abstracts methods overriden
Q_INVOKABLE bool loadJson(QJsonObject json, bool full_init=true);
Q_INVOKABLE QJsonObject toJson();
Q_INVOKABLE void save();
Q_INVOKABLE void load(bool forceRefresh=true);
Q_INVOKABLE bool loadJson(QJsonObject json, bool full_init=true) override;
Q_INVOKABLE QJsonObject toJson() override;
Q_INVOKABLE void save() override;
Q_INVOKABLE void load(bool forceRefresh=true) override;

// Methods
Q_INVOKABLE inline FieldColumnInfos* getColumnInfo(QString uid) { return mAnnotations.contains(uid) ? mAnnotations[uid] : nullptr; }
Expand Down Expand Up @@ -168,8 +168,6 @@ class FilteringAnalysis : public Analysis
void resetSets();

Q_SIGNALS:
void dataChanged();

void loadingStatusChanged(LoadingStatus oldSatus, LoadingStatus newStatus);
void annotationsChanged();
void displayedAnnotationsChanged();
Expand Down
2 changes: 1 addition & 1 deletion app/Model/analysis/filtering/filteringresultcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FilteringResultCell : public QObject

public:
// Constructors
explicit FilteringResultCell(QObject *parent = nullptr);
FilteringResultCell(QObject *parent = nullptr);

// Getters
inline QString uid() { return mUid; }
Expand Down
Loading

0 comments on commit e2aaa37

Please sign in to comment.