fixes linux

This commit is contained in:
2026-04-12 15:08:28 +02:00
parent b79b7285bf
commit 3f5c60f051
10 changed files with 309 additions and 9 deletions

View File

@@ -8,6 +8,9 @@ QMAKE_CXXFLAGS += -Werror
win32:VERSION = 0.0.1.0 # major.minor.patch.build win32:VERSION = 0.0.1.0 # major.minor.patch.build
else:VERSION = 0.0.1 # major.minor.patch else:VERSION = 0.0.1 # major.minor.patch
DEFINES += APP_VERSION=\"\\\"$${VERSION}.preview1\\\"\"
TMP_APP_ARCH = APP_ARCH=\"\\\"unknown\\\"\"
# remove possible other optimization flags # remove possible other optimization flags
win32 { win32 {
message("Build for Windows") message("Build for Windows")
@@ -16,10 +19,12 @@ win32 {
QMAKE_CXXFLAGS_RELEASE *= -O2 QMAKE_CXXFLAGS_RELEASE *= -O2
equals(QMAKE_TARGET.arch, arm64) { equals(QMAKE_TARGET.arch, arm64) {
message("CPU Architecture : aarch64") message("CPU Architecture : aarch64")
TMP_APP_ARCH = APP_ARCH=\"\\\"arm64\\\"\"
} }
equals(QMAKE_TARGET.arch, x86_64) { equals(QMAKE_TARGET.arch, x86_64) {
message("CPU Architecture : x64") message("CPU Architecture : x64")
QMAKE_CXXFLAGS_RELEASE += -favor:INTEL64 QMAKE_CXXFLAGS_RELEASE += -favor:INTEL64
TMP_APP_ARCH = APP_ARCH=\"\\\"x64\\\"\"
} }
RC_ICONS = icon.ico RC_ICONS = icon.ico
QMAKE_TARGET_COMPANY = "Aurelie Delhaie" QMAKE_TARGET_COMPANY = "Aurelie Delhaie"
@@ -37,28 +42,34 @@ macx {
QMAKE_CXXFLAGS_RELEASE *= -O3 QMAKE_CXXFLAGS_RELEASE *= -O3
QMAKE_APPLE_DEVICE_ARCHS = arm64 QMAKE_APPLE_DEVICE_ARCHS = arm64
QMAKE_CXXFLAGS_RELEASE += -march=armv8.6-a+fp16+simd QMAKE_CXXFLAGS_RELEASE += -march=armv8.6-a+fp16+simd
TMP_APP_ARCH = APP_ARCH=\"\\\"arm64\\\"\"
} }
linux-* { linux-* {
message("Build for Linux") message("Build for Linux")
equals(ARCH, aarch64) { equals(QMAKE_HOST.arch, aarch64) {
message("CPU Architecture : aarch64") message("CPU Architecture : aarch64")
QMAKE_CXXFLAGS_RELEASE += -mtune=armv8.6-a+fp16+simd QMAKE_CXXFLAGS_RELEASE += -mtune=armv8.6-a+fp16+simd
TMP_APP_ARCH = APP_ARCH=\"\\\"aarch64\\\"\"
} }
equals(ARCH, amd64) { equals(QMAKE_HOST.arch, amd64) {
message("CPU Architecture : amd64") message("CPU Architecture : amd64")
QMAKE_CXXFLAGS_RELEASE += -march=tigerlake QMAKE_CXXFLAGS_RELEASE += -march=tigerlake
QMAKE_CXXFLAGS_RELEASE += -mtune=intel QMAKE_CXXFLAGS_RELEASE += -mtune=intel
TMP_APP_ARCH = APP_ARCH=\"\\\"amd64\\\"\"
} }
QMAKE_CXXFLAGS_RELEASE *= -O3 QMAKE_CXXFLAGS_RELEASE *= -O3
} }
DEFINES += $$TMP_APP_ARCH
# You can make your code fail to compile if it uses deprecated APIs. # You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \ SOURCES += \
src/core/noteservice.cpp \ src/core/noteservice.cpp \
src/gui/dialog/about/aboutdialog.cpp \
src/gui/dialog/input/inputdialog.cpp \ src/gui/dialog/input/inputdialog.cpp \
src/obj/list.cpp \ src/obj/list.cpp \
src/core/listservice.cpp \ src/core/listservice.cpp \
@@ -68,6 +79,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
src/core/noteservice.h \ src/core/noteservice.h \
src/gui/dialog/about/aboutdialog.h \
src/gui/dialog/input/inputdialog.h \ src/gui/dialog/input/inputdialog.h \
src/obj/list.h \ src/obj/list.h \
src/core/listservice.h \ src/core/listservice.h \
@@ -75,6 +87,7 @@ HEADERS += \
src/obj/note.h src/obj/note.h
FORMS += \ FORMS += \
src/gui/dialog/about/aboutdialog.ui \
src/gui/dialog/input/inputdialog.ui \ src/gui/dialog/input/inputdialog.ui \
src/gui/mainwindow.ui src/gui/mainwindow.ui
@@ -87,3 +100,6 @@ CONFIG += embed_translations
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \
src/resources.qrc

View File

@@ -0,0 +1,15 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::AboutDialog)
{
ui->setupUi(this);
ui->versionLabel->setText(QString("%1-%2").arg(APP_VERSION, APP_ARCH));
}
AboutDialog::~AboutDialog()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = nullptr);
~AboutDialog();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="windowModality">
<enum>Qt::WindowModality::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>258</width>
<height>183</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>258</width>
<height>183</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>258</width>
<height>183</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::ContextMenuPolicy::NoContextMenu</enum>
</property>
<property name="windowTitle">
<string>About ToDo</string>
</property>
<property name="windowIcon">
<iconset resource="../../../resources.qrc">
<normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../../resources.qrc">:/images/icon.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="styleSheet">
<string notr="true">font-weight: 200;
font-size: 36px;</string>
</property>
<property name="text">
<string>ToDo</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>0.0.0-dev</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../../resources.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -3,7 +3,7 @@
<class>InputDialog</class> <class>InputDialog</class>
<widget class="QDialog" name="InputDialog"> <widget class="QDialog" name="InputDialog">
<property name="windowModality"> <property name="windowModality">
<enum>Qt::WindowModality::ApplicationModal</enum> <enum>Qt::WindowModality::WindowModal</enum>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
@@ -28,6 +28,10 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<property name="windowIcon">
<iconset resource="../../../resources.qrc">
<normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(249, 255, 251);</string> <string notr="true">background-color: rgb(249, 255, 251);</string>
</property> </property>
@@ -191,6 +195,8 @@ QPushButton::pressed {
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="../../../resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View File

@@ -2,6 +2,7 @@
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "src/gui/dialog/input/inputdialog.h" #include "src/gui/dialog/input/inputdialog.h"
#include "src/gui/dialog/about/aboutdialog.h"
#include "src/core/listservice.h" #include "src/core/listservice.h"
#include "src/core/noteservice.h" #include "src/core/noteservice.h"
@@ -16,6 +17,8 @@ MainWindow::MainWindow(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->version->setText(QString("%1").arg(APP_VERSION));
/* /*
* Events * Events
*/ */
@@ -28,6 +31,11 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->saveNoteButton, &QPushButton::clicked, this, &MainWindow::onSaveNoteButtonClicked); connect(ui->saveNoteButton, &QPushButton::clicked, this, &MainWindow::onSaveNoteButtonClicked);
connect(ui->notes, &QListWidget::itemChanged, this, &MainWindow::onNoteChanged); connect(ui->notes, &QListWidget::itemChanged, this, &MainWindow::onNoteChanged);
// action menu
connect(ui->actionNew_list, &QAction::triggered, this, &MainWindow::openCreateListDialog);
connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::openAboutDialog);
connect(ui->actionClose, &QAction::triggered, this, &MainWindow::quit);
// services // services
connect(ListService::getInstance(), &ListService::onListCreated, this, &MainWindow::onListCreated); connect(ListService::getInstance(), &ListService::onListCreated, this, &MainWindow::onListCreated);
connect(ListService::getInstance(), &ListService::onListUpdated, this, &MainWindow::onListUpdate); connect(ListService::getInstance(), &ListService::onListUpdated, this, &MainWindow::onListUpdate);
@@ -59,6 +67,12 @@ void MainWindow::openCreateListDialog(bool)
ListService::getInstance()->create(newListName); ListService::getInstance()->create(newListName);
} }
void MainWindow::openAboutDialog()
{
AboutDialog d(this);
d.exec();
}
void MainWindow::onListCreated(List value) void MainWindow::onListCreated(List value)
{ {
QListWidgetItem* item = new QListWidgetItem(); QListWidgetItem* item = new QListWidgetItem();
@@ -307,6 +321,11 @@ void MainWindow::onListContextMenuRename(bool)
} }
} }
void MainWindow::quit()
{
QApplication::closeAllWindows();
}
inline void MainWindow::preload() inline void MainWindow::preload()
{ {
QList<List> lists = ListService::getInstance()->getAll(); QList<List> lists = ListService::getInstance()->getAll();

View File

@@ -23,6 +23,7 @@ public:
private slots: private slots:
void openCreateListDialog(bool); void openCreateListDialog(bool);
void openAboutDialog();
void onListCreated(List value); void onListCreated(List value);
void onListUpdate(List value); void onListUpdate(List value);
void onListDeleted(QUuid uuid); void onListDeleted(QUuid uuid);
@@ -36,6 +37,7 @@ private slots:
void onListRightClick(const QPoint &pos); void onListRightClick(const QPoint &pos);
void onListContextMenuDelete(bool); void onListContextMenuDelete(bool);
void onListContextMenuRename(bool); void onListContextMenuRename(bool);
void quit();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;

View File

@@ -19,6 +19,10 @@
<property name="windowTitle"> <property name="windowTitle">
<string>ToDo</string> <string>ToDo</string>
</property> </property>
<property name="windowIcon">
<iconset resource="../resources.qrc">
<normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true"/> <string notr="true"/>
</property> </property>
@@ -75,14 +79,16 @@
<property name="font"> <property name="font">
<font> <font>
<pointsize>28</pointsize> <pointsize>28</pointsize>
<fontweight>DemiBold</fontweight> <fontweight>ExtraLight</fontweight>
</font> </font>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(119, 167, 92); <string notr="true">background-color: rgb(119, 167, 92);
color: rgb(249, 255, 251);
border: none; border: none;
padding-left: 2px; padding-left: 2px;
border-bottom: 2px solid rgb(242, 242, 242)</string> border-bottom: 2px solid rgb(242, 242, 242);
font-weight: 200;</string>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>0</number> <number>0</number>
@@ -207,13 +213,32 @@ QListView::item:hover {
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QLabel" name="version"> <widget class="QLabel" name="version">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="styleSheet">
<string notr="true">color: rgb(74, 104, 57);</string>
</property>
<property name="text"> <property name="text">
<string>0.0.1</string> <string>0.0.0-dev</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -368,7 +393,7 @@ padding: 8px;</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset theme="QIcon::ThemeIcon::MailSend"/> <iconset theme="QIcon::ThemeIcon::DocumentSend"/>
</property> </property>
<property name="flat"> <property name="flat">
<bool>false</bool> <bool>false</bool>
@@ -399,7 +424,76 @@ padding: 8px;</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1032</width>
<height>24</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(119, 167, 92);
color: rgb(249, 255, 251);
font-weight: 200;</string>
</property>
<widget class="QMenu" name="menuAbout">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuFichier">
<property name="title">
<string>File</string>
</property>
<addaction name="actionNew_list"/>
<addaction name="separator"/>
<addaction name="actionClose"/>
</widget>
<addaction name="menuFichier"/>
<addaction name="menuAbout"/>
</widget>
<action name="actionAbout">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::HelpAbout"/>
</property>
<property name="text">
<string>About</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::AboutRole</enum>
</property>
</action>
<action name="actionNew_list">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentNew"/>
</property>
<property name="text">
<string>New list...</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionClose">
<property name="icon">
<iconset theme="QIcon::ThemeIcon::ApplicationExit"/>
</property>
<property name="text">
<string>Close</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
<property name="menuRole">
<enum>QAction::MenuRole::QuitRole</enum>
</property>
</action>
</widget> </widget>
<resources/> <resources>
<include location="../resources.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

BIN
src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

5
src/resources.qrc Normal file
View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/images">
<file>icon.png</file>
</qresource>
</RCC>