diff options
Diffstat (limited to 'sinksh/syntax_modules/sink_list.cpp')
-rw-r--r-- | sinksh/syntax_modules/sink_list.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sinksh/syntax_modules/sink_list.cpp b/sinksh/syntax_modules/sink_list.cpp index 9712b6f..cb71ce4 100644 --- a/sinksh/syntax_modules/sink_list.cpp +++ b/sinksh/syntax_modules/sink_list.cpp | |||
@@ -69,28 +69,29 @@ bool list(const QStringList &args, State &state) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | //qDebug() << "Listing"; | 71 | //qDebug() << "Listing"; |
72 | int colSize = 38; //Necessary to display a complete UUID | 72 | QStringList line; |
73 | state.print(QObject::tr("Resource").leftJustified(colSize, ' ', true) + | 73 | line << QObject::tr("Resource") << QObject::tr("Identifier"); |
74 | QObject::tr("Identifier").leftJustified(colSize, ' ', true)); | ||
75 | for (int i = 0; i < model->columnCount(QModelIndex()); i++) { | 74 | for (int i = 0; i < model->columnCount(QModelIndex()); i++) { |
76 | state.print(" | " + model->headerData(i, Qt::Horizontal).toString().leftJustified(colSize, ' ', true)); | 75 | line << model->headerData(i, Qt::Horizontal).toString(); |
77 | } | 76 | } |
78 | state.printLine(); | 77 | state.stageTableLine(line); |
79 | 78 | ||
80 | QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model, colSize, state](const QModelIndex &index, int start, int end) { | 79 | QObject::connect(model.data(), &QAbstractItemModel::rowsInserted, [model, state](const QModelIndex &index, int start, int end) { |
81 | for (int i = start; i <= end; i++) { | 80 | for (int i = start; i <= end; i++) { |
82 | auto object = model->data(model->index(i, 0, index), Sink::Store::DomainObjectBaseRole).value<Sink::ApplicationDomain::ApplicationDomainType::Ptr>(); | 81 | auto object = model->data(model->index(i, 0, index), Sink::Store::DomainObjectBaseRole).value<Sink::ApplicationDomain::ApplicationDomainType::Ptr>(); |
83 | state.print(object->resourceInstanceIdentifier().leftJustified(colSize, ' ', true)); | 82 | QStringList line; |
84 | state.print(object->identifier().leftJustified(colSize, ' ', true)); | 83 | line << object->resourceInstanceIdentifier(); |
84 | line << object->identifier(); | ||
85 | for (int col = 0; col < model->columnCount(QModelIndex()); col++) { | 85 | for (int col = 0; col < model->columnCount(QModelIndex()); col++) { |
86 | state.print(" | " + model->data(model->index(i, col, index)).toString().leftJustified(colSize, ' ', true)); | 86 | line << model->data(model->index(i, col, index)).toString(); |
87 | } | 87 | } |
88 | state.printLine(); | 88 | state.stageTableLine(line); |
89 | } | 89 | } |
90 | }); | 90 | }); |
91 | 91 | ||
92 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, state](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { | 92 | QObject::connect(model.data(), &QAbstractItemModel::dataChanged, [model, state](const QModelIndex &, const QModelIndex &, const QVector<int> &roles) { |
93 | if (roles.contains(Sink::Store::ChildrenFetchedRole)) { | 93 | if (roles.contains(Sink::Store::ChildrenFetchedRole)) { |
94 | state.flushTable(); | ||
94 | state.commandFinished(); | 95 | state.commandFinished(); |
95 | } | 96 | } |
96 | }); | 97 | }); |