Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program Database & Archive Library #1542

Open
wants to merge 67 commits into
base: 3.3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
90a98ef
Initial work on a slade program database for v3.3.0
sirjuddington Apr 3, 2022
05d7879
Merge branch 'master' into database_330
sirjuddington Apr 3, 2022
ef8186e
Merge branch 'master' into database_330
sirjuddington Apr 7, 2022
e7eabac
Merge branch '3.3.0' into database_330
sirjuddington May 14, 2022
907ff40
Merge branch '3.3.0' into database_330
sirjuddington May 17, 2022
3808686
Add support for calculating fast hash of MemChunk data, keep hash of …
sirjuddington May 24, 2022
4dbd660
Support 'global' database contexts from multiple threads
sirjuddington May 24, 2022
556faad
Various changes and WIP
sirjuddington May 25, 2022
7ac6c5f
Update library on archive save
sirjuddington May 26, 2022
2e3ea49
Save/load per-archive entry list column info to/from the database
sirjuddington May 26, 2022
f355815
Rename archive_elist_config table, add splitter position
sirjuddington May 27, 2022
5031a0a
Support directory archives in library
sirjuddington May 28, 2022
2214626
Merge branch '3.3.0' into database_330
sirjuddington May 28, 2022
cde40a3
Implement save/load archive entry info in the library
sirjuddington Jun 5, 2022
7b6118c
Save (some) ArchiveEntry extra props to library
sirjuddington Jun 6, 2022
4104274
Save bookmarked entries to library
sirjuddington Jun 6, 2022
e6fd540
Merge branch '3.3.0' into database_330
sirjuddington Jun 10, 2022
8f2ab9e
Add functionality to scan a directory for archives to add to library
sirjuddington Jun 11, 2022
c21ca5a
Add 'Archive Library' UI
sirjuddington Jun 14, 2022
643762b
Merge branch 'master' into database_330
sirjuddington Jun 15, 2022
b84bbb5
Use SQliteCpp in thirdparty folder, add string_view support to it
sirjuddington Jun 16, 2022
c4ae633
Add new 'UI State' table to database for keeping state between sessions
sirjuddington Jun 18, 2022
b0ab73a
Library panel list (+ other) improvements
sirjuddington Jun 20, 2022
66f71bf
Fix release build
sirjuddington Jun 22, 2022
e1493fd
Rejig archive loading / entry type detection
sirjuddington Jun 23, 2022
0a13df2
Change library list to use database view, add entry count column
sirjuddington Jun 23, 2022
72c38c2
Merge branch '3.3.0' into database_330
sirjuddington Jun 25, 2022
dc35d28
Save basic map info per archive to library
sirjuddington Jun 26, 2022
5aea9fe
Save run dialog configuration to database per-archive
sirjuddington Jun 28, 2022
e0e4abb
Merge 3.3.0 branch
sirjuddington May 19, 2023
c6f3442
Merge branch '3.3.0' into database_330
sirjuddington May 25, 2023
ea425e6
Merge branch '3.3.0' into database_330
sirjuddington May 25, 2023
083ca85
Save selected map editor game and port per archive
sirjuddington May 26, 2023
1b0ef74
Fix opening archives within archives
sirjuddington May 26, 2023
dff6de4
Fix table creation sql files
sirjuddington May 26, 2023
462a2d7
Replace *_maximised cvars with UI state props
sirjuddington May 27, 2023
e8dfd0e
Migrate pre-3.3.0 configs when creating the database
sirjuddington May 27, 2023
b0f9ce9
Some cleanup
sirjuddington May 27, 2023
23888d7
Read recent files from cfg and combine with library recent files
sirjuddington May 28, 2023
faf08d5
Add filter to library panel
sirjuddington May 28, 2023
c1bede3
Add IWAD selection combobox to Run dialog, remembered per-archive
sirjuddington May 29, 2023
06982f3
Merge branch '3.3.0' into database_330
sirjuddington May 30, 2023
71fe9d6
Compilation fixes
sirjuddington May 30, 2023
0363046
Update SQLiteCpp, add Statement wrapper to handle string_view
sirjuddington May 30, 2023
d1d7057
Cleanup
sirjuddington May 30, 2023
d5e6bb3
Add db_info table with a database version number to be used for updates
sirjuddington May 30, 2023
d67ca92
Merge branch '3.3.0' into database_330
sirjuddington May 30, 2023
c8faa63
Merge from 3.3.0
sirjuddington Jun 1, 2023
61c8782
Initial support for 'child' archives in the library
sirjuddington Jun 1, 2023
b03336a
Add session database table
sirjuddington Jun 2, 2023
2da38e9
Merge branch '3.3.0' into database_330
sirjuddington Jun 4, 2023
694b98c
Some minor things
sirjuddington Jun 5, 2023
cac9ba9
Merge branch '3.3.0' into database_330
sirjuddington Jul 4, 2023
f30c758
Merge from 3.3.0
sirjuddington Nov 8, 2023
3712e8c
Merge branch '3.3.0' into database_330
sirjuddington Dec 5, 2023
d4c06ab
Merge branch 3.3.0
sirjuddington Dec 27, 2023
221b1ba
Add 'View Archive Library' button to start page
sirjuddington Dec 27, 2023
18076a4
Merge from 3.3.0
sirjuddington Jan 3, 2024
0858041
Merge from 3.3.0
sirjuddington May 2, 2024
1bc39db
Don't ignore 7z_command.cmake
sirjuddington May 2, 2024
61e740a
Remove files missed in merge
sirjuddington May 2, 2024
80c03aa
Merge branch '3.3.0' into database_330
sirjuddington May 3, 2024
ab6f424
Cleanup and refactoring
sirjuddington May 4, 2024
36e6113
Build fixes for linux
sirjuddington May 4, 2024
993f39b
Update macOS CI workflow
sirjuddington May 4, 2024
3a3ecb8
Fix macOS build (hopefully)
sirjuddington May 4, 2024
4e7e98d
More build fixes
sirjuddington May 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- {
name: "macOS",
os: macos-12,
deps_cmdline: "brew install fluidsynth freeimage ftgl glm lua mpg123 sfml wxwidgets"
deps_cmdline: "brew install fluidsynth freeimage ftgl glm lua mpg123 sfml sqlite wxwidgets"
}
- {
name: "Linux GCC",
Expand All @@ -22,7 +22,7 @@ jobs:
sudo apt-add-repository 'deb https://repos.codelite.org/wx3.2.0/ubuntu/ focal universe' && \
sudo apt update && sudo apt install \
libfluidsynth-dev libfreeimage-dev libftgl-dev libglm-dev libgtk-3-dev \
liblua5.3-dev libmpg123-dev libsfml-dev libwxgtk3.2unofficial-dev"
liblua5.3-dev libmpg123-dev libsfml-dev libsqlite3-dev libwxgtk3.2unofficial-dev"
}
- {
name: "Linux Clang",
Expand All @@ -32,7 +32,7 @@ jobs:
sudo apt-add-repository 'deb https://repos.codelite.org/wx3.2.0/ubuntu/ focal universe' && \
sudo apt update && sudo apt install \
libfluidsynth-dev libfreeimage-dev libftgl-dev libglm-dev libgtk-3-dev \
liblua5.3-dev libmpg123-dev libsfml-dev libwxgtk3.2unofficial-dev"
liblua5.3-dev libmpg123-dev libsfml-dev libsqlite3-dev libwxgtk3.2unofficial-dev"
}

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
!/dist/res
!/dist/CMakeLists.txt
!/dist/makebuild.ps1
!/dist/7z_command.cmake

/msvc/*
!/msvc/resource.h
Expand Down
2 changes: 2 additions & 0 deletions cmake/unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ if (NOT NO_LUA)
endif()
find_package(MPG123 REQUIRED)
find_package(glm REQUIRED)
find_package(SQLite3 REQUIRED)
include_directories(
${FREEIMAGE_INCLUDE_DIR}
${SFML_INCLUDE_DIR}
Expand Down Expand Up @@ -180,6 +181,7 @@ target_link_libraries(slade
${LUA_LIBRARIES}
${MPG123_LIBRARIES}
glm::glm
sqlite3
)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION LESS 9)
Expand Down
5 changes: 5 additions & 0 deletions cmake/win_msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ find_package(MPG123 CONFIG REQUIRED)
find_package(OpenGL REQUIRED)
find_package(SFML COMPONENTS system audio window network CONFIG REQUIRED)
find_package(glm REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
#find_package(xxHash CONFIG REQUIRED)


# Include Search Paths ---------------------------------------------------------
Expand All @@ -46,6 +48,7 @@ include_directories(
.
..
../thirdparty/glad/include
../thirdparty/SQLiteCpp/include
./Application
)

Expand Down Expand Up @@ -97,6 +100,8 @@ target_link_libraries(slade
sfml-network
sfml-window
glm::glm
unofficial::sqlite3::sqlite3
# xxHash::xxhash
)

if (NOT NO_LUA)
Expand Down
1 change: 1 addition & 0 deletions dist/res/actions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "actions/ptxt.cfg" // TextEntryPanel
#include "actions/mapw.cfg" // MapEditorWindow
#include "actions/scrm.cfg" // ScriptManagerWindow
#include "actions/alib.cfg" // LibraryPanel

// MapEntryPanel
action pmap_open_text
Expand Down
21 changes: 21 additions & 0 deletions dist/res/actions/alib.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

action alib_open
{
text = "Open";
icon = "open";
help_text = "Open the seleted archive(s)";
}

action alib_remove
{
text = "Remove";
icon = "delete";
help_text = "Remove the selected archive(s) from the library";
}

action alib_run
{
text = "Run";
icon = "run";
help_text = "Run the selected archive";
}
11 changes: 9 additions & 2 deletions dist/res/actions/main.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ action main_setbra

action main_preferences
{
text = "&Preferences...";
text = "&Preferences";
icon = "settings";
help_text = "Setup SLADE options and preferences";
custom_wx_id = 5022; // wxID_PREFERENCES
Expand Down Expand Up @@ -100,7 +100,7 @@ action main_about

action main_updatecheck
{
text = "Check for Updates...";
text = "Check for Updates";
help_text = "Check online for updates";
icon = "up";
}
Expand All @@ -111,3 +111,10 @@ action main_runscript
icon = "script";
help_text = "Open the Script Manager to write/run a SLADE script";
}

action main_showlibrary
{
text = "Archive Library";
icon = "library";
help_text = "Open the SLADE Archive Library";
}
12 changes: 6 additions & 6 deletions dist/res/config/archive_formats.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ archive_formats

extensions
{
wad = "WAD";
iwad = "IWAD";
wad = "Doom WAD";
iwad = "Doom IWAD";
dta = "SRB2 DTA";
gwa = "GL-Nodes WAD";
hwa = "EDGE HWA";
Expand Down Expand Up @@ -56,7 +56,7 @@ archive_formats
{
name = "Quake BSP";
entry_format = "archive_bsp";
extensions { bsp = "BSP"; }
extensions { bsp = "Quake BSP"; }
}

bz2
Expand Down Expand Up @@ -209,7 +209,7 @@ archive_formats
max_name_length = 16;
names_extensions = false;
entry_format = "archive_wad2";
extensions { wad = "WAD2"; }
extensions { wad = "Quake WAD2"; }
}

wadj
Expand All @@ -220,7 +220,7 @@ archive_formats
max_name_length = 8;
entry_format = "archive_wadj";
prefer_uppercase = true;
extensions { wad = "WAD"; }
extensions { wad = "Jaguar Doom WAD"; }
}

wolf
Expand Down Expand Up @@ -249,6 +249,6 @@ archive_formats
max_name_length = 120;
supports_dirs = true;
entry_format = "archive_sin";
extensions { sin = "SiN"; }
extensions { sin = "SiN File"; }
}
}
12 changes: 12 additions & 0 deletions dist/res/database/tables/archive_bookmark.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BEGIN;

CREATE TABLE archive_bookmark (
archive_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE,
entry_id INTEGER,
UNIQUE (
archive_id,
entry_id
)
);

COMMIT;
24 changes: 24 additions & 0 deletions dist/res/database/tables/archive_entry.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BEGIN;

CREATE TABLE archive_entry (
archive_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE,
id INTEGER,
path TEXT,
[index] INTEGER,
name TEXT,
size INTEGER,
hash TEXT,
type_id TEXT,
CONSTRAINT primary_key UNIQUE (
archive_id,
id
)
);

CREATE INDEX entry_match ON archive_entry (
name,
path,
hash
);

COMMIT;
16 changes: 16 additions & 0 deletions dist/res/database/tables/archive_entry_property.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
BEGIN;

CREATE TABLE archive_entry_property (
archive_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE,
entry_id INTEGER,
[key] TEXT,
value_type INTEGER,
value NONE,
UNIQUE (
archive_id,
entry_id,
[key]
)
);

COMMIT;
14 changes: 14 additions & 0 deletions dist/res/database/tables/archive_file.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BEGIN;

CREATE TABLE archive_file (
id INTEGER PRIMARY KEY,
path TEXT UNIQUE, -- Path to the archive file on disk (or directory), must be unique in the table
size INTEGER, -- Size of the file on disk (in bytes)
hash TEXT, -- Hash (xxHash 128-bit) of the file data on disk
format_id TEXT, -- Archive format id (eg. 'wad')
last_opened DATETIME, -- Time the archive was last opened in SLADE
last_modified DATETIME, -- Modified time of the file on disk
parent_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE -- For archives within archives, the id of this archive's parent
);

COMMIT;
14 changes: 14 additions & 0 deletions dist/res/database/tables/archive_map.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BEGIN;

CREATE TABLE archive_map (
archive_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE,
header_entry_id INTEGER,
name TEXT,
format INTEGER,
UNIQUE (
archive_id,
header_entry_id
)
);

COMMIT;
9 changes: 9 additions & 0 deletions dist/res/database/tables/archive_map_config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BEGIN;

CREATE TABLE archive_map_config (
archive_id INTEGER REFERENCES archive_file (id) ON DELETE CASCADE,
game TEXT,
port TEXT
);

COMMIT;
12 changes: 12 additions & 0 deletions dist/res/database/tables/archive_run_config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BEGIN;

CREATE TABLE archive_run_config (
archive_id INTEGER PRIMARY KEY
REFERENCES archive_file (id) ON DELETE CASCADE,
executable_id TEXT,
run_config INTEGER,
run_extra TEXT,
iwad_path TEXT
);

COMMIT;
18 changes: 18 additions & 0 deletions dist/res/database/tables/archive_ui_config.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
BEGIN;

CREATE TABLE archive_ui_config (
archive_id INTEGER PRIMARY KEY
REFERENCES archive_file (id) ON DELETE CASCADE,
elist_index_visible BOOLEAN,
elist_index_width INTEGER,
elist_name_width INTEGER,
elist_size_visible BOOLEAN,
elist_size_width INTEGER,
elist_type_visible BOOLEAN,
elist_type_width INTEGER,
elist_sort_column TEXT,
elist_sort_descending BOOLEAN,
splitter_position INTEGER
);

COMMIT;
7 changes: 7 additions & 0 deletions dist/res/database/tables/db_info.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BEGIN;

CREATE TABLE db_info (
version INTEGER
);

COMMIT;
13 changes: 13 additions & 0 deletions dist/res/database/tables/session.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BEGIN;

CREATE TABLE session (
id INTEGER PRIMARY KEY,
opened_time DATETIME,
closed_time DATETIME,
version_major INTEGER,
version_minor INTEGER,
version_revision INTEGER,
version_beta INTEGER
);

COMMIT;
8 changes: 8 additions & 0 deletions dist/res/database/tables/ui_state.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BEGIN;

CREATE TABLE ui_state (
name TEXT PRIMARY KEY,
value NONE
);

COMMIT;
12 changes: 12 additions & 0 deletions dist/res/database/tables/window_info.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BEGIN;

CREATE TABLE window_info (
window_id TEXT PRIMARY KEY
NOT NULL,
left INTEGER,
top INTEGER,
width INTEGER,
height INTEGER
);

COMMIT;
13 changes: 13 additions & 0 deletions dist/res/database/tables/window_layout.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BEGIN;

CREATE TABLE window_layout (
window_id TEXT,
component TEXT,
layout TEXT,
UNIQUE (
window_id,
component
)
);

COMMIT;
26 changes: 26 additions & 0 deletions dist/res/database/views/archive_library_list.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BEGIN;

CREATE VIEW archive_library_list AS
SELECT archive_file.id,
archive_file.path,
archive_file.size,
archive_file.format_id,
archive_file.last_opened,
archive_file.last_modified,
archive_file.parent_id,
(
SELECT COUNT( * )
FROM archive_entry
WHERE archive_entry.archive_id = archive_file.id
)
AS entry_count,
(
SELECT COUNT( * )
FROM archive_map
WHERE archive_map.archive_id = archive_file.id
)
AS map_count
FROM archive_file
ORDER BY archive_file.path COLLATE NOCASE ASC;

COMMIT;
Loading
Loading