Skip to content

Commit 3482061

Browse files
committed
a12 beta
1 parent d913994 commit 3482061

19 files changed

+397
-105
lines changed

app/main.lua

+3-6
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ window:setRootViewController(VIEWCONTROLLER(function(m)
140140
local super = nav.cell.mnew
141141
function nav.cell.mnew(_)
142142
local m = super(_)
143-
m:textLabel():setFont(objc.UIFont:fontWithName_size('HelveticaNeue-Bold', 22))
143+
m:textLabel():setFont(objc.UIFont:fontWithName_size('HelveticaNeue-Light', 18))
144144
return m
145145
end
146146
local selected_view = objc.UIView:alloc():initWithFrame{{0, 0},{2, 44}}
@@ -149,10 +149,6 @@ window:setRootViewController(VIEWCONTROLLER(function(m)
149149
local item = nav.items[section][row]
150150
m:textLabel():setText(item.title)
151151
m:imageView():setImage(item.icon)
152-
if item.icon then
153-
local siz = 22
154-
m:imageView():setTransform(C.CGAffineTransformMakeScale(siz/item.icon:size().width, siz/item.icon:size().height))
155-
end
156152
if item.view == active then
157153
m:addSubview(selected_view)
158154
end
@@ -241,4 +237,5 @@ CHECK_UPDATE(function(json, err)
241237
end)
242238
end)
243239

244-
require 'autorun_loader'('app')
240+
require 'page.crossfeed'
241+
require 'page.compressor'

app/page/compressor.lua

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- put this into /var/tweak/com.r333d.eqe/lua/autorun/app/
2+
-- load by restarting the EQE app
3+
4+
local str_esc = require 'str_esc'
5+
local md = require 'md'
6+
7+
local page = {}
8+
page.title = 'Compressor (beta)'
9+
page.icon = IMG('radio-waves.png', PAGE_ICON_COLOR):retain()
10+
11+
local function ipc(s, safe)
12+
s = str_esc(s)
13+
if safe then
14+
return IPC('return eqe.raw('..s..')')
15+
else
16+
return IPC('return eqe.raw('..s..', true)')
17+
end
18+
end
19+
20+
local pad = 11
21+
local function create_switch(y, canvaswidth, title, m)
22+
local target = ns.target:new()
23+
target.switch = objc.UISwitch:alloc():init()
24+
local s = target.switch:frame().size
25+
local x = canvaswidth - s.width - pad*3
26+
target.switch:setFrame{{x, y},s}
27+
target.switch:setOnTintColor(COLOR(0x4bc2ffaa))
28+
target.switch:setTintColor(COLOR(0xffffff55))
29+
target.switch:addTarget_action_forControlEvents(target.m, target.sel, UIControlEventValueChanged)
30+
31+
target.label = objc.UILabel:alloc():init()
32+
target.label:setFont(objc.UIFont:fontWithName_size('HelveticaNeue', 16))
33+
target.label:setTextColor(COLOR(0xffffff8d))
34+
target.label:setBackgroundColor(objc.UIColor:clearColor())
35+
target.label:setText(title)
36+
target.label:sizeToFit()
37+
local switchS = s
38+
local s = target.label:frame().size
39+
target.label:setFrame{{x - s.width - pad, y + (switchS.height - s.height)/2},s}
40+
41+
m:view():addSubview(target.label)
42+
m:view():addSubview(target.switch)
43+
return target, y + target.switch:frame().size.height
44+
end
45+
46+
function page:init()
47+
local vc = VIEWCONTROLLER(function(m)
48+
local frame = m:view():frame()
49+
local width = frame.size.width
50+
51+
local y = 64
52+
53+
local enable, y = create_switch(y, width, 'Enabled', m)
54+
function enable.onaction()
55+
local on = objc.weirdbool(enable.switch:isOn())
56+
ipc('compressor.enabled('..tostring(on)..')')
57+
ipc('compressor.save()')
58+
end
59+
self.enable = enable
60+
61+
local r = md.new(width - pad*2)
62+
self.helper_text = r.m
63+
self.helper_text:setFrame{{pad, y + pad},{0,0}}
64+
m:view():addSubview(self.helper_text)
65+
r:init[[
66+
This basically makes your audio more "level" and "loud". Good for listening to podcasts and that kinda stuff. [Wikipedia article](https://en.wikipedia.org/wiki/Dynamic_range_compression)
67+
68+
This is a super basic version of a compressor, it's literally just an enable switch with some super basic presets. There should be more options here but I don't know how compressors work.
69+
70+
If you know how to use a compressor, hop on the [Discord chat](https://discord.gg/RSJWAuX). I can show you the under-the-hood settings in Terminal.
71+
72+
This code is open source.
73+
]]
74+
75+
end)
76+
self.view = vc:view()
77+
end
78+
79+
function page:refresh()
80+
local enabled = ipc('return compressor.enabled()') == 'true'
81+
82+
self.enable.switch:setOn(enabled)
83+
end
84+
85+
function page:hide(hiding)
86+
if not hiding then
87+
self:refresh()
88+
end
89+
90+
end
91+
92+
Page.compressor = page
93+
ADD_NAV_PAGE(page, Page.eqe)

app/page/crossfeed.lua

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
-- put this into /var/tweak/com.r333d.eqe/lua/autorun/app/
2+
-- load by restarting the EQE app
3+
4+
local str_esc = require 'str_esc'
5+
local md = require 'md'
6+
7+
local page = {}
8+
page.title = 'Crossfeed (beta)'
9+
page.icon = IMG('headphone.png', PAGE_ICON_COLOR):retain()
10+
11+
local function ipc(s, safe)
12+
s = str_esc(s)
13+
if safe then
14+
return IPC('return eqe.raw('..s..')')
15+
else
16+
return IPC('return eqe.raw('..s..', true)')
17+
end
18+
end
19+
20+
local thumbImg = IMG('thumb.png'):retain()
21+
22+
local pad = 11
23+
local function create_slider(y, width, title, m)
24+
local self = {}
25+
self.onchange = function() end
26+
self.onfinish = function() end
27+
28+
self.label = objc.UILabel:alloc():initWithFrame{{pad,y},{width - pad*2,44}}
29+
self.label:setFont(objc.UIFont:fontWithName_size('HelveticaNeue', 16))
30+
self.label:setTextColor(COLOR(0xffffff8d))
31+
self.label:setBackgroundColor(objc.UIColor:clearColor())
32+
self.label:setText(title)
33+
34+
y = y + self.label:frame().size.height
35+
36+
self.slider = objc.EQEOBSlider:alloc():initWithFrame{{pad,y},{width - pad*2,44}}
37+
self.slider:setThumbImage_forState(thumbImg, UIControlStateNormal)
38+
self.slider:setMinimumTrackTintColor(COLOR(0xffffff80))
39+
self.slider:setMaximumTrackTintColor(COLOR(0xffffff50))
40+
41+
local target = ns.target:new()
42+
function target.onaction()
43+
self.onfinish()
44+
end
45+
self.slider:addTarget_action_forControlEvents(target.m, target.sel, bit.bor(UIControlEventTouchUpInside, UIControlEventTouchUpOutside))
46+
47+
local target = ns.target:new()
48+
function target.onaction()
49+
self.onchange()
50+
end
51+
self.slider:addTarget_action_forControlEvents(target.m, target.sel, bit.bor(UIControlEventValueChanged))
52+
53+
local target = ns.target:new()
54+
self.slider:addTarget_action_forControlEvents(target.m, target.sel, UIControlEventValueChanged)
55+
function self.updatetext()
56+
self.label:setText(title..': '..self.slider:value())
57+
end
58+
function target.onaction()
59+
self.updatetext()
60+
end
61+
62+
y = y + self.slider:frame().size.height
63+
64+
m:view():addSubview(self.slider)
65+
m:view():addSubview(self.label)
66+
67+
return self, y
68+
end
69+
70+
local function create_button(x, y, canvaswidth, title, m)
71+
local height = 34
72+
local width = canvaswidth*2/3
73+
local button = ui.button:new()
74+
button.m:setFrame{{x + (canvaswidth-width)/2, y},{width,height}}
75+
button.m:layer():setCornerRadius(8)
76+
button:setFont('HelveticaNeue', 16)
77+
button:setColor(COLOR(0xff, 0xff, 0xff, 0xff*0.7))
78+
button.m:setBackgroundColor(COLOR(0xff, 0xff, 0xff, 0xff*0.07))
79+
button:setTitle(title)
80+
m:view():addSubview(button.m)
81+
return button, y + height
82+
end
83+
84+
local function create_switch(y, canvaswidth, title, m)
85+
local target = ns.target:new()
86+
target.switch = objc.UISwitch:alloc():init()
87+
local s = target.switch:frame().size
88+
local x = canvaswidth - s.width - pad*3
89+
target.switch:setFrame{{x, y},s}
90+
target.switch:setOnTintColor(COLOR(0x4bc2ffaa))
91+
target.switch:setTintColor(COLOR(0xffffff55))
92+
target.switch:addTarget_action_forControlEvents(target.m, target.sel, UIControlEventValueChanged)
93+
94+
target.label = objc.UILabel:alloc():init()
95+
target.label:setFont(objc.UIFont:fontWithName_size('HelveticaNeue', 16))
96+
target.label:setTextColor(COLOR(0xffffff8d))
97+
target.label:setBackgroundColor(objc.UIColor:clearColor())
98+
target.label:setText(title)
99+
target.label:sizeToFit()
100+
local switchS = s
101+
local s = target.label:frame().size
102+
target.label:setFrame{{x - s.width - pad, y + (switchS.height - s.height)/2},s}
103+
104+
m:view():addSubview(target.label)
105+
m:view():addSubview(target.switch)
106+
return target, y + target.switch:frame().size.height
107+
end
108+
109+
function page:init()
110+
local vc = VIEWCONTROLLER(function(m)
111+
local frame = m:view():frame()
112+
local width = frame.size.width
113+
114+
local intensity, y = create_slider(64, width, 'Intensity', m)
115+
intensity.slider:setMinimumValue(0)
116+
intensity.slider:setMaximumValue(1)
117+
function intensity.onchange()
118+
ipc('crossfeed.intensity('..intensity.slider:value()..')')
119+
end
120+
function intensity.onfinish()
121+
intensity.onchange()
122+
ipc('crossfeed.save()')
123+
end
124+
self.intensity = intensity
125+
126+
local delay, y = create_slider(y, width, 'Delay (ms)', m)
127+
delay.slider:setMinimumValue(0)
128+
delay.slider:setMaximumValue(4)
129+
function delay.onchange()
130+
ipc('crossfeed.delay('..delay.slider:value()..')')
131+
end
132+
function delay.onfinish()
133+
delay.onchange()
134+
ipc('crossfeed.save()')
135+
end
136+
self.delay = delay
137+
138+
--[[
139+
y = y + pad*2
140+
141+
self.save = create_button(0, y, width/2, 'Save', m)
142+
local load, y = create_button(width/2, y, width/2, 'Load', m)
143+
self.load = load
144+
145+
function self.save.ontoggle()
146+
ipc('crossfeed.save()')
147+
end
148+
149+
function self.load.ontoggle()
150+
ipc('crossfeed.load()')
151+
self:refresh()
152+
end
153+
]]
154+
155+
y = y + pad*2
156+
157+
local enable, y = create_switch(y, width, 'Enabled', m)
158+
function enable.onaction()
159+
local on = objc.weirdbool(enable.switch:isOn())
160+
ipc('crossfeed.enabled('..tostring(on)..')', true)
161+
end
162+
self.enable = enable
163+
164+
local r = md.new(width - pad*2)
165+
self.helper_text = r.m
166+
self.helper_text:setFrame{{pad, y + pad},{0,0}}
167+
m:view():addSubview(self.helper_text)
168+
r:init[[
169+
If you have no clue what this does, [here's a pretty good explanation](http://www.meier-audio.homepage.t-online.de/crossfeed.htm).
170+
171+
Basically, you should use this if you're using headphones, it makes it sound more "full" and "open", like speakers.
172+
173+
Credits to xC0nfused on [Discord](https://discord.gg/RSJWAuX) for helping make this. This code is open source.]]
174+
175+
end)
176+
self.view = vc:view()
177+
end
178+
179+
function page:refresh()
180+
local intensity = tonumber(ipc('return crossfeed.intensity()'))
181+
local delay = tonumber(ipc('return crossfeed.delay()'))
182+
local enabled = ipc('return crossfeed.enabled()') == 'true'
183+
184+
self.intensity.slider:setValue(intensity)
185+
self.intensity.updatetext()
186+
self.delay.slider:setValue(delay)
187+
self.delay.updatetext()
188+
self.enable.switch:setOn(enabled)
189+
end
190+
191+
function page:hide(hiding)
192+
if not hiding then
193+
self:refresh()
194+
end
195+
196+
end
197+
198+
Page.crossfeed = page
199+
ADD_NAV_PAGE(page, Page.eqe)

app/page/history/init.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ function page:init()
6767
function tbl.cell.onshow(_, m, section, row)
6868
local item = items[row]
6969
m:textLabel():setText(item.title)
70-
local scale = 22
70+
local scale = 32
7171
scale = scale/math.max(item.icon:size().width, item.icon:size().height)
72-
m:imageView():setTransform(C.CGAffineTransformMakeScale(scale, scale))
72+
m:setImageViewSize{scale*item.icon:size().width, scale*item.icon:size().height}
7373
m:imageView():setImage(item.icon)
7474
end
7575
function tbl.cell.onselect(_, section, row)

app/page/history/top/init.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ return function(query, render)
4343
if icon then
4444
local scale = 22
4545
scale = scale/math.max(icon:size().width, icon:size().height)
46-
m:imageView():setTransform(C.CGAffineTransformMakeScale(scale, scale))
46+
m:setImageViewSize{scale*icon:size().width, scale*icon:size().height}
4747
end
4848
end
4949

app/page/history/whitelist.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ return function(m)
8181
m:accessoryView():setOn(app.enabled == 1 and true or false)
8282

8383
if icon then
84-
local scale = 22
84+
local scale = 32
8585
scale = scale/math.max(icon:size().width, icon:size().height)
86-
m:imageView():setTransform(C.CGAffineTransformMakeScale(scale, scale))
86+
m:setImageViewSize{scale*icon:size().width, scale*icon:size().height}
8787
end
8888
end
8989
end

app/page/settings.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function page:init()
2424
local items = {
2525
{
2626
title = 'Enable mediaserverd hook',
27-
subtitle = 'When disabled, audio will not be processed. Basically the equivalent of disabling in iCleaner.',
27+
subtitle = 'Handles processing of all audio.',
2828
cb = function(enabled)
2929
if enabled == nil then
3030
return IPC('return GET_ENABLED()') == 'true'

app/page/update.lua

+1-6
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ function page:init()
110110
end
111111

112112
local cydia_notice_text = "If you want, you can just update through Cydia. Both methods are compatible with each other."
113-
local version_info_text
114-
if string.find(EQE_TWEAK_VERSION, '%~beta') then
115-
version_info_text = 'Current version: '..EQE_TWEAK_VERSION..'\ngit commit: '..string.sub(require 'config.default.git_commit', 1, 6)..'\n\nIf you are reporting an issue, please specify the git commit as well.'
116-
else
117-
version_info_text = 'Current version: '..EQE_TWEAK_VERSION
118-
end
113+
local version_info_text = 'Current version: '..EQE_TWEAK_VERSION
119114

120115
local cydia_notice = objc.UILabel:alloc():init()
121116
cydia_notice:setColor(COLOR(0xffffff5d))

app/ui/cell.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function ui.cell:mnew()
3333
self.m = m
3434
objc.ref(m, self)
3535

36+
m:setImageViewSize{32, 32}
3637
m:textLabel():setTextColor(objc.UIColor:whiteColor())
3738
m:textLabel():setBackgroundColor(objc.UIColor:clearColor())
3839
m:detailTextLabel():setTextColor(objc.UIColor:whiteColor())
@@ -49,7 +50,7 @@ end
4950
function ui.cell:dealloc()
5051
end
5152

52-
ui.cell.class = objc.GenerateClass('UITableViewCell')
53+
ui.cell.class = objc.GenerateClass('EQEEditCell')
5354
local class = ui.cell.class
5455

5556
function class.dealloc(m)

0 commit comments

Comments
 (0)