Conversation
WalkthroughAboutDialog enhanced to display adapter version information. Constructor signature updated to accept SettingsModel parameter. New method retrieves and displays adapter versions from SettingsModel. UI layout adjusted with new label. MainWindow updated to pass SettingsModel when instantiating AboutDialog. Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/dialogs/aboutdialog.cpp (1)
17-19: Add a Qt Doxygen block for the updated public constructor.This public constructor was changed but is still undocumented in the source file.
📝 Proposed comment block
+/*! + * \brief Creates the About dialog and initialises displayed version metadata. + * \param pUpdateNotify Update notifier used for update status text. + * \param pSettingsModel Settings model used to resolve adapter version text. + * \param parent Parent widget. + */ AboutDialog::AboutDialog(UpdateNotify* pUpdateNotify, SettingsModel* pSettingsModel, QWidget* parent) : QDialog(parent), _pUi(new Ui::AboutDialog)As per coding guidelines,
**/*.{cpp,cxx}: Document all public functions with brief Doxygen comments in the source file.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/dialogs/aboutdialog.cpp` around lines 17 - 19, Add a brief Qt-style Doxygen comment above the updated public constructor AboutDialog::AboutDialog(UpdateNotify* pUpdateNotify, SettingsModel* pSettingsModel, QWidget* parent) in aboutdialog.cpp describing the purpose of the constructor and its parameters; include `@param` tags for pUpdateNotify, pSettingsModel and parent and a one-line summary (e.g., "Constructs the About dialog and initializes UI and update/settings pointers"). Ensure the comment follows the project's Doxygen formatting used elsewhere in the .cpp files.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/dialogs/aboutdialog.cpp`:
- Around line 97-113: AboutDialog::setAdapterVersionInfo currently dereferences
pSettingsModel without a null check; add a guard at the start of the function
(e.g., if (!pSettingsModel) { _pUi->lblAdapterVersion->setVisible(false);
_pUi->lblAdapterVersion->setText(QString()); return; }) so you don’t call
pSettingsModel->adapterIds() or adapterData() when pSettingsModel is null, and
ensure _pUi->lblAdapterVersion visibility/text are set to safe defaults when
returning early.
---
Nitpick comments:
In `@src/dialogs/aboutdialog.cpp`:
- Around line 17-19: Add a brief Qt-style Doxygen comment above the updated
public constructor AboutDialog::AboutDialog(UpdateNotify* pUpdateNotify,
SettingsModel* pSettingsModel, QWidget* parent) in aboutdialog.cpp describing
the purpose of the constructor and its parameters; include `@param` tags for
pUpdateNotify, pSettingsModel and parent and a one-line summary (e.g.,
"Constructs the About dialog and initializes UI and update/settings pointers").
Ensure the comment follows the project's Doxygen formatting used elsewhere in
the .cpp files.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3498ea78-6107-47cf-9c49-1cf61b8a5fe6
📒 Files selected for processing (4)
src/dialogs/aboutdialog.cppsrc/dialogs/aboutdialog.hsrc/dialogs/aboutdialog.uisrc/dialogs/mainwindow.cpp
| void AboutDialog::setAdapterVersionInfo(SettingsModel* pSettingsModel) | ||
| { | ||
| QString versionTxt; | ||
|
|
||
| for (const QString& id : pSettingsModel->adapterIds()) | ||
| { | ||
| const QString version = pSettingsModel->adapterData(id)->version(); | ||
| if (!version.isEmpty()) | ||
| { | ||
| versionTxt = QString(tr("Adapter: v%1")).arg(version); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| _pUi->lblAdapterVersion->setVisible(!versionTxt.isEmpty()); | ||
| _pUi->lblAdapterVersion->setText(versionTxt); | ||
| } |
There was a problem hiding this comment.
Guard pSettingsModel before use to prevent a crash.
Line 101 dereferences pSettingsModel unconditionally. If a null pointer reaches this path, About dialog construction will fail.
💡 Proposed fix
void AboutDialog::setAdapterVersionInfo(SettingsModel* pSettingsModel)
{
+ if (pSettingsModel == nullptr)
+ {
+ _pUi->lblAdapterVersion->clear();
+ _pUi->lblAdapterVersion->setVisible(false);
+ return;
+ }
+
QString versionTxt;
for (const QString& id : pSettingsModel->adapterIds())
{
const QString version = pSettingsModel->adapterData(id)->version();🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/dialogs/aboutdialog.cpp` around lines 97 - 113,
AboutDialog::setAdapterVersionInfo currently dereferences pSettingsModel without
a null check; add a guard at the start of the function (e.g., if
(!pSettingsModel) { _pUi->lblAdapterVersion->setVisible(false);
_pUi->lblAdapterVersion->setText(QString()); return; }) so you don’t call
pSettingsModel->adapterIds() or adapterData() when pSettingsModel is null, and
ensure _pUi->lblAdapterVersion visibility/text are set to safe defaults when
returning early.
Summary by CodeRabbit