contour icon indicating copy to clipboard operation
contour copied to clipboard

Refactor frontend to use QML / QtQuick.

Open christianparpart opened this issue 1 year ago • 1 comments

Motivation

  • More future-proof / forward compatible Qt API usage
  • Hopefully easier to create new UI elements using QML / QtQuick rather than QtWidgets.
  • Basinc new ideas on top of this PR, specifically: Tabs and later on split views.
  • Having a unified look'n'feel of UI elements. In fact, the scrollbar currently doesn't look nice on all systems, e.g. @whisperity seems to have the default style while I have the awesome style on 0.3.2. With moving the QML/QtQuick it seems possible to have the same look on all platforms and desktops.

This PR "simply" refactors the frontend and ports it from QtWidgets (QOpenGLWidget) to QML / QtQuick. I try not to add any new feature or anything but get it on feature parity.

Checklist

  • [x] port to QQuickItem for the Widget
  • [x] expose TerminalSession to QML
  • [x] ensure functional scrollbar
  • [x] ensure window title updates
  • [x] use implicitWidth / implicitHeight rather than width / height to declare widget component size
  • [x] system beep working
  • [x] BUG: currently app termination is assert()ing
  • [x] ensure blurred background is working
  • [x] UI dialogs working, such as permission request
  • [x] notifications-OSC working (Requires Qt 5.12 or higher)
  • [ ] IME working
  • [ ] [PLATFORM] ensure proper rendering on Wayland
  • [ ] [PLATFORM] Ensure it's running on Windows
  • [ ] scrollbar: move the current JS impl to C++ by introducing a ScrollBar.vertical property (similar to QtQuick's)
  • [ ] platforms (ox/windows/linux): ensure creating new windows in-process and out-of-process is working
  • [ ] ...

christianparpart avatar Jul 21 '22 18:07 christianparpart

Also add to TODO to not break the functionality on macOS where a single process can have multiple windows instead of spawning entirely new process

uspasojevic96 avatar Jul 22 '22 19:07 uspasojevic96

I get following errors when I run contour built from this branch

Critical:
ERROR: No native SystemTrayIcon implementation available.
Qt Labs Platform requires Qt Widgets on this setup.
Add 'QT += widgets' to .pro and create QApplication in main().
 ((null):0, (null))
Critical:
ERROR: No native Menu implementation available.
Qt Labs Platform requires Qt Widgets on this setup.
Add 'QT += widgets' to .pro and create QApplication in main().
 ((null):0, (null))
Warning: QSoundEffect(qaudio): Error decoding source qrc:/contour/bell.oga ((null):0, (null))
[error] OpenGL error 1282 for call: glTexImage2D(target, levelOfDetail, (int) glFmt, unbox<int>(param.size.width), unbox<int>(param.size.height), UnusedParam, glFmt, type, stub.data())
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
h[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glPixelStorei(GL_UNPACK_ALIGNMENT, param.rowAlignment)
[error] OpenGL error 1282 for call: glDeleteVertexArrays(1, &_rectVAO)
 

Though contour seems to work fine. I am running contour on Fedora 37 with Gnome 43.5

Utkarsh-khambra avatar Jun 02 '23 21:06 Utkarsh-khambra

Crash that i see on qml branch

[/home/yaraslau/repo/contour/src/vtrasterizer/TextRenderer.cpp:855] Precondition failed. rowCount <= unbox<unsigned>(glyph.bitmapSize.height)
==20042==
==20042== Process terminating with default action of signal 6 (SIGABRT): dumping core
==20042==    at 0x75E526C: __pthread_kill_implementation (pthread_kill.c:44)
==20042==    by 0x7595A07: raise (raise.c:26)
==20042==    by 0x757E5C1: abort (abort.c:100)
==20042==    by 0x2F9759: crispy::detail::fail(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, int) (assert.h:84)
==20042==    by 0x448B42: terminal::rasterizer::TextRenderer::createRasterizedGlyph(terminal::rasterizer::atlas::TileLocation, text::glyph_key const&, unicode::PresentationStyle) (TextRenderer.cpp:855)
==20042==    by 0x449223: terminal::rasterizer::TextRenderer::createSlicedRasterizedGlyph(terminal::rasterizer::atlas::TileLocation, text::glyph_key const&, unicode::PresentationStyle, crispy::StrongHash const&) (TextRenderer.cpp:724)
==20042==    by 0x449D22: operator() (TextRenderer.cpp:712)
==20042==    by 0x449D22: constructTile<terminal::rasterizer::TextRenderer::getOrCreateRasterizedMetadata(const crispy::StrongHash&, const text::glyph_key&, unicode::PresentationStyle)::<lambda(terminal::rasterizer::atlas::TileLocation)> > (TextureAtlas.h:563)

Yaraslaut avatar Jun 05 '23 19:06 Yaraslaut

Crash that i see on qml branch

[/home/yaraslau/repo/contour/src/vtrasterizer/TextRenderer.cpp:855] Precondition failed. rowCount <= unbox<unsigned>(glyph.bitmapSize.height)
==20042==
==20042== Process terminating with default action of signal 6 (SIGABRT): dumping core
==20042==    at 0x75E526C: __pthread_kill_implementation (pthread_kill.c:44)
==20042==    by 0x7595A07: raise (raise.c:26)
==20042==    by 0x757E5C1: abort (abort.c:100)
==20042==    by 0x2F9759: crispy::detail::fail(std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, std::basic_string_view<char, std::char_traits<char> >, int) (assert.h:84)
==20042==    by 0x448B42: terminal::rasterizer::TextRenderer::createRasterizedGlyph(terminal::rasterizer::atlas::TileLocation, text::glyph_key const&, unicode::PresentationStyle) (TextRenderer.cpp:855)
==20042==    by 0x449223: terminal::rasterizer::TextRenderer::createSlicedRasterizedGlyph(terminal::rasterizer::atlas::TileLocation, text::glyph_key const&, unicode::PresentationStyle, crispy::StrongHash const&) (TextRenderer.cpp:724)
==20042==    by 0x449D22: operator() (TextRenderer.cpp:712)
==20042==    by 0x449D22: constructTile<terminal::rasterizer::TextRenderer::getOrCreateRasterizedMetadata(const crispy::StrongHash&, const text::glyph_key&, unicode::PresentationStyle)::<lambda(terminal::rasterizer::atlas::TileLocation)> > (TextureAtlas.h:563)

This crash certainly is not related to this PR. It looks like it most definitely will also raise that assert() outside this PR.

EDIT: Okay, looks like you fixed that one already on master, right? Well yeah. ^^

christianparpart avatar Jun 20 '23 15:06 christianparpart