diff options
| author | saturneric <[email protected]> | 2026-09-21 21:34:50 +0200 |
|---|---|---|
| committer | saturneric <[email protected]> | 2026-09-21 21:34:50 +0200 |
| commit | 5c1259e3c166163e0815cf746af3765fcf5438ff (patch) | |
| tree | 3e5ca77dc3682cc6383f04831c7be520c397ddf1 /src/m_gpg_info | |
| parent | build(cmake): relocate module test binaries (diff) | |
| download | modules-5c1259e3c166163e0815cf746af3765fcf5438ff.tar.gz modules-5c1259e3c166163e0815cf746af3765fcf5438ff.zip | |
style(gpg): improve comments and log messages
- clarify file processing and table focus comments
- correct typos in directory and option log messages
- improve warning message punctuation and readability
Diffstat (limited to 'src/m_gpg_info')
| -rw-r--r-- | src/m_gpg_info/GnuPGInfoGatheringModule.cpp | 19 | ||||
| -rw-r--r-- | src/m_gpg_info/GnupgTab.cpp | 16 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp index 803e478..d2543bf 100644 --- a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp +++ b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp @@ -206,7 +206,7 @@ auto StartGatheringAllGnuPGInfo() -> int { QFileInfo(default_home_path).canonicalFilePath()); MLogDebug(QString("final default home path: %1").arg(default_home_path)); - // get components infos + // gather component information StartStartGatheringGnuPGComponentsInfo(gpgme_version, gpgconf_path, default_home_path); @@ -277,7 +277,7 @@ auto StartGatheringAllGnuPGInfo() -> int { } auto CalculateBinaryChecksum(const QString &path) -> std::optional<QString> { - // check file info and access rights + // Check the file's existence and access rights. QFileInfo const info(path); if (!info.exists() || !info.isFile() || !info.isReadable()) { MLogDebug(QString("get info for file %1 error, exists: %2") @@ -286,7 +286,7 @@ auto CalculateBinaryChecksum(const QString &path) -> std::optional<QString> { return {}; } - // open and read file + // Open and read the file. QFile f(info.filePath()); if (!f.open(QIODevice::ReadOnly)) { MLogDebug(QString("open %1 to calculate checksum error: %2") @@ -297,8 +297,8 @@ auto CalculateBinaryChecksum(const QString &path) -> std::optional<QString> { QCryptographicHash hash_sha(QCryptographicHash::Sha256); - // read data by chunks - const qint64 buffer_size = 8192; // Define a suitable buffer size + // Read the data in chunks. + const qint64 buffer_size = 8192; while (!f.atEnd()) { QByteArray const buffer = f.read(buffer_size); if (buffer.isEmpty()) { @@ -309,11 +309,10 @@ auto CalculateBinaryChecksum(const QString &path) -> std::optional<QString> { hash_sha.addData(buffer); } - // close the file + // Close the file. f.close(); - // return the first 6 characters of the SHA-256 hash - // of the file + // Return the first 6 characters of the file's SHA-256 hash. return QString(hash_sha.result().toHex()).left(6); } @@ -444,7 +443,7 @@ void GetGpgDirectoryInfos(void *, int exit_code, const char *out, for (const auto &line : line_split_list) { auto info_split_list = line.split(":"); - MLogDebug(QString("gpgconf direcrotries info line: %1 info size: %2") + MLogDebug(QString("gpgconf directories info line: %1 info size: %2") .arg(line) .arg(info_split_list.size())); @@ -483,7 +482,7 @@ void GetGpgOptionInfos(void *data, int exit_code, const char *out, MLogDebug( QString( - "gpgconf %1 avaliable options exit_code: %2 process stdout size: %3") + "gpgconf %1 available options exit_code: %2 process stdout size: %3") .arg(component_name) .arg(exit_code) .arg(p_out.size())); diff --git a/src/m_gpg_info/GnupgTab.cpp b/src/m_gpg_info/GnupgTab.cpp index 6f32f12..a2c38b6 100644 --- a/src/m_gpg_info/GnupgTab.cpp +++ b/src/m_gpg_info/GnupgTab.cpp @@ -65,8 +65,8 @@ GnupgTab::GnupgTab(QWidget* parent) ui_->componentDetailsTable->setEditTriggers( QAbstractItemView::NoEditTriggers); - // no focus (rectangle around table items) - // may be it should focus on whole row + // No focus rectangle around table items; maybe this should highlight the + // whole row instead. ui_->componentDetailsTable->setFocusPolicy(Qt::NoFocus); ui_->componentDetailsTable->setAlternatingRowColors(true); @@ -86,8 +86,8 @@ GnupgTab::GnupgTab(QWidget* parent) ui_->directoriesDetailsTable->setEditTriggers( QAbstractItemView::NoEditTriggers); - // no focus (rectangle around table items) - // may be it should focus on whole row + // No focus rectangle around table items; maybe this should highlight the + // whole row instead. ui_->directoriesDetailsTable->setFocusPolicy(Qt::NoFocus); ui_->directoriesDetailsTable->setAlternatingRowColors(true); @@ -105,8 +105,8 @@ GnupgTab::GnupgTab(QWidget* parent) // table items not editable ui_->optionDetailsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); - // no focus (rectangle around table items) - // may be it should focus on whole row + // No focus rectangle around table items; maybe this should highlight the + // whole row instead. ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus); ui_->optionDetailsTable->setAlternatingRowColors(true); @@ -145,7 +145,7 @@ void GnupgTab::slot_process_software_info() { auto component_info = component_info_json.object(); if (!component_info.contains("name")) { - MLogWarn(QString("illegal gnupg component info. it doesn't have a " + MLogWarn(QString("illegal gnupg component info: it doesn't have a " "name, json: %1") .arg(component_info_json_bytes)); continue; @@ -272,7 +272,7 @@ void GnupgTab::slot_process_software_info() { auto option_info = option_info_json.object(); if (!option_info.contains("name")) { - MLogWarn(QString("illegal gnupg configuration info. it doesn't have a " + MLogWarn(QString("illegal gnupg configuration info: it doesn't have a " "name, json: %1") .arg(option_info_json_bytes)); continue; |
