Sublime UI
From KDevelop
[edit] Modus Operandi
- UI provides support for "areas" (alike Eclipse's perspectives)
- The basic set of areas is:
- code editing area with splitted editor windows (with kate/konqueror-like splitting)
- debugging area (Xcode-like debugger window with only one editor view by default but with possiblility to show more)
- profiling area (like KCacheGrind)
- user interface design area (like Qt designer)
- Area configuration includes code editor windows (unlike Eclipse)
- Each area can be displayed in usual Qt mainwindow with toolviews in dockwidgets
- Areas are shown in separate mainwindows so that multiple-monitor setups become the best supported
- One area can be shown in two and more mainwindows by "cloning" the area (unlike Eclipse that pretends that two mainwindows show the same area)
- Optionally areas can be switched inside the same mainwindow without opening new ones (like in Eclipse), but this mode of operation is currently not implemented. Also Sublime was not optimized for this use-case. See other wiki pages (...which?) for a detailed discussion and explanation of possible problems.
- It is possible to open as many similar toolviews as necessary (for example, several Konsoles)
- It is possible to open several views for the same file in code editor view (unlike KDevelop 3.x)
- Instead of tabs for editor windows a "switcher" is provided. Currently the switcher is a combobox but that will change for sure.
[edit] Brief Architecture Overview
Sublime::Controller is the central point of the whole Sublime infrastructure. It contains areas, documents and controlls mainwindows. Sublime::Controller::showArea() is the only way to show an area in the mainwindow.
Sublime::MainWindow is just a KParts::MainWindow which just knows how to "reconstruct" the area, react on area changes. Additionally it knows which view and toolview is "active" (i.e. last focused).
Sublime::Area is the object that controls views, toolviews and defines their placement inside the mainwindow. Provides various view management (e.g. add/remove/etc.) methods and signals. Also Area is responsible to store/restore view layout (on-disk storage is not implemented currently).
Area is identified by its name. Each KDevelop platform application, for example, has to define a concept of "default area" in ShellExtension so that UiController can load it by default.
While areas operate on views, the Sublime Controller deals with Sublime::Documents only. Sublime::View is only a thin wrapper around actual QWidget.
Document is what provides views. Sublime::Document::createView() is the only way to get a view. When createView() is called, the protected Sublime::Document::createViewWidget() is called to return the actual widget for a view.
There is an abstract Sublime::Document class with no createViewWidget() implementation and there's a convenience class Sublime::ToolDocument that can create widgets of user-specified type.
KDevelop currently uses Sublime::PartDocument which is subclassed by KDevelop::PartDocument. This PartDocument creates a view by loading a part and then asking a part about its widget.