chatgui: fix NodesPage truncated Node ID + add DB diagnostics

- NodesPage: show full 64-bit Node ID (hex16) instead of truncated 4 hex chars
- NodesPage: show diagnostic when DB handle is NULL (was silent return)
- DatabaseSettingsPage: show 'Database not connected' when DB handle is NULL
- DatabaseSettingsPage: add refreshStatus() called on tab select
- SettingsDialog: refresh Database tab on category change
This commit is contained in:
Evgeny committed 2026-07-18 17:04:50 +03:00
1 parent 93665c50f0
commit 853297290f
4 files changed
+55 -5

No files matched your search

@@ -127,6 +127,48 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
layout->addWidget(m_resultText);
layout->addStretch();
if (!m_db || !m_db->m_db) {
m_statusLabel->setText("Database not connected");
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: red;");
m_quickBtn->setEnabled(false);
m_fullBtn->setEnabled(false);
m_optimizeBtn->setEnabled(false);
qWarning("DatabaseSettingsPage: DB not ready m_db=%p m_db->m_db=%p", (void*)m_db, m_db ? (void*)m_db->m_db : nullptr);
}
}
void DatabaseSettingsPage::refreshStatus() {
if (!m_db || !m_db->m_db) {
m_statusLabel->setText("Database not connected");
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: red;");
m_quickBtn->setEnabled(false);
m_fullBtn->setEnabled(false);
m_optimizeBtn->setEnabled(false);
return;
}
m_quickBtn->setEnabled(true);
m_fullBtn->setEnabled(true);
m_optimizeBtn->setEnabled(true);
const char* fname = sqlite3_db_filename(m_db->m_db, "main");
if (fname && fname[0]) {
QString dbPath = QString::fromUtf8(fname);
m_filePathLabel->setText(dbPath);
QFileInfo fi(dbPath);
if (fi.exists()) {
qint64 sz = fi.size();
if (sz < 1024) m_fileSizeLabel->setText(QString("%1 B").arg(sz));
else if (sz < 1024 * 1024) m_fileSizeLabel->setText(QString("%1 KB").arg(sz / 1024));
else m_fileSizeLabel->setText(QString("%1 MB").arg(sz / (1024.0 * 1024.0), 0, 'f', 2));
QFileInfo walFi(dbPath + "-wal");
if (walFi.exists()) {
qint64 wsz = walFi.size();
if (wsz < 1024) m_walSizeLabel->setText(QString("%1 B").arg(wsz));
else if (wsz < 1024 * 1024) m_walSizeLabel->setText(QString("%1 KB").arg(wsz / 1024));
else m_walSizeLabel->setText(QString("%1 MB").arg(wsz / (1024.0 * 1024.0), 0, 'f', 2));
} else { m_walSizeLabel->setText("n/a"); }
}
}
}
void DatabaseSettingsPage::setBusy(bool busy) {