From ce6fbdaa7aa2379a4c42470f071a2c56b074b5ea Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 3 Nov 2014 14:21:19 +0100 Subject: [PATCH] New package: obconf-qt. --- srcpkgs/obconf-qt/patches/qt5.patch | 138 ++++++++++++++++++++++++++++ srcpkgs/obconf-qt/qt5.patch | 138 ++++++++++++++++++++++++++++ srcpkgs/obconf-qt/template | 16 ++++ 3 files changed, 292 insertions(+) create mode 100644 srcpkgs/obconf-qt/patches/qt5.patch create mode 100644 srcpkgs/obconf-qt/qt5.patch create mode 100644 srcpkgs/obconf-qt/template diff --git a/srcpkgs/obconf-qt/patches/qt5.patch b/srcpkgs/obconf-qt/patches/qt5.patch new file mode 100644 index 0000000000..bc0bdd848c --- /dev/null +++ b/srcpkgs/obconf-qt/patches/qt5.patch @@ -0,0 +1,138 @@ +commit 49a4067c58711130848cf4a30a0c4eedead405ac +Author: Hong Jen Yee (PCMan) +Date: Sat Jun 21 05:55:22 2014 +0100 + + Support Qt5. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f32926..3824bd9 100644 +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -4,7 +4,23 @@ cmake_minimum_required(VERSION 2.8.6) + + find_program(SED_PROGRAM sed) + +-find_package(Qt4 REQUIRED QtCore QtGui) # Qt ++# Support Qt5 ++option(USE_QT5 "Build with Qt5." $ENV{USE_QT5}) ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++set(CMAKE_AUTOMOC ON) ++if(USE_QT5) ++ cmake_minimum_required(VERSION 2.8.11) ++ find_package(Qt5Widgets REQUIRED) ++ find_package(Qt5X11Extras REQUIRED) ++ find_package(Qt5LinguistTools REQUIRED QUIET) ++ message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}") ++else() ++ find_package(Qt4 REQUIRED QtCore QtGui) # Qt ++ include(${QT_USE_FILE}) ++ message(STATUS "Building with Qt${QTVERSION}") ++endif() ++ + find_package(PkgConfig) + pkg_check_modules(GLIB REQUIRED + glib-2.0 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 218b72e..4057097 100644 +--- src/CMakeLists.txt ++++ src/CMakeLists.txt +@@ -1,17 +1,21 @@ + # set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code + set(CMAKE_CXX_FLAGS "-DQT_NO_KEYWORDS -fno-exceptions") + ++if(USE_QT5) ++ set(QTX_INCLUDE_DIRS "") ++ set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras) ++else() ++ set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR}) ++ set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY}) ++endif() ++ + include_directories( +- ${QT_INCLUDES} ++ ${QTX_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} + ${OPENBOX_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +- ${CMAKE_CURRENT_SOURCE_DIR} +- + ) + +-set(CMAKE_AUTOMOC TRUE) +- + set(obconf-qt_SRCS + obconf-qt.cpp + maindialog.cpp +@@ -32,9 +36,11 @@ set(obconf-qt_UIS + obconf.ui + ) + +-qt4_wrap_ui(obconf-qt_UI_H +- ${obconf-qt_UIS} +-) ++if(USE_QT5) ++ qt5_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) ++else() ++ qt4_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) ++endif() + + # The ui code generated by Qt uic contains QMetaObject::connectSlotsByName() + # but we don't want that. Fix it with sed. +@@ -51,14 +57,25 @@ add_custom_command( + + # add translation for obconf-qt + option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files") +-if (UPDATE_TRANSLATIONS) +- qt4_create_translation(QM_FILES +- ${obconf-qt_SRCS} +- ${obconf-qt_UI_H} +- ${TS_FILES}) +-else (UPDATE_TRANSLATIONS) +- qt4_add_translation(QM_FILES ${TS_FILES}) +-endif (UPDATE_TRANSLATIONS) ++if(USE_QT5) ++ if (UPDATE_TRANSLATIONS) ++ qt5_create_translation(QM_FILES ++ ${obconf-qt_SRCS} ++ ${obconf-qt_UI_H} ++ ${TS_FILES}) ++ else (UPDATE_TRANSLATIONS) ++ qt5_add_translation(QM_FILES ${TS_FILES}) ++ endif (UPDATE_TRANSLATIONS) ++else(USE_QT5) # use qt4 ++ if (UPDATE_TRANSLATIONS) ++ qt4_create_translation(QM_FILES ++ ${obconf-qt_SRCS} ++ ${obconf-qt_UI_H} ++ ${TS_FILES}) ++ else (UPDATE_TRANSLATIONS) ++ qt4_add_translation(QM_FILES ${TS_FILES}) ++ endif (UPDATE_TRANSLATIONS) ++endif(USE_QT5) + add_custom_target (obconf-qt_translations DEPENDS ${QM_FILES}) + install(FILES ${QM_FILES} DESTINATION share/obconf-qt/translations) + # prevent the generated files from being deleted during make clean +@@ -78,8 +95,7 @@ add_definitions( + ) + + target_link_libraries(obconf-qt +- ${QT_QTCORE_LIBRARY} +- ${QT_QTGUI_LIBRARY} ++ ${QTX_LIBRARIES} + ${GLIB_LIBRARIES} + ${OPENBOX_LIBRARIES} + ) +diff --git a/src/appearance.cpp b/src/appearance.cpp +index 316455c..64d1cf3 100644 +--- src/appearance.cpp ++++ src/appearance.cpp +@@ -79,7 +79,7 @@ void MainDialog::on_title_layout_textChanged(const QString& text) { + QByteArray layout; + // omit unknown chars + for(int i = 0; i < text.length(); ++i) { +- char ch = text.at(i).toUpper().toAscii(); ++ char ch = text.at(i).toUpper().toLatin1(); + if(strchr("NDSLIMC", ch)) + layout += ch; + } diff --git a/srcpkgs/obconf-qt/qt5.patch b/srcpkgs/obconf-qt/qt5.patch new file mode 100644 index 0000000000..a9a5913f38 --- /dev/null +++ b/srcpkgs/obconf-qt/qt5.patch @@ -0,0 +1,138 @@ +commit 49a4067c58711130848cf4a30a0c4eedead405ac +Author: Hong Jen Yee (PCMan) +Date: Sat Jun 21 05:55:22 2014 +0100 + + Support Qt5. + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f32926..3824bd9 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,7 +4,23 @@ cmake_minimum_required(VERSION 2.8.6) + + find_program(SED_PROGRAM sed) + +-find_package(Qt4 REQUIRED QtCore QtGui) # Qt ++# Support Qt5 ++option(USE_QT5 "Build with Qt5." $ENV{USE_QT5}) ++set(CMAKE_INCLUDE_CURRENT_DIR ON) ++set(CMAKE_POSITION_INDEPENDENT_CODE ON) ++set(CMAKE_AUTOMOC ON) ++if(USE_QT5) ++ cmake_minimum_required(VERSION 2.8.11) ++ find_package(Qt5Widgets REQUIRED) ++ find_package(Qt5X11Extras REQUIRED) ++ find_package(Qt5LinguistTools REQUIRED QUIET) ++ message(STATUS "Building with Qt${Qt5Core_VERSION_STRING}") ++else() ++ find_package(Qt4 REQUIRED QtCore QtGui) # Qt ++ include(${QT_USE_FILE}) ++ message(STATUS "Building with Qt${QTVERSION}") ++endif() ++ + find_package(PkgConfig) + pkg_check_modules(GLIB REQUIRED + glib-2.0 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 218b72e..4057097 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -1,17 +1,21 @@ + # set visibility to hidden to hide symbols, unlesss they're exporeted manually in the code + set(CMAKE_CXX_FLAGS "-DQT_NO_KEYWORDS -fno-exceptions") + ++if(USE_QT5) ++ set(QTX_INCLUDE_DIRS "") ++ set(QTX_LIBRARIES Qt5::Widgets Qt5::X11Extras) ++else() ++ set(QTX_INCLUDE_DIRS ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTDBUS_DIR}) ++ set(QTX_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTDBUS_LIBRARY}) ++endif() ++ + include_directories( +- ${QT_INCLUDES} ++ ${QTX_INCLUDE_DIRS} + ${GLIB_INCLUDE_DIRS} + ${OPENBOX_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +- ${CMAKE_CURRENT_SOURCE_DIR} +- + ) + +-set(CMAKE_AUTOMOC TRUE) +- + set(obconf-qt_SRCS + obconf-qt.cpp + maindialog.cpp +@@ -32,9 +36,11 @@ set(obconf-qt_UIS + obconf.ui + ) + +-qt4_wrap_ui(obconf-qt_UI_H +- ${obconf-qt_UIS} +-) ++if(USE_QT5) ++ qt5_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) ++else() ++ qt4_wrap_ui(obconf-qt_UI_H ${obconf-qt_UIS}) ++endif() + + # The ui code generated by Qt uic contains QMetaObject::connectSlotsByName() + # but we don't want that. Fix it with sed. +@@ -51,14 +57,25 @@ add_custom_command( + + # add translation for obconf-qt + option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts files") +-if (UPDATE_TRANSLATIONS) +- qt4_create_translation(QM_FILES +- ${obconf-qt_SRCS} +- ${obconf-qt_UI_H} +- ${TS_FILES}) +-else (UPDATE_TRANSLATIONS) +- qt4_add_translation(QM_FILES ${TS_FILES}) +-endif (UPDATE_TRANSLATIONS) ++if(USE_QT5) ++ if (UPDATE_TRANSLATIONS) ++ qt5_create_translation(QM_FILES ++ ${obconf-qt_SRCS} ++ ${obconf-qt_UI_H} ++ ${TS_FILES}) ++ else (UPDATE_TRANSLATIONS) ++ qt5_add_translation(QM_FILES ${TS_FILES}) ++ endif (UPDATE_TRANSLATIONS) ++else(USE_QT5) # use qt4 ++ if (UPDATE_TRANSLATIONS) ++ qt4_create_translation(QM_FILES ++ ${obconf-qt_SRCS} ++ ${obconf-qt_UI_H} ++ ${TS_FILES}) ++ else (UPDATE_TRANSLATIONS) ++ qt4_add_translation(QM_FILES ${TS_FILES}) ++ endif (UPDATE_TRANSLATIONS) ++endif(USE_QT5) + add_custom_target (obconf-qt_translations DEPENDS ${QM_FILES}) + install(FILES ${QM_FILES} DESTINATION share/obconf-qt/translations) + # prevent the generated files from being deleted during make clean +@@ -78,8 +95,7 @@ add_definitions( + ) + + target_link_libraries(obconf-qt +- ${QT_QTCORE_LIBRARY} +- ${QT_QTGUI_LIBRARY} ++ ${QTX_LIBRARIES} + ${GLIB_LIBRARIES} + ${OPENBOX_LIBRARIES} + ) +diff --git a/src/appearance.cpp b/src/appearance.cpp +index 316455c..64d1cf3 100644 +--- a/src/appearance.cpp ++++ b/src/appearance.cpp +@@ -79,7 +79,7 @@ void MainDialog::on_title_layout_textChanged(const QString& text) { + QByteArray layout; + // omit unknown chars + for(int i = 0; i < text.length(); ++i) { +- char ch = text.at(i).toUpper().toAscii(); ++ char ch = text.at(i).toUpper().toLatin1(); + if(strchr("NDSLIMC", ch)) + layout += ch; + } diff --git a/srcpkgs/obconf-qt/template b/srcpkgs/obconf-qt/template new file mode 100644 index 0000000000..d366d938aa --- /dev/null +++ b/srcpkgs/obconf-qt/template @@ -0,0 +1,16 @@ +# Template file for 'obconf-qt' +pkgname=obconf-qt +version=0.1.0 +revision=1 +create_wrksrc=yes +build_style=cmake +configure_args="-DUSE_QT5=1" +hostmakedepends="cmake pkg-config" +makedepends="qt5-x11extras-devel qt5-tools-devel libSM-devel openbox-devel" +depends="desktop-file-utils" +short_desc="LXQT Openbox configuration UI" +maintainer="Juan RP " +license="LGPL-2.1" +homepage="http://lxqt.org/" +distfiles="http://lxqt.org/downloads/${pkgname}/${version}/${pkgname}-${version}.tar.xz" +checksum=4831bfc06eff0529697a51196c1d7866cb12e3b19a0724e8201dbdfd2bca082b