summaryrefslogtreecommitdiff
path: root/gui/dynamicwaysentry.h
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-19 02:23:03 -0400
committerbd <bdunahu@operationnull.com>2025-04-19 02:23:03 -0400
commitda25748edb6997629ffb380683c8c736f24033a8 (patch)
treec7ffcaccc57afde2235fb53a16679225c06c0ed9 /gui/dynamicwaysentry.h
parentf18eac2ac2e5760a4cb81784ad2f23f91b6643d6 (diff)
Add custom QWidget to keep track of up to 4 user cache ways
Diffstat (limited to 'gui/dynamicwaysentry.h')
-rw-r--r--gui/dynamicwaysentry.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/gui/dynamicwaysentry.h b/gui/dynamicwaysentry.h
new file mode 100644
index 0000000..be42696
--- /dev/null
+++ b/gui/dynamicwaysentry.h
@@ -0,0 +1,28 @@
+#include <QLineEdit>
+#include <QStringList>
+#include <QVBoxLayout>
+#include <QVector>
+#include <QWidget>
+
+class DynamicWaysEntry : public QWidget
+{
+ public:
+ DynamicWaysEntry(QWidget *parent = nullptr);
+ QStringList get_entries() const;
+ /**
+ * Parses a string from this entry field, if it is valid.
+ * @param a string
+ * @param -1 if the string is not suitable as a way, an integer compatible
+ * with the cache constructor otherwise.
+ */
+ int parse_valid_way(QString t);
+ private slots:
+ void on_number_enter(const QString &t);
+
+ private:
+ QVBoxLayout *l;
+ QVector<QLineEdit *> fields;
+ QStringList entries;
+ void add_field();
+ void remove_last_field();
+};