Commit bda280bb authored by Rafał Malinowski's avatar Rafał Malinowski

Merge branch 'qt5-playground'

Conflicts:
	kadu-core/chat-style/chat-style-manager.cpp
	kadu-core/chat-style/engine/adium/adium-time-formatter.cpp
	kadu-core/chat/html-messages-renderer.cpp
	kadu-core/chat/style-engines/chat-engine-adium/chat-engine-
adium.cpp
	kadu-core/chat/style-engines/chat-engine-kadu/chat-engine-
kadu.cpp
	kadu-core/gui/widgets/chat-messages-view.cpp
	kadu-core/gui/widgets/configuration/config-preview.cpp
	kadu-core/gui/widgets/plugin-list/plugin-list-widget-item-
delegate.cpp
	kadu-core/gui/widgets/plugin-list/plugin-list-widget.cpp
	plugins/gadu_protocol/gui/widgets/gadu-create-account-widget.cpp
	plugins/gadu_protocol/gui/widgets/gadu-create-account-widget.h
	plugins/gadu_protocol/gui/widgets/token-widget.cpp
	plugins/gadu_protocol/gui/widgets/token-widget.h
	plugins/gadu_protocol/gui/windows/gadu-change-password-
window.cpp
	plugins/gadu_protocol/gui/windows/gadu-change-password-window.h
	plugins/gadu_protocol/gui/windows/gadu-remind-password-
window.cpp
	plugins/gadu_protocol/gui/windows/gadu-remind-password-window.h
	plugins/gadu_protocol/gui/windows/gadu-unregister-account-
window.cpp
	plugins/gadu_protocol/gui/windows/gadu-unregister-account-
window.h
	plugins/gadu_protocol/gui/windows/gadu-wait-for-account-
register-window.cpp
	plugins/gadu_protocol/server/gadu-token-fetcher.cpp
	plugins/gadu_protocol/server/gadu-token-fetcher.h
parents 1e06e8ad 13d18b1f
project (Kadu)
cmake_minimum_required (VERSION 2.8.10)
cmake_minimum_required (VERSION 2.8.11)
# Options (some of them)
......@@ -27,7 +27,7 @@ endif ()
# C++11 support, warnings and other flags
set (DEFINITIONS QT_USE_QSTRINGBUILDER QT_NO_CAST_TO_ASCII)
set (DEFINITIONS QT_USE_QSTRINGBUILDER QT_NO_CAST_TO_ASCII QT_DISABLE_DEPRECATED_BEFORE=0x040900)
if (BUILD_TESTING)
list (APPEND DEFINITIONS KADU_EXPORT_TESTS)
endif ()
......@@ -280,7 +280,7 @@ if (NOT WIN32)
endif ()
endif ()
include_directories (${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/kadu-core ${QT_INCLUDES})
include_directories (${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/kadu-core)
add_subdirectory (kadu-core)
add_subdirectory (varia)
......
......@@ -48,11 +48,11 @@ set (DEFAULT_PLUGINS
# General sound plugin
sound
# Phonon sound support
phonon_sound
#phonon_sound
# External sound player support
ext_sound
# QtSound sound support
qt4_sound
#qt4_sound
# mediaplayer
# Media players support plugin
......@@ -62,9 +62,9 @@ set (DEFAULT_PLUGINS
# Antistring
antistring
# Auto away module
autoaway
#autoaway
# Auto hide Kadu window
auto_hide
#auto_hide
# Autoresponder plugin
autoresponder
# Autostatus
......@@ -80,7 +80,7 @@ set (DEFAULT_PLUGINS
# Protection against unwanted chats
firewall
# Idle time counter
idle
#idle
# Shows image links and youtube links as images and videos in chat
imagelink
# Last status infos
......@@ -88,7 +88,7 @@ set (DEFAULT_PLUGINS
# Imports profiles from old Kadu
profiles_import
# Easily take screenshots and send as images
screenshot
#screenshot
# Simple view - neww port for 0.11.0
simpleview
# Single window mode
......
......@@ -8,7 +8,7 @@
# Copyright (c) 2009, Ruslan Nigmatullin, <[email protected]>
# Copyrignt (c) 2011, Rafał 'Vogel' Malinowski <[email protected]>
cmake_minimum_required (VERSION 2.8.10)
cmake_minimum_required (VERSION 2.8.11)
# Set default install prefix
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
......@@ -21,15 +21,14 @@ if (NOT DEFINED CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
endif ()
# libraries
set (QT_USE_QTXML 1)
set (QT_USE_QTNETWORK 1)
set (QT_USE_QTWEBKIT 1)
set (QT_USE_QTDECLARATIVE 1)
if (UNIX AND NOT APPLE)
set (QT_USE_QTDBUS 1)
endif ()
find_package (Qt4 4.8.0 REQUIRED)
include (${QT_USE_FILE})
# TODO: support cmake parameters for this
find_package (Qt5Core 5.1)
if (Qt5Core_FOUND)
find_package (Qt5LinguistTools REQUIRED)
else ()
set (QT_USE_IMPORTED_TARGETS TRUE)
find_package (Qt4 4.8 REQUIRED)
endif()
macro (kadu_numeric_version _version _result_variable)
# Remove non-digit suffixes like "-git".
......@@ -101,6 +100,7 @@ function (kadu_plugin KADU_PLUGIN_NAME)
PLUGIN_DATA_DIRECTORIES
PLUGIN_DEPENDENCIES
PLUGIN_LIBRARIES
PLUGIN_ADDITIONAL_QT_MODULES
)
cmake_parse_arguments (KADU "" "" "${_multi_value_keywords}" ${ARGN})
......@@ -150,7 +150,11 @@ function (kadu_plugin KADU_PLUGIN_NAME)
endif ()
if (_translation_sources)
qt4_add_translation (_translation_files ${_translation_sources})
if (Qt5Core_FOUND)
qt5_add_translation (_translation_files ${_translation_sources})
else ()
qt4_add_translation (_translation_files ${_translation_sources})
endif ()
install (FILES ${_translation_files}
DESTINATION ${KADU_INSTALL_PLUGINS_DATA_DIR}/translations
......@@ -179,8 +183,26 @@ function (kadu_plugin KADU_PLUGIN_NAME)
endforeach ()
endif ()
if (Qt5Core_FOUND)
qt5_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE Core Gui Widgets Network Xml WebKit WebKitWidgets Declarative)
if (UNIX AND NOT APPLE)
qt5_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE DBus)
endif ()
if (KADU_PLUGIN_ADDITIONAL_QT_MODULES)
qt5_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE ${KADU_PLUGIN_ADDITIONAL_QT_MODULES})
endif ()
else ()
qt4_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE Core Gui Network Xml WebKit Declarative)
if (UNIX AND NOT APPLE)
qt4_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE DBus)
endif ()
if (KADU_PLUGIN_ADDITIONAL_QT_MODULES)
qt4_use_modules (${KADU_PLUGIN_NAME} LINK_PRIVATE ${KADU_PLUGIN_ADDITIONAL_QT_MODULES})
endif ()
endif ()
target_link_libraries (${KADU_PLUGIN_NAME} LINK_PRIVATE
${KADU_LIBRARIES} ${KADU_PLUGIN_DEPENDENCIES} ${KADU_PLUGIN_LIBRARIES} ${QT_LIBRARIES}
${KADU_LIBRARIES} ${KADU_PLUGIN_DEPENDENCIES} ${KADU_PLUGIN_LIBRARIES}
)
configure_file ("${KADU_SDK_DIR}/plugins/PluginConfig.cmake.in" "${CMAKE_BINARY_DIR}/KaduPlugin_${KADU_PLUGIN_NAME}Config.cmake" @ONLY)
......
......@@ -23,16 +23,23 @@ if (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
else (QCA2_INCLUDE_DIR AND QCA2_LIBRARIES)
if (Qt5Core_FOUND)
set (QCA_QCA_NAME qca-qt5)
set (QCA_QCA2_NAME qca2-qt5)
else (Qt5Core_FOUND)
set (QCA_QCA_NAME qca)
set (QCA_QCA2_NAME qca2)
endif (Qt5Core_FOUND)
if (NOT WIN32)
find_package(PkgConfig)
pkg_check_modules(PC_QCA2 QUIET qca2)
pkg_check_modules(PC_QCA2 QUIET ${QCA_QCA2_NAME})
set(QCA2_DEFINITIONS ${PC_QCA2_CFLAGS_OTHER})
endif (NOT WIN32)
find_library_with_debug(QCA2_LIBRARIES
WIN32_DEBUG_POSTFIX d
NAMES qca qca2
NAMES ${QCA_QCA_NAME} ${QCA_QCA2_NAME}
HINTS ${PC_QCA2_LIBDIR} ${PC_QCA2_LIBRARY_DIRS}
)
......
......@@ -11,7 +11,7 @@ else ()
message (STATUS "Fast (re)linking disabled")
endif ()
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT Qt5Core_FOUND)
if (NOT DEFINED WITH_LIBINDICATE_QT OR WITH_LIBINDICATE_QT)
find_package (PkgConfig)
pkg_search_module (LIBINDICATE_QT indicate-qt)
......@@ -38,12 +38,12 @@ if (UNIX AND NOT APPLE)
endif ()
endif ()
if (NOT DEFINED NETWORK_IMPLEMENTATION OR "${NETWORK_IMPLEMENTATION}" STREQUAL "ntrack")
if ((NOT DEFINED NETWORK_IMPLEMENTATION AND NOT Qt5Core_FOUND) OR "${NETWORK_IMPLEMENTATION}" STREQUAL "ntrack")
find_package (QNtrack 010)
endif ()
if (NOT DEFINED NETWORK_IMPLEMENTATION)
if (QNTRACK_FOUND)
if (QNTRACK_FOUND AND NOT Qt5Core_FOUND)
message (STATUS "No NETWORK_IMPLEMENTATION defined. Autodetected implementation: ntrack")
set (NETWORK_IMPLEMENTATION "ntrack")
else ()
......@@ -85,7 +85,7 @@ else ()
)
endif ()
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT Qt5Core_FOUND)
list (APPEND kadu_SRCS
os/x11tools.cpp
)
......@@ -149,10 +149,12 @@ set (kadu_SUBDIRS
url-handlers
)
find_package (QCA2 REQUIRED)
include_directories (${QCA2_INCLUDE_DIR})
add_definitions (${QCA2_DEFINITIONS})
list (APPEND ADDITIONAL_LIBRARIES ${QCA2_LIBRARIES})
if (NOT Qt5Core_FOUND)
find_package (QCA2 REQUIRED)
include_directories (${QCA2_INCLUDE_DIR})
add_definitions (${QCA2_DEFINITIONS})
list (APPEND ADDITIONAL_LIBRARIES ${QCA2_LIBRARIES})
endif ()
find_package (LibArchive 2.6.0 REQUIRED)
include (CheckLibraryExists)
......@@ -165,7 +167,7 @@ endif ()
include_directories (${LibArchive_INCLUDE_DIRS})
list (APPEND ADDITIONAL_LIBRARIES ${LibArchive_LIBRARIES})
if (UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE AND NOT Qt5Core_FOUND)
find_package (X11 REQUIRED COMPONENTS X11 Xutil Xfixes)
if (X11_FOUND AND X11_Xutil_FOUND AND X11_Xfixes_FOUND)
message (STATUS "Found required X11 libraries: ${X11_X11_LIB};${X11_Xfixes_LIB}")
......@@ -229,11 +231,28 @@ if (FAST_LINKING)
endif ()
endif ()
target_link_libraries (libkadu LINK_PRIVATE ${QT_LIBRARIES} ${ADDITIONAL_LIBRARIES})
if (Qt5Core_FOUND)
qt5_use_modules (libkadu LINK_PRIVATE Core Gui Widgets Xml Network WebKit WebKitWidgets Declarative)
if (UNIX AND NOT APPLE)
qt5_use_modules (libkadu LINK_PRIVATE DBus)
endif ()
else ()
qt4_use_modules (libkadu LINK_PRIVATE Core Gui Xml Network WebKit Declarative)
if (UNIX AND NOT APPLE)
qt4_use_modules (libkadu LINK_PRIVATE DBus)
endif ()
endif ()
target_link_libraries (libkadu LINK_PRIVATE ${ADDITIONAL_LIBRARIES})
add_executable (kadu WIN32 ${main_SRCS})
kadu_set_flags (kadu)
target_link_libraries (kadu LINK_PRIVATE libkadu ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
if (Qt5Core_FOUND)
qt5_use_modules (kadu LINK_PRIVATE Core Gui Widgets Network Xml)
else ()
qt4_use_modules (kadu LINK_PRIVATE Core Gui Network Xml)
endif ()
target_link_libraries (kadu LINK_PRIVATE libkadu)
if (NOT IS_ABSOLUTE "${KADU_INSTALL_LIB_DIR}")
set (install_full_lib_dir "${CMAKE_INSTALL_PREFIX}/${KADU_INSTALL_LIB_DIR}")
else ()
......@@ -259,9 +278,19 @@ if (WIN32)
kadu_set_flags (kadu_c)
set_property (TARGET kadu_c APPEND PROPERTY COMPILE_DEFINITIONS KADU_CONSOLE)
if (Qt5Core_FOUND)
set_property (TARGET kadu_c PROPERTY Qt5_NO_LINK_QTMAIN TRUE)
else ()
set_property (TARGET kadu_c PROPERTY QT4_NO_LINK_QTMAIN TRUE)
endif ()
target_link_libraries (kadu LINK_PRIVATE ws2_32)
target_link_libraries (kadu_c LINK_PRIVATE libkadu ${QT_LIBRARIES} ws2_32)
if (Qt5Core_FOUND)
qt5_use_modules (kadu_c LINK_PRIVATE Core Gui Widgets Network Xml)
else ()
qt4_use_modules (kadu_c LINK_PRIVATE Core Gui Network Xml)
endif ()
target_link_libraries (kadu_c LINK_PRIVATE libkadu ws2_32)
install (TARGETS kadu_c DESTINATION ${KADU_INSTALL_BIN_DIR})
......
......@@ -26,7 +26,7 @@
#ifndef ACCOUNTS_PROXY_MODEL_H
#define ACCOUNTS_PROXY_MODEL_H
#include <QtGui/QSortFilterProxyModel>
#include <QtCore/QSortFilterProxyModel>
class AbstractAccountFilter;
......
#include <QtGui/QWidget>
#include <QtWidgets/QWidget>
#include "activate.h"
......
......@@ -42,10 +42,12 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QLabel>
#include <QtGui/QPalette>
#include <QtWidgets/QPushButton>
static bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
{
......
......@@ -20,8 +20,11 @@
#include "os/generic/system-info.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QChar>
#include <QtCore/QDateTime>
#include <QtCore/QLocale>
#include <QtCore/QString>
#include <QtWidgets/QApplication>
namespace AdiumTimeFormatter
{
......
......@@ -27,6 +27,8 @@
#include "chat-list-model.h"
#define NO_PARENT_ID 0xffffff
ChatListModel::ChatListModel(QObject *parent) :
QAbstractItemModel(parent)
{
......@@ -98,7 +100,7 @@ void ChatListModel::removeChat(const Chat &chat)
QModelIndex ChatListModel::index(int row, int column, const QModelIndex &parent) const
{
return hasIndex(row, column, parent) ? createIndex(row, column, parent.isValid() ? parent.row() : -1) : QModelIndex();
return hasIndex(row, column, parent) ? createIndex(row, column, parent.isValid() ? parent.row() : NO_PARENT_ID) : QModelIndex();
}
int ChatListModel::columnCount(const QModelIndex &parent) const
......@@ -132,7 +134,7 @@ QFlags<Qt::ItemFlag> ChatListModel::flags(const QModelIndex& index) const
QModelIndex ChatListModel::parent(const QModelIndex &child) const
{
if (-1 == child.internalId())
if (NO_PARENT_ID == child.internalId())
return QModelIndex();
else
return index(static_cast<int>(child.internalId()), 0, QModelIndex());
......
......@@ -34,7 +34,7 @@
#include <QtCore/QMutexLocker>
#include <QtCore/QTextCodec>
#include <QtCore/QTextStream>
#include <QtGui/QApplication>
#include <QtWidgets/QApplication>
#include "configuration/xml-configuration-file.h"
#include "misc/misc.h"
......
......@@ -23,7 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui/QApplication>
#include <QtWidgets/QApplication>
#include "configuration/toolbar-configuration-manager.h"
#include "configuration/xml-configuration-file.h"
......
......@@ -32,9 +32,11 @@
#include <QtCore/QLocale>
#include <QtCore/QSettings>
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtWidgets/QApplication>
#if QT_VERSION < 0x050000
#include <QtCrypto>
#endif
#include "accounts/account-manager.h"
#include "avatars/avatar-manager.h"
......@@ -214,7 +216,10 @@ Core::Core() :
CurrentPluginManager{nullptr},
Window(0),
Myself(Buddy::create()), IsClosing(false),
ShowMainWindowOnStart(true), QcaInit(new QCA::Initializer())
ShowMainWindowOnStart(true)
#if QT_VERSION < 0x050000
, QcaInit(new QCA::Initializer())
#endif
{
// must be created first
CurrentStoragePointFactory = new StoragePointFactory(this);
......@@ -270,11 +275,12 @@ Core::~Core()
triggerAllAccountsUnregistered();
#if QT_VERSION < 0x050000
// Sometimes it causes crash which I don't understand. For me 100% reproducible
// if Kadu was compiled with Clang and we logged in to a jabber account. --beevvy
// TODO: fix it
// delete QcaInit;
// QcaInit = 0;
#endif
}
void Core::import_0_6_5_configuration()
......
......@@ -45,10 +45,12 @@
template<class T>
class DefaultProvider;
#if QT_VERSION < 0x050000
namespace QCA
{
class Initializer;
}
#endif
class AccountConfigurationWidgetFactoryRepository;
class BuddyConfigurationWidgetFactoryRepository;
......@@ -167,10 +169,12 @@ class KADUAPI Core : public QObject, private AccountsAwareObject, public Configu
bool IsClosing;
bool ShowMainWindowOnStart; // TODO: 0.11.0, it is a hack
#if QT_VERSION < 0x050000
// NOTE: Kadu core itself doesn't use QCA, but important plugins do. And QCA lib
// isn't very well suited to be unloaded, so we just link to it in core and initialize
// here.
QCA::Initializer *QcaInit;
#endif
Core();
virtual ~Core();
......
......@@ -21,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui/QFileDialog>
#include <QtWidgets/QFileDialog>
#include "configuration/configuration-file.h"
#include "contacts/contact-set.h"
......
......@@ -25,7 +25,7 @@
#ifndef FILE_TRANSFER_ACTIONS_H
#define FILE_TRANSFER_ACTIONS_H
#include <QtGui/QAction>
#include <QtWidgets/QAction>