diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index b62e64d0d..3066c8dcf 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -2,6 +2,6 @@ add_subdirectory(cppdap) add_subdirectory(unioncode-qscintilla214) if (QT_VERSION_MAJOR MATCHES 5) add_subdirectory(unioncode-GitQlient) -add_subdirectory(unioncode-qtermwidget-0.14.1) endif() +add_subdirectory(unioncode-qtermwidget-0.14.1) add_subdirectory(unioncode-jsonrpccpp) diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/CMakeLists.txt b/3rdparty/unioncode-qtermwidget-0.14.1/CMakeLists.txt index 4f5043ecb..c8e298854 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/CMakeLists.txt +++ b/3rdparty/unioncode-qtermwidget-0.14.1/CMakeLists.txt @@ -28,8 +28,13 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(QT_MINIMUM_VERSION "5.7.1") set(LXQTBT_MINIMUM_VERSION "0.6.0") -find_package(Qt5Widgets "${QT_MINIMUM_VERSION}" REQUIRED) -find_package(Qt5LinguistTools "${QT_MINIMUM_VERSION}" REQUIRED) +#find_package(Qt5Widgets "${QT_MINIMUM_VERSION}" REQUIRED) +#find_package(Qt5LinguistTools "${QT_MINIMUM_VERSION}" REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}LinguistTools REQUIRED) +if (${QT_VERSION_MAJOR} MATCHES 6) + find_package(Qt6Core5Compat REQUIRED) +endif() find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED) if(USE_UTF8PROC) @@ -110,9 +115,15 @@ message(STATUS "Translations will be installed in: ${TRANSLATIONS_DIR}") CHECK_FUNCTION_EXISTS(updwtmpx HAVE_UPDWTMPX) -qt5_wrap_cpp(MOCS ${HDRS}) -qt5_wrap_ui(UI_SRCS ${UI}) -set(PKG_CONFIG_REQ "Qt5Widgets") +if (${QT_VERSION_MAJOR} MATCHES 6) + qt6_wrap_cpp(MOCS ${HDRS}) + qt6_wrap_ui(UI_SRCS ${UI}) +else() + qt5_wrap_cpp(MOCS ${HDRS}) + qt5_wrap_ui(UI_SRCS ${UI}) +endif() + +set(PKG_CONFIG_REQ "Qt${QT_VERSION_MAJOR}Widgets") lxqt_translate_ts(QTERMWIDGET_QM TRANSLATION_DIR "lib/translations" @@ -127,7 +138,10 @@ lxqt_translate_ts(QTERMWIDGET_QM ) add_library(${QTERMWIDGET_LIBRARY_NAME} SHARED ${SRCS} ${MOCS} ${UI_SRCS} ${QTERMWIDGET_QM}) -target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt5::Widgets) +target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt${QT_VERSION_MAJOR}::Widgets) +if (${QT_VERSION_MAJOR} MATCHES 6) + target_link_libraries(${QTERMWIDGET_LIBRARY_NAME} Qt6::Core5Compat) +endif() if(APPLE) target_compile_definitions(${QTERMWIDGET_LIBRARY_NAME} diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Character.h b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Character.h index 9c9fae293..eb588d139 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Character.h +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Character.h @@ -78,8 +78,12 @@ class Character union { /** The unicode character value for this character. */ - wchar_t character; - /** +#if QT_VERSION >= 0x060000 + char16_t character; +#else + wchar_t character; +#endif + /** * Experimental addition which allows a single Character instance to contain more than * one unicode character. * diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/ColorScheme.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/ColorScheme.cpp index c9cc851d3..75a8fdee5 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/ColorScheme.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/ColorScheme.cpp @@ -31,7 +31,7 @@ #include #include #include - +#include // KDE //#include @@ -177,11 +177,9 @@ void ColorScheme::setColorTableEntry(int index , const ColorEntry& entry) } ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const { + Q_UNUSED(randomSeed); Q_ASSERT( index >= 0 && index < TABLE_COLORS ); - if ( randomSeed != 0 ) - qsrand(randomSeed); - ColorEntry entry = colorTable()[index]; if ( randomSeed != 0 && @@ -191,9 +189,9 @@ ColorEntry ColorScheme::colorEntry(int index , uint randomSeed) const const RandomizationRange& range = _randomTable[index]; - int hueDifference = range.hue ? (qrand() % range.hue) - range.hue/2 : 0; - int saturationDifference = range.saturation ? (qrand() % range.saturation) - range.saturation/2 : 0; - int valueDifference = range.value ? (qrand() % range.value) - range.value/2 : 0; + int hueDifference = range.hue ? (QRandomGenerator::global()->bounded(range.hue)) - range.hue/2 : 0; + int saturationDifference = range.saturation ? (QRandomGenerator::global()->bounded(range.saturation)) - range.saturation/2 : 0; + int valueDifference = range.value ? (QRandomGenerator::global()->bounded(range.value)) - range.value/2 : 0; QColor& color = entry.color; @@ -367,9 +365,9 @@ void ColorScheme::readColorEntry(QSettings * s , int index) if (hexColorPattern.match(colorStr).hasMatch()) { // Parsing is always ok as already matched by the regexp - r = colorStr.midRef(1, 2).toInt(nullptr, 16); - g = colorStr.midRef(3, 2).toInt(nullptr, 16); - b = colorStr.midRef(5, 2).toInt(nullptr, 16); + r = colorStr.mid(1, 2).toInt(nullptr, 16); + g = colorStr.mid(3, 2).toInt(nullptr, 16); + b = colorStr.mid(5, 2).toInt(nullptr, 16); ok = true; } } @@ -502,7 +500,7 @@ ColorScheme* KDE3ColorSchemeReader::read() ColorScheme* scheme = new ColorScheme(); - QRegExp comment(QLatin1String("#.*$")); + QRegularExpression comment(QLatin1String("#.*$")); while ( !_device->atEnd() ) { QString line(QString::fromUtf8(_device->readLine())); diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.cpp index 41c514f7b..74e8de187 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.cpp @@ -24,7 +24,7 @@ #include "Emulation.h" #include "HistorySearch.h" -HistorySearch::HistorySearch(EmulationPtr emulation, QRegExp regExp, +HistorySearch::HistorySearch(EmulationPtr emulation, QRegularExpression regExp, bool forwards, int startColumn, int startLine, QObject* parent) : QObject(parent), @@ -41,7 +41,7 @@ HistorySearch::~HistorySearch() { void HistorySearch::search() { bool found = false; - if (! m_regExp.isEmpty()) + if( ! m_regExp.isValid()) { if (m_forwards) { found = search(m_startColumn, m_startLine, -1, m_emulation->lineCount()) || search(0, 0, m_startColumn, m_startLine); @@ -119,7 +119,8 @@ bool HistorySearch::search(int startColumn, int startLine, int endColumn, int en if (matchStart > -1) { - int matchEnd = matchStart + m_regExp.matchedLength() - 1; + auto match = m_regExp.match(string); + int matchEnd = matchStart + match.capturedLength() - 1; qDebug() << "Found in string from" << matchStart << "to" << matchEnd; // Translate startPos and endPos to startColum, startLine, endColumn and endLine in history. diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.h b/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.h index e019650c6..fc2dee55d 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.h +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/HistorySearch.h @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,7 @@ class HistorySearch : public QObject Q_OBJECT public: - explicit HistorySearch(EmulationPtr emulation, QRegExp regExp, bool forwards, + explicit HistorySearch(EmulationPtr emulation, QRegularExpression regExp, bool forwards, int startColumn, int startLine, QObject* parent); ~HistorySearch(); @@ -55,7 +56,7 @@ class HistorySearch : public QObject EmulationPtr m_emulation; - QRegExp m_regExp; + QRegularExpression m_regExp; bool m_forwards; int m_startColumn; int m_startLine; diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/KeyboardTranslator.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/KeyboardTranslator.cpp index 7382e158a..d81b088bc 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/KeyboardTranslator.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/KeyboardTranslator.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "tools.h" @@ -532,10 +533,10 @@ QList KeyboardTranslatorReader::tokenize(const text = text.simplified(); // title line: keyboard "title" - static QRegExp title(QLatin1String("keyboard\\s+\"(.*)\"")); + QRegularExpression title(QLatin1String("keyboard\\s+\"(.*)\"")); // key line: key KeySequence : "output" // key line: key KeySequence : command - static QRegExp key(QLatin1String("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)")); + QRegularExpression key(QLatin1String("key\\s+([\\w\\+\\s\\-\\*\\.]+)\\s*:\\s*(\"(.*)\"|\\w+)")); QList list; if ( text.isEmpty() ) @@ -543,30 +544,31 @@ QList KeyboardTranslatorReader::tokenize(const return list; } - if ( title.exactMatch(text) ) + if ( title.match(text).hasMatch() ) { + auto match = title.match(text); Token titleToken = { Token::TitleKeyword , QString() }; - Token textToken = { Token::TitleText , title.capturedTexts().at(1) }; - + Token textToken = { Token::TitleText , match.capturedTexts().at(1) }; list << titleToken << textToken; } - else if ( key.exactMatch(text) ) + else if ( key.match(text).hasMatch() ) { + auto match = key.match(text); Token keyToken = { Token::KeyKeyword , QString() }; - Token sequenceToken = { Token::KeySequence , key.capturedTexts().value(1).remove(QLatin1Char(' ')) }; + Token sequenceToken = { Token::KeySequence , match.capturedTexts().value(1).remove(QLatin1Char(' ')) }; list << keyToken << sequenceToken; - if ( key.capturedTexts().at(3).isEmpty() ) + if ( match.capturedTexts().size() < 4 || match.capturedTexts().at(3).isEmpty() ) { // capturedTexts()[2] is a command - Token commandToken = { Token::Command , key.capturedTexts().at(2) }; + Token commandToken = { Token::Command , match.capturedTexts().at(2) }; list << commandToken; } else { // capturedTexts()[3] is the output string - Token outputToken = { Token::OutputText , key.capturedTexts().at(3) }; + Token outputToken = { Token::OutputText , match.capturedTexts().at(3) }; list << outputToken; } } @@ -664,7 +666,8 @@ QByteArray KeyboardTranslator::Entry::escapedText(bool expandWildCards,Qt::Keybo if ( replacement == 'x' ) { - result.replace(i,1,"\\x"+QByteArray(1,ch).toHex()); + QByteArray data = "\\x"+QByteArray(1,ch).toHex(); + result.replace(i,1,data); } else if ( replacement != 0 ) { result.remove(i,1); @@ -682,7 +685,7 @@ QByteArray KeyboardTranslator::Entry::unescape(const QByteArray& input) const for ( int i = 0 ; i < result.count()-1 ; i++ ) { - QByteRef ch = result[i]; + auto ch = result[i]; if ( ch == '\\' ) { char replacement[2] = {0,0}; diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.cpp index 87484be2d..ee7c429f0 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.cpp @@ -317,10 +317,11 @@ int Pty::foregroundProcessGroup() const return 0; } +// TODO: we need to handle this +#if QT_VERSION < 0x060000 void Pty::setupChildProcess() { KPtyProcess::setupChildProcess(); - // reset all signal handlers // this ensures that terminal applications respond to // signals generated via key sequences such as Ctrl+C @@ -328,11 +329,13 @@ void Pty::setupChildProcess() struct sigaction action; sigset_t sigset; sigemptyset(&action.sa_mask); + sigemptyset(&sigset); action.sa_handler = SIG_DFL; action.sa_flags = 0; for (int signal=1;signal < NSIG; signal++) { - sigaction(signal,&action,0L); + sigaction(signal,&action,nullptr); sigaddset(&sigset, signal); } - sigprocmask(SIG_UNBLOCK, &sigset, NULL); + sigprocmask(SIG_UNBLOCK, &sigset, nullptr); } +#endif diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.h b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.h index e5f6cebf9..d1e14cee0 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.h +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Pty.h @@ -188,8 +188,10 @@ Q_OBJECT */ void receivedData(const char* buffer, int length); - protected: - void setupChildProcess(); +#if QT_VERSION < 0x060000 +protected: + void setupChildProcess() override; +#endif private slots: // called when data is received from the terminal process diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Session.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Session.cpp index c92069f56..e28768805 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Session.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Session.cpp @@ -30,13 +30,13 @@ // Qt #include -#include #include #include #include #include #include #include +#include #include "Pty.h" //#include "kptyprocess.h" @@ -381,7 +381,11 @@ void Session::setUserTitle( int what, const QString & caption ) if (what == 31) { QString cwd=caption; +#if QT_VERSION >= 0x060000 + cwd=cwd.replace( QRegularExpression(QLatin1String("^~")), QDir::homePath() ); +#else cwd=cwd.replace( QRegExp(QLatin1String("^~")), QDir::homePath() ); +#endif emit openUrlRequest(cwd); } diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/TerminalDisplay.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/TerminalDisplay.cpp index ef0f87c1c..4d35bf435 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/TerminalDisplay.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/TerminalDisplay.cpp @@ -252,19 +252,19 @@ void TerminalDisplay::fontChange(const QFont&) void TerminalDisplay::calDrawTextAdditionHeight(QPainter& painter) { QRect test_rect, feedback_rect; - test_rect.setRect(1, 1, _fontWidth * 4, _fontHeight); + test_rect.setRect(1, 1, _fontWidth * 4, _fontHeight); painter.drawText(test_rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + QLatin1String("Mq"), &feedback_rect); - //qDebug() << "test_rect:" << test_rect << "feeback_rect:" << feedback_rect; + //qDebug() << "test_rect:" << test_rect << "feeback_rect:" << feedback_rect; - _drawTextAdditionHeight = (feedback_rect.height() - _fontHeight) / 2; - if(_drawTextAdditionHeight < 0) { - _drawTextAdditionHeight = 0; - } + _drawTextAdditionHeight = (feedback_rect.height() - _fontHeight) / 2; + if(_drawTextAdditionHeight < 0) { + _drawTextAdditionHeight = 0; + } - // update the original content + // update the original content _drawTextTestFlag = false; - update(); + update(); } void TerminalDisplay::setVTFont(const QFont& f) @@ -276,8 +276,9 @@ void TerminalDisplay::setVTFont(const QFont& f) // this ensures the same handling for all platforms // but then there was revealed that various Linux distros // have this problem too... - font.setStyleStrategy(QFont::ForceIntegerMetrics); - +#if QT_VERSION < 0x060000 + font.setStyleStrategy(QFont::ForceIntegerMetrics); +#endif QFontMetrics metrics(font); if ( !QFontInfo(font).fixedPitch() ) @@ -1946,7 +1947,13 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev) spot->activate(QLatin1String("click-action")); } } - else if ( ev->button() == Qt::MidButton ) + else if ( ev->button() == +#if QT_VERSION >= 0x060000 + Qt::MiddleButton +#else + Qt::MidButton +#endif + ) { if ( _mouseMarks || (ev->modifiers() & Qt::ShiftModifier) ) emitSelection(true,ev->modifiers() & Qt::ControlModifier); @@ -2037,7 +2044,13 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev) int button = 3; if (ev->buttons() & Qt::LeftButton) button = 0; - if (ev->buttons() & Qt::MidButton) + if (ev->buttons() & +#if QT_VERSION >= 0x060000 + Qt::MiddleButton +#else + Qt::MidButton +#endif + ) button = 1; if (ev->buttons() & Qt::RightButton) button = 2; @@ -2079,7 +2092,14 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev) if (_actSel == 0) return; // don't extend selection while pasting - if (ev->buttons() & Qt::MidButton) return; + if (ev->buttons() & +#if QT_VERSION >= 0x060000 + Qt::MiddleButton +#else + Qt::MidButton +#endif + ) + return; extendSelection( ev->pos() ); } @@ -2334,9 +2354,21 @@ void TerminalDisplay::mouseReleaseEvent(QMouseEvent* ev) if ( !_mouseMarks && ((ev->button() == Qt::RightButton && !(ev->modifiers() & Qt::ShiftModifier)) - || ev->button() == Qt::MidButton) ) + || ev->button() == +#if QT_VERSION >= 0x060000 + Qt::MiddleButton +#else + Qt::MidButton +#endif +)) { - emit mouseSignal( ev->button() == Qt::MidButton ? 1 : 2, + emit mouseSignal( ev->button() == +#if QT_VERSION >= 0x060000 + Qt::MiddleButton +#else + Qt::MidButton +#endif + ? 1 : 2, charColumn + 1, charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , 2); @@ -2483,8 +2515,8 @@ void TerminalDisplay::mouseDoubleClickEvent(QMouseEvent* ev) void TerminalDisplay::wheelEvent( QWheelEvent* ev ) { - if (ev->orientation() != Qt::Vertical) - return; + if (ev->angleDelta().y() == 0) + return; // if the terminal program is not interested mouse events // then send the event to the scrollbar if the slider has room to move @@ -2503,10 +2535,10 @@ void TerminalDisplay::wheelEvent( QWheelEvent* ev ) // to get a reasonable scrolling speed, scroll by one line for every 5 degrees // of mouse wheel rotation. Mouse wheels typically move in steps of 15 degrees, // giving a scroll of 3 lines - int key = ev->delta() > 0 ? Qt::Key_Up : Qt::Key_Down; + int key = ev->angleDelta().y() > 0 ? Qt::Key_Up : Qt::Key_Down; - // QWheelEvent::delta() gives rotation in eighths of a degree - int wheelDegrees = ev->delta() / 8; + // QWheelEvent::angleDelta().y() gives rotation in eighths of a degree + int wheelDegrees = ev->angleDelta().y() / 8; int linesToScroll = abs(wheelDegrees) / 5; QKeyEvent keyScrollEvent(QEvent::KeyPress,key,Qt::NoModifier); @@ -2519,14 +2551,17 @@ void TerminalDisplay::wheelEvent( QWheelEvent* ev ) { // terminal program wants notification of mouse activity - int charLine; - int charColumn; - getCharacterPosition( ev->pos() , charLine , charColumn ); - - emit mouseSignal( ev->delta() > 0 ? 4 : 5, - charColumn + 1, - charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , - 0); + int charLine; + int charColumn; +#if QT_VERSION <= 0x060000 + getCharacterPosition( ev->pos() , charLine , charColumn ); +#else + getCharacterPosition( ev->position().toPoint() , charLine , charColumn ); +#endif + emit mouseSignal( ev->angleDelta().y() > 0 ? 4 : 5, + charColumn + 1, + charLine + 1 +_scrollBar->value() -_scrollBar->maximum() , + 0); } } diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Vt102Emulation.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Vt102Emulation.cpp index 64726598a..3f54f90c7 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/Vt102Emulation.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/Vt102Emulation.cpp @@ -44,7 +44,6 @@ // Qt #include #include -#include // KDE //#include @@ -413,10 +412,10 @@ void Vt102Emulation::processWindowAttributeChange() return; } - QString newValue; - newValue.reserve(tokenBufferPos-i-2); - for (int j = 0; j < tokenBufferPos-i-2; j++) - newValue[j] = tokenBuffer[i+1+j]; + // copy from the first char after ';', and skipping the ending delimiter + // 0x07 or 0x92. Note that as control characters in OSC text parts are + // ignored, only the second char in ST ("\e\\") is appended to tokenBuffer. + QString newValue = QString::fromWCharArray(tokenBuffer + i + 1, tokenBufferPos-i-2); _pendingTitleUpdates[attributeToChange] = newValue; _titleUpdateTimer->start(20); @@ -961,8 +960,8 @@ void Vt102Emulation::sendMouseEvent( int cb, int cx, int cy , int eventType ) // coordinate+32, no matter what the locale is. We could easily // convert manually, but QString can also do it for us. QChar coords[2]; - coords[0] = cx + 0x20; - coords[1] = cy + 0x20; + coords[0] = QChar(cx + 0x20); + coords[1] = QChar(cy + 0x20); QString coordsStr = QString(coords, 2); QByteArray utf8 = coordsStr.toUtf8(); snprintf(command, sizeof(command), "\033[M%c%s", cb + 0x20, utf8.constData()); @@ -1341,8 +1340,8 @@ char Vt102Emulation::eraseChar() const { KeyboardTranslator::Entry entry = _keyTranslator->findEntry( Qt::Key_Backspace, - 0, - 0); + Qt::NoModifier, + KeyboardTranslator::NoState); if ( entry.text().count() > 0 ) return entry.text().at(0); else diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.cpp index 73264a611..d4ca8fbad 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.cpp @@ -404,9 +404,9 @@ int KProcess::startDetached(const QStringList &argv) int KProcess::pid() const { #ifdef Q_OS_UNIX - return (int) QProcess::pid(); + return (int) QProcess::processId(); #else - return QProcess::pid() ? QProcess::pid()->dwProcessId : 0; + return QProcess::processId() ? QProcess::processId()->dwProcessId : 0; #endif } diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.h b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.h index ec90721d1..3a9446144 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.h +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kprocess.h @@ -336,8 +336,10 @@ class KProcess : public QProcess private: // hide those +#if QT_VERSION < 0x060000 using QProcess::setReadChannelMode; using QProcess::readChannelMode; +#endif using QProcess::setProcessChannelMode; using QProcess::processChannelMode; diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kpty.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kpty.cpp index 97416d828..fcd820e20 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kpty.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kpty.cpp @@ -332,24 +332,28 @@ bool KPty::open() (st.st_mode & (S_IRGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))) && !d->chownpty(true)) { qWarning() - << "chownpty failed for device " << ptyName << "::" << d->ttyName - << "\nThis means the communication can be eavesdropped." << endl; + << "chownpty failed for device " << ptyName << "::" << d->ttyName +#if QT_VERSION >= 0x060000 + << "\nThis means the communication can be eavesdropped." << Qt::endl; +#else + << "\nThis means the communication can be eavesdropped." << endl; +#endif } -#if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT) +# if defined(HAVE__GETPTY) || defined(HAVE_GRANTPT) grantedpt: -#endif +# endif -#ifdef HAVE_REVOKE +# ifdef HAVE_REVOKE revoke(d->ttyName.data()); -#endif +# endif -#ifdef HAVE_UNLOCKPT +# ifdef HAVE_UNLOCKPT unlockpt(d->masterFd); -#elif defined(TIOCSPTLCK) +# elif defined(TIOCSPTLCK) int flag = 0; ioctl(d->masterFd, TIOCSPTLCK, &flag); -#endif +# endif d->slaveFd = ::open(d->ttyName.data(), O_RDWR | O_NOCTTY); if (d->slaveFd < 0) { @@ -359,11 +363,11 @@ bool KPty::open() return false; } -#if (defined(__svr4__) || defined(__sgi__)) +# if (defined(__svr4__) || defined(__sgi__)) // Solaris ioctl(d->slaveFd, I_PUSH, "ptem"); ioctl(d->slaveFd, I_PUSH, "ldterm"); -#endif +# endif #endif /* HAVE_OPENPTY */ diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.cpp index ec8df33ed..f455f7cc4 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.cpp @@ -46,6 +46,25 @@ KPtyProcess::KPtyProcess(QObject *parent) : d->pty->open(); connect(this, SIGNAL(stateChanged(QProcess::ProcessState)), SLOT(_k_onStateChanged(QProcess::ProcessState))); +#if QT_VERSION >= 0x060000 + setChildProcessModifier([this] { + Q_D(KPtyProcess); + d->pty->setCTty(); + +#if 0 + if (d->addUtmp) + d->pty->login(KUser(KUser::UseRealUserID).loginName().toLocal8Bit().data(), qgetenv("DISPLAY")); +#endif + if (d->ptyChannels & StdinChannel) + dup2(d->pty->slaveFd(), 0); + + if (d->ptyChannels & StdoutChannel) + dup2(d->pty->slaveFd(), 1); + + if (d->ptyChannels & StderrChannel) + dup2(d->pty->slaveFd(), 2); + }); +#endif } KPtyProcess::KPtyProcess(int ptyMasterFd, QObject *parent) : @@ -119,6 +138,7 @@ KPtyDevice *KPtyProcess::pty() const return d->pty; } +#if QT_VERSION < 0x060000 void KPtyProcess::setupChildProcess() { Q_D(KPtyProcess); @@ -140,5 +160,6 @@ void KPtyProcess::setupChildProcess() KProcess::setupChildProcess(); } +#endif //#include "kptyprocess.moc" diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.h b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.h index 1270c475b..8816b2b5d 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.h +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/kptyprocess.h @@ -144,8 +144,9 @@ class KPtyProcess : public KProcess /** * @reimp */ - virtual void setupChildProcess(); - +#if QT_VERSION < 0x060000 // move to KPtyProcess() + void setupChildProcess() override; +#endif private: Q_PRIVATE_SLOT(d_func(), void _k_onStateChanged(QProcess::ProcessState)) }; diff --git a/3rdparty/unioncode-qtermwidget-0.14.1/lib/qtermwidget.cpp b/3rdparty/unioncode-qtermwidget-0.14.1/lib/qtermwidget.cpp index 2d92a8b59..1ec007189 100644 --- a/3rdparty/unioncode-qtermwidget-0.14.1/lib/qtermwidget.cpp +++ b/3rdparty/unioncode-qtermwidget-0.14.1/lib/qtermwidget.cpp @@ -159,10 +159,10 @@ void QTermWidget::search(bool forwards, bool next) qDebug() << "current selection starts at: " << startColumn << startLine; qDebug() << "current cursor position: " << m_impl->m_terminalDisplay->screenWindow()->cursorPosition(); - QRegExp regExp(m_searchBar->searchText()); - regExp.setPatternSyntax(m_searchBar->useRegularExpression() ? QRegExp::RegExp : QRegExp::FixedString); - regExp.setCaseSensitivity(m_searchBar->matchCase() ? Qt::CaseSensitive : Qt::CaseInsensitive); - + QRegularExpression regExp(m_searchBar->searchText(), + m_searchBar->matchCase() ? QRegularExpression::CaseInsensitiveOption| + QRegularExpression::UseUnicodePropertiesOption + : QRegularExpression::UseUnicodePropertiesOption); HistorySearch *historySearch = new HistorySearch(m_impl->m_session->emulation(), regExp, forwards, startColumn, startLine, this); connect(historySearch, SIGNAL(matchFound(int, int, int, int)), this, SLOT(matchFound(int, int, int, int))); @@ -253,7 +253,7 @@ void QTermWidget::startTerminalTeletype() void QTermWidget::init(int startnow) { m_layout = new QVBoxLayout(); - m_layout->setMargin(0); + m_layout->setContentsMargins(0, 0, 0, 0); setLayout(m_layout); // translations diff --git a/CMakeLists.txt b/CMakeLists.txt index 947922ae3..d156a6ef0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,7 +80,8 @@ endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wl,--as-need -fPIE") -find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +# find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) +set(QT_VERSION_MAJOR 6) message(" >>> Found Qt version: ${QT_VERSION_MAJOR}") if (QT_VERSION_MAJOR MATCHES 6) set(DTK_VERSION_MAJOR 6) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index db9294701..dbfd6b3f6 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -11,10 +11,10 @@ add_subdirectory(debugger) add_subdirectory(codeeditor) add_subdirectory(filebrowser) if (QT_VERSION_MAJOR MATCHES 5) -#add_subdirectory(collaborators) -#add_subdirectory(console) -# add_subdirectory(javascript) +add_subdirectory(collaborators) +add_subdirectory(javascript) endif() +add_subdirectory(console) add_subdirectory(builder) #remove it until system lock issue resolved. #add_subdirectory(container)