-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started working on kits. Basically - the idea is that all tasks (and binaries) will be run under a user editable script, which contains some variables - that would be substitutioned on runtime.
- Loading branch information
Showing
8 changed files
with
228 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "kitdefinitionmodel.h" | ||
|
||
KitDefinitionModel::KitDefinitionModel(QObject *parent) | ||
: QAbstractListModel(parent) | ||
{} | ||
|
||
void KitDefinitionModel::setKitDefinitions(const std::vector<KitDefinition> &kits) | ||
{ | ||
kitDefinitions = kits; | ||
// Notify the view that the model data has changed | ||
beginResetModel(); | ||
endResetModel(); | ||
} | ||
|
||
int KitDefinitionModel::rowCount(const QModelIndex &parent) const | ||
{ | ||
Q_UNUSED(parent); | ||
return kitDefinitions.size(); | ||
} | ||
|
||
QVariant KitDefinitionModel::data(const QModelIndex &index, int role) const | ||
{ | ||
if (!index.isValid() || index.row() >= kitDefinitions.size()) { | ||
return QVariant(); | ||
} | ||
|
||
const auto &kit = kitDefinitions[index.row()]; | ||
if (role == Qt::DisplayRole) { | ||
return QString::fromStdString(kit.name); // Display the name in the combo box | ||
} | ||
return QVariant(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "kitdefinitions.h" | ||
#include <QAbstractListModel> | ||
#include <QString> | ||
#include <vector> | ||
|
||
class KitDefinitionModel : public QAbstractListModel { | ||
Q_OBJECT | ||
|
||
public: | ||
KitDefinitionModel(QObject *parent = nullptr); | ||
void setKitDefinitions(const std::vector<KitDefinition> &kits); | ||
int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; | ||
|
||
private: | ||
std::vector<KitDefinition> kitDefinitions; // Store a copy of the vector | ||
}; |
Oops, something went wrong.