arboressence
This commit is contained in:
parent
6989e45d81
commit
de0393f9f3
12 changed files with 166 additions and 0 deletions
0
enquete-gui/Enquete.sqlite
Normal file
0
enquete-gui/Enquete.sqlite
Normal file
28
enquete-gui/Makefile
Normal file
28
enquete-gui/Makefile
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
CC = gcc
|
||||
|
||||
PKG_CONFIG = pkg-config
|
||||
|
||||
CFLAGS = -Wall -Wextra -Wpedantic -std=c23 -g \
|
||||
-Iinclude \
|
||||
$(shell $(PKG_CONFIG) --cflags gtk4 sqlite3)
|
||||
|
||||
LDFLAGS = $(shell $(PKG_CONFIG) --libs gtk4 sqlite3)
|
||||
|
||||
SRC := $(wildcard src/*.c)
|
||||
OBJ := $(SRC:.c=.o)
|
||||
|
||||
TARGET = enquete-gui
|
||||
|
||||
$(TARGET): $(OBJ)
|
||||
$(CC) $(OBJ) -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(TARGET)
|
||||
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
.PHONY: clean run
|
||||
22
enquete-gui/compile_flags.txt
Normal file
22
enquete-gui/compile_flags.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-I/usr/include/gtk-4.0
|
||||
-I/usr/include/pango-1.0
|
||||
-I/usr/include/fribidi
|
||||
-I/usr/include/harfbuzz
|
||||
-I/usr/include/gdk-pixbuf-2.0
|
||||
-I/usr/include/glycin-2
|
||||
-I/usr/include/cairo
|
||||
-I/usr/include/freetype2
|
||||
-I/usr/include/libpng16
|
||||
-I/usr/include/pixman-1
|
||||
-I/usr/include/graphene-1.0
|
||||
-I/usr/lib/graphene-1.0/include
|
||||
-mfpmath=sse
|
||||
-msse
|
||||
-msse2
|
||||
-I/usr/include/glib-2.0
|
||||
-I/usr/lib/glib-2.0/include
|
||||
-I/usr/include/libmount
|
||||
-I/usr/include/blkid
|
||||
-I/usr/include/sysprof-6
|
||||
-pthread
|
||||
-Iinclude
|
||||
BIN
enquete-gui/enquete-gui
Executable file
BIN
enquete-gui/enquete-gui
Executable file
Binary file not shown.
8
enquete-gui/include/app.h
Normal file
8
enquete-gui/include/app.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef APP_H
|
||||
#define APP_H
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
GtkWidget *app_create_main_window(GtkApplication *app);
|
||||
|
||||
#endif
|
||||
9
enquete-gui/include/database.h
Normal file
9
enquete-gui/include/database.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
int db_open(sqlite3 **db, const char *path);
|
||||
void db_close(sqlite3 *db);
|
||||
|
||||
#endif
|
||||
42
enquete-gui/src/app.c
Normal file
42
enquete-gui/src/app.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include "app.h"
|
||||
|
||||
GtkWidget *app_create_main_window(GtkApplication *app)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *box;
|
||||
GtkWidget *sidebar;
|
||||
GtkWidget *content;
|
||||
GtkWidget *label;
|
||||
|
||||
window = gtk_application_window_new(app);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Enquête OSINT");
|
||||
gtk_window_set_default_size(GTK_WINDOW(window), 1000, 650);
|
||||
|
||||
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_window_set_child(GTK_WINDOW(window), box);
|
||||
|
||||
sidebar = gtk_list_box_new();
|
||||
gtk_widget_set_size_request(sidebar, 220, -1);
|
||||
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Preuves"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Entités"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Chronologie"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Recherches"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Hypothèses"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Sources"));
|
||||
gtk_list_box_append(GTK_LIST_BOX(sidebar), gtk_label_new("Rapport"));
|
||||
|
||||
content = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_widget_set_margin_top(content, 20);
|
||||
gtk_widget_set_margin_bottom(content, 20);
|
||||
gtk_widget_set_margin_start(content, 20);
|
||||
gtk_widget_set_margin_end(content, 20);
|
||||
|
||||
label = gtk_label_new("Tableau de bord de l'enquête");
|
||||
gtk_box_append(GTK_BOX(content), label);
|
||||
|
||||
gtk_box_append(GTK_BOX(box), sidebar);
|
||||
gtk_box_append(GTK_BOX(box), content);
|
||||
|
||||
return window;
|
||||
}
|
||||
BIN
enquete-gui/src/app.o
Normal file
BIN
enquete-gui/src/app.o
Normal file
Binary file not shown.
21
enquete-gui/src/database.c
Normal file
21
enquete-gui/src/database.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "database.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int db_open(sqlite3 **db, const char *path)
|
||||
{
|
||||
int rc = sqlite3_open(path, db);
|
||||
|
||||
if (rc != SQLITE_OK) {
|
||||
fprintf(stderr, "Erreur SQLite: %s\n", sqlite3_errmsg(*db));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void db_close(sqlite3 *db)
|
||||
{
|
||||
if (db != NULL) {
|
||||
sqlite3_close(db);
|
||||
}
|
||||
}
|
||||
BIN
enquete-gui/src/database.o
Normal file
BIN
enquete-gui/src/database.o
Normal file
Binary file not shown.
36
enquete-gui/src/main.c
Normal file
36
enquete-gui/src/main.c
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include <gtk/gtk.h>
|
||||
#include <sqlite3.h>
|
||||
|
||||
#include "app.h"
|
||||
#include "database.h"
|
||||
|
||||
static void activate(GtkApplication *app, gpointer user_data)
|
||||
{
|
||||
(void)user_data;
|
||||
|
||||
GtkWidget *window = app_create_main_window(app);
|
||||
gtk_window_present(GTK_WINDOW(window));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
sqlite3 *db = NULL;
|
||||
|
||||
if (db_open(&db, "Enquete.sqlite") != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
GtkApplication *app = gtk_application_new(
|
||||
"com.labfytools.enquete",
|
||||
G_APPLICATION_DEFAULT_FLAGS
|
||||
);
|
||||
|
||||
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
|
||||
|
||||
int status = g_application_run(G_APPLICATION(app), argc, argv);
|
||||
|
||||
g_object_unref(app);
|
||||
db_close(db);
|
||||
|
||||
return status;
|
||||
}
|
||||
BIN
enquete-gui/src/main.o
Normal file
BIN
enquete-gui/src/main.o
Normal file
Binary file not shown.
Loading…
Reference in a new issue