WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Feb 28, 2023. It is now read-only.

Commit 3f16815

Browse files
committed
Merge branch 'release/0404'
2 parents abcc101 + d76e3a0 commit 3f16815

File tree

12 files changed

+383
-142
lines changed

12 files changed

+383
-142
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# Version 0404 - 2015/11/24
2+
3+
### Additions
4+
- Added option to add a repository by dropping its folder onto LoGiVi (Closes [#46](https://github.com/rm-code/logivi/issues/46))
5+
- Added automatic camera zoom (Closes [#47](https://github.com/rm-code/logivi/issues/47))
6+
- Added fading of deleted files. They will no longer be removed instantly, but instead fade out until they are invisible (Closes [#49](https://github.com/rm-code/logivi/issues/49))
7+
- Added animation of files when they are rearranged around their parent nodes
8+
9+
### Fixes
10+
- Fixed [#44](https://github.com/rm-code/logivi/issues/44) - File paths are validated after the config has been validated
11+
- Fixed direction of camera rotation
112

213
# Version 0375 - 2015/11/11
314

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# LoGiVi
22

3-
LoGiVi is a git-repository visualisation tool inspired by [Gource](http://gource.io/) and __currently in development__. It was written from scratch using [Lua](http://www.lua.org/) and the [LÖVE](https://love2d.org/) framework.
3+
LoGiVi is a git-repository visualisation tool inspired by [Gource](http://gource.io/) and __currently in development__. It was written from scratch using [Lua](http://www.lua.org/) and the [LÖVE](https://love2d.org/) framework. Note: Since version [0375](https://github.com/rm-code/logivi/releases/tag/0375) LoGiVi uses version [0.10.0](https://love2d.org/wiki/0.10.0) of the LÖVE framework.
44

55
![Example Visualization](https://github.com/rm-code/logivi/wiki/media/logivi_0312.gif)
66

conf.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local PROJECT_TITLE = "LoGiVi";
22

3-
local PROJECT_VERSION = "0375";
3+
local PROJECT_VERSION = "0404";
44

55
local PROJECT_IDENTITY = "rmcode_LoGiVi";
66

main.lua

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ local showDebug = false;
1515
--
1616
local function checkSupport()
1717
print("\n---- RENDERER ---- ");
18-
local name, version, vendor, device = love.graphics.getRendererInfo()
18+
local name, version, vendor, device = love.graphics.getRendererInfo();
1919
print(string.format("Name: %s \nVersion: %s \nVendor: %s \nDevice: %s", name, version, vendor, device));
2020

2121
print("\n---- SYSTEM ---- ");
@@ -86,9 +86,8 @@ function love.resize(x, y)
8686
end
8787

8888
function love.keypressed(key)
89-
if key == ' ' then
90-
key = 'space';
91-
elseif tonumber(key) then
89+
-- Transform strings to numbers to fit the control values we read from the config file.
90+
if tonumber(key) then
9291
key = tonumber(key);
9392
end
9493

@@ -114,3 +113,7 @@ end
114113
function love.wheelmoved(x, y)
115114
ScreenManager.wheelmoved(x, y);
116115
end
116+
117+
function love.directorydropped(path)
118+
ScreenManager.directorydropped(path);
119+
end

src/FileManager.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function FileManager.draw(x, y)
5959
love.graphics.print(totalFiles, x + FRST_OFFSET, y + 10);
6060
love.graphics.print('Files', x + SCND_OFFSET, y + 10);
6161
for i, tbl in ipairs(sortedList) do
62-
love.graphics.setColor(tbl.color);
62+
love.graphics.setColor(tbl.color.r, tbl.color.g, tbl.color.b);
6363
love.graphics.print(tbl.amount, x + FRST_OFFSET, y + 10 + i * 20);
6464
love.graphics.print(tbl.extension, x + SCND_OFFSET, y + 10 + i * 20);
6565
love.graphics.setColor(255, 255, 255);
@@ -80,7 +80,11 @@ function FileManager.add(fileName)
8080
extensions[ext] = {};
8181
extensions[ext].extension = ext;
8282
extensions[ext].amount = 0;
83-
extensions[ext].color = colors[ext] or { love.math.random(0, 255), love.math.random(0, 255), love.math.random(0, 255) };
83+
extensions[ext].color = colors[ext] or {
84+
r = love.math.random(0, 255),
85+
g = love.math.random(0, 255),
86+
b = love.math.random(0, 255)
87+
};
8488
end
8589
extensions[ext].amount = extensions[ext].amount + 1;
8690
totalFiles = totalFiles + 1;

src/Resources.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ local fonts = {
1818
}
1919
};
2020

21-
2221
-- ------------------------------------------------
2322
-- Public Functions
2423
-- ------------------------------------------------

src/conf/ConfigReader.lua

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ local ConfigReader = {};
77
local FILE_NAME = 'settings.cfg';
88
local TEMPLATE_PATH = 'res/templates/settings.cfg';
99

10+
local INVALID_CONFIG_HEADER = 'Invalid config file';
11+
local MISSING_SECTION_WARNING = 'Seems like the loaded configuration file is missing the [%s] section. The default settings will be used instead.';
12+
local MISSING_VALUE_WARNING = 'Seems like the loaded configuration file is missing the [%s] value in the [%s] section. The default settings will be used instead.';
13+
1014
-- ------------------------------------------------
1115
-- Local Variables
1216
-- ------------------------------------------------
@@ -18,16 +22,28 @@ local config;
1822
-- Local Functions
1923
-- ------------------------------------------------
2024

25+
---
26+
-- Checks if the settings file exists on the user's system.
27+
--
2128
local function hasConfigFile()
2229
return love.filesystem.isFile(FILE_NAME);
2330
end
2431

32+
---
33+
-- Creates a new settings file on the user's system based on the default template.
34+
-- @param name - The file name to use for the config file.
35+
-- @param default - The path to the default settings file.
36+
--
2537
local function createConfigFile(name, default)
2638
for line in love.filesystem.lines(default) do
2739
love.filesystem.append(name, line .. '\r\n');
2840
end
2941
end
3042

43+
---
44+
-- Tries to transform strings to their actual types if possible.
45+
-- @param value - The value to transform.
46+
--
3147
local function toType(value)
3248
value = value:match('^%s*(.-)%s*$');
3349
if value == 'true' then
@@ -44,6 +60,7 @@ end
4460
local function loadFile(file)
4561
local config = {};
4662
local section;
63+
4764
for line in love.filesystem.lines(file) do
4865
if line == '' or line:find(';') == 1 then
4966
-- Ignore comments and empty lines.
@@ -68,31 +85,31 @@ local function loadFile(file)
6885
end
6986
end
7087

71-
-- Validate file paths.
72-
for project, path in pairs(config.repositories) do
73-
config.repositories[project] = path:gsub('\\+', '/');
74-
end
75-
7688
return config;
7789
end
7890

91+
---
92+
-- Validates a loaded config file by comparing it to the default config file.
93+
-- It checks if the file contains all the necessary sections and values. If it
94+
-- doesn't a warning is displayed and the default config will be used.
95+
-- @param default - The default file to use for comparison.
96+
-- @param loaded - The settings file loaded from the user's system.
97+
--
7998
local function validateFile(default, loaded)
8099
print('Validating configuration file ... ');
81100
for skey, section in pairs(default) do
82101

83102
-- If loaded config file doesn't contain section return default.
84103
if loaded[skey] == nil then
85-
love.window.showMessageBox('Invalid config file', 'Seems like the loaded configuration file is missing the "' ..
86-
skey .. '" section. The default settings will be used instead.', 'warning', false);
104+
love.window.showMessageBox(INVALID_CONFIG_HEADER, string.format(MISSING_SECTION_WARNING, skey), 'warning', false);
87105
return default;
88106
end
89107

108+
-- If the loaded config file is missing a value, display warning and return default.
90109
if type(section) == 'table' then
91110
for vkey, _ in pairs(section) do
92111
if loaded[skey][vkey] == nil then
93-
love.window.showMessageBox('Invalid config file',
94-
'Seems like the loaded configuration file is missing the "' ..
95-
vkey .. '" value in the "' .. skey .. '" section. The default settings will be used instead.', 'warning', false);
112+
love.window.showMessageBox(INVALID_CONFIG_HEADER, string.format(MISSING_VALUE_WARNING, vkey, skey), 'warning', false);
96113
return default;
97114
end
98115
end
@@ -103,6 +120,17 @@ local function validateFile(default, loaded)
103120
return loaded;
104121
end
105122

123+
---
124+
-- Replaces backslashes in paths with forwardslashes.
125+
-- @param The loaded config.
126+
--
127+
local function validateRepositoryPaths(config)
128+
for project, path in pairs(config.repositories) do
129+
config.repositories[project] = path:gsub('\\+', '/');
130+
end
131+
return config;
132+
end
133+
106134
-- ------------------------------------------------
107135
-- Public Functions
108136
-- ------------------------------------------------
@@ -118,6 +146,7 @@ function ConfigReader.init()
118146
if not config then
119147
config = loadFile(FILE_NAME);
120148
config = validateFile(default, config);
149+
config = validateRepositoryPaths(config);
121150
end
122151

123152
return config;

0 commit comments

Comments
 (0)