fhackenberger / ktikz

KtikZ provides a nice user interface for making pictures using TikZ.
Other
355 stars 34 forks source link

Replace text editor with KTextEditor #33

Closed jfmcarreira closed 3 years ago

jfmcarreira commented 6 years ago

I would like to have some feedback on the interest of the users to have KTextEditor replacing the current text editor widget.

This will give a similar look as Kate, Kile and other KDE text editors.

Let me know what you think.

flying-sheep commented 4 years ago

Yeah, definitely something I’d want. As it is now, I have to painstakingly adapt the colours for it to be usable, else it looks like this:

image

I don’t know how desirable the Qt version is anyway. KDE frameworks are pretty slim these days.

jfmcarreira commented 4 years ago

Can you build a local version? If so I would ask you to build the "develKTextEditor" branch of my "fork" and give it some testing.

If you did not find any major bug I would merge it. However, I still need to figure out how to make it as optional dependency.

flying-sheep commented 4 years ago

Looks nice, but you missed merging the menus and toolbars. I only see basically Kate’s menu and an editor toolbar, nothing to stop compilation, toggle shell-escape and so on.

jfmcarreira commented 4 years ago

You might need to perform a make install as remove the existing instalation of ktikz. You are not using the modified xml. Otherwise you would see all Tollbar and menus

flying-sheep commented 4 years ago

Sorry, but idk what I’m doing wrong:

$ pacman -R ktikz
...
$ rm -rf build; mkdir build
$ cd build
$ cmake .. -DKTIKZ_USE_KTEXTEDITOR=1
$ make
$ ./app/ktikz

image

jfmcarreira commented 4 years ago

Sorry for the late reply.

You need to add the file app/ktikzui_frameworks.rc to /usr/share/kxmlgui5/ktikz/ (or similar). I do not recall which eviromental variable is used to set this directory. You also need to set KTIKZ_USE_KTEXTEDITOR in the cmake to ON

I will try in the next weeks to merge this into master. For that I will need to add an option so both editors are available. As of this moment the auto-complete is not as good in the new editor as it is in the QT one.

flying-sheep commented 4 years ago

That took a while to find out. KDE probably uses something similar to:

QStringList found = QStandardPaths::locateAll(
    QStandardPaths::GenericDataLocation,
    QStringLiteral("kxmlgui5/ktikz/ktikzui_frameworks.rc"),
);

QStandardPaths relies on XDG_DATA_DIRS on linux, soo one can prepend a directory to XDG_DATA_DIRS to make it work:

$ XDG_DATA_DIRS="/my/dir:${XDG_DATA_DIRS-/usr/local/share:/usr/share}" qtpaths --paths GenericDataLocation
~/.local/share:/my/dir:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
               ^ here it is!
jfmcarreira commented 4 years ago

Yeah you are right. I asked for it in the IRC channel #kde-devel.

I managed to apply the change optionally. Just need to add a configuration option and then I will merge it to master.

I do not feel confortable to just remove the old editor. This approach allow for the user to choose.

flying-sheep commented 4 years ago

Ah, cool! Works great:

$ mkdir -p app/kxmlgui5/ktikz
$ ln -s ../../ktikzui_frameworks.rc app/kxmlgui5/ktikz/ktikzui_frameworks.rc
$ ... cmake build dance ...
$ XDG_DATA_DIRS="$PWD/app:${XDG_DATA_DIRS-/usr/local/share:/usr/share}" build/app/ktikz

grafik

For some reason I’m now seeing the built-in Oxygen icons instead of my system icons, but I think that has nothing to do with the branch.

jfmcarreira commented 4 years ago

I pushed a new branch development into this repository. It will be the new features next merged into master.

The text editor widget can be selected in the settings now. You need to restart the application in order to apply changes image

Please let me know what you think.

flying-sheep commented 4 years ago

Sounds good! Is KTikZ startable if compiled with KTextEditor support, but without KTextEditor installed? I think that would be optimal, because distributions could ship a binary package that has optional KTextEditor support, while users see the KTextEditor option only if they have it installed.

If you would be open for requiring KTextEditor at compile time, you could even get rid of KTIKZ_USE_KTEXTEDITOR and the resulting code complexity, while still allowing to use it without KTextEditor.

Word of warning: I don’t know how complex it is to implement this runtime library loading. I just assume it’s not too hard, because a lot of programs do it.

jfmcarreira commented 4 years ago

Although it would be a nice improvement I do not think the work needed to be done would be worth it.

This is my opinion: Either you want to use in KDE environment therefore there is high change you already have the KTextEditor framework installed; or you do not use KDE and you will have a better experience with the Qt-only version.

At some point KTextEditor should become the only editor with KDE enabled. However, to accomplish that I need to improve the code completion features which are not working as good as in the existing editor.

flying-sheep commented 4 years ago

Ah! Do you think the KTextEditor option should be the default anyway when compiled in?