From 971854bfefad4c644ac3d5f5d6003f24d551bf1d Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Mon, 10 Mar 2025 22:04:24 +0530 Subject: Add completer + simplify command parsing + class generator --- include/completion/CommandsModel.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/completion/CommandsModel.hpp (limited to 'include/completion/CommandsModel.hpp') diff --git a/include/completion/CommandsModel.hpp b/include/completion/CommandsModel.hpp new file mode 100644 index 0000000..6cb25f9 --- /dev/null +++ b/include/completion/CommandsModel.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +struct Command { + QString name; + QString description; +}; + +const QList commands = { + {.name = "open", .description = "Open a url in the current tab"}, + {.name = "tabopen", .description = "Open a url in a new tab"}, + {.name = "bnext", .description = "Go to next tab"}, + {.name = "bprev", .description = "Go to previous tab"}, +}; + +class CommandsModel : public QAbstractListModel { + Q_OBJECT + +public: + CommandsModel(QObject *parent = nullptr); + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QHash roleNames() const override; + QVariant data(const QModelIndex &index, + int role = Qt::DisplayRole) const override; + +private: + QList items; +}; -- cgit v1.3.1