Discussion:
[Qt-creator] Text editor architecture similar to Chrome browser
Szyk Cech
2018-08-26 18:38:53 UTC
Permalink
Hi

I have an idea to write new version of my text editor (not published -
only for my personal usage). Now it is monolithic app. But new version I
want to write in modular way.

I want:

+ edition in 2 modes: text and hex (they can be plugins like in Qt Creator)

+ plugins for every editor aspects: highlighting, spell checking, user
actions in context menu and in main menu (like text speech and search
phrase in the Internet, check word translation in the internet
dictionary), search and replace

+ should be resistant to editors or plugins failure

Two first points can be easily achieved by mimicry of the Qt Creator
architecture (in true I don't need every Qt Creator features). But I am
afraid that it is not true for third point.

Today I get some info about Chrome browser architecture from fairy old
document:
https://seclab.stanford.edu/websec/chromium/chromium-security-architecture.pdf
, but I like that it is secure and fault resistant. I know I don't need
such high security, but crash resistant architecture seems attractive to me.

I also know that in forthcoming Qt 5.12 Qt Remote Objects will be
officially released. So maybe my simply text editor project will be
great opportunity to use this state of the art module?!?

I think that maybe it is not so crazy idea to design text editor like
multi process application?!? I mean to write thin kernel (like your core
plugin) and implement editors (text and hex) in separate processes and
design plugin system where each plugin resides in separate process. They
can be load on demand (not every at start). And I think that it is
possible to implement internal state diagnostic in order to detect
failures in editors or in plugins.

Main problems what I see is:

1) to design suitable Api for every part of my text editor (like you do
for Qt Creator)

2) efficient implementation of the editor text rendering

@1) I think I can study Qt Creator more carefully to understand every
nuances - so this require work on my site

@2) I have questions to you:

a) Do you have any advice how should I rendering text in separate
process and display it in main process (which displays Qt Gui)?

b) Is there some Qt solution for this case or I need to write my own
layer to cover Os specific shared memory Api?

c) Is Qt prepared for such cases like render QPlainText widget to the
buffer instead to the screen?

I know this question is not directly related to Qt Creator, but I think
it is advanced enough to ask experienced Qt Creators developers as Qt
user forums probably can't answer to such details.

thanks and best regards

Szyk Cech
Eike Ziller
2018-08-27 07:19:05 UTC
Permalink
Hi
I have an idea to write new version of my text editor (not published - only for my personal usage). Now it is monolithic app. But new version I want to write in modular way.
+ edition in 2 modes: text and hex (they can be plugins like in Qt Creator)
+ plugins for every editor aspects: highlighting, spell checking, user actions in context menu and in main menu (like text speech and search phrase in the Internet, check word translation in the internet dictionary), search and replace
+ should be resistant to editors or plugins failure
Two first points can be easily achieved by mimicry of the Qt Creator architecture (in true I don't need every Qt Creator features). But I am afraid that it is not true for third point.
Today I get some info about Chrome browser architecture from fairy old document: https://seclab.stanford.edu/websec/chromium/chromium-security-architecture.pdf , but I like that it is secure and fault resistant. I know I don't need such high security, but crash resistant architecture seems attractive to me.
I also know that in forthcoming Qt 5.12 Qt Remote Objects will be officially released. So maybe my simply text editor project will be great opportunity to use this state of the art module?!?
I think that maybe it is not so crazy idea to design text editor like multi process application?!? I mean to write thin kernel (like your core plugin) and implement editors (text and hex) in separate processes and design plugin system where each plugin resides in separate process. They can be load on demand (not every at start). And I think that it is possible to implement internal state diagnostic in order to detect failures in editors or in plugins.
1) to design suitable Api for every part of my text editor (like you do for Qt Creator)
2) efficient implementation of the editor text rendering
@1) I think I can study Qt Creator more carefully to understand every nuances - so this require work on my site
a) Do you have any advice how should I rendering text in separate process and display it in main process (which displays Qt Gui)?
Afaik the Qt Quick Designer is doing that (with its “qmlpuppet" separate process), so maybe that can give some inspiration.
http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/share/qtcreator/qml/qmlpuppet/qml2puppet
b) Is there some Qt solution for this case or I need to write my own layer to cover Os specific shared memory Api?
There is QSharedMemory.
c) Is Qt prepared for such cases like render QPlainText widget to the buffer instead to the screen?
QWidgets can be rendered to images/pixmaps:
http://doc.qt.io/qt-5/qwidget.html#render
I know this question is not directly related to Qt Creator, but I think it is advanced enough to ask experienced Qt Creators developers as Qt user forums probably can't answer to such details.
thanks and best regards
Have fun!
Br, Eike

--
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
***@qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
Szyk Cech
2018-08-27 17:34:15 UTC
Permalink
Thanks for your kindly reply!
Post by Eike Ziller
a) Do you have any advice how should I rendering text in separate process and display it in main process (which displays Qt Gui)?
Afaik the Qt Quick Designer is doing that (with its “qmlpuppet" separate process), so maybe that can give some inspiration.
http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/share/qtcreator/qml/qmlpuppet/qml2puppet
This really scared me! "Qt Quick Designer" is definitely the worst part
of Qt framework family - it works very slow at least on my Core Duo and
even it is slow on 4 thread able i5 (I used this program in first half
of 2017 - maybe this changed, but I doubt due to JavaScript nature).

best regards
Szyk Cech
André Pönitz
2018-08-27 09:00:06 UTC
Permalink
Post by Szyk Cech
Thanks for your kindly reply!
Post by Eike Ziller
a) Do you have any advice how should I rendering text in separate process and display it in main process (which displays Qt Gui)?
Afaik the Qt Quick Designer is doing that (with its “qmlpuppet" separate process), so maybe that can give some inspiration.
http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/share/qtcreator/qml/qmlpuppet/qml2puppet
This really scared me! "Qt Quick Designer" is definitely the worst part of
Qt framework family - it works very slow at least on my Core Duo and even it
is slow on 4 thread able i5 (I used this program in first half of 2017 -
maybe this changed, but I doubt due to JavaScript nature).
Running things in separate processes is needed at times. E.g. for privilege
separation, for unreliable code, for different versions of a library the
main application uses etc. And it *is* expensive.

I see no reason why a *text editor* would need that kind of encapsulation
for it's day-to-day work.

You were asking whether it's possible, and whether there's precedence
in Creator. Yes and yes. Does it make sense for a text editor? No.

Andre'

Loading...