// Help Menu
auto* helpMenu = menuBar()->addMenu("&Help");
- auto* aboutAction = helpMenu->addAction("&About");
- connect(aboutAction, &QAction::triggered, this, &MainWindow::onAbout);
- auto* infoAction = helpMenu->addAction("&Info");
- connect(infoAction, &QAction::triggered, this, [this]() {
+ auto* licenseAction = helpMenu->addAction("&License");
+ connect(licenseAction, &QAction::triggered, this, [this]() {
QMessageBox::information(
- this, "Philosophy",
- "It's a free app designed not as a weight-loss app but a true nutrition "
- "coach, giving insights into what you're getting and what you're lacking, "
- "empowering you to make more informed and healthy decisions and live more "
- "of the vibrant life you were put here for.");
+ this, "License",
+ "<h3>GNU General Public License v3.0</h3>"
+ "<p>This program is free software: you can redistribute it and/or modify "
+ "it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation, either version 3 of the License, or "
+ "(at your option) any later version.</p>"
+ "<p>This program is distributed in the hope that it will be useful, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>"
+ "<p>See <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">"
+ "https://www.gnu.org/licenses/gpl-3.0.html</a> for details.</p>");
});
+ auto* aboutAction = helpMenu->addAction("&About");
+ connect(aboutAction, &QAction::triggered, this, &MainWindow::onAbout);
+
auto* centralWidget = new QWidget(this);
setCentralWidget(centralWidget);
void MainWindow::onAbout() {
QMessageBox::about(this, "About Nutrient Coach",
QString("<h3>Nutrient Coach %1</h3>"
- "<p>A C++/Qt application for tracking nutrition.</p>"
+ "<p>This application is a tool designed not as a weight-loss app "
+ "but as a true <b>nutrition coach</b>, giving insights into what "
+ "you're getting and what you're lacking, empowering you to make "
+ "more informed and healthy decisions and live more of the vibrant "
+ "life you were put here for.</p>"
"<p>Homepage: <a "
"href=\"https://github.com/nutratech/gui\">https://github.com/"
"nutratech/gui</a></p>")
QDir recipeDir(recipePath);
int recipeCount = 0;
if (recipeDir.exists()) {
- recipeCount = recipeDir.entryList(QDir::Files).count();
+ recipeCount = static_cast<int>(recipeDir.entryList(QDir::Files).count());
}
lblRecipes->setText(QString::number(recipeCount));
qint64 totalBackupSize = 0;
if (backupDir.exists()) {
QFileInfoList files = backupDir.entryInfoList({"*.sql.gz"}, QDir::Files);
- snapshotCount = files.count();
+ snapshotCount = static_cast<int>(files.count());
for (const auto& fi : files) {
totalBackupSize += fi.size();
}
}
QString PreferencesDialog::formatBytes(qint64 bytes) const {
- if (bytes < 1024) return QString("%1 B").arg(bytes);
- if (bytes < 1024 * 1024) return QString("%1 KB").arg(bytes / 1024.0, 0, 'f', 1);
- if (bytes < 1024 * 1024 * 1024)
- return QString("%1 MB").arg(bytes / (1024.0 * 1024.0), 0, 'f', 2);
- return QString("%1 GB").arg(bytes / (1024.0 * 1024.0 * 1024.0), 0, 'f', 2);
+ constexpr qint64 KB = 1024LL;
+ constexpr qint64 MB = 1024LL * 1024LL;
+ constexpr qint64 GB = 1024LL * 1024LL * 1024LL;
+ if (bytes < KB) return QString("%1 B").arg(bytes);
+ if (bytes < MB) return QString("%1 KB").arg(static_cast<double>(bytes) / KB, 0, 'f', 1);
+ if (bytes < GB) return QString("%1 MB").arg(static_cast<double>(bytes) / MB, 0, 'f', 2);
+ return QString("%1 GB").arg(static_cast<double>(bytes) / GB, 0, 'f', 2);
}