From 5a521ba8f868526b63b62dad1e22fdec11a1dd42 Mon Sep 17 00:00:00 2001 From: "Jason W. Bacon" Date: Tue, 31 Aug 2021 08:34:22 -0500 Subject: x11/coreterminal: Terminal emulator from the CoreApps family Coreterminal is terminal emulator from the CuboCore suite of simple, lightweight Qt-base applications. --- x11/Makefile | 1 + x11/coreterminal/Makefile | 31 ++++++++++++ x11/coreterminal/distinfo | 3 ++ x11/coreterminal/files/patch-coreterminal.cpp | 69 +++++++++++++++++++++++++++ x11/coreterminal/files/patch-coreterminal.hpp | 10 ++++ x11/coreterminal/files/patch-settings.cpp | 16 +++++++ x11/coreterminal/pkg-descr | 4 ++ 7 files changed, 134 insertions(+) create mode 100644 x11/coreterminal/Makefile create mode 100644 x11/coreterminal/distinfo create mode 100644 x11/coreterminal/files/patch-coreterminal.cpp create mode 100644 x11/coreterminal/files/patch-coreterminal.hpp create mode 100644 x11/coreterminal/files/patch-settings.cpp create mode 100644 x11/coreterminal/pkg-descr diff --git a/x11/Makefile b/x11/Makefile index 091775bf68ca..7a964eade35f 100644 --- a/x11/Makefile +++ b/x11/Makefile @@ -41,6 +41,7 @@ SUBDIR += conlecterm SUBDIR += controllermap SUBDIR += cool-retro-term + SUBDIR += coreterminal SUBDIR += deforaos-desktop SUBDIR += deforaos-keyboard SUBDIR += deforaos-libdesktop diff --git a/x11/coreterminal/Makefile b/x11/coreterminal/Makefile new file mode 100644 index 000000000000..6de11ccaf53b --- /dev/null +++ b/x11/coreterminal/Makefile @@ -0,0 +1,31 @@ +PORTNAME= coreterminal +DISTVERSION= 4.3.0 +CATEGORIES= x11 + +MAINTAINER= jwb@FreeBSD.org +COMMENT= Terminal emulator from the CoreApps family + +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libqtermwidget5.so:x11-toolkits/qtermwidget \ + libcprime-core.so:deskutils/libcprime +RUN_DEPENDS= coregarage:deskutils/coregarage + +USES= cmake localbase:ldflags qt:5 +USE_QT= buildtools_build core gui qmake_build serialport widgets +USE_GITLAB= yes + +GL_ACCOUNT= CuboCore +GL_COMMIT= c61e5f8e0941dee2ab8920f2470fe93d21d717a2 + +PLIST_FILES= bin/coreterminal \ + share/applications/org.cubocore.CoreTerminal.desktop \ + share/icons/hicolor/scalable/apps/org.cubocore.CoreTerminal.svg + +pre-configure: + @${REINPLACE_CMD} \ + -e 's|/usr/bin/coreterminal|${PREFIX}/bin/coreterminal|g' \ + ${WRKSRC}/org.cubocore.CoreTerminal.desktop + +.include diff --git a/x11/coreterminal/distinfo b/x11/coreterminal/distinfo new file mode 100644 index 000000000000..f83af4566883 --- /dev/null +++ b/x11/coreterminal/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1629410989 +SHA256 (CuboCore-coreterminal-c61e5f8e0941dee2ab8920f2470fe93d21d717a2_GL0.tar.gz) = 01466f9dd7b8855f5f55b69c076a2310522da41a1a39de59893de9581d586d97 +SIZE (CuboCore-coreterminal-c61e5f8e0941dee2ab8920f2470fe93d21d717a2_GL0.tar.gz) = 73363 diff --git a/x11/coreterminal/files/patch-coreterminal.cpp b/x11/coreterminal/files/patch-coreterminal.cpp new file mode 100644 index 000000000000..ae15e597e257 --- /dev/null +++ b/x11/coreterminal/files/patch-coreterminal.cpp @@ -0,0 +1,69 @@ +--- coreterminal.cpp.orig 2021-08-18 11:17:12 UTC ++++ coreterminal.cpp +@@ -27,6 +27,7 @@ + * + */ + ++#include + #include + #include + #include +@@ -34,6 +35,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -75,6 +78,7 @@ CoreTerminal::~CoreTerminal() + void CoreTerminal::loadSettings() + { + uiMode = smi->getValue("CoreApps", "UIMode"); ++ terminalFont = smi->getValue("CoreTerminal", "Font"); + } + + void CoreTerminal::createGUI() +@@ -239,7 +243,40 @@ void CoreTerminal::setWindowProperties() + // setStyleSheet( "#base { background-color: palette(Window); }" ); + // } + +- resize( 800, 500 ); ++ QFontMetrics fm( terminalFont ); ++ std::cerr << "fm.boundingRect(\"M\").width() = " << fm.boundingRect( "M" ).width() ++ << "\nfm.boundingRect(\"M\").height() = " << fm.boundingRect("M").height() ++ << "\nfm.averageCharWidth() = " << fm.averageCharWidth() ++ << "\nfm.height() = " << fm.height() ++ << "\nfm.lineSpacing() = " << fm.lineSpacing() ++ << "\nfm.leading() = " << fm.leading() ++ << "\ntabBar.width() = " << TabWidget->tabBar()->width() ++ << "\ntabBar.height() = " << TabWidget->tabBar()->height() ++ << "\nframeGeometry.height() = " << frameGeometry().height() ++ << "\ngeometry.height() = " << geometry().height() ++ << "\nPM_ScrollBarExtent = " << qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) ++ << "\nPM_TabBarTabOverlap = " << qApp->style()->pixelMetric(QStyle::PM_TabBarTabOverlap) ++ << "\nPM_TabBarTabVSpace = " << qApp->style()->pixelMetric(QStyle::PM_TabBarTabVSpace) ++ << "\nPM_TabBarBaseHeight = " << qApp->style()->pixelMetric(QStyle::PM_TabBarBaseHeight) ++ << "\nPM_TabBarBaseOverlap = " << qApp->style()->pixelMetric(QStyle::PM_TabBarBaseOverlap) ++ << "\ntabBar()->height() = " << TabWidget->tabBar()->height() ++ << "\ntabBar()->tabRect().height() = " << TabWidget->tabBar()->tabRect(0).height() ++ << '\n'; ++ ++ int width = fm.averageCharWidth() * 80 ++ + qApp->style()->pixelMetric(QStyle::PM_ScrollBarExtent) ++ + 2; ++ /* ++ * Perfect size = ++ * tabBar->height() +7 for Fusion, +4 for QtCurve, +3 for Windows ++ * tabBar->tabRect(0).height() seems to align: ++ * 36 for Fusion, 33 for QtCurve, 32 for Windows using 12pt font ++ * Also verified with several other styles and font sizes ++ */ ++ int height = fm.height() * 30 ++ + TabWidget->tabBar()->tabRect(0).height() ++ + 1; ++ resize(width, height); + + if (uiMode != 0) { + setWindowFlags( windowFlags() ); diff --git a/x11/coreterminal/files/patch-coreterminal.hpp b/x11/coreterminal/files/patch-coreterminal.hpp new file mode 100644 index 000000000000..4629c46f023c --- /dev/null +++ b/x11/coreterminal/files/patch-coreterminal.hpp @@ -0,0 +1,10 @@ +--- coreterminal.hpp.orig 2021-08-18 11:17:12 UTC ++++ coreterminal.hpp +@@ -53,6 +53,7 @@ public : + private: + int uiMode; + settings *smi; ++ QFont terminalFont; + + void loadSettings(); + void createGUI(); diff --git a/x11/coreterminal/files/patch-settings.cpp b/x11/coreterminal/files/patch-settings.cpp new file mode 100644 index 000000000000..3b6041ca7294 --- /dev/null +++ b/x11/coreterminal/files/patch-settings.cpp @@ -0,0 +1,16 @@ +--- settings.cpp.orig 2021-08-19 22:10:26 UTC ++++ settings.cpp +@@ -92,11 +92,11 @@ void settings::setDefaultSettings() + QFont monoFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + + if (not monoFont.family().count()) { +- monoFont = QFont("monospace", 9); ++ monoFont = QFont("monospace", 12); + } + + if (monoFont.styleHint() != QFont::Monospace) { +- monoFont = QFont("monospace", 9); ++ monoFont = QFont("monospace", 12); + } + + cSetting->setValue("CoreTerminal/Font", monoFont); diff --git a/x11/coreterminal/pkg-descr b/x11/coreterminal/pkg-descr new file mode 100644 index 000000000000..a8d9b76a2303 --- /dev/null +++ b/x11/coreterminal/pkg-descr @@ -0,0 +1,4 @@ +Coreterminal is terminal emulator from the CuboCore suite of simple, +lightweight Qt-base applications. + +WWW: https://gitlab.com/cubocore/coreterminal -- cgit v1.2.3