mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: Add qcodeeditor.
* gnu/packages/qt.scm (qcodeeditor): New variable. * gnu/packages/patches/qcodeeditor-qt6.patch: New file. * gnu/local.mk: Register it. Change-Id: I073bfc191d77f293afc7019d0cc2ebd460ffa58e
This commit is contained in:
parent
fcda199a1c
commit
f2ce123d6b
3 changed files with 252 additions and 0 deletions
|
@ -2010,6 +2010,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/python-sphobjinv-defer-ssl-import.patch \
|
%D%/packages/patches/python-sphobjinv-defer-ssl-import.patch \
|
||||||
%D%/packages/patches/python-sphinx-prompt-docutils-0.19.patch \
|
%D%/packages/patches/python-sphinx-prompt-docutils-0.19.patch \
|
||||||
%D%/packages/patches/python-wxwidgets-type-errors.patch \
|
%D%/packages/patches/python-wxwidgets-type-errors.patch \
|
||||||
|
%D%/packages/patches/qcodeeditor-qt6.patch \
|
||||||
%D%/packages/patches/qtdeclarative-5-disable-qmlcache.patch \
|
%D%/packages/patches/qtdeclarative-5-disable-qmlcache.patch \
|
||||||
%D%/packages/patches/qtdeclarative-disable-qmlcache.patch \
|
%D%/packages/patches/qtdeclarative-disable-qmlcache.patch \
|
||||||
%D%/packages/patches/quodlibet-fix-invalid-glob.patch \
|
%D%/packages/patches/quodlibet-fix-invalid-glob.patch \
|
||||||
|
|
199
gnu/packages/patches/qcodeeditor-qt6.patch
Normal file
199
gnu/packages/patches/qcodeeditor-qt6.patch
Normal file
|
@ -0,0 +1,199 @@
|
||||||
|
From 4c07c7e63727750a85f796a5b356c480f462bec2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: benyamin <benyamin.saedi@gmail.com>
|
||||||
|
Date: Wed, 14 Sep 2022 19:43:38 +0430
|
||||||
|
Subject: [PATCH] initialized with Qt6
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 12 ++++++------
|
||||||
|
example/CMakeLists.txt | 14 +++++++-------
|
||||||
|
example/src/MainWindow.cpp | 9 +++++----
|
||||||
|
src/internal/QCodeEditor.cpp | 15 ++++++++-------
|
||||||
|
src/internal/QLanguage.cpp | 7 ++-----
|
||||||
|
src/internal/QSyntaxStyle.cpp | 19 +++++++------------
|
||||||
|
6 files changed, 35 insertions(+), 41 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 40d5617..7cc7496 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -75,9 +75,9 @@ set(CMAKE_AUTOMOC On)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
# Find includes in corresponding build directories
|
||||||
|
-find_package(Qt5Core CONFIG REQUIRED)
|
||||||
|
-find_package(Qt5Widgets CONFIG REQUIRED)
|
||||||
|
-find_package(Qt5Gui CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Core CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Widgets CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Gui CONFIG REQUIRED)
|
||||||
|
|
||||||
|
add_library(QCodeEditor STATIC
|
||||||
|
${RESOURCES_FILE}
|
||||||
|
@@ -104,7 +104,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
|
target_link_libraries(QCodeEditor
|
||||||
|
- Qt5::Core
|
||||||
|
- Qt5::Widgets
|
||||||
|
- Qt5::Gui
|
||||||
|
+ Qt::Core
|
||||||
|
+ Qt::Widgets
|
||||||
|
+ Qt::Gui
|
||||||
|
)
|
||||||
|
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
|
||||||
|
index 0e0bf4a..d6204e4 100644
|
||||||
|
--- a/example/CMakeLists.txt
|
||||||
|
+++ b/example/CMakeLists.txt
|
||||||
|
@@ -6,9 +6,9 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_AUTOMOC On)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
-find_package(Qt5Core CONFIG REQUIRED)
|
||||||
|
-find_package(Qt5Widgets CONFIG REQUIRED)
|
||||||
|
-find_package(Qt5Gui CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Core CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Widgets CONFIG REQUIRED)
|
||||||
|
+find_package(Qt6Gui CONFIG REQUIRED)
|
||||||
|
|
||||||
|
add_executable(QCodeEditorExample
|
||||||
|
resources/demo_resources.qrc
|
||||||
|
@@ -22,8 +22,8 @@ target_include_directories(QCodeEditorExample PUBLIC
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(QCodeEditorExample
|
||||||
|
- Qt5::Core
|
||||||
|
- Qt5::Widgets
|
||||||
|
- Qt5::Gui
|
||||||
|
+ Qt::Core
|
||||||
|
+ Qt::Widgets
|
||||||
|
+ Qt::Gui
|
||||||
|
QCodeEditor
|
||||||
|
-)
|
||||||
|
\ No newline at end of file
|
||||||
|
+)
|
||||||
|
diff --git a/example/src/MainWindow.cpp b/example/src/MainWindow.cpp
|
||||||
|
index 5552835..e71a1f2 100644
|
||||||
|
--- a/example/src/MainWindow.cpp
|
||||||
|
+++ b/example/src/MainWindow.cpp
|
||||||
|
@@ -15,13 +15,14 @@
|
||||||
|
#include <QPythonHighlighter>
|
||||||
|
|
||||||
|
// Qt
|
||||||
|
-#include <QComboBox>
|
||||||
|
-#include <QVBoxLayout>
|
||||||
|
-#include <QHBoxLayout>
|
||||||
|
#include <QCheckBox>
|
||||||
|
-#include <QSpinBox>
|
||||||
|
+#include <QComboBox>
|
||||||
|
+#include <QFile>
|
||||||
|
#include <QGroupBox>
|
||||||
|
+#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
+#include <QSpinBox>
|
||||||
|
+#include <QVBoxLayout>
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget* parent) :
|
||||||
|
QMainWindow(parent),
|
||||||
|
diff --git a/src/internal/QCodeEditor.cpp b/src/internal/QCodeEditor.cpp
|
||||||
|
index 1aa93e7..1369ff4 100644
|
||||||
|
--- a/src/internal/QCodeEditor.cpp
|
||||||
|
+++ b/src/internal/QCodeEditor.cpp
|
||||||
|
@@ -537,16 +537,17 @@ void QCodeEditor::keyPressEvent(QKeyEvent* e) {
|
||||||
|
|
||||||
|
// Shortcut for moving line to left
|
||||||
|
if (m_replaceTab && e->key() == Qt::Key_Backtab) {
|
||||||
|
- indentationLevel = std::min(indentationLevel, m_tabReplace.size());
|
||||||
|
+ indentationLevel = std::min(indentationLevel, (int) m_tabReplace.size());
|
||||||
|
|
||||||
|
- auto cursor = textCursor();
|
||||||
|
+ auto cursor = textCursor();
|
||||||
|
|
||||||
|
- cursor.movePosition(QTextCursor::MoveOperation::StartOfLine);
|
||||||
|
- cursor.movePosition(QTextCursor::MoveOperation::Right,
|
||||||
|
- QTextCursor::MoveMode::KeepAnchor, indentationLevel);
|
||||||
|
+ cursor.movePosition(QTextCursor::MoveOperation::StartOfLine);
|
||||||
|
+ cursor.movePosition(QTextCursor::MoveOperation::Right,
|
||||||
|
+ QTextCursor::MoveMode::KeepAnchor,
|
||||||
|
+ indentationLevel);
|
||||||
|
|
||||||
|
- cursor.removeSelectedText();
|
||||||
|
- return;
|
||||||
|
+ cursor.removeSelectedText();
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTextEdit::keyPressEvent(e);
|
||||||
|
diff --git a/src/internal/QLanguage.cpp b/src/internal/QLanguage.cpp
|
||||||
|
index 3665df7..417c657 100644
|
||||||
|
--- a/src/internal/QLanguage.cpp
|
||||||
|
+++ b/src/internal/QLanguage.cpp
|
||||||
|
@@ -32,8 +32,7 @@ bool QLanguage::load(QIODevice* device)
|
||||||
|
|
||||||
|
if (type == QXmlStreamReader::TokenType::StartElement)
|
||||||
|
{
|
||||||
|
- if (reader.name() == "section")
|
||||||
|
- {
|
||||||
|
+ if (reader.name().toString() == "section") {
|
||||||
|
if (!list.empty())
|
||||||
|
{
|
||||||
|
m_list[name] = list;
|
||||||
|
@@ -41,9 +40,7 @@ bool QLanguage::load(QIODevice* device)
|
||||||
|
}
|
||||||
|
|
||||||
|
name = reader.attributes().value("name").toString();
|
||||||
|
- }
|
||||||
|
- else if (reader.name() == "name")
|
||||||
|
- {
|
||||||
|
+ } else if (reader.name().toString() == "name") {
|
||||||
|
readText = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/internal/QSyntaxStyle.cpp b/src/internal/QSyntaxStyle.cpp
|
||||||
|
index 6a9eb55..a4730de 100644
|
||||||
|
--- a/src/internal/QSyntaxStyle.cpp
|
||||||
|
+++ b/src/internal/QSyntaxStyle.cpp
|
||||||
|
@@ -25,15 +25,12 @@ bool QSyntaxStyle::load(QString fl)
|
||||||
|
|
||||||
|
if(token == QXmlStreamReader::StartElement)
|
||||||
|
{
|
||||||
|
- if (reader.name() == "style-scheme")
|
||||||
|
- {
|
||||||
|
+ if (reader.name().toString() == "style-scheme") {
|
||||||
|
if (reader.attributes().hasAttribute("name"))
|
||||||
|
{
|
||||||
|
m_name = reader.attributes().value("name").toString();
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
- else if (reader.name() == "style")
|
||||||
|
- {
|
||||||
|
+ } else if (reader.name().toString() == "style") {
|
||||||
|
auto attributes = reader.attributes();
|
||||||
|
|
||||||
|
auto name = attributes.value("name");
|
||||||
|
@@ -50,21 +47,19 @@ bool QSyntaxStyle::load(QString fl)
|
||||||
|
format.setForeground(QColor(attributes.value("foreground").toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (attributes.hasAttribute("bold") &&
|
||||||
|
- attributes.value("bold") == "true")
|
||||||
|
- {
|
||||||
|
+ if (attributes.hasAttribute("bold")
|
||||||
|
+ && attributes.value("bold").toString() == "true") {
|
||||||
|
format.setFontWeight(QFont::Weight::Bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (attributes.hasAttribute("italic") &&
|
||||||
|
- attributes.value("italic") == "true")
|
||||||
|
- {
|
||||||
|
+ if (attributes.hasAttribute("italic")
|
||||||
|
+ && attributes.value("italic").toString() == "true") {
|
||||||
|
format.setFontItalic(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributes.hasAttribute("underlineStyle"))
|
||||||
|
{
|
||||||
|
- auto underline = attributes.value("underlineStyle");
|
||||||
|
+ auto underline = attributes.value("underlineStyle").toString();
|
||||||
|
|
||||||
|
auto s = QTextCharFormat::UnderlineStyle::NoUnderline;
|
||||||
|
|
|
@ -4867,6 +4867,58 @@ a binding language:
|
||||||
@end itemize\n")
|
@end itemize\n")
|
||||||
(license license:lgpl3))) ;version 3 only (+ exception)
|
(license license:lgpl3))) ;version 3 only (+ exception)
|
||||||
|
|
||||||
|
(define-public qcodeeditor
|
||||||
|
(let ((commit "dc644d41b68978ab9a5591ba891a223221570e74") ;no tags
|
||||||
|
(revision "0"))
|
||||||
|
(package
|
||||||
|
(name "qcodeeditor")
|
||||||
|
(version (git-version "0" revision commit))
|
||||||
|
(source (origin
|
||||||
|
(method git-fetch)
|
||||||
|
(uri (git-reference
|
||||||
|
(url "https://github.com/Megaxela/QCodeEditor")
|
||||||
|
(commit commit)))
|
||||||
|
(file-name (git-file-name name version))
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"1bpvfwbgp275w79dzrd7d9k3md1ch7n88rh59mxdfj8s911n42j8"))
|
||||||
|
(patches
|
||||||
|
(search-patches "qcodeeditor-qt6.patch"))))
|
||||||
|
(build-system qt-build-system)
|
||||||
|
(arguments
|
||||||
|
(list #:qtbase qtbase
|
||||||
|
#:tests? #f ;no tests
|
||||||
|
#:configure-flags
|
||||||
|
#~(list "-DBUILD_EXAMPLE=ON"
|
||||||
|
(string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
|
||||||
|
#$output "/lib"))
|
||||||
|
#:phases
|
||||||
|
#~(modify-phases %standard-phases
|
||||||
|
(add-after 'unpack 'build-shared-library
|
||||||
|
(lambda _
|
||||||
|
(substitute* "CMakeLists.txt"
|
||||||
|
(("STATIC") "SHARED"))))
|
||||||
|
;; Install rule does not exist.
|
||||||
|
(replace 'install
|
||||||
|
(lambda _
|
||||||
|
(install-file "example/QCodeEditorExample"
|
||||||
|
(string-append #$output "/bin"))
|
||||||
|
(install-file "libQCodeEditor.so"
|
||||||
|
(string-append #$output "/lib"))
|
||||||
|
(for-each
|
||||||
|
(lambda (file)
|
||||||
|
(install-file file
|
||||||
|
(string-append #$output
|
||||||
|
"/include/QCodeEditor")))
|
||||||
|
(find-files "../source/include/internal" "\\.hpp")))))))
|
||||||
|
(inputs
|
||||||
|
(list qtwayland))
|
||||||
|
(home-page "https://github.com/Megaxela/QCodeEditor")
|
||||||
|
(synopsis "Qt code editor widget")
|
||||||
|
(description
|
||||||
|
"QCodeEditor is a Qt widget for editing/viewing code.")
|
||||||
|
(license license:expat))))
|
||||||
|
|
||||||
(define-public qtcolorwidgets
|
(define-public qtcolorwidgets
|
||||||
(package
|
(package
|
||||||
(name "qtcolorwidgets")
|
(name "qtcolorwidgets")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue