From 96079b493a263ee0f71fff3dc15dc8a796db603f Mon Sep 17 00:00:00 2001 From: Jon ESA Date: Wed, 1 Apr 2026 21:27:46 +0100 Subject: [PATCH] Added time duration and countdown duration to game tab --- GamesPanel.cpp | 52 +++++++++++++++++++++++++++++++++++++++++--------- GamesPanel.h | 3 +++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/GamesPanel.cpp b/GamesPanel.cpp index 458358a..5a79a68 100644 --- a/GamesPanel.cpp +++ b/GamesPanel.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include #include @@ -22,7 +23,7 @@ static QMap parseGamResponse(const QString &response, return result; for (const QString &entry : tokens.mid(2)) { - if (entry.size() < 5) continue; // need at least 4-char code + 1-char name + if (entry.size() < 5) continue; const QString code = entry.left(4); QString name = entry.mid(4); name.replace("_S", " "); @@ -59,7 +60,7 @@ GamesPanel::GamesPanel(QWidget *parent) : QWidget(parent) leftLayout->addWidget(m_availableList, 1); leftLayout->addWidget(m_addBtn); - // ---- Right pane: Installed games + Start/Stop ---- + // ---- Right pane: Installed games + Start/Stop + time/countdown inputs ---- auto *rightWidget = new QWidget(splitter); auto *rightLayout = new QVBoxLayout(rightWidget); rightLayout->setContentsMargins(4, 4, 4, 4); @@ -67,13 +68,32 @@ GamesPanel::GamesPanel(QWidget *parent) : QWidget(parent) auto *instLabel = new QLabel("Installed Games", rightWidget); instLabel->setStyleSheet("color: #555;"); - m_installedList = new QListWidget(rightWidget); + m_installedList = new QListWidget(rightWidget); m_installedList->addItem("Connect to load installed games..."); + // Parameter inputs row + auto *paramRow = new QHBoxLayout(); + auto *timeLabel = new QLabel("Time:", rightWidget); + m_timeEdit = new QLineEdit(rightWidget); + m_timeEdit->setPlaceholderText("seconds"); + m_timeEdit->setFixedWidth(72); + m_timeEdit->setToolTip("Optional: game duration in seconds (adds ,t)"); + auto *countLabel = new QLabel("Countdown:", rightWidget); + m_countdownEdit = new QLineEdit(rightWidget); + m_countdownEdit->setPlaceholderText("seconds"); + m_countdownEdit->setFixedWidth(72); + m_countdownEdit->setToolTip("Optional: countdown duration in seconds (adds ,c)"); + paramRow->addWidget(timeLabel); + paramRow->addWidget(m_timeEdit); + paramRow->addSpacing(8); + paramRow->addWidget(countLabel); + paramRow->addWidget(m_countdownEdit); + paramRow->addStretch(1); + // Start / Stop button row - auto *btnRow = new QHBoxLayout(); - m_startBtn = new QPushButton("▶ Start Game", rightWidget); - m_stopBtn = new QPushButton("■ Stop Game", rightWidget); + auto *btnRow = new QHBoxLayout(); + m_startBtn = new QPushButton("▶ Start Game", rightWidget); + m_stopBtn = new QPushButton("■ Stop Game", rightWidget); m_startBtn->setEnabled(false); m_startBtn->setStyleSheet( "QPushButton { color: white; background-color: #2e7d32;" @@ -90,6 +110,7 @@ GamesPanel::GamesPanel(QWidget *parent) : QWidget(parent) rightLayout->addWidget(instLabel); rightLayout->addWidget(m_installedList, 1); + rightLayout->addLayout(paramRow); rightLayout->addLayout(btnRow); splitter->addWidget(leftWidget); @@ -154,7 +175,7 @@ void GamesPanel::rebuildAvailable() } // --------------------------------------------------------------------------- -// Add selected available game to installed list +// Add selected available game // --------------------------------------------------------------------------- void GamesPanel::onAddClicked() { @@ -166,7 +187,11 @@ void GamesPanel::onAddClicked() } // --------------------------------------------------------------------------- -// Start selected installed game: GST ,p +// Start selected installed game: +// GST ,p (no params) +// GST ,p,t