Skip to content

Commit

Permalink
show sqlcipher version in about screen
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed May 27, 2023
1 parent 92e0dce commit ecbe8b4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/persistence/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,24 @@ QString History::getPushtoken(const ToxPk& friendPk)
return pushtoken;
}

QString History::getSqlcipherVersion()
{
if (!isValid()) {
return QString("");
}

QString sqlcipherVersion = QString("");
db->execNow(
RawDatabase::Query("PRAGMA cipher_version;",
[&](const QVector<QVariant>& row) {
sqlcipherVersion = row[0].toString();
qDebug() << "getSqlcipherVersion:" << sqlcipherVersion;
})
);

return sqlcipherVersion;
}

void History::pushtokenPing(const ToxPk& sender)
{
if (!isValid()) {
Expand Down
1 change: 1 addition & 0 deletions src/persistence/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class History : public QObject, public std::enable_shared_from_this<History>

void addPushtoken(const ToxPk& sender, const QString& pushtoken);
QString getPushtoken(const ToxPk& friendPk);
QString getSqlcipherVersion();
void pushtokenPing(const ToxPk& sender);

void addNewFileMessage(const ChatId& chatId, const QByteArray& fileId,
Expand Down
11 changes: 10 additions & 1 deletion src/widget/form/settings/aboutform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "src/widget/style.h"
#include "src/widget/tool/recursivesignalblocker.h"
#include "src/widget/translator.h"
#include "src/widget/widget.h"

#include <tox/tox.h>

Expand Down Expand Up @@ -102,7 +103,15 @@ void AboutForm::replaceVersions()
tr("Commit hash: %1").arg(createLink(commitLink, QString(GIT_VERSION))));

bodyUI->toxCoreVersion->setText(tr("toxcore version: %1").arg(TOXCORE_VERSION));
bodyUI->qtVersion->setText(QString("Qt compiled: ") + QString(QT_VERSION_STR) + QString(" / runtime: ") + QString::fromUtf8(qVersion()));
bodyUI->qtVersion->setText(QString("Qt compiled: ") +
QString(QT_VERSION_STR) +
QString(" / runtime: ") +
QString::fromUtf8(qVersion()) +
QString("\nSQLCipher: ") +
Widget::sqlcipher_version
);

qDebug() << "sqlcipher_version:" << Widget::sqlcipher_version;

QString issueBody = QString("##### Brief Description\n\n"
"OS: %1\n"
Expand Down
5 changes: 5 additions & 0 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const QString saveHandlerKey("save");

} // namespace

QString Widget::sqlcipher_version = "";

bool Widget::toxActivateEventHandler(const QByteArray& data, void* userData)
{
std::ignore = data;
Expand Down Expand Up @@ -176,6 +178,9 @@ Widget::Widget(Profile &profile_, IAudioControl& audio_, CameraSource& cameraSou

void Widget::init()
{
auto history_cur = profile.getHistory();
Widget::sqlcipher_version = history_cur->getSqlcipherVersion();

ui->setupUi(this);

QIcon themeIcon = QIcon::fromTheme("qtox");
Expand Down
1 change: 1 addition & 0 deletions src/widget/widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class Widget final : public QMainWindow
void registerIpcHandlers();
static bool toxActivateEventHandler(const QByteArray& data, void* userData);
bool handleToxSave(const QString& path);
static QString sqlcipher_version;

public slots:
void reloadTheme();
Expand Down

0 comments on commit ecbe8b4

Please sign in to comment.