koreader / kindlepdfviewer

(DEPRECATED, please use KOReader instead) A PDF (plus DJVU, ePub, TXT, CHM, FB2, HTML...) viewer made for e-ink framebuffer devices, using muPDF, djvulibre, crengine
GNU General Public License v3.0
499 stars 98 forks source link

propose on adjusting directory tree structure (new UI branch) #756

Closed houqp closed 11 years ago

houqp commented 11 years ago

Currently, I think files inside frontend directory is a little bit messy.

The main problem is that all the files are put into ui folder.

We now have ui widgets like menu.lua, config.lua, botton.lua, etc. We also have core ui modules like screen.lua, device.lua, event.lua, inputevent.lua and gesturedetector.lua. Besides these two main categories, we have helper modules like geometry.lua and time.lua. All of these modules are put into one folder which is not developer friendly. I myself sometime find it hard to find a specific file that I need to edit.

Therefore, I suggest we create a widget subfolder inside ui folder and put all the widget files into it. So when some one needs a button widget, they can use `require "ui/widget/button" to include it.

As for other files in ui folder, maybe we can leave them as is for now.

We might also need a frontend\data folder which holds data modules that are related to UIs. For instance, all the reader options currently defined inside different document modules.

I am interested in how other people think about this. Feel free to comments :)

chrox commented 11 years ago

It's a good idea. And the filenames of readerui.lua and ui.lua is confusing. Each time when I want to add a widget controller I have a good chance to open the wrong file. Should we rename ui.lua to uimanager.lua so that the function of this module can be easily identified?

hwhw commented 11 years ago

I think that's a very good approach. When I started the new branch, I thought of something like this, a bit Java-style...

hwhw commented 11 years ago

+1 to this, too. The ui.lua file started as a kind of pool, when the structure wasn't clear yet.

houqp commented 11 years ago

yeah also +1 for uimanager.lua.

houqp commented 11 years ago

OK, #782 is sent to handle this. Changes included: