diff --git a/TaskNote.pro b/TaskNote.pro index 9443911..2e57e34 100755 --- a/TaskNote.pro +++ b/TaskNote.pro @@ -4,25 +4,33 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++17 +win32:VERSION = 1.1.1.0 # major.minor.patch.build +else:VERSION = 1.1.1 # major.minor.patch + +DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\" +DEFINES += APP_NAME=\"\\\"TaskNote\\\"\" + # remove possible other optimization flags win32 { message("Build for Windows") QMAKE_CXXFLAGS_RELEASE -= -O QMAKE_CXXFLAGS_RELEASE -= -O1 QMAKE_CXXFLAGS_RELEASE *= -O2 + DEFINES += APP_OS=\"\\\"Windows\\\"\" + DEFINES += APP_OS_VERSION=\"\\\"$$system(wmic os get version /value)\\\"\" equals(QMAKE_TARGET.arch, arm64) { message("CPU Architecture : aarch64") - # Add specific arm stuff here + DEFINES += APP_ARCH=\"\\\"arm64\\\"\" } equals(QMAKE_TARGET.arch, x86_64) { message("CPU Architecture : x64") QMAKE_CXXFLAGS_RELEASE += -favor:INTEL64 + DEFINES += APP_ARCH=\"\\\"x64\\\"\" } RC_ICONS = icon.ico - VERSION = 1.2.0.0 QMAKE_TARGET_COMPANY = "Aurelie Delhaie" QMAKE_TARGET_PRODUCT = "TaskNote" - QMAKE_TARGET_DESCRIPTION = "TaskNote" + QMAKE_TARGET_DESCRIPTION = "Simple note-taking workbook" } macx { @@ -33,22 +41,27 @@ macx { QMAKE_CXXFLAGS_RELEASE -= -O1 QMAKE_CXXFLAGS_RELEASE -= -O2 QMAKE_CXXFLAGS_RELEASE *= -O3 + DEFINES += APP_OS=\"\\\"macOS\\\"\" + DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\" equals(QMAKE_APPLE_DEVICE_ARCHS, arm64) { message("CPU Architecture : aarch64") + DEFINES += APP_ARCH=\"\\\"aarch64\\\"\" QMAKE_CXXFLAGS_RELEASE += -mcpu=apple-a14 } - VERSION = 1.2.0 } linux-g++* { message("Build for Linux") - LIBS += -L/usr/lib/crypto++ -lcrypto++ - INCS += -I/usr/include/crypto++ + #LIBS += -L/usr/lib/crypto++ -lcrypto++ + #INCS += -I/usr/include/crypto++ + #DEFINES += __SECURED=1 + DEFINES += APP_OS=\"\\\"$$system(cat /etc/issue | cut -d\' \' -f1)\\\"\" + DEFINES += APP_OS_VERSION=\"\\\"$$system(uname -r)\\\"\" + DEFINES += APP_ARCH=\"\\\"amd64\\\"\" QMAKE_CXXFLAGS_RELEASE *= -O3 QMAKE_CXXFLAGS_RELEASE += -march=skylake - VERSION = 1.2.0 } # You can make your code fail to compile if it uses deprecated APIs. diff --git a/TaskNote.pro.user b/TaskNote.pro.user index d162e94..618b18e 100755 --- a/TaskNote.pro.user +++ b/TaskNote.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {23c6a5b6-2840-4c04-84d4-91387dc9bb9f} + {dbe9fba1-e5a9-4d98-85bf-f46da0900eba} ProjectExplorer.Project.ActiveTarget @@ -142,7 +142,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -183,7 +183,7 @@ true QtProjectManager.QMakeBuildStep - true + false @@ -238,14 +238,12 @@ 2 - Qt4ProjectManager.Qt4RunConfiguration:/home/aurelie/src/TaskNote/TaskNote.pro - /home/aurelie/src/TaskNote/TaskNote.pro + ProjectExplorer.CustomExecutableRunConfiguration + false true - true false true - /home/aurelie/src/build-TaskNote-Desktop_Qt_6_2_3_GCC_64bit-Debug 1 diff --git a/src/frames/aboutdialog.cpp b/src/frames/aboutdialog.cpp index 13933b3..3ad17a1 100755 --- a/src/frames/aboutdialog.cpp +++ b/src/frames/aboutdialog.cpp @@ -6,7 +6,8 @@ AboutDialog::AboutDialog(QWidget *parent) : ui(new Ui::AboutDialog) { ui->setupUi(this); - ui->appNameLabel->setText(QString("TaskNote (%1)").arg(QSysInfo::currentCpuArchitecture())); + ui->appNameLabel->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH)); + ui->versionLabel->setText(QString("Version %1").arg(APP_VERSION)); } AboutDialog::~AboutDialog() diff --git a/src/frames/aboutdialog.ui b/src/frames/aboutdialog.ui index 4e04184..b1082e9 100755 --- a/src/frames/aboutdialog.ui +++ b/src/frames/aboutdialog.ui @@ -69,7 +69,7 @@ - + Version 1.2.0.0 diff --git a/src/frames/mainwindow.cpp b/src/frames/mainwindow.cpp index 2b17b1f..dfb7ee8 100755 --- a/src/frames/mainwindow.cpp +++ b/src/frames/mainwindow.cpp @@ -14,7 +14,9 @@ MainWindow::MainWindow(QWidget *parent) connect(ui->noteList, &QListWidget::currentRowChanged, this, &MainWindow::selectionChanged); connect(ui->titleEdit, &QLineEdit::textChanged, this, &MainWindow::titleChanged); connect(ui->contentEdit, &QPlainTextEdit::textChanged, this, &MainWindow::contentChanged); + #ifdef __SECURED connect(ui->actionEncrypt, &QAction::triggered, this, &MainWindow::encryptNote); + #endif const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); ui->contentEdit->setFont(fixedFont); this->savemng = new SaveManager(); @@ -56,12 +58,16 @@ void MainWindow::selectionChanged(int i) ui->titleEdit->setDisabled(false); ui->contentEdit->setDisabled(false); ui->titleEdit->setText(n->getTitle()); +#ifdef __SECURED if (n->isEncrypted()) { ui->contentEdit->setPlainText(n->getEncryptedContent("azertyuiop")); } else { ui->contentEdit->setPlainText(n->getContent()); } +#else + ui->contentEdit->setPlainText(n->getContent()); +#endif ui->markdownViewer->setMarkdown(ui->contentEdit->toPlainText()); } @@ -107,6 +113,7 @@ void MainWindow::showAboutBox() dialog.exec(); } +#ifdef __SECURED void MainWindow::encryptNote() { if (this->currentIndex > -1) @@ -116,6 +123,7 @@ void MainWindow::encryptNote() savemng->flushSave(); } } +#endif void MainWindow::contentChanged() { diff --git a/src/frames/mainwindow.h b/src/frames/mainwindow.h index 0f9d008..0c39b5c 100755 --- a/src/frames/mainwindow.h +++ b/src/frames/mainwindow.h @@ -30,7 +30,9 @@ private slots: void contentChanged(); void titleChanged(); void showAboutBox(); +#ifdef __SECURED void encryptNote(); +#endif private: Ui::MainWindow *ui; diff --git a/src/frames/mainwindow.ui b/src/frames/mainwindow.ui index ce9b996..0d2b1d0 100755 --- a/src/frames/mainwindow.ui +++ b/src/frames/mainwindow.ui @@ -222,6 +222,9 @@ + + false + :/icon/resources/outline_shield_black_48dp.png:/icon/resources/outline_shield_black_48dp.png diff --git a/src/models/note.cpp b/src/models/note.cpp index 59be5be..fbfd6dd 100755 --- a/src/models/note.cpp +++ b/src/models/note.cpp @@ -12,7 +12,9 @@ QJsonObject Note::toJson() o["uuid"] = this->uuid; o["title"] = this->title; o["content"] = this->content; + #ifdef __SECURED o["encrypted"] = this->encrypted; + #endif return o; } @@ -44,7 +46,7 @@ QString Note::getContent() } return ""; } - +#ifdef __SECURED QString Note::getEncryptedContent(QString passwd) { if (this->encrypted) @@ -80,7 +82,7 @@ bool Note::isEncrypted() { return this->encrypted; } - +#endif void Note::setTitle(QString value) { this->title = value; @@ -92,7 +94,7 @@ void Note::setContent(QString value) this->content = value; } } - +#ifdef __SECURED // TODO encrypt avec le mot de passe bool Note::setEncryptedContent(QString value, QString passwd) { @@ -141,4 +143,4 @@ void Note::encrypt(QString password) } } } - +#endif diff --git a/src/models/note.h b/src/models/note.h index ee4aa47..81f4b95 100755 --- a/src/models/note.h +++ b/src/models/note.h @@ -11,6 +11,7 @@ #include #include +#ifdef __SECURED #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#endif class Note { @@ -32,15 +34,19 @@ public: QString getUuid(); QString getTitle(); QString getContent(); + + #ifdef __SECURED QString getEncryptedContent(QString passwd); bool isEncrypted(); + #endif void setTitle(QString value); void setContent(QString value); + + #ifdef __SECURED bool setEncryptedContent(QString value, QString passwd); - void encrypt(QString password); - + #endif private: QString uuid; QString title;