Commit 1ee81878 authored by Andi Fischer's avatar Andi Fischer
Browse files

First compilable and buildable version of umbrello on KFT.

Some changes are questinable or not done by marking with FIXME KF5.
parent a70a5478
......@@ -8,15 +8,7 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
# we need some parts of the ECM CMake helpers
find_package(ECM 1.1.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
#set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
set(QT_MIN_VERSION "5.2.0")
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
Widgets
Xml
Test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(KDECompilerSettings)
......@@ -25,6 +17,47 @@ include(FeatureSummary)
include(ECMInstallIcons)
include(ECMSetupVersion)
# search packages used by Qt
set(QT_MIN_VERSION "5.2.0")
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS
Core
DBus
Gui
PrintSupport
Svg
Test
Widgets
Xml
)
# search packages used by KDE
find_package(KF5 REQUIRED COMPONENTS
Archive
Auth
Completion
Config
CoreAddons
DocTools
GuiAddons
I18n
IconThemes
Init
KDELibs4Support
KIO
Parts
Service
TextEditor
WindowSystem
WidgetsAddons
XmlGui
)
# use some compile flags
add_definitions(
-DQT_NO_SIGNAL_SLOTS_KEYWORDS
-DQT_NO_URL_CAST_FROM_STRING
)
# set default umbrello version
# umbrello version could be overridden by cmake command line using -DUMBRELLO_VERSION_STRING=major.minor.patch
if(NOT UMBRELLO_VERSION_STRING)
......@@ -45,54 +78,38 @@ endif()
message(STATUS "Using umbrello version ${UMBRELLO_VERSION_STRING}")
add_definitions(-DUMBRELLO_VERSION_STRING="${UMBRELLO_VERSION_STRING}")
# search packages used by KDE
find_package(KF5 REQUIRED COMPONENTS
Config
DocTools
GuiAddons
I18n
Init
WindowSystem
XmlGui
)
message(STATUS "Using automoc4 version ${AUTOMOC4_VERSION}")
message(STATUS "Using cmake version ${CMAKE_VERSION}")
# The FindKDE4.cmake module sets _KDE4_PLATFORM_DEFINITIONS with
# definitions like _GNU_SOURCE that are needed on each platform.
#set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS} -DQT_STRICT_ITERATORS)
find_package(LibXslt)
#macro_log_feature(LIBXSLT_FOUND "LibXSLT" "A library to transform XMLfiles into other XML files" #"http://xmlsoft.org/XSLT" FALSE "" "Required to build Umbrello.")
set_package_properties(LibXslt PROPERTIES
DESCRIPTION "A library to transform XMLfiles into other XML files."
URL "http://xmlsoft.org/XSLT"
TYPE REQUIRED)
find_package(LibXml2)
#macro_log_feature(LIBXML2_FOUND "LibXML2" "Libraries used to develop XML applications" "http://xmlsoft.org" FALSE "" #"Required to build Umbrello.")
set_package_properties(LibXml2 PROPERTIES
DESCRIPTION "Libraries used to develop XML applications."
URL "http://xmlsoft.org"
TYPE REQUIRED)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_INSTALL_PREFIX}/include/KF5 #FIXME
/opt/project-neon5/include/KF5/KConfigCore #FIXME
/opt/project-neon5/include/KF5/KConfigGui #FIXME
/opt/project-neon5/include/KF5/KConfigWidgets #FIXME
/opt/project-neon5/include/KF5/KDELibs4Support #FIXME
/opt/project-neon5/include/KF5/KConfigCore #FIXME
/opt/project-neon5/include/KF5/KWidgetsAddons #FIXME
/opt/project-neon5/include/KF5/KI18n #FIXME
/opt/project-neon5/include/KF5/KXmlGui #FIXME
/opt/project-neon5/include/KF5/KCompletion #FIXME
/opt/project-neon5/include/KF5/KIOCore #FIXME
/opt/project-neon5/include/KF5/KIOFileWidgets #FIXME
/opt/project-neon5/include/KF5/KIOWidgets #FIXME
/opt/project-neon5/include/KF5/KTextWidgets #FIXME
/opt/project-neon5/include/KF5/SonnetUi #FIXME
/opt/project-neon5/include/KF5/KAuth #FIXME
)
message(STATUS "===========> ${CMAKE_INSTALL_PREFIX}")
#macro_display_feature_log()
#KDE4_NO_ENABLE_FINAL(umbrello)
if(LIBXSLT_FOUND AND LIBXML2_FOUND)
add_subdirectory( umbrello )
add_subdirectory( doc )
add_subdirectory(umbrello)
add_subdirectory(doc)
# do we build the unit tests
if(KDE4_BUILD_TESTS)
ENABLE_TESTING()
......@@ -101,3 +118,5 @@ if(LIBXSLT_FOUND AND LIBXML2_FOUND)
endif(LIBXSLT_FOUND AND LIBXML2_FOUND)
set(KDE4_BUILD_TESTS ON) # for unit tests
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
......@@ -20,7 +20,7 @@
#ifndef __ast_h
#define __ast_h
#include <KSharedPtr>
#include <QExplicitlySharedDataPointer>
#include <memory>
#include <QString>
......@@ -1893,10 +1893,10 @@ private:
};
class TranslationUnitAST: public AST, public KShared
class TranslationUnitAST: public AST, public QSharedData
{
public:
typedef KSharedPtr<TranslationUnitAST> Node;
typedef QExplicitlySharedDataPointer<TranslationUnitAST> Node;
enum { Type = NodeType_TranslationUnit };
DECLARE_ALLOC(TranslationUnitAST)
......
......@@ -46,7 +46,7 @@ enum {
typedef QPair<QString, int> Dependence;
class ParsedFile;
typedef KSharedPtr<ParsedFile> ParsedFilePointer;
typedef QExplicitlySharedDataPointer<ParsedFile> ParsedFilePointer;
class ParsedFile: public AbstractParseResult
{
......
......@@ -830,7 +830,7 @@ int Lexer::macroPrimary()
{
readWhiteSpaces(false);
int result = 0;
switch (currentChar().toAscii()) {
switch (currentChar().toLatin1()) {
case '(':
nextChar();
result = macroExpression();
......
......@@ -25,7 +25,7 @@
class LexerCache;
class CachedLexedFile : public KShared, public CacheNode
class CachedLexedFile : public QSharedData, public CacheNode
{
public:
///@todo add and manage the set of included files
......@@ -113,7 +113,7 @@ private:
*/
};
typedef KSharedPtr<CachedLexedFile> CachedLexedFilePointer;
typedef QExplicitlySharedDataPointer<CachedLexedFile> CachedLexedFilePointer;
struct CachedLexedFilePointerCompare {
bool operator() (const CachedLexedFilePointer& lhs, const CachedLexedFilePointer& rhs) const
......
......@@ -28,11 +28,10 @@ Code Model - a memory symbol store.
#include "ast.h"
#include <KSharedPtr>
#include <qmap.h>
#include <QExplicitlySharedDataPointer>
#include <QMap>
#include <QStringList>
#include <qvector.h>
#include <QVector>
#include "hashedstring.h"
#include <iostream>
......@@ -45,7 +44,7 @@ enum ParsedFileType {
CppParsedFile
};
class AbstractParseResult : public KShared
class AbstractParseResult : public QSharedData
{
public:
virtual ~AbstractParseResult() {}
......@@ -56,7 +55,7 @@ public:
virtual ParsedFileType type() const = 0;
};
typedef KSharedPtr<AbstractParseResult> ParseResultPointer;
typedef QExplicitlySharedDataPointer<AbstractParseResult> ParseResultPointer;
using namespace std;
......@@ -76,90 +75,90 @@ class TypeAliasModel;
/**
@class ItemDom
Safe pointer to the @ref CodeModelItem.
This is a type definition: @code typedef KSharedPtr<CodeModelItem> ItemDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<CodeModelItem> ItemDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<CodeModelItem> ItemDom;
typedef QExplicitlySharedDataPointer<CodeModelItem> ItemDom;
/**
@class FileDom
Safe pointer to the @ref FileModel.
This is a type definition: @code typedef KSharedPtr<FileModel> FileDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<FileModel> FileDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<FileModel> FileDom;
typedef QExplicitlySharedDataPointer<FileModel> FileDom;
/**
@class NamespaceDom
Safe pointer to the @ref NamespaceModel.
This is a type definition: @code typedef KSharedPtr<NamespaceModel> NamespaceDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<NamespaceModel> NamespaceDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<NamespaceModel> NamespaceDom;
typedef QExplicitlySharedDataPointer<NamespaceModel> NamespaceDom;
/**
@class ClassDom
Safe pointer to the @ref ClassModel.
This is a type definition: @code typedef KSharedPtr<ClassModel> ClassDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<ClassModel> ClassDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<ClassModel> ClassDom;
typedef QExplicitlySharedDataPointer<ClassModel> ClassDom;
/**
@class FunctionDom
Safe pointer to the @ref FunctionModel.
This is a type definition: @code typedef KSharedPtr<FunctionModel> FunctionDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<FunctionModel> FunctionDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<FunctionModel> FunctionDom;
typedef QExplicitlySharedDataPointer<FunctionModel> FunctionDom;
/**
@class FunctionDefinitionDom
Safe pointer to the @ref FunctionDefinitionModel.
This is a type definition: @code typedef KSharedPtr<FunctionDefinitionModel> FunctionDefinitionDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<FunctionDefinitionModel> FunctionDefinitionDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<FunctionDefinitionModel> FunctionDefinitionDom;
typedef QExplicitlySharedDataPointer<FunctionDefinitionModel> FunctionDefinitionDom;
/**
@class VariableDom
Safe pointer to the @ref VariableModel.
This is a type definition: @code typedef KSharedPtr<VariableModel> VariableDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<VariableModel> VariableDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<VariableModel> VariableDom;
typedef QExplicitlySharedDataPointer<VariableModel> VariableDom;
/**
@class ArgumentDom
Safe pointer to the @ref ArgumentModel.
This is a type definition: @code typedef KSharedPtr<ArgumentModel> ArgumentDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<ArgumentModel> ArgumentDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<ArgumentModel> ArgumentDom;
typedef QExplicitlySharedDataPointer<ArgumentModel> ArgumentDom;
/**
@class EnumDom
Safe pointer to the @ref EnumModel.
This is a type definition: @code typedef KSharedPtr<EnumModel> EnumDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<EnumModel> EnumDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<EnumModel> EnumDom;
typedef QExplicitlySharedDataPointer<EnumModel> EnumDom;
/**
@class TypeAliasDom
Safe pointer to the @ref TypeAliasModel.
This is a type definition: @code typedef KSharedPtr<TypeAliasModel> TypeAliasDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<TypeAliasModel> TypeAliasDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<TypeAliasModel> TypeAliasDom;
typedef QExplicitlySharedDataPointer<TypeAliasModel> TypeAliasDom;
/**
@class EnumeratorDom
Safe pointer to the @ref EnumeratorModel.
This is a type definition: @code typedef KSharedPtr<EnumeratorModel> EnumeratorDom; @endcode
@sa KSharedPtr
This is a type definition: @code typedef QExplicitlySharedDataPointer<EnumeratorModel> EnumeratorDom; @endcode
@sa QExplicitlySharedDataPointer
*/
typedef KSharedPtr<EnumeratorModel> EnumeratorDom;
typedef QExplicitlySharedDataPointer<EnumeratorModel> EnumeratorDom;
/**
@class ItemList
......@@ -275,7 +274,7 @@ QStringList sortedNameList(const ItemList& lst)
}
/**
Casts safe code model pointers (@p KSharedPtr<T> objects like
Casts safe code model pointers (@p QExplicitlySharedDataPointer<T> objects like
FileDom, NamespaceDom, etc.) to the @p Result type.
Example:
......@@ -286,7 +285,7 @@ ClassDom cl = model_cast<ClassDom>(ns);
@param x Object to cast.
*/
template <class Result, class T>
Result model_cast(KSharedPtr<T> x)
Result model_cast(QExplicitlySharedDataPointer<T> x)
{
Result r(static_cast<T*>(x));
return r;
......@@ -462,7 +461,7 @@ variables, arguments, enums and enumerators, type aliases.
Instances of this class should be created using @ref CodeModel::create method but usually
it is better to create instances of derived classes like ClassModel, NamespaceModel, FileModel, etc.
*/
class CodeModelItem: public KShared
class CodeModelItem: public QSharedData
{
public:
/**A definition of safe pointer to the code model item.*/
......
......@@ -61,7 +61,7 @@ void HashedString::initHash()
}
class HashedStringSetData : public KShared
class HashedStringSetData : public QSharedData
{
public:
#ifdef USE_HASHMAP
......@@ -177,7 +177,9 @@ void HashedStringSet::makeDataPrivate()
m_data = new HashedStringSetData();
return ;
}
#if 0 //FIXME KF5
if (m_data.count() != 1)
#endif
m_data = new HashedStringSetData(*m_data);
}
......
......@@ -126,7 +126,7 @@ public:
private:
friend class HashedStringSetGroup;
void makeDataPrivate();
KSharedPtr<HashedStringSetData> m_data; //this implies some additional cost because KShared's destructor is virtual. Maybe change that by copying KShared without the virtual destructor.
QExplicitlySharedDataPointer<HashedStringSetData> m_data; //this implies some additional cost because QSharedData's destructor is virtual. Maybe change that by copying QSharedData without the virtual destructor.
friend HashedStringSet operator + (const HashedStringSet& lhs, const HashedStringSet& rhs);
};
......
......@@ -432,6 +432,7 @@ set(libumbrello_SRCS
toolbarstateother.cpp
toolbarstatepool.cpp
uml.cpp
umlappprivate.cpp
umlattributelist.cpp
umlcanvasobject.cpp
umlclassifierlistitemlist.cpp
......@@ -452,7 +453,6 @@ set(libumbrello_SRCS
uniqueid.cpp
usecase.cpp
worktoolbar.cpp
umlappprivate.cpp
)
kconfig_add_kcfg_files(umbrello_SRCS umbrellosettings.kcfgc)
......@@ -483,11 +483,23 @@ target_link_libraries(umbrello
Qt5::Xml
Qt5::DBus
Qt5::PrintSupport
Qt5::Svg
KF5::Archive
KF5::Auth
KF5::Completion
# KF5::Config
KF5::CoreAddons
KF5::Config
# KF5::TextEditor
KF5::I18n
KF5::IconThemes
KF5::GuiAddons
KF5::TextEditor
KF5::WidgetsAddons
KF5::WindowSystem
KF5::XmlGui
${LIBXSLT_LIBRARIES}
${LIBXML2_LIBRARIES}
KF5::KDELibs4Support
${KDE4_KFILE_LIBS} ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${KDE4_KTEXTEDITOR_LIBS})
)
install(TARGETS umbrello ${INSTALL_TARGETS_DEFAULT_ARGS} )
########### install files #############
......
......@@ -219,7 +219,7 @@ void UMLDragData::setUMLDataClip4(UMLObjectList& objects, UMLWidgetList& widgets
setData(QLatin1String("application/x-uml-clip4"), domDoc.toString().toUtf8());
QImage img = pngImage.toImage();
int l_size = img.numBytes();
int l_size = img.byteCount();
QByteArray clipdata;
clipdata.resize(l_size);
QDataStream clipstream(&clipdata, QIODevice::WriteOnly);
......
......@@ -84,7 +84,7 @@ CPPCodeGenerationForm::~CPPCodeGenerationForm()
void CPPCodeGenerationForm::browseClicked()
{
QString button = sender()->objectName();
QString file = KFileDialog::getOpenFileName(KUrl(), QLatin1String("*.h"), this, QLatin1String("Get Header File"));
QString file = KFileDialog::getOpenFileName(QUrl(), QLatin1String("*.h"), this, QLatin1String("Get Header File"));
if (file.isEmpty()) {
return;
......
......@@ -93,7 +93,7 @@ void CppImport::feedTheModel(const QString& fileName)
}
}
ParsedFilePointer ast = ms_driver->translationUnit(fileName);
if (ast.isNull()) {
if (!ast) {
uError() << fileName << " not found in list of parsed files";
return;
}
......
......@@ -24,11 +24,11 @@
#include "umlpackagelist.h"
// kde includes
#include <KStandardDirs>
// qt includes
#include <QProcess>
#include <QRegExp>
#include <QStandardPaths>
#include <QStringList>
#include <stdio.h>
......@@ -49,17 +49,17 @@ IDLImport::IDLImport(CodeImpThread* thread) : NativeImportBase(QLatin1String("//
}
QStringList arguments;
QString executable = KStandardDirs::findExe(QLatin1String("cpp"));
QString executable = QStandardPaths::findExecutable(QLatin1String("cpp"));
if (!executable.isEmpty()) {
arguments << QLatin1String("-C"); // -C means "preserve comments"
}
#ifdef Q_WS_WIN
else {
executable = KStandardDirs::findExe(QLatin1String("cl"));
executable = QStandardPaths::findExecutable(QLatin1String("cl"));
if (executable.isEmpty()) {
QString path = QLatin1String(qgetenv("VS100COMNTOOLS").constData());
if (!path.isEmpty())
executable = KStandardDirs::findExe(QLatin1String("cl"), path + QLatin1String("/../../VC/bin"));
executable = QStandardPaths::findExecutable(QLatin1String("cl"), path + QLatin1String("/../../VC/bin"));
}
if (!executable.isEmpty()) {
arguments << QLatin1String("-E"); // -E means "preprocess to stdout"
......
......@@ -26,16 +26,18 @@
#include <QTabWidget>
CodeViewerDialog::CodeViewerDialog (QWidget* parent, CodeDocument * doc,
Settings::CodeViewerState state)
: KDialog (parent), m_state(state)
Settings::CodeViewerState state)
: QDialog (parent), m_state(state)
{
setModal(false);
setButtons(KDialog::Cancel);
setupUi(mainWidget());
#if 0 //FIXME KF5
setButtons(QDialog::Cancel);
setInitialSize(QSize(630, 730));
#endif
setupUi(window());
initGUI();
addCodeDocument(doc);
connect(this, SIGNAL(cancelClicked()), mainWidget(), SLOT(close()));
connect(this, SIGNAL(cancelClicked()), window(), SLOT(close()));
}
CodeViewerDialog::~CodeViewerDialog()
......@@ -87,7 +89,7 @@ bool CodeViewerDialog::close()
// remember block show status
m_state.showHiddenBlocks = ui_showHiddenCodeCB->isChecked();
// run superclass close now
return KDialog::close();
return QDialog::close();
}
/**
......
......@@ -16,6 +16,8 @@
#include "codeviewerstate.h"
#include "ui_codeviewerdialogbase.h"
#include <QDialog>
class CodeDocument;
......@@ -24,7 +26,7 @@ class CodeDocument;
* that works, and thats all we need. In the future, a re-write is mandated to
* bring a bit of beauty to this beast. -b.t.
*/
class CodeViewerDialog : public KDialog, private Ui::CodeViewerDialogBase
class CodeViewerDialog : public QDialog, private Ui::CodeViewerDialogBase
{
Q_OBJECT
public:
......
......@@ -18,7 +18,7 @@
#include "umlwidgetstylepage.h"
#include <KFontChooser>
#include <KLocale>
#include <KLocalizedString>
#include <KPageDialog>
#include <KPageWidget>
......@@ -41,6 +41,7 @@ DialogBase::DialogBase(QWidget *parent, bool withDefaultButton)
{
if (m_useDialog) {
m_pageDialog = new KPageDialog(parent);
#if 0 //FIXME KF5
KDialog::ButtonCodes buttons = KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Help;
if (withDefaultButton)
buttons |= KDialog::Default;
......@@ -50,6 +51,7 @@ DialogBase::DialogBase(QWidget *parent, bool withDefaultButton)
m_pageDialog->setFaceType(KPageDialog::List);
m_pageDialog->setModal(true);
m_pageDialog->setHelp(QString::fromLatin1("umbrello/index.html"), QString());
#endif
connect(m_pageDialog, SIGNAL(okClicked()), this, SLOT(slotOkClicked()));
connect(m_pageDialog, SIGNAL(applyClicked()), this, SLOT(slotApplyClicked()));
connect(m_pageDialog, SIGNAL(defaultClicked()), this, SLOT(slotDefaultClicked()));
......@@ -134,8 +136,10 @@ void DialogBase::saveStylePageData(UMLWidget *widget)
void DialogBase::setCaption(const QString &caption)
{
#if 0 //FIXME KF5
if (m_pageDialog)
m_pageDialog->setCaption(caption);
#endif
}
void DialogBase::accept()
......@@ -168,7 +172,10 @@ void DialogBase::addPage(KPageWidgetItem *page)
int DialogBase::spacingHint()
{
#if 0 //FIXME KF5
return KDialog::spacingHint();
#endif
return 0;
}
int DialogBase::exec()
......
......@@ -24,14 +24,14 @@
* @param parent The parent of the dialog.
* @param name The internal name.
*
* @see KDialog::KDialog
* @see QDialog::QDialog
*/
ExportAllViewsDialog::ExportAllViewsDialog(QWidget* parent, const char* name)
: KDialog(parent)
: QDialog(parent)
{
setObjectName(QString::fromLatin1(name));
setModal(false);
setupUi(mainWidget());
setupUi(window());
// create and initialize m_imageType
m_imageType = new KFileFilterCombo(this);
......