Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+82
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* from FileManangement - Folder Model
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Iuliana Ojog, SLSE, 2017-07-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Services/FileManagement/flm_dtc.h>
|
||||
#include <Services/ExerciseManagement/exm_dtc.h>
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <nglwidgets/ngltreemodel.h>
|
||||
|
||||
class QTableWidget;
|
||||
// -------------------------------------------------------------------------------------
|
||||
namespace LtsWidgets
|
||||
{
|
||||
class DialogModelFolder : public NGLTreeModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Columns
|
||||
{
|
||||
NAME,
|
||||
ID
|
||||
};
|
||||
|
||||
explicit DialogModelFolder(QObject *parent
|
||||
, NGLTreeItem *rootItem
|
||||
, const std::shared_ptr<FileManagement::Interface::Dtc> &dtc
|
||||
, const std::shared_ptr<ExerciseManagement::Interface::Dtc> &exmDtc
|
||||
, const QStringList &header);
|
||||
|
||||
bool initModel(int exerciseId, const QVector<FileManagement::MainFolder> &mainFolders);
|
||||
|
||||
bool isRowRemovable(NGLTreeItem *parentItem) const;
|
||||
FileManagement::Folder getFolder(const QModelIndex &idx) const;
|
||||
QModelIndex getIndex(int folderId) const;
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override final;
|
||||
QVariant data(const QModelIndex &, int) const override final;
|
||||
QString getFolderName(const FileManagement::Folder &folderData) const;
|
||||
|
||||
public Q_SLOTS :
|
||||
bool onInsertRow(int &row, const QModelIndex &parent, const FileManagement::Folder &folderData);
|
||||
bool onUpdateRow(const QModelIndex &index, const FileManagement::Folder &folderData);
|
||||
bool onDeleteRow(const QModelIndex &idx, bool isFirstItem = true);
|
||||
|
||||
private:
|
||||
std::shared_ptr<FileManagement::Interface::Dtc> m_flmDtc;
|
||||
std::shared_ptr<ExerciseManagement::Interface::Dtc> m_exmDtc;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
class DialogModelProxyFolder : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using QSortFilterProxyModel::QSortFilterProxyModel;
|
||||
void setOperatorId(int operatorId);
|
||||
void setSourceModel(QAbstractItemModel *model) override;
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
||||
|
||||
protected:
|
||||
bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const override;
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
||||
|
||||
DialogModelFolder *m_sourceModel = nullptr;
|
||||
int m_operatorId = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
Q_DECLARE_METATYPE(FileManagement::Folder)
|
||||
|
||||
Reference in new issue
Block a user