Skip to content

Commit

Permalink
Work in progress on qt6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Ri0n committed Mar 14, 2024
1 parent df8a9e7 commit 07beb9b
Show file tree
Hide file tree
Showing 41 changed files with 156 additions and 143 deletions.
12 changes: 6 additions & 6 deletions 3rdparty/qhttp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ include_directories(
./qhttp/src/private
)

find_package(Qt5 COMPONENTS Core Network REQUIRED)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core Network REQUIRED)
find_package(HttpParser 2.2 QUIET)

if(NOT HttpParser_FOUND)
Expand Down Expand Up @@ -77,7 +77,7 @@ set(qhttp_priv_hdrs
qhttp/src/private/qsocket.hpp
)

qt5_wrap_cpp(MOCS
qt_wrap_cpp(MOCS
qhttp/src/qhttpabstracts.hpp
qhttp/src/qhttpserverconnection.hpp
qhttp/src/qhttpserver.hpp
Expand All @@ -95,11 +95,11 @@ add_library(qhttp

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
endif()
# if(NOT MSVC)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# endif()

target_link_libraries(qhttp Qt5::Core Qt5::Network ${EXTRA_LIBS})
target_link_libraries(qhttp Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Network ${EXTRA_LIBS})
target_include_directories(qhttp
PUBLIC
./qhttp/src
Expand Down
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ if (APPLE OR (MSVC OR USE_MXE))
set( DEFAULT_BUNDLED_USRSCTP ON )
endif()

if(QT_DEFAULT_MAJOR_VERSION STREQUAL "")
set(QT_DEFAULT_MAJOR_VERSION 6)
endif()


# Common options
set( CHAT_TYPE "BASIC" CACHE STRING "Type of chatlog engine. WEBKIT | WEBENGINE | BASIC" )
Expand All @@ -59,7 +63,7 @@ option( USE_ASPELL "Build psi with aspell spellcheck" OFF )
option( USE_CCACHE "Use ccache utility if found" ON )
option( USE_CRASH "Enable builtin sigsegv handling" OFF )
option( USE_DBUS "Enable DBUS support" ON )
option( USE_KEYCHAIN "Enable Qt5Keychain support" ON )
option( USE_KEYCHAIN "Enable QtKeychain support" ON )
option( ONLY_BINARY "Build and install only binary file" OFF )
option( ONLY_PLUGINS "Build psi plugins only" OFF )
option( INSTALL_EXTRA_FILES "Install sounds, iconsets, certs, client_icons.txt, themes" ON )
Expand Down Expand Up @@ -113,6 +117,10 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" )

include(policyRules)

if(QT_DEFAULT_MAJOR_VERSION STREQUAL "")
set(QT_DEFAULT_MAJOR_VERSION 5)
endif()

set(IS_WEBKIT OFF CACHE INTERNAL "Use webkit. Internal variable")
set(IS_WEBENGINE OFF CACHE INTERNAL "Use webengine. Internal variable")
string(TOLOWER "${CHAT_TYPE}" LCHAT_TYPE)
Expand All @@ -125,7 +133,6 @@ if("${LCHAT_TYPE}" STREQUAL "webkit")
message(STATUS "Chatlog type - QtWebKit")
elseif("${LCHAT_TYPE}" STREQUAL "webengine")
set(IS_WEBENGINE ON)
find_package( Qt5Core 5.9.0 REQUIRED )
add_definitions(
-DWEBKIT
-DWEBENGINE=1
Expand Down Expand Up @@ -231,8 +238,8 @@ endif()
STRING (REGEX MATCH "NetBSD" PROJECT_OS_NETBSD ${CMAKE_SYSTEM_NAME})
if(PROJECT_OS_NETBSD)
message(STATUS "NetBSD detected")
set(CMAKE_C_FLAGS "-Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib -Wl,-rpath,/usr/pkg/qt5/lib")
set(CMAKE_CXX_FLAGS "-Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib -Wl,-rpath,/usr/pkg/qt5/lib")
set(CMAKE_C_FLAGS "-Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib -Wl,-rpath,/usr/pkg/qt${QT_DEFAULT_MAJOR_VERSION}/lib")
set(CMAKE_CXX_FLAGS "-Wl,-rpath,/usr/X11R7/lib -Wl,-rpath,/usr/pkg/lib -Wl,-rpath,/usr/pkg/qt${QT_DEFAULT_MAJOR_VERSION}/lib")
endif()

# Qt dependencies make building very slow
Expand Down
2 changes: 1 addition & 1 deletion iris
Submodule iris updated 58 files
+11 −2 3rdparty/stringprep/CMakeLists.txt
+8 −6 CMakeLists.txt
+5 −0 cmake/modules/IrisQCA.cmake
+1 −1 cmake/modules/policyRules.cmake
+7 −2 src/irisnet/CMakeLists.txt
+1 −1 src/irisnet/corelib/netinterface_qtname.cpp
+2 −2 src/irisnet/corelib/netinterface_unix.cpp
+3 −3 src/irisnet/corelib/netnames.cpp
+1 −1 src/irisnet/corelib/objectsession.cpp
+2 −2 src/irisnet/noncore/cutestuff/httpconnect.cpp
+3 −3 src/irisnet/noncore/cutestuff/httppoll.cpp
+1 −1 src/irisnet/noncore/dtls.cpp
+4 −4 src/irisnet/noncore/ice176.cpp
+3 −3 src/irisnet/noncore/iceagent.cpp
+1 −1 src/irisnet/noncore/icelocaltransport.cpp
+1 −1 src/irisnet/noncore/stunallocate.cpp
+2 −2 src/irisnet/noncore/stunallocate.h
+1 −1 src/irisnet/noncore/stuntransaction.cpp
+1 −1 src/irisnet/noncore/stuntypes.cpp
+7 −7 src/irisnet/noncore/udpportreserver.cpp
+2 −1 src/xmpp/CMakeLists.txt
+3 −3 src/xmpp/sasl/digestmd5proplist.cpp
+15 −16 src/xmpp/sasl/scramsha1response.cpp
+6 −9 src/xmpp/sasl/scramsha1signature.cpp
+1 −1 src/xmpp/xmpp-core/parser.cpp
+1 −1 src/xmpp/xmpp-core/parser.h
+13 −12 src/xmpp/xmpp-core/protocol.cpp
+2 −2 src/xmpp/xmpp-core/securestream.cpp
+3 −3 src/xmpp/xmpp-core/stream.cpp
+9 −5 src/xmpp/xmpp-core/tlshandler.cpp
+0 −8 src/xmpp/xmpp-core/xmlprotocol.cpp
+3 −3 src/xmpp/xmpp-im/client.cpp
+4 −4 src/xmpp/xmpp-im/filetransfer.cpp
+1 −2 src/xmpp/xmpp-im/httpfileupload.cpp
+1 −1 src/xmpp/xmpp-im/jingle-ft.cpp
+2 −2 src/xmpp/xmpp-im/jingle-ice.cpp
+2 −1 src/xmpp/xmpp-im/jingle-s5b.cpp
+12 −12 src/xmpp/xmpp-im/jingle-session.cpp
+2 −0 src/xmpp/xmpp-im/jingle.h
+10 −10 src/xmpp/xmpp-im/s5b.cpp
+1 −1 src/xmpp/xmpp-im/stundisco.cpp
+9 −9 src/xmpp/xmpp-im/types.cpp
+1 −1 src/xmpp/xmpp-im/xmpp_bitsofbinary.cpp
+2 −3 src/xmpp/xmpp-im/xmpp_caps.cpp
+3 −1 src/xmpp/xmpp-im/xmpp_encryption.cpp
+3 −1 src/xmpp/xmpp-im/xmpp_encryption.h
+3 −3 src/xmpp/xmpp-im/xmpp_externalservicediscovery.cpp
+3 −3 src/xmpp/xmpp-im/xmpp_hash.cpp
+3 −3 src/xmpp/xmpp-im/xmpp_hash.h
+1 −1 src/xmpp/xmpp-im/xmpp_ibb.cpp
+3 −3 src/xmpp/xmpp-im/xmpp_serverinfomanager.cpp
+6 −5 src/xmpp/xmpp-im/xmpp_serverinfomanager.h
+9 −6 src/xmpp/xmpp-im/xmpp_tasks.cpp
+9 −8 src/xmpp/xmpp-im/xmpp_vcard.cpp
+7 −2 src/xmpp/xmpp-im/xmpp_xdata.cpp
+6 −6 src/xmpp/xmpp-im/xmpp_xmlcommon.cpp
+2 −3 src/xmpp/xmpp-im/xmpp_xmlcommon.h
+1 −1 tools/icetunnel/main.cpp
6 changes: 3 additions & 3 deletions plugins/include/iqfilteringhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
#include <QtPlugin>

class IqNamespaceFilter;
class QRegExp;
class QRegularExpression;
class QString;

class IqFilteringHost {
public:
virtual ~IqFilteringHost() { }

virtual void addIqNamespaceFilter(const QString &ns, IqNamespaceFilter *filter) = 0;
virtual void addIqNamespaceFilter(const QRegExp &ns, IqNamespaceFilter *filter) = 0;
virtual void addIqNamespaceFilter(const QRegularExpression &ns, IqNamespaceFilter *filter) = 0;

virtual void removeIqNamespaceFilter(const QString &ns, IqNamespaceFilter *filter) = 0;
virtual void removeIqNamespaceFilter(const QRegExp &ns, IqNamespaceFilter *filter) = 0;
virtual void removeIqNamespaceFilter(const QRegularExpression &ns, IqNamespaceFilter *filter) = 0;
};

// TODO(mck): iq results/error may contain no namespaced element - think about this!!
Expand Down
2 changes: 1 addition & 1 deletion src/AutoUpdater/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if(USE_QDCHECKER)
)
endif()

qt5_wrap_ui(UI_FORMS ${FORMS})
qt_wrap_ui(UI_FORMS ${FORMS})
add_library(AutoUpdater STATIC ${HEADERS} ${SOURCES} ${UI_FORMS})
if(USE_QDCHECKER)
add_dependencies(AutoUpdater build_ui_files tools widgets)
Expand Down
67 changes: 36 additions & 31 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,23 @@ endif()
set(TRANSLATIONS_DIR "${PROJECT_SOURCE_DIR}/translations" CACHE STRING "Path to Psi/Psi+ translations directory")

#Work with external packages
find_package(Qt5 COMPONENTS Widgets Core Gui Xml Network Concurrent Multimedia Svg Sql REQUIRED)
set(REQUIRED_QT_COMPONENTS Widgets Core Gui Xml Network Concurrent Multimedia Svg Sql)
if(IS_WEBKIT)
find_package(Qt5 COMPONENTS WebKit WebKitWidgets REQUIRED)
set(WEBKIT_LIBS Qt5::WebKit Qt5::WebKitWidgets)
list(APPEND REQUIRED_QT_COMPONENTS WebKit WebKitWidgets)
set(WEBKIT_LIBS Qt${QT_DEFAULT_MAJOR_VERSION}::WebKit Qt${QT_DEFAULT_MAJOR_VERSION}::WebKitWidgets)
elseif(IS_WEBENGINE)
find_package(Qt5 COMPONENTS WebEngine WebEngineWidgets WebChannel REQUIRED)
set(WEBKIT_LIBS Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebChannel)
endif()

if(USE_KEYCHAIN)
find_package( Qt5 COMPONENTS Keychain QUIET )
if( Qt5Keychain_FOUND )
message(STATUS "Found Qt5Keychain: ${QTKEYCHAIN_LIBRARIES}")
set(KEYCHAIN_LIBS ${QTKEYCHAIN_LIBRARIES})
include_directories(${QTKEYCHAIN_INCLUDE_DIRS})
add_definitions(-DHAVE_KEYCHAIN)
else()
message(STATUS "Qt5Keychain - not found")
endif()
list(APPEND REQUIRED_QT_COMPONENTS WebEngine WebEngineWidgets WebChannel)
set(WEBKIT_LIBS Qt${QT_DEFAULT_MAJOR_VERSION}::WebEngine Qt${QT_DEFAULT_MAJOR_VERSION}::WebEngineWidgets Qt${QT_DEFAULT_MAJOR_VERSION}::WebChannel)
endif()

if(LINUX)
if(USE_DBUS)
find_package(Qt5 COMPONENTS DBus REQUIRED)
list(APPEND REQUIRED_QT_COMPONENTS DBus)
endif()
if(USE_X11 OR LIMIT_X11_USAGE)
find_package(Qt5 COMPONENTS X11Extras REQUIRED)
if(QT_DEFAULT_MAJOR_VERSION LESS 6)
list(APPEND REQUIRED_QT_COMPONENTS X11Extras)
endif()
find_package(XCB REQUIRED)
set(EXTRA_LIBS
${XCB_LIBRARY}
Expand All @@ -64,7 +54,7 @@ if(LINUX)
endif()

if(APPLE)
find_package(Qt5MacExtras REQUIRED)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION}MacExtras REQUIRED)
if(USE_SPARKLE)
find_package(Sparkle REQUIRED)
include_directories(${SPARKLE_INCLUDE_DIR})
Expand All @@ -75,25 +65,40 @@ endif()
if(NOT ONLY_BINARY AND (EXISTS "${TRANSLATIONS_DIR}"))
set(LANGS_EXISTS ON)
message(STATUS "${PROJECT_NAME} translations found at ${TRANSLATIONS_DIR}")
find_package(Qt5 COMPONENTS LinguistTools REQUIRED)
set(QT_LUPDATE_EXECUTABLE ${Qt5_LUPDATE_EXECUTABLE})
list(APPEND REQUIRED_QT_COMPONENTS LinguistTools)
set(QT_LUPDATE_EXECUTABLE ${Qt${QT_DEFAULT_MAJOR_VERSION}_LUPDATE_EXECUTABLE})
endif()

set(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Network Qt5::Xml ${WEBKIT_LIBS} Qt5::Concurrent Qt5::Multimedia Qt5::Svg Qt5::Sql ${KEYCHAIN_LIBS})
if(QT_DEFAULT_MAJOR_VERSION LESS 6)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} 5.10 REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS})
else()
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} 6.6 REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS})
endif()
set(QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Network Qt${QT_DEFAULT_MAJOR_VERSION}::Xml ${WEBKIT_LIBS} Qt${QT_DEFAULT_MAJOR_VERSION}::Concurrent Qt${QT_DEFAULT_MAJOR_VERSION}::Multimedia Qt${QT_DEFAULT_MAJOR_VERSION}::Svg Qt${QT_DEFAULT_MAJOR_VERSION}::Sql ${KEYCHAIN_LIBS})

if(USE_KEYCHAIN)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Keychain)
set(KEYCHAIN_LIBS ${QTKEYCHAIN_LIBRARIES})
include_directories(${QTKEYCHAIN_INCLUDE_DIRS})
add_definitions(-DHAVE_KEYCHAIN)
endif()

if(LINUX)
if(USE_DBUS)
list(APPEND QT_LIBRARIES Qt5::DBus)
list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::DBus)
endif()
if(USE_X11 OR LIMIT_X11_USAGE)
list(APPEND QT_LIBRARIES Qt5::X11Extras ${LIBXCB_LIBRARIES})
if(QT_DEFAULT_MAJOR_VERSION LESS 6)
list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::X11Extras)
endif()
list(APPEND QT_LIBRARIES ${LIBXCB_LIBRARIES})
endif()
endif()
if(UNIX OR IS_WEBENGINE)
list(APPEND EXTRA_LIBS qhttp)
endif()
if(APPLE)
list(APPEND QT_LIBRARIES Qt5::MacExtras)
list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::MacExtras)
if(USE_SPARKLE)
list(APPEND EXTRA_LDFLAGS ${SPARKLE_LIBRARY})
endif()
Expand Down Expand Up @@ -312,11 +317,11 @@ if(LANGS_EXISTS)
endforeach()

# Psi translations
qt5_add_translation(QM ${PSI_TRANSLATIONS})
Qt_add_translation(QM ${PSI_TRANSLATIONS})

if(WIN32 OR APPLE)
# Qt translations
get_target_property(QtCore_location Qt5::Core LOCATION)
get_target_property(QtCore_location Qt${QT_DEFAULT_MAJOR_VERSION}::Core LOCATION)
get_filename_component(QtCore_DIR "${QtCore_location}" DIRECTORY)
if(APPLE)
get_filename_component(QT_TRANSLATIONS_DIR "${QtCore_DIR}/../../translations" ABSOLUTE)
Expand All @@ -340,8 +345,8 @@ if(IS_WEBKIT OR IS_WEBENGINE)
list(APPEND RESOURCES ${PROJECT_SOURCE_DIR}/themes/chatview.qrc)
endif()

qt5_add_resources(QRC_SOURCES ${RESOURCES})
qt5_wrap_ui(UI_FORMS ${FORMS})
Qt_add_resources(QRC_SOURCES ${RESOURCES})
qt_wrap_ui(UI_FORMS ${FORMS})
#Small hack to compile ui files before some *.cpp files
add_custom_target(build_ui_files DEPENDS "${UI_FORMS}")

Expand Down Expand Up @@ -632,7 +637,7 @@ elseif(APPLE)

# Special hack for qca package from Homebrew
if(HOMEBREW AND NOT IRIS_BUNDLED_QCA)
install(DIRECTORY "${HOMEBREW}/opt/qca/lib/qt5/plugins/crypto"
install(DIRECTORY "${HOMEBREW}/opt/qca/lib/Qt${QT_DEFAULT_MAJOR_VERSION}/plugins/crypto"
DESTINATION "${CLIENT_NAME}.app/Contents/PlugIns")
endif()
# end of qca hack
Expand Down
2 changes: 1 addition & 1 deletion src/Certificates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ list(APPEND SOURCES
CertificateHelpers.cpp
)

qt5_wrap_ui(UI_FORMS ${FORMS})
qt_wrap_ui(UI_FORMS ${FORMS})
add_library(Certificates STATIC ${HEADERS} ${SOURCES} ${UI_FORMS})
target_link_libraries(Certificates ${QT_LIBRARIES} ${iris_LIB})
target_include_directories(Certificates PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
3 changes: 2 additions & 1 deletion src/Certificates/CertificateDisplayDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QDateTime>
#include <QLabel>
#include <QPushButton>
#include <QRegularExpression>
#include <QtCrypto>

CertificateDisplayDialog::CertificateDisplayDialog(const QCA::Certificate &cert, int result, QCA::Validity validity,
Expand Down Expand Up @@ -66,7 +67,7 @@ CertificateDisplayDialog::CertificateDisplayDialog(const QCA::Certificate &cert,
QString hashstr = QCA::Hash(i == 0 ? "md5" : "sha1")
.hashToString(cert.toDER())
.toUpper()
.replace(QRegExp("(..)"), ":\\1")
.replace(QRegularExpression("(..)"), ":\\1")
.mid(1);
str += QString("Fingerprint(%1): %2<br>").arg(i == 0 ? "MD5" : "SHA-1", hashstr);
}
Expand Down
2 changes: 1 addition & 1 deletion src/avcall/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(FORMS
call.ui
)

qt5_wrap_ui(UI_FORMS ${FORMS})
qt_wrap_ui(UI_FORMS ${FORMS})
add_library(avcall STATIC ${SOURCES} ${HEADERS} ${UI_FORMS})
add_dependencies(avcall build_ui_files)
target_link_libraries(avcall ${QT_LIBRARIES} ${iris_LIB} libpsi_tools widgets)
Expand Down
4 changes: 2 additions & 2 deletions src/chatview_te.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
//#define CORRECTION_DEBUG

static const char * informationalColorOpt = "options.ui.look.colors.messages.informational";
static const QRegExp underlineFixRE("(<a href=\"addnick://psi/[^\"]*\"><span style=\")");
static const QRegExp removeTagsRE("<[^>]*>");
static const QRegularExpression underlineFixRE("(<a href=\"addnick://psi/[^\"]*\"><span style=\")");
static const QRegularExpression removeTagsRE("<[^>]*>");

//----------------------------------------------------------------------------
// ChatView
Expand Down
2 changes: 1 addition & 1 deletion src/chatview_webkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class ChatViewPrivate {

static QString closeIconTags(const QString &richText)
{
static QRegExp mIcon("(<icon [^>]+>)");
static QRegularExpression mIcon("(<icon [^>]+>)");
QString s(richText);
s.replace(mIcon, "\\1</icon>");
return s;
Expand Down
4 changes: 2 additions & 2 deletions src/chatviewcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "psioptions.h"

#include <QApplication>
#include <QRegExp>
#include <QRegularExpression>
#include <QWidget>
#include <math.h>

Expand All @@ -49,7 +49,7 @@ QString ChatViewCommon::getMucNickColor(const QString &nick, bool isSelf)
}

QString nickwoun = nick; // nick without underscores
nickwoun.remove(QRegExp("(^_*|_*$)"));
nickwoun.remove(QRegularExpression("(^_*|_*$)"));

if (PsiOptions::instance()->getOption("options.ui.muc.use-hash-nick-coloring").toBool()) {
/* Hash-driven colors */
Expand Down
8 changes: 4 additions & 4 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <QObject>
#include <QPaintDevice>
#include <QProcess>
#include <QRegExp>
#include <QRegularExpression>
#include <QSound>
#include <QUrl>
#include <QUuid>
Expand Down Expand Up @@ -192,9 +192,9 @@ QString status2txt(int status)

QString logencode(QString str)
{
str.replace(QRegExp("\\\\"), "\\\\"); // backslash to double-backslash
str.replace(QRegExp("\\|"), "\\p"); // pipe to \p
str.replace(QRegExp("\n"), "\\n"); // newline to \n
str.replace(QRegularExpression("\\\\"), "\\\\"); // backslash to double-backslash
str.replace(QRegularExpression("\\|"), "\\p"); // pipe to \p
str.replace(QRegularExpression("\n"), "\\n"); // newline to \n
return str;
}

Expand Down
2 changes: 1 addition & 1 deletion src/contactmanager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ list(APPEND FORMS
contactmanagerdlg.ui
)

qt5_wrap_ui(UI_FORMS ${FORMS})
qt_wrap_ui(UI_FORMS ${FORMS})
add_library(contactmanager STATIC ${HEADERS} ${SOURCES} ${UI_FORMS})
target_link_libraries(contactmanager ${QT_LIBRARIES} widgets)
target_include_directories(contactmanager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
4 changes: 2 additions & 2 deletions src/contactmanager/contactmanagermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ void ContactManagerModel::invertByMatch(int columnIndex, int matchType, const QS
emit layoutAboutToBeChanged();
Role columnRole = roles[columnIndex];
QString data;
QRegExp reg;
QRegularExpression reg;
if (matchType == ContactManagerModel::RegexpMatch) {
reg = QRegExp(str);
reg = QRegularExpression(str);
}
for (UserListItem *u : qAsConst(_userList)) {
data = userFieldString(u, columnRole);
Expand Down
2 changes: 1 addition & 1 deletion src/desktoputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ QString defaultBrowser()
{
QSettings settings("HKEY_CLASSES_ROOT\\HTTP\\shell\\open\\command", QSettings::NativeFormat);
QString command = settings.value(".").toString();
QRegExp rx("\"(.+)\"");
QRegularExpression rx("\"(.+)\"");
if (rx.indexIn(command) != -1)
return rx.capturedTexts()[1];
return command;
Expand Down
2 changes: 1 addition & 1 deletion src/groupchatdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ void GCMainDlg::message(const Message &_m, const PsiEvent::Ptr &e)
tv.setDateTime(m.timeStamp());

ui_.le_topic->setText(
topic.replace("\n\n", " || ").replace("\n", " | ").replace("\t", " ").replace(QRegExp("\\s{2,}"), " "));
topic.replace("\n\n", " || ").replace("\n", " | ").replace("\t", " ").replace(QRegularExpression("\\s{2,}"), " "));
ui_.le_topic->setCursorPosition(0);
ui_.le_topic->setToolTip(QString("<qt><p>%1</p></qt>").arg(subjectTooltip));

Expand Down
2 changes: 1 addition & 1 deletion src/mcmdmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ QString MCmdManager::serializeCommand(const QStringList &list)
{
QString retval;
bool needspace = false;
QRegExp specials("([\"\'\\\\ ])");
QRegularExpression specials("([\"\'\\\\ ])");
for (QString item : list) {
item.replace(specials, "\\\\1");
if (item == "")
Expand Down
Loading

0 comments on commit 07beb9b

Please sign in to comment.