Skip to content

Commit c7d2e85

Browse files
committed
Added about with hardware acceleration for better ui
1 parent baaef8a commit c7d2e85

File tree

3 files changed

+100
-13
lines changed

3 files changed

+100
-13
lines changed

include/mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <QFile>
1515
#include <QDir>
1616

17-
1817
QT_BEGIN_NAMESPACE
1918
namespace Ui { class MainWindow; }
2019
QT_END_NAMESPACE
@@ -47,6 +46,7 @@ private slots:
4746
// New slots for menu actions
4847
void on_actionExit_triggered();
4948
void on_actionPreferences_triggered();
49+
void on_actionAbout_triggered();
5050
void applyTheme(const QString &theme);
5151

5252
private:

src/mainwindow.cpp

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <QFile>
1818
#include <QDir>
1919
#include "encryptionengine.h"
20+
#include <QDirIterator>
21+
#include <QProcess>
2022

2123
// Add the static member initialization here
2224
QTextStream* MainWindow::s_logStream = nullptr;
@@ -65,7 +67,7 @@ MainWindow::MainWindow(QWidget *parent)
6567

6668
MainWindow::~MainWindow()
6769
{
68-
// Save preferences before closing
70+
// Save preferences before closing
6971
savePreferences();
7072

7173
workerThread.quit();
@@ -139,6 +141,7 @@ void MainWindow::connectSignalsAndSlots()
139141
// Menu actions
140142
safeConnect(ui->actionExit, SIGNAL(triggered()), this, SLOT(on_actionExit_triggered()));
141143
safeConnect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(on_actionPreferences_triggered()));
144+
safeConnect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(on_actionAbout_triggered()));
142145

143146
m_signalsConnected = true;
144147
}
@@ -269,7 +272,7 @@ void MainWindow::on_folderKeyfileBrowseButton_clicked()
269272
void MainWindow::checkHardwareAcceleration() {
270273
bool supported = encryptionEngine.isHardwareAccelerationSupported();
271274
QString status = supported ? "Supported" : "Not supported";
272-
ui->hardwareAccelerationLabel->setText("Hardware Acceleration: " + status);
275+
qDebug() << "Hardware Acceleration: " + status;
273276
}
274277

275278
void MainWindow::on_benchmarkButton_clicked()
@@ -394,6 +397,40 @@ void MainWindow::on_actionPreferences_triggered()
394397
}
395398
}
396399

400+
void MainWindow::on_actionAbout_triggered()
401+
{
402+
// Execute git command to get the latest tag
403+
QProcess tagProcess;
404+
tagProcess.setWorkingDirectory(QDir::currentPath());
405+
tagProcess.start("git", QStringList() << "describe" << "--tags" << "--abbrev=0");
406+
tagProcess.waitForFinished();
407+
QString version = tagProcess.readAllStandardOutput().trimmed();
408+
if (version.isEmpty()) {
409+
version = "Unknown";
410+
}
411+
412+
// Execute git command to get the latest commit hash
413+
QProcess hashProcess;
414+
hashProcess.setWorkingDirectory(QDir::currentPath());
415+
hashProcess.start("git", QStringList() << "rev-parse" << "HEAD");
416+
hashProcess.waitForFinished();
417+
QString commitHash = hashProcess.readAllStandardOutput().trimmed();
418+
if (commitHash.isEmpty()) {
419+
commitHash = "Unknown";
420+
}
421+
422+
QString aboutText = QString(
423+
"Open Encryption UI\n"
424+
"Version: %1\n"
425+
"Latest Commit: %2\n"
426+
"Hardware Acceleration: %3"
427+
).arg(version)
428+
.arg(commitHash)
429+
.arg(encryptionEngine.isHardwareAccelerationSupported() ? "Supported" : "Not supported");
430+
431+
QMessageBox::about(this, "About", aboutText);
432+
}
433+
397434
void MainWindow::applyTheme(const QString &theme) {
398435
QString themeFilePath;
399436
if (theme == "Dark") {

ui/mainwindow.ui

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@
1515
</property>
1616
<widget class="QWidget" name="centralwidget">
1717
<layout class="QVBoxLayout" name="verticalLayout">
18-
<item>
19-
<widget class="QLabel" name="hardwareAccelerationLabel">
20-
<property name="text">
21-
<string>Hardware Acceleration: Checking...</string>
22-
</property>
23-
<property name="alignment">
24-
<set>Qt::AlignCenter</set>
25-
</property>
26-
</widget>
27-
</item>
2818
<item>
2919
<widget class="QTabWidget" name="tabWidget">
3020
<property name="currentIndex">
@@ -138,13 +128,37 @@
138128
<property name="text">
139129
<string>Encrypt</string>
140130
</property>
131+
<property name="sizePolicy">
132+
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
133+
<horstretch>0</horstretch>
134+
<verstretch>0</verstretch>
135+
</sizepolicy>
136+
</property>
137+
<property name="minimumSize">
138+
<size>
139+
<width>0</width>
140+
<height>50</height>
141+
</size>
142+
</property>
141143
</widget>
142144
</item>
143145
<item>
144146
<widget class="QPushButton" name="fileDecryptButton">
145147
<property name="text">
146148
<string>Decrypt</string>
147149
</property>
150+
<property name="sizePolicy">
151+
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
152+
<horstretch>0</horstretch>
153+
<verstretch>0</verstretch>
154+
</sizepolicy>
155+
</property>
156+
<property name="minimumSize">
157+
<size>
158+
<width>0</width>
159+
<height>50</height>
160+
</size>
161+
</property>
148162
</widget>
149163
</item>
150164
</layout>
@@ -259,13 +273,37 @@
259273
<property name="text">
260274
<string>Encrypt Folder</string>
261275
</property>
276+
<property name="sizePolicy">
277+
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
278+
<horstretch>0</horstretch>
279+
<verstretch>0</verstretch>
280+
</sizepolicy>
281+
</property>
282+
<property name="minimumSize">
283+
<size>
284+
<width>0</width>
285+
<height>50</height>
286+
</size>
287+
</property>
262288
</widget>
263289
</item>
264290
<item>
265291
<widget class="QPushButton" name="folderDecryptButton">
266292
<property name="text">
267293
<string>Decrypt Folder</string>
268294
</property>
295+
<property name="sizePolicy">
296+
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
297+
<horstretch>0</horstretch>
298+
<verstretch>0</verstretch>
299+
</sizepolicy>
300+
</property>
301+
<property name="minimumSize">
302+
<size>
303+
<width>0</width>
304+
<height>50</height>
305+
</size>
306+
</property>
269307
</widget>
270308
</item>
271309
</layout>
@@ -332,8 +370,15 @@
332370
</property>
333371
<addaction name="actionPreferences"/>
334372
</widget>
373+
<widget class="QMenu" name="menuHelp">
374+
<property name="title">
375+
<string>Help</string>
376+
</property>
377+
<addaction name="actionAbout"/>
378+
</widget>
335379
<addaction name="menuFile"/>
336380
<addaction name="menuEdit"/>
381+
<addaction name="menuHelp"/>
337382
</widget>
338383
<widget class="QStatusBar" name="statusbar"/>
339384
<action name="actionExit">
@@ -346,6 +391,11 @@
346391
<string>Preferences</string>
347392
</property>
348393
</action>
394+
<action name="actionAbout">
395+
<property name="text">
396+
<string>About</string>
397+
</property>
398+
</action>
349399
</widget>
350400
<customwidgets>
351401
<customwidget>

0 commit comments

Comments
 (0)