diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f60e669..eed9d3cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,342 +1,339 @@ project(calligraplan) cmake_minimum_required(VERSION 2.8.12) if (POLICY CMP0002) cmake_policy(SET CMP0002 NEW) endif () if (POLICY CMP0017) cmake_policy(SET CMP0017 NEW) endif () if (POLICY CMP0022) cmake_policy(SET CMP0022 NEW) endif () if (POLICY CMP0026) cmake_policy(SET CMP0026 OLD) endif() if (POLICY CMP0046) cmake_policy(SET CMP0046 NEW) endif () if (POLICY CMP0059) cmake_policy(SET CMP0059 OLD) endif() if (POLICY CMP0063) cmake_policy(SET CMP0063 NEW) endif() # define the version of Plan # update these version for every release: set(PLAN_YEAR 2018) # update every year set(PLAN_VERSION_STRING "3.1.89") set(PLAN_STABLE_VERSION_MAJOR 3) # 3 for 3.x, 4 for 4.x, etc. set(PLAN_STABLE_VERSION_MINOR 1) # 0 for 3.0, 1 for 3.1, etc. set(PLAN_VERSION_RELEASE 89) # 89 for Alpha, increase for next test releases, set 0 for first Stable, etc. set(PLAN_ALPHA 1) # uncomment only for Alpha #set(PLAN_BETA 2) # uncomment only for Beta #set(PLAN_RC 1) # uncomment only for RC # Define the generic version of the Calligra Plan libraries here # This makes it easy to advance it when the next release comes. # 14 was the last GENERIC_CALLIGRA_LIB_VERSION_MAJOR of the previous Calligra series # (2.x) so we're starting with 15 in 3.x series. if(PLAN_STABLE_VERSION_MAJOR EQUAL 3) math(EXPR GENERIC_PLAN_LIB_VERSION_MAJOR "${PLAN_STABLE_VERSION_MINOR} + 15") else() # let's make sure we won't forget to update the "15" message(FATAL_ERROR "Reminder: please update offset == 15 used to compute GENERIC_PLAN_LIB_VERSION_MAJOR to something bigger") endif() set(GENERIC_PLAN_LIB_VERSION "${GENERIC_PLAN_LIB_VERSION_MAJOR}.0.0") set(GENERIC_PLAN_LIB_SOVERSION "${GENERIC_PLAN_LIB_VERSION_MAJOR}") message(STATUS "") message(STATUS "Build Calligra Plan ${PLAN_VERSION_STRING} with cmake version: ${CMAKE_VERSION}, required version: ${CMAKE_MINIMUM_REQUIRED_VERSION}") message(STATUS "") # ensure out-of-source build string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" isBuildInSource) if(isBuildInSource) message(FATAL_ERROR "Compiling Plan inside the source folder is not possible.\nPlease refer to the build instruction: https://community.kde.org/Calligra/Building/3\nYou need to clean up the source folder from all build artifacts just created, otherwise further building attempts will fail again: With a git repo, you can use \"git clean -df\" in the toplevel source folder (attention! will remove also uncommited changes to the source code). With sources from a file bundle (like a zip file), delete the source folder and unbundle the sources again.") endif() ############ ############# ## Options ## ############# ############ option(PACKAGERS_BUILD "Build support of multiple CPU architectures in one binary. Should be used by packagers only." ON) ########################## ########################### ## Look for ECM, Qt, KF5 ## ########################### ########################## find_package(ECM 5.19 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) # ECM KDE macros (include first, to have their policies and settings effect all other macros) include(KDEInstallDirs) include(KDECMakeSettings NO_POLICY_SCOPE) include(KDECompilerSettings NO_POLICY_SCOPE) # CMake macros include(CMakePackageConfigHelpers) include(WriteBasicConfigVersionFile) include(CheckFunctionExists) include(CheckTypeSize) include(CheckIncludeFile) include(GenerateExportHeader) include(FeatureSummary) # ECM macros include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMAddAppIcon) include(ECMSetupVersion) include(ECMAddTests) include(ECMMarkAsTest) include(ECMMarkNonGuiExecutable) include(ECMGenerateHeaders) # Own macros # This macro is a copy from calligra so only needs to be included when plan is build stand alone set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) include(MacroOptionalFindPackage) set(REQUIRED_KF5_VERSION "5.7.0") find_package(KF5 ${REQUIRED_KF5_VERSION} REQUIRED COMPONENTS Init Archive # Codecs # Completion Config ConfigWidgets CoreAddons DBusAddons # DocTools GuiAddons I18n IconThemes ItemViews JobWidgets KCMUtils KIO Notifications # NotifyConfig Parts # Sonnet TextWidgets Wallet WidgetsAddons WindowSystem XmlGui # Kross ) find_package(KF5Activities) set_package_properties(KF5Activities PROPERTIES DESCRIPTION "Library for Activities" PURPOSE "Required for activities support (optional)" TYPE OPTIONAL ) if(KF5Activities_FOUND) set(HAVE_KACTIVITIES TRUE) endif() find_package(KF5KHtml) set_package_properties(KF5KHtml PROPERTIES PURPOSE "Required for rich text support" TYPE REQUIRED ) find_package(KF5Holidays 5.3.3) set_package_properties(KF5Holidays PROPERTIES DESCRIPTION "Library for generation of public holidays" PURPOSE "Required for holidays support (optional)" TYPE RECOMMENDED ) if(${KF5_VERSION} VERSION_LESS "5.16.0") set(CALLIGRA_OLD_PLUGIN_METADATA TRUE) endif() set(REQUIRED_QT_VERSION "5.4.0") find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Gui Network PrintSupport Svg Test Widgets Xml ) find_package(Qt5 ${REQUIRED_QT_VERSION} QUIET COMPONENTS DBus OpenGL # Quick # Sql # WebKit # WebKitWidgets ) # Qt5Declarative was removed in Qt 5.6.0 so search for it in a separate call # Including it in a collected find_package(Qt5 ...) call can lead to a fatal not-found error: # * Qt5 (required version >= 5.3.0) # find_package(Qt5Declarative ${REQUIRED_QT_VERSION} QUIET) set_package_properties(Qt5DBus PROPERTIES DESCRIPTION "Library for dbus access" PURPOSE "Required for dbus support (optional)" TYPE OPTIONAL ) find_package(X11) if(X11_FOUND) find_package(Qt5 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS X11Extras ) set(HAVE_X11 TRUE) add_definitions(-DHAVE_X11) else() set(HAVE_X11 FALSE) endif() # use sane compile flags add_definitions( -DQT_USE_QSTRINGBUILDER -DQT_STRICT_ITERATORS -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_TO_ASCII ) # only with this definition will all the FOO_TEST_EXPORT macro do something # TODO: check if this can be moved to only those places which make use of it, # to reduce global compiler definitions that would trigger a recompile of # everything on a change (like adding/removing tests to/from the build) if(BUILD_TESTING) add_definitions(-DCOMPILING_TESTS) endif() # overcome some platform incompatibilities if(WIN32) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/winquirks) add_definitions(-D_USE_MATH_DEFINES) add_definitions(-DNOMINMAX) set(WIN32_PLATFORM_NET_LIBS ws2_32.lib netapi32.lib) endif() ########################### ############################ ## Required dependencies ## ############################ ########################### ## ## Test for KGantt ## macro_optional_find_package(KGantt 2.6.0 QUIET) set_package_properties(KGantt PROPERTIES DESCRIPTION "Library for creating Gantt diagrams (part of KDiagram)" URL "https://www.kde.org/" TYPE REQUIRED ) ## ## Test for KChart ## macro_optional_find_package(KChart 2.6.0 QUIET) set_package_properties(KChart PROPERTIES DESCRIPTION "Library for creating business charts (part of KDiagram)" URL "https://www.kde.org/" TYPE REQUIRED ) find_package(Perl REQUIRED) find_package(ZLIB REQUIRED) ########################### ############################ ## Optional dependencies ## ############################ ########################### ## ## Test for KF5CalendarCore ## find_package(KF5CalendarCore CONFIG QUIET) set_package_properties(KF5CalendarCore PROPERTIES DESCRIPTION "KDE Calendar Library" URL "https://www.kde.org/" PURPOSE "Required for Ical export" TYPE OPTIONAL ) ## ## Test for KF5AkonadiContact ## find_package(KF5AkonadiContact CONFIG QUIET) set_package_properties(KF5AkonadiContact PROPERTIES DESCRIPTION "Library for Accessing Contacts stored in Akonadi" URL "https://www.kde.org/" PURPOSE "Required for address book support" TYPE OPTIONAL ) if(WIN32) set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} LIBRARY ${INSTALL_TARGETS_DEFAULT_ARGS} ARCHIVE ${INSTALL_TARGETS_DEFAULT_ARGS} ) endif() #### Disable kreport for now, reconsider when it is stable #### if (TEST_FOR_KREPORT) # # Test for KReport # macro_optional_find_package(KReport 3.1 QUIET) set_package_properties(KReport PROPERTIES PURPOSE "Required for KReport support in Plan" TYPE OPTIONAL ) ## ## Test for KPropertyWidgets ## macro_optional_find_package(KPropertyWidgets 3.1 QUIET) set_package_properties(KPropertyWidgets PROPERTIES PURPOSE "Required for KReports support in Plan" TYPE OPTIONAL ) if (KReport_FOUND AND KPropertyWidgets_FOUND) set(PLAN_USE_KREPORT TRUE) endif() endif (TEST_FOR_KREPORT) add_subdirectory(src) add_subdirectory(devtools) if (BUILD_TESTING) add_subdirectory(tests) endif() #add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -if (PLAN_IS_MAIN_PROJECT) +### Summarize findings #### +feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) - ### Summarize findings #### - feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) - -endif (PLAN_IS_MAIN_PROJECT) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbb42b4e..7ccc0082 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,245 +1,245 @@ set(PLAN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/interfaces) set(PLANPLUGIN_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/plugin ) set(PLANKUNDO2_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/kundo2 ${CMAKE_CURRENT_BINARY_DIR}/libs/kundo2 ) set(PLANODF_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/odf ${CMAKE_CURRENT_SOURCE_DIR}/libs/store ${CMAKE_CURRENT_BINARY_DIR}/libs/odf ${CMAKE_CURRENT_BINARY_DIR}/libs/store ) set(PLANWIDGETS_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/widgetutils ${CMAKE_CURRENT_BINARY_DIR}/libs/widgetutils ${CMAKE_CURRENT_SOURCE_DIR}/libs/widgets ${CMAKE_CURRENT_BINARY_DIR}/libs/widgets ) set(PLANMAIN_INCLUDES ${PLANWIDGETS_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/libs/main ${CMAKE_CURRENT_BINARY_DIR}/libs/main ${CMAKE_CURRENT_SOURCE_DIR}/libs/main/config ) set(PLANKERNEL_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/kernel ${CMAKE_CURRENT_BINARY_DIR}/libs/kernel ) set(PLANMODELS_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/models ${CMAKE_CURRENT_BINARY_DIR}/libs/models ) set(PLANUI_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/libs/ui ${CMAKE_CURRENT_BINARY_DIR}/libs/ui ) -set(KPLATO_INCLUDES +set(PLAN_INCLUDES ${CMAKE_CURRENT_BINARY_DIR} ${PLANKERNEL_INCLUDES} ${PLANMODELS_INCLUDES} ${PLANUI_INCLUDES} ${PLANMAIN_INCLUDES} ) # For odf set(RNG_SOURCE_DIR ${PROJECT_SOURCE_DIR}/devtools/scripts) if(KF5Holidays_FOUND) add_definitions(-DHAVE_KHOLIDAYS) endif() if (KF5AkonadiContact_FOUND) # disable for now: there is a bug # it only works if you use kde contacts (of course) but many use other stuff, so gets dissapointed add_definitions(-DPLAN_KDEPIMLIBS_FOUND) message(WARNING "AkonadiContacs available, but function is disabled due to Bug 311940") endif () if ("${KF5CalendarCore_VERSION}" VERSION_GREATER 5.6.40) set(HAVE_QDATETIME_KCALCORE TRUE) endif() if (PLANCHARTDEBUG) add_definitions(-DPLAN_CHART_DEBUG) endif () #add_subdirectory(interfaces) add_subdirectory(servicetypes) add_subdirectory( templates ) add_subdirectory( pics ) add_subdirectory( toolbar ) add_subdirectory( plugins ) add_subdirectory( libs ) if(BUILD_TESTING) add_subdirectory( tests ) endif() add_subdirectory( workpackage ) -include_directories(${KPLATO_INCLUDES}) +include_directories(${PLAN_INCLUDES}) add_definitions(-DTRANSLATION_DOMAIN=\"calligraplan\") ########### KPlato private library ############### set(planprivate_LIB_SRCS kptviewlistdocker.cpp kptviewlist.cpp kptviewlistdialog.cpp kptschedulesdocker.cpp kptconfig.cpp ConfigWorkVacationPanel.cpp ConfigProjectPanel.cpp kpttaskdefaultpanel.cpp kptworkpackageconfigpanel.cpp kptcolorsconfigpanel.cpp kptcontext.cpp kptfactory.cpp kptpart.cpp kptmaindocument.cpp kptview.cpp # KPtViewAdaptor.cpp kptprintingcontrolprivate.cpp kptschedulerpluginloader.cpp kptbuiltinschedulerplugin.cpp kptconfigskeleton.cpp kptinsertfiledlg.cpp about/aboutpage.cpp KPlatoXmlLoader.cpp ) ki18n_wrap_ui(planprivate_LIB_SRCS kptviewlistaddview.ui kptviewlisteditview.ui kptviewlisteditcategory.ui ConfigWorkVacationPanel.ui ConfigProjectPanel.ui kptconfigtaskpanelbase.ui kptworkpackageconfigpanel.ui kptcolorsconfigpanel.ui kptinsertfilepanel.ui ) kconfig_add_kcfg_files(plansettings_SRCS calligraplansettings.kcfgc) add_library(planprivate SHARED ${planprivate_LIB_SRCS} ${plansettings_SRCS} ) -generate_export_header(planprivate BASE_NAME kplato) +generate_export_header(planprivate BASE_NAME plan) target_link_libraries(planprivate PUBLIC - kplatokernel - kplatomodels - kplatoui + plankernel + planmodels + planui planmain PRIVATE planplugin KF5::IconThemes #KF5::KHtml ) if(KF5AkonadiContact_FOUND) target_link_libraries(planprivate PRIVATE KF5::AkonadiContact) endif() set_target_properties(planprivate PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) install(TARGETS planprivate ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### KPlato part ############### set(planpart_PART_SRCS kptfactoryinit.cpp ) add_library(calligraplanpart MODULE ${planpart_PART_SRCS}) #calligraplan_part_desktop_to_json(calligraplanpart planpart.desktop) if(${KF5_VERSION} VERSION_LESS "5.16.0") kcoreaddons_desktop_to_json(calligraplanpart planpart.desktop) else() kcoreaddons_desktop_to_json(calligraplanpart planpart.desktop # SERVICE_TYPES ${PLAN_SOURCE_DIR}/servicetypes/calligraplan_part.desktop ) endif() target_link_libraries(calligraplanpart PUBLIC KF5::Parts KF5::CoreAddons PRIVATE planprivate) install(TARGETS calligraplanpart DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/parts) ########### KPlato executable ############### set(calligraplan_KDEINIT_SRCS main.cpp ) file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/pics/*-apps-calligraplan.png") ecm_add_app_icon(kdeinit_app_ICONS_SRCS ICONS ${ICONS_SRCS}) if(WIN32) set(_resourcefile "${CMAKE_CURRENT_BINARY_DIR}/kdeinit_app_ICONS_SRCS.rc") endif() kf5_add_kdeinit_executable( calligraplan ${calligraplan_KDEINIT_SRCS}) if (APPLE) set_target_properties(calligraplan PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template) set_target_properties(calligraplan PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.calligra.plan") set_target_properties(calligraplan PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Plan") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/calligraplan_KDEINIT_SRCS.icns DESTINATION ${BUNDLE_INSTALL_DIR}/calligraplan.app/Contents/Resources) endif () target_link_libraries(kdeinit_calligraplan planmain) install(TARGETS kdeinit_calligraplan ${INSTALL_TARGETS_DEFAULT_ARGS}) target_link_libraries(calligraplan kdeinit_calligraplan planmain) install(TARGETS calligraplan ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### install( FILES calligraplan.rc calligraplan_readonly.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/calligraplan) install( PROGRAMS org.kde.calligraplan.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install( FILES calligraplanrc DESTINATION ${CONFIG_INSTALL_DIR}) install(FILES calligraplansettings.kcfg DESTINATION ${KCFG_INSTALL_DIR}) install(FILES org.kde.calligraplan.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) # TODO: with the new embedded JSON data for plugins there is no schema ATM to define extended properties # plan_viewplugin.desktop install(FILES about/top-left-plan.png about/main.html about/intro.html about/tips.html about/tutorial.html about/plan.css DESTINATION ${DATA_INSTALL_DIR}/calligraplan/about ) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) #add_custom_target(apidox doc/api/gendocs.pl WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) diff --git a/src/ConfigProjectPanel.h b/src/ConfigProjectPanel.h index 27fe23bb..3e052e1c 100644 --- a/src/ConfigProjectPanel.h +++ b/src/ConfigProjectPanel.h @@ -1,56 +1,56 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CONFIGPROJECTPANEL_H #define CONFIGPROJECTPANEL_H -#include "kplato_export.h" +#include "plan_export.h" #include "ui_ConfigProjectPanel.h" #include namespace KPlato { class ConfigProjectPanelImpl : public QWidget, public Ui::ConfigProjectPanel { Q_OBJECT public: explicit ConfigProjectPanelImpl(QWidget *parent); void initDescription(); public Q_SLOTS: void resourceFileBrowseBtnClicked(); void projectsPlaceBrowseBtnClicked(); }; -class KPLATO_EXPORT ConfigProjectPanel : public ConfigProjectPanelImpl +class PLAN_EXPORT ConfigProjectPanel : public ConfigProjectPanelImpl { Q_OBJECT public: explicit ConfigProjectPanel( QWidget *parent=0 ); }; } //KPlato namespace #endif // CONFIGPROJECTPANEL_H diff --git a/src/ConfigWorkVacationPanel.h b/src/ConfigWorkVacationPanel.h index 43235ae9..a2585d40 100644 --- a/src/ConfigWorkVacationPanel.h +++ b/src/ConfigWorkVacationPanel.h @@ -1,56 +1,56 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CONFIGWORKVACATIONPANEL_H #define CONFIGWORKVACATIONPANEL_H -#include "kplato_export.h" +#include "plan_export.h" #include "ui_ConfigWorkVacationPanel.h" #include namespace KPlato { class ConfigWorkVacationPanelImpl : public QWidget, public Ui::ConfigWorkVacationPanel { Q_OBJECT public: explicit ConfigWorkVacationPanelImpl(QWidget *parent); private Q_SLOTS: #ifdef HAVE_KHOLIDAYS void slotRegionChanged(int idx); void slotRegionCodeChanged(const QString &code); #endif }; -class KPLATO_EXPORT ConfigWorkVacationPanel : public ConfigWorkVacationPanelImpl +class PLAN_EXPORT ConfigWorkVacationPanel : public ConfigWorkVacationPanelImpl { Q_OBJECT public: explicit ConfigWorkVacationPanel( QWidget *parent=0 ); }; } //KPlato namespace #endif // CONFIGWORKVACATIONPANEL_H diff --git a/src/kptbuiltinschedulerplugin.h b/src/kptbuiltinschedulerplugin.h index 62aacac8..57389631 100644 --- a/src/kptbuiltinschedulerplugin.h +++ b/src/kptbuiltinschedulerplugin.h @@ -1,80 +1,80 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTBUILTINSCHEDULERPLUGIN_H #define KPTBUILTINSCHEDULERPLUGIN_H -#include "kplato_export.h" +#include "plan_export.h" #include "kptschedulerplugin.h" #include "kptschedule.h" namespace KPlato { class KPlatoScheduler; class Project; class ScheduleManager; -class KPLATO_EXPORT BuiltinSchedulerPlugin : public SchedulerPlugin +class PLAN_EXPORT BuiltinSchedulerPlugin : public SchedulerPlugin { Q_OBJECT public: explicit BuiltinSchedulerPlugin(QObject *parent); virtual ~BuiltinSchedulerPlugin(); virtual QString description() const; /// Calculate the project virtual void calculate( Project &project, ScheduleManager *sm, bool nothread = false ); Q_SIGNALS: void sigCalculationStarted( Project*, ScheduleManager* ); void sigCalculationFinished( Project*, ScheduleManager* ); void maxProgress( int, ScheduleManager* ); void sigProgress( int, ScheduleManager* ); protected Q_SLOTS: void slotStarted( SchedulerThread *job ); void slotFinished( SchedulerThread *job ); }; class KPlatoScheduler : public SchedulerThread { Q_OBJECT public: KPlatoScheduler( Project *project, ScheduleManager *sm, QObject *parent = 0 ); ~KPlatoScheduler(); public Q_SLOTS: /// Stop scheduling. virtual void stopScheduling(); /// Halt scheduling virtual void haltScheduling() { m_haltScheduling = true; stopScheduling(); } protected: void run(); }; } //namespace KPlato #endif diff --git a/src/kptconfigskeleton.h b/src/kptconfigskeleton.h index e3eb849c..0cbd7e9e 100644 --- a/src/kptconfigskeleton.h +++ b/src/kptconfigskeleton.h @@ -1,39 +1,39 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTCONFIGSKELETON_H #define KPTCONFIGSKELETON_H -#include "kplato_export.h" +#include "plan_export.h" #include #include "kptfactory.h" -class KPLATO_EXPORT KPlatoConfigSkeleton : public KConfigSkeleton +class PLAN_EXPORT KPlatoConfigSkeleton : public KConfigSkeleton { Q_OBJECT public: KPlatoConfigSkeleton(); ~KPlatoConfigSkeleton(); }; #endif // KPTCONFIGSKELETON_H diff --git a/src/kptfactory.h b/src/kptfactory.h index d9d10792..fbc1b8f8 100644 --- a/src/kptfactory.h +++ b/src/kptfactory.h @@ -1,53 +1,53 @@ /* This file is part of the KDE project Copyright (C) 1998, 1999, 2000 Torben Weis This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTFACTORY_H #define KPTFACTORY_H -#include "kplato_export.h" +#include "plan_export.h" #include class KAboutData; class KoComponentData; namespace KPlato { -class KPLATO_EXPORT Factory : public KPluginFactory +class PLAN_EXPORT Factory : public KPluginFactory { Q_OBJECT public: explicit Factory(); ~Factory(); virtual QObject* create(const char* iface, QWidget* parentWidget, QObject *parent, const QVariantList& args, const QString& keyword); static const KoComponentData &global(); static KAboutData* aboutData(); private: static KoComponentData* s_global; static KAboutData* s_aboutData; }; } // KPlato namespace #endif diff --git a/src/kptmaindocument.h b/src/kptmaindocument.h index 88689fb7..0ab4a045 100644 --- a/src/kptmaindocument.h +++ b/src/kptmaindocument.h @@ -1,249 +1,249 @@ /* This file is part of the KDE project Copyright (C) 1998, 1999, 2000 Torben Weis Copyright (C) 2004 - 2010 Dag Andersen Copyright (C) 2006 Raphael Langerhorst Copyright (C) 2007 Thorsten Zachmann This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTMAINDOCUMENT_H #define KPTMAINDOCUMENT_H -#include "kplato_export.h" +#include "plan_export.h" #include "kpttask.h" #include "kptconfig.h" #include "kptwbsdefinition.h" #include "kptxmlloaderobject.h" #include "about/aboutpage.h" #include "KoDocument.h" #include #include #define PLAN_MIME_TYPE "application/x-vnd.kde.plan" /// The main namespace. namespace KPlato { class DocumentChild; class Project; class Context; class SchedulerPlugin; class ViewListItem; class View; class Package; -class KPLATO_EXPORT MainDocument : public KoDocument +class PLAN_EXPORT MainDocument : public KoDocument { Q_OBJECT public: explicit MainDocument(KoPart *part); ~MainDocument(); /// reimplemented from KoDocument virtual QByteArray nativeFormatMimeType() const { return PLAN_MIME_TYPE; } /// reimplemented from KoDocument virtual QByteArray nativeOasisMimeType() const { return ""; } /// reimplemented from KoDocument virtual QStringList extraNativeMimeTypes() const { return QStringList() << PLAN_MIME_TYPE; } void setReadWrite( bool rw ); void configChanged(); virtual void paintContent( QPainter& painter, const QRect& rect); void setProject( Project *project ); Project &getProject() { return *m_project; } const Project &getProject() const { return * m_project; } /** * Return the set of SupportedSpecialFormats that the kplato wants to * offer in the "Save" file dialog. * Note: SaveEncrypted is not supported. */ virtual int supportedSpecialFormats() const { return SaveAsDirectoryStore; } // The load and save functions. Look in the file kplato.dtd for info virtual bool loadXML( const KoXmlDocument &document, KoStore *store ); virtual QDomDocument saveXML(); /// Save a workpackage file containing @p node with schedule identity @p id, owned by @p resource QDomDocument saveWorkPackageXML( const Node *node, long id, Resource *resource = 0 ); bool saveOdf( SavingContext &/*documentContext */) { return false; } bool loadOdf( KoOdfReadStore & odfStore ); Config &config() { return m_config; } Context *context() const { return m_context; } WBSDefinition &wbsDefinition() { return m_project->wbsDefinition(); } const XMLLoaderObject &xmlLoader() const { return m_xmlLoader; } DocumentChild *createChild( KoDocument *doc, const QRect &geometry = QRect() ); bool saveWorkPackageToStream( QIODevice * dev, const Node *node, long id, Resource *resource = 0 ); bool saveWorkPackageFormat( const QString &file, const Node *node, long id, Resource *resource = 0 ); bool saveWorkPackageUrl( const QUrl & _url, const Node *node, long id, Resource *resource = 0 ); void mergeWorkPackages(); void mergeWorkPackage( const Package *package ); void terminateWorkPackage( const Package *package ); /// Load the workpackage from @p url into @p project. Return true if successful, else false. bool loadWorkPackage( Project &project, const QUrl &url ); Package *loadWorkPackageXML( Project& project, QIODevice*, const KoXmlDocument& document, const QUrl& url ); QMap workPackages() const { return m_workpackages; } void insertFile( const QUrl &url, Node *parent, Node *after = 0 ); bool insertProject( Project &project, Node *parent, Node *after ); bool mergeResources(Project &project); KPlatoAboutPage &aboutPage() { return m_aboutPage; } bool extractFiles( KoStore *store, Package *package ); bool extractFile( KoStore *store, Package *package, const Document *doc ); void registerView( View *view ); /// Create a new project from this project /// Generates new project id and task ids /// Keeps resource- and calendar ids void createNewProject(); using KoDocument::setModified; public Q_SLOTS: void setModified( bool mod ); /// Inserts an item into all other views than @p view void insertViewListItem( View *view, const ViewListItem *item, const ViewListItem *parent, int index ); /// Removes the view list item from all other views than @p view void removeViewListItem( View *view, const ViewListItem *item ); /// View selector has been modified void viewlistModified(); /// Check for workpackages /// If @p keep is true, packages that has been refused will not be checked for again void checkForWorkPackages( bool keep = false ); void setLoadingTemplate( bool ); void setLoadingSharedResourcesTemplate( bool ); void insertResourcesFile(const QUrl &url, const QUrl &projects = QUrl()); void slotProjectCreated(); /// Prepare for insertion of resource assignments of shared resources from the project(s) in @p url void insertSharedProjects(const QUrl &url); /// Clear resource assignments of shared resources void clearResourceAssignments(); /// Load resource assignments of shared resources from the project(s) in @p url void loadResourceAssignments(QUrl url); void setIsTaskModule(bool value); bool isTaskModule() const; Q_SIGNALS: void changed(); void workPackageLoaded(); void viewlistModified( bool ); void viewListItemAdded(const ViewListItem *item, const ViewListItem *parent, int index); void viewListItemRemoved(const ViewListItem *item); void insertSharedProject(); protected: /// Load kplato specific files virtual bool completeLoading( KoStore* store ); /// Save kplato specific files virtual bool completeSaving( KoStore* store ); void mergeWorkPackage( Task *to, const Task *from, const Package *package ); // used by insert file struct InsertFileInfo { QUrl url; Node *parent; Node *after; } m_insertFileInfo; protected Q_SLOTS: void slotViewDestroyed(); void addSchedulerPlugin( const QString&, SchedulerPlugin *plugin ); void autoCheckForWorkPackages(); void checkForWorkPackage(); void insertFileCompleted(); void insertResourcesFileCompleted(); void insertFileCancelled( const QString& ); void slotInsertSharedProject(); void insertSharedProjectCompleted(); void insertSharedProjectCancelled( const QString& ); void workPackageMergeDialogFinished( int result ); private: bool loadAndParse(KoStore* store, const QString& filename, KoXmlDocument& doc); void loadSchedulerPlugins(); private: Project *m_project; QWidget* m_parentWidget; Config m_config; Context *m_context; XMLLoaderObject m_xmlLoader; bool m_loadingTemplate; bool m_loadingSharedResourcesTemplate; QMap m_schedulerPlugins; QMap m_workpackages; QFileInfoList m_infoList; QMap m_mergedPackages; KPlatoAboutPage m_aboutPage; QDomDocument m_reports; bool m_viewlistModified; bool m_checkingForWorkPackages; QList > m_views; bool m_loadingSharedProject; QList m_sharedProjectsFiles; bool m_skipSharedProjects; bool m_isTaskModule; }; } //KPlato namespace #endif diff --git a/src/kptmycombobox_p.h b/src/kptmycombobox_p.h index 0382a497..7846da9a 100644 --- a/src/kptmycombobox_p.h +++ b/src/kptmycombobox_p.h @@ -1,42 +1,42 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTMYCOMBOBOX_P_H #define KPTMYCOMBOBOX_P_H -#include "kplato_export.h" +#include "plan_export.h" #include namespace KPlato { class MyComboBox : public KComboBox { public: explicit MyComboBox(QWidget *parent = 0) : KComboBox(parent) {} void emitActivated( int i ) { emit activated( i ); } }; } //KPlato namespace #endif // KPTMYCOMBOBOX_P_H diff --git a/src/kptpart.h b/src/kptpart.h index 1f442403..2e0849d3 100644 --- a/src/kptpart.h +++ b/src/kptpart.h @@ -1,78 +1,78 @@ /* This file is part of the KDE project Copyright (C) 2012 C. Boemann This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTPART_H #define KPTPART_H #include -#include "kplato_export.h" +#include "plan_export.h" #include class KoView; class QStackedWidget; /// The main namespace. namespace KPlato { class MainDocument; class HtmlView; -class KPLATO_EXPORT Part : public KoPart +class PLAN_EXPORT Part : public KoPart { Q_OBJECT public: explicit Part(QObject *parent); virtual ~Part(); void setDocument(KPlato::MainDocument *document); /// reimplemented virtual KoView *createViewInstance(KoDocument *document, QWidget *parent); /// reimplemented virtual KoMainWindow *createMainWindow(); virtual void showStartUpWidget(KoMainWindow *parent); protected Q_SLOTS: void finish(); void slotShowIntroduction(); void slotOpenUrlRequest( HtmlView *v, const QUrl &url ); virtual void openTemplate( const QUrl& url ); void openTaskModule(const QUrl& url); void slotHelpContents(); protected: void createStarUpWidget(KoMainWindow *parent); QWidget *createWelcomeView(KoMainWindow *parent); QWidget *createIntroductionView(); private: KPlato::MainDocument *m_document; QPointer startUpWidget; bool m_toolbarVisible; }; } //KPlato namespace #endif diff --git a/src/kpttaskdefaultpanel.h b/src/kpttaskdefaultpanel.h index 8d0b2ea0..3ea6c942 100644 --- a/src/kpttaskdefaultpanel.h +++ b/src/kpttaskdefaultpanel.h @@ -1,62 +1,62 @@ /* This file is part of the KDE project Copyright (C) 2004-2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKDEFAULTPANEL_H #define KPTTASKDEFAULTPANEL_H -#include "kplato_export.h" +#include "plan_export.h" #include "ui_kptconfigtaskpanelbase.h" #include namespace KPlato { class DateTime; class Task; class ConfigTaskPanelImpl : public QWidget, public Ui_ConfigTaskPanelBase { Q_OBJECT public: explicit ConfigTaskPanelImpl(QWidget *parent); void initDescription(); public Q_SLOTS: virtual void changeLeader(); void startDateTimeChanged( const QDateTime& ); void endDateTimeChanged( const QDateTime& ); void unitChanged( int unit ); void currentUnitChanged( int ); }; -class KPLATO_EXPORT TaskDefaultPanel : public ConfigTaskPanelImpl +class PLAN_EXPORT TaskDefaultPanel : public ConfigTaskPanelImpl { Q_OBJECT public: explicit TaskDefaultPanel( QWidget *parent=0 ); }; } //KPlato namespace #endif // TASKDEFAULTPANEL_H diff --git a/src/kptview.h b/src/kptview.h index a98e5534..13c755cc 100644 --- a/src/kptview.h +++ b/src/kptview.h @@ -1,452 +1,452 @@ /* This file is part of the KDE project Copyright (C) 1998, 1999, 2000 Torben Weis Copyright (C) 2002 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTVIEW_H #define KPTVIEW_H -#include "kplato_export.h" +#include "plan_export.h" #include #include "kptcontext.h" #include "kptviewbase.h" #include #include #include #include #include class QMenu; class QPrintDialog; class QStackedWidget; class QSplitter; class QUrl; class KUndo2Command; class QAction; class KToggleAction; class QLabel; class KConfigSkeleton; class KConfigSkeletonItem; class KoView; namespace KPlato { class View; class ViewBase; class ViewListItem; class ViewListWidget; struct ViewInfo; class AccountsView; class GanttView; class PertEditor; class AccountsEditor; class TaskEditor; class CalendarEditor; class ScheduleEditor; class ScheduleManager; class CalculateScheduleCmd; class ResourceAssignmentView; class TaskStatusView; class Calendar; class MainDocument; class Part; class Node; class Project; class Task; class MainSchedule; class Schedule; class Resource; class ResourceGroup; class Relation; class Context; class ViewAdaptor; class HtmlView; class ReportView; class ReportDesignDialog; class DockWidget; class ConfigDialog : public KConfigDialog { Q_OBJECT public: ConfigDialog( QWidget *parent, const QString &name, KConfigSkeleton *config ); protected Q_SLOTS: /// Return true if any widget has changed virtual bool hasChanged(); /** * Update the settings from the dialog. * Virtual function for custom additions. * * Example use: User clicks Ok or Apply button in a configure dialog. */ virtual void updateSettings(); /** * Update the dialog based on the settings. * Virtual function for custom additions. * * Example use: Initialisation of dialog. * Example use: User clicks Reset button in a configure dialog. */ virtual void updateWidgets(); /** * Update the dialog based on the default settings. * Virtual function for custom additions. * * Example use: User clicks Defaults button in a configure dialog. */ virtual void updateWidgetsDefault(); /** * Returns whether the current state of the dialog is * the same as the default configuration. */ virtual bool isDefault(); private: KConfigSkeleton *m_config; QMap m_signalsmap; QMap m_itemmap; QMap m_propertymap; }; //------------- -class KPLATO_EXPORT View : public KoView +class PLAN_EXPORT View : public KoView { Q_OBJECT public: explicit View(KoPart *part, MainDocument *doc, QWidget *parent = 0); ~View(); MainDocument *getPart() const; KoPart *getKoPart() const; Project& getProject() const; QMenu *popupMenu( const QString& name ); virtual bool loadContext(); virtual void saveContext( QDomElement &context ) const; /// Load the workpackage from @p url into @p project. Return true if successful, else false. bool loadWorkPackage( Project &project, const QUrl &url ); QWidget *canvas() const; KoPageLayout pageLayout() const; void setPageLayout(const KoPageLayout &pageLayout); ScheduleManager *currentScheduleManager() const; long activeScheduleId() const; void setActiveSchedule( long id ); /// Returns the default view information like standard name and tooltip for view type @p type ViewInfo defaultViewInfo( const QString &type ) const; /// Returns the default category information like standard name and tooltip for category type @p type ViewInfo defaultCategoryInfo( const QString &type ) const; ViewBase *createTaskEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createResourceEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createAccountsEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createCalendarEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createScheduleHandler( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ScheduleEditor *createScheduleEditor( QWidget *parent ); ViewBase *createScheduleEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createDependencyEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createPertEditor( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createProjectStatusView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createPerformanceStatusView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createTaskStatusView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createTaskView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createTaskWorkPackageView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createGanttView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createMilestoneGanttView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createResourceAppointmentsView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createResourceAppointmentsGanttView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createAccountsView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createResourceAssignmentView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createChartView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createReportView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); ViewBase *createReportsGeneratorView( ViewListItem *cat, const QString &tag, const QString &name = QString(), const QString &tip = QString(), int index = -1 ); KoPrintJob * createPrintJob(); QPrintDialog* createPrintDialog(KoPrintJob*, QWidget*); Q_SIGNALS: void currentScheduleManagerChanged( ScheduleManager *sm ); void taskModulesChanged(const QStringList &modules); public Q_SLOTS: void slotUpdate(); void slotCreateNewProject(); void slotEditResource(); void slotEditResource( Resource *resource ); void slotEditCut(); void slotEditCopy(); void slotEditPaste(); void slotRefreshView(); void slotViewSelector( bool show ); void slotAddTask(); void slotAddSubTask(); void slotAddMilestone(); void slotAddSubMilestone(); void slotProjectEdit(); void slotDefineWBS(); void slotCurrencyConfig(); void slotCreateView(); void slotConfigure(); void slotIntroduction(); void slotAddRelation( Node *par, Node *child ); void slotModifyRelation( Relation *rel ); void slotAddRelation( Node *par, Node *child, int linkType ); void slotModifyRelation( Relation *rel, int linkType ); void slotModifyRelation(); void slotDeleteRelation(); void slotRenameNode( Node *node, const QString& name ); void slotPopupMenu( const QString& menuname, const QPoint &pos ); void slotPopupMenu( const QString& menuname, const QPoint &pos, ViewListItem *item ); void addViewListItem( const ViewListItem *item, const ViewListItem *parent, int index ); void removeViewListItem( const ViewListItem *item ); void slotOpenReportFile(); protected Q_SLOTS: void slotGuiActivated( ViewBase *view, bool ); void slotViewActivated( ViewListItem*, ViewListItem* ); void slotPlugScheduleActions(); void slotViewSchedule( QAction *act ); void slotScheduleChanged( MainSchedule* ); void slotScheduleAdded( const MainSchedule * ); void slotScheduleRemoved( const MainSchedule * ); void slotSelectionChanged( ScheduleManager *sm ); void slotAddScheduleManager( Project *project ); void slotDeleteScheduleManager( Project *project, ScheduleManager *sm ); void slotMoveScheduleManager( ScheduleManager *sm, ScheduleManager *parent, int index ); void slotCalculateSchedule( Project*, ScheduleManager* ); void slotBaselineSchedule( Project *project, ScheduleManager *sm ); void slotProjectWorktime(); void slotOpenNode(); void slotOpenNode( Node *node ); void slotTaskProgress(); void slotTaskDescription(); void slotDeleteTask( QList lst ); void slotDeleteTask( Node *node ); void slotDeleteTask(); void slotIndentTask(); void slotUnindentTask(); void slotMoveTaskUp(); void slotMoveTaskDown(); void slotConnectNode(); void slotDeleteResource( Resource *resource ); void slotDeleteResourceGroup( ResourceGroup *group ); void slotDeleteResourceObjects( QObjectList ); void slotCurrentChanged( int ); void slotSelectDefaultView(); void slotInsertResourcesFile(const QString&, const QUrl &projects); void slotInsertFile(); void slotWorkPackageLoaded(); void slotMailWorkpackage( Node *node, Resource *resource = 0 ); void slotMailWorkpackages( const QList &nodes, Resource *resource = 0 ); void slotOpenUrlRequest( HtmlView *v, const QUrl &url ); void slotProjectCalculated( ScheduleManager *sm ); void slotUpdateViewInfo( ViewListItem *itm ); void createReportView(const QDomDocument &doc); void saveTaskModule( const QUrl &url, Project *project ); void removeTaskModule( const QUrl &url ); void taskModuleFileChanged(const QString &path); protected: virtual void guiActivateEvent( bool activated ); virtual void updateReadWrite( bool readwrite ); QList sortedActionList(); QAction *addScheduleAction( Schedule *sch ); void setLabel( ScheduleManager *sm = 0 ); Task *currentTask() const; Node *currentNode() const; Resource *currentResource(); ResourceGroup *currentResourceGroup(); Calendar *currentCalendar(); void updateView( QWidget *widget ); ViewBase *currentView() const; ViewBase *createIntroductionView(); private Q_SLOTS: void slotActionDestroyed( QObject *o ); void slotViewListItemRemoved( ViewListItem *item ); void slotViewListItemInserted( ViewListItem *item, ViewListItem *parent, int index ); void slotProjectEditFinished( int result ); void slotTaskEditFinished( int result ); void slotSummaryTaskEditFinished( int result ); void slotEditResourceFinished( int result ); void slotProjectWorktimeFinished( int result ); void slotDefineWBSFinished( int result ); void slotCurrencyConfigFinished( int result ); void slotInsertFileFinished( int result ); void slotAddSubTaskFinished( int result ); void slotAddTaskFinished( int result ); void slotAddSubMilestoneFinished( int result ); void slotAddMilestoneFinished( int result ); void slotTaskProgressFinished( int result ); void slotMilestoneProgressFinished( int result ); void slotTaskDescriptionFinished( int result ); void slotAddRelationFinished( int result ); void slotModifyRelationFinished( int result ); void slotReportDesignFinished( int result ); void slotOpenReportFileFinished( int result ); void slotCreateViewFinished( int result ); void slotRemoveCommands(); void hideToolDocker(); void initiateViews(); void slotViewScheduleManager(ScheduleManager *sm); private: void createViews(); ViewBase *createView( ViewListItem *cat, const QString &type, const QString &tag, const QString &name, const QString &tip, int index = -1 ); QString standardTaskStatusReport() const; private: QSplitter *m_sp; QStackedWidget *m_tab; ViewListWidget *m_viewlist; ViewListItem *m_viewlistItem; // requested popupmenu item //QDockWidget *m_toolbox; int m_viewGrp; int m_defaultFontSize; int m_currentEstimateType; bool m_updateAccountsview; bool m_updateResourceAssignmentView; bool m_updatePertEditor; QLabel *m_estlabel; ViewAdaptor* m_dbus; QActionGroup *m_scheduleActionGroup; QMap m_scheduleActions; QMultiMap m_calculationcommands; QList m_undocommands; bool m_readWrite; int m_defaultView; QList m_visitedViews; QList m_dockers; // ------ File QAction *actionCreateTemplate; QAction *actionCreateNewProject; // ------ Edit QAction *actionCut; QAction *actionCopy; QAction *actionPaste; // ------ View KToggleAction *actionViewSelector; // ------ Insert // ------ Project QAction *actionEditMainProject; // ------ Tools QAction *actionEditStandardWorktime; QAction *actionDefineWBS; QAction *actionInsertFile; QAction *actionCurrencyConfig; QAction *actionOpenReportFile; // ------ Settings QAction *actionConfigure; // ------ Help QAction *actionIntroduction; // ------ Popup QAction *actionOpenNode; QAction *actionTaskProgress; QAction *actionTaskDescription; QAction *actionDeleteTask; QAction *actionIndentTask; QAction *actionUnindentTask; QAction *actionMoveTaskUp; QAction *actionMoveTaskDown; QAction *actionEditResource; QAction *actionEditRelation; QAction *actionDeleteRelation; //Test QAction *actNoInformation; QMap m_reportActionMap; KoPart *m_partpart; KDirWatch m_dirwatch; }; } //Kplato namespace #endif diff --git a/src/kptviewlist.h b/src/kptviewlist.h index bcbca5cc..ebb28fb2 100644 --- a/src/kptviewlist.h +++ b/src/kptviewlist.h @@ -1,222 +1,222 @@ /* This file is part of the KDE project Copyright (C) 2007 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTVIEWLIST_H #define KPTVIEWLIST_H -#include "kplato_export.h" +#include "plan_export.h" #include "kptschedulemodel.h" #include class QDomElement; class KoDocument; class KoView; class QComboBox; namespace KPlato { class View; class ViewBase; class ViewListItem; class ViewListWidget; class MainDocument; class Context; class ScheduleManager; #define TIP_USE_DEFAULT_TEXT "TIP_USE_DEFAULT_TEXT" //-------------- struct ViewInfo { QString name; QString tip; }; //-------------- -class KPLATO_EXPORT ViewListItem : public QTreeWidgetItem +class PLAN_EXPORT ViewListItem : public QTreeWidgetItem { public: enum ItemType { ItemType_Category = Type, ItemType_SubView = UserType }; enum DataRole { DataRole_View = Qt::UserRole, DataRole_Document }; ViewListItem( const QString &tag, const QStringList &strings, int type = ItemType_Category ); ViewListItem( QTreeWidget *parent, const QString &tag, const QStringList &strings, int type = ItemType_Category ); ViewListItem( QTreeWidgetItem *parent, const QString &tag, const QStringList &strings, int type = ItemType_Category ); void setView( ViewBase *view ); ViewBase *view() const; void setDocument( KoDocument *doc ); KoDocument *document() const; void setViewInfo( const ViewInfo &vi ) { m_viewinfo = vi; } QString viewType() const; QString tag() const { return m_tag; } void save( QDomElement &element ) const; void setReadWrite( bool rw ); private: QString m_tag; ViewInfo m_viewinfo; }; -class KPLATO_EXPORT ViewListTreeWidget : public QTreeWidget +class PLAN_EXPORT ViewListTreeWidget : public QTreeWidget { Q_OBJECT public: explicit ViewListTreeWidget( QWidget *parent ); ViewListItem *findCategory( const QString &cat ); /// Return the category of @p view ViewListItem *category( const KoView *view ) const; void save( QDomElement &element ) const; protected: void drawRow( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; virtual void mousePressEvent ( QMouseEvent *event ); /// Setup drop enabled/disabled dependent on the selected item virtual void startDrag( Qt::DropActions supportedActions ); /// If modified by the drop, emit modified void dropEvent( QDropEvent *event ); Q_SIGNALS: void activated( QTreeWidgetItem* ); void updateViewInfo( ViewListItem *itm ); void modified(); private Q_SLOTS: void handleMousePress( QTreeWidgetItem *item ); }; -class KPLATO_EXPORT ViewListWidget : public QWidget +class PLAN_EXPORT ViewListWidget : public QWidget { Q_OBJECT public: ViewListWidget( MainDocument *part, QWidget *parent );//QString name, KXmlGuiWindow *parent ); ~ViewListWidget(); /// Set read/write permission on all views. void setReadWrite( bool rw ); /// Add a category if it does not already exist ViewListItem *addCategory( const QString &tag, const QString& name ); /// Return a list of all categories QList categories() const; /// Return the category with @p tag ViewListItem *findCategory( const QString &tag ) const; /// Return the category of @p view ViewListItem *category( const KoView *view ) const; /// Create a unique tag QString uniqueTag( const QString &seed ) const; /// Add a sub-view ViewListItem *addView(QTreeWidgetItem *category, const QString &tag, const QString &name, ViewBase *view, KoDocument *doc, const QString &iconName = QString(), int index = -1 ); void setSelected( QTreeWidgetItem *item ); ViewListItem *currentItem() const; void setCurrentItem( QTreeWidgetItem *item ); ViewListItem *currentCategory() const; KoView *findView( const QString &tag ) const; ViewListItem *findItem( const QString &tag ) const; ViewListItem *findItem( const QString &tag, QTreeWidgetItem* parent ) const; ViewListItem *findItem( const ViewBase *view, QTreeWidgetItem* parent = 0 ) const; /// Remove @p item, don't emit signal int removeViewListItem( ViewListItem *item ); /// Add @p item to @p parent at @p index, don't emit signal void addViewListItem( ViewListItem *item, QTreeWidgetItem *parent, int index ); /// Remove @p item, emit signal int takeViewListItem( ViewListItem *item ); /// Add @p item to @p parent at @ index, emit signal void insertViewListItem( ViewListItem *item, QTreeWidgetItem *parent, int index ); void save( QDomElement &element ) const; ViewListItem *previousViewItem() const { return m_prev; } ScheduleManager *selectedSchedule() const; Q_SIGNALS: void activated( ViewListItem*, ViewListItem* ); void createView(); void viewListItemRemoved( ViewListItem *item ); void viewListItemInserted( ViewListItem *item, ViewListItem *parent, int index ); void selectionChanged( ScheduleManager* ); void updateViewInfo( ViewListItem *itm ); void modified(); public Q_SLOTS: void setProject( Project *project ); void setSelectedSchedule( ScheduleManager *sm ); void setModified(); protected Q_SLOTS: void slotActivated( QTreeWidgetItem *item, QTreeWidgetItem *prev ); void slotItemChanged( QTreeWidgetItem *item, int col ); void renameCategory(); void slotAddView(); void slotRemoveCategory(); void slotRemoveView(); void slotEditViewTitle(); void slotEditDocumentTitle(); void slotConfigureItem(); void slotCurrentScheduleChanged( int ); void slotScheduleManagerAdded( ScheduleManager* ); void slotDialogFinished( int result ); protected: virtual void contextMenuEvent ( QContextMenuEvent *event ); private: void setupContextMenus(); private: MainDocument *m_part; ViewListTreeWidget *m_viewlist; QComboBox *m_currentSchedule; ScheduleSortFilterModel m_sfModel; ScheduleItemModel m_model; ViewListItem *m_contextitem; QList m_categoryactions; QList m_viewactions; QList m_listactions; ViewListItem *m_prev; ScheduleManager *m_temp; }; } //Kplato namespace #endif diff --git a/src/libs/kernel/CMakeLists.txt b/src/libs/kernel/CMakeLists.txt index 7c76fc4f..09f310b0 100644 --- a/src/libs/kernel/CMakeLists.txt +++ b/src/libs/kernel/CMakeLists.txt @@ -1,60 +1,60 @@ if(BUILD_TESTING) add_subdirectory( tests ) endif() include_directories(${PLANODF_INCLUDES} ${PLANKUNDO2_INCLUDES}) ########### KPlato kernel library ############### -set(kplatokernel_LIB_SRCS +set(plankernel_LIB_SRCS kptglobal.cpp kptlocale.cpp kpteffortcostmap.cpp kptdocuments.cpp kptaccount.cpp kptappointment.cpp kptnode.cpp kptproject.cpp kptrelation.cpp kptresource.cpp kpttask.cpp kptduration.cpp kptdatetime.cpp kptcalendar.cpp kptschedule.cpp kptwbsdefinition.cpp kptcommand.cpp kptpackage.cpp kptdebug.cpp kptschedulerplugin.cpp kptconfigbase.cpp KPlatoXmlLoaderBase.cpp ) -add_library(kplatokernel SHARED ${kplatokernel_LIB_SRCS}) -generate_export_header(kplatokernel) +add_library(plankernel SHARED ${plankernel_LIB_SRCS}) +generate_export_header(plankernel) -target_link_libraries(kplatokernel +target_link_libraries(plankernel PUBLIC plankundo2 planstore planwidgetutils # KF5::I18n # KF5::CoreAddons ) if(KF5Holidays_FOUND) - target_link_libraries(kplatokernel PUBLIC KF5::Holidays) + target_link_libraries(plankernel PUBLIC KF5::Holidays) endif() -set_target_properties(kplatokernel PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) +set_target_properties(plankernel PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) -install(TARGETS kplatokernel ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS plankernel ${INSTALL_TARGETS_DEFAULT_ARGS}) # TODO: with the new embedded JSON data for plugins there is no schema ATM to define extended properties # plan_schedulerplugin.desktop diff --git a/src/libs/kernel/KPlatoXmlLoaderBase.h b/src/libs/kernel/KPlatoXmlLoaderBase.h index 33880b91..3341fcf9 100644 --- a/src/libs/kernel/KPlatoXmlLoaderBase.h +++ b/src/libs/kernel/KPlatoXmlLoaderBase.h @@ -1,103 +1,103 @@ /* This file is part of the KDE project Copyright (C) 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPLATOXMLLOADERBASE_H #define KPLATOXMLLOADERBASE_H #include "kptaccount.h" #include "kpttask.h" #include #define KPLATO_MAX_FILE_SYNTAX_VERSION "0.6.5" #define KPLATOWORK_MAX_FILE_SYNTAX_VERSION "0.6.5" class KoXmlElement; namespace KPlato { class XMLLoaderObject; class Project; class Task; class Calendar; class CalendarDay; class CalendarWeekdays; class StandardWorktime; class Relation; class ResourceGroup; class Resource; class Accounts; class Account; class ScheduleManager; class Schedule; class NodeSchedule; class WBSDefinition; class WorkPackage; class Documents; class Estimate; class ResourceGroupRequest; class ResourceRequest; class Completion; class Appointment; class AppointmentIntervalList; class AppointmentInterval; -class KPLATOKERNEL_EXPORT KPlatoXmlLoaderBase : public QObject +class PLANKERNEL_EXPORT KPlatoXmlLoaderBase : public QObject { Q_OBJECT public: KPlatoXmlLoaderBase(); virtual ~KPlatoXmlLoaderBase() {} bool load( Project *project, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Task *task, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Calendar *Calendar, const KoXmlElement &element, XMLLoaderObject &status ); bool load( CalendarDay *day, const KoXmlElement &element, XMLLoaderObject &status ); bool load( CalendarWeekdays *weekdays, const KoXmlElement& element, XMLLoaderObject& status ); bool load( StandardWorktime *swt, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Relation *relation, const KoXmlElement &element, XMLLoaderObject &status ); bool load( ResourceGroup *rg, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Resource *resource, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Accounts &accounts, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Account *account, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Account::CostPlace *cp, const KoXmlElement &element, XMLLoaderObject &status ); bool load( ScheduleManager *manager, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Schedule *schedule, const KoXmlElement &element, XMLLoaderObject &status ); MainSchedule *loadMainSchedule( ScheduleManager* manager, const KoXmlElement &element, XMLLoaderObject& status); bool loadMainSchedule( MainSchedule* ms, const KoXmlElement &element, XMLLoaderObject& status); bool loadNodeSchedule( NodeSchedule* sch, const KoXmlElement &element, XMLLoaderObject& status); bool load( WBSDefinition &def, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Documents &documents, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Document *document, const KoXmlElement &element, XMLLoaderObject &status ); bool load( Estimate *estimate, const KoXmlElement &element, XMLLoaderObject &status ); bool load( ResourceGroupRequest *gr, const KoXmlElement &element, XMLLoaderObject &status ); bool load( ResourceRequest *rr, const KoXmlElement &element, XMLLoaderObject &status ); bool load( WorkPackage& wp, const KoXmlElement& element, XMLLoaderObject& status ); bool loadWpLog( WorkPackage* wp, KoXmlElement &element, XMLLoaderObject &status); bool load( Completion& completion, const KoXmlElement& element, XMLLoaderObject& status ); bool load( Completion::UsedEffort *ue, const KoXmlElement& element, XMLLoaderObject& status ); bool load( Appointment *appointment, const KoXmlElement& element, XMLLoaderObject& status, Schedule &sch ); bool load( AppointmentIntervalList &lst, const KoXmlElement& element, XMLLoaderObject& status ); bool load( AppointmentInterval &interval, const KoXmlElement& element, XMLLoaderObject& status ); }; } // namespace KPlato #endif // KPLATOXMLLOADERBASE_H diff --git a/src/libs/kernel/kptaccount.h b/src/libs/kernel/kptaccount.h index 3c0ad448..b5fe97ee 100644 --- a/src/libs/kernel/kptaccount.h +++ b/src/libs/kernel/kptaccount.h @@ -1,298 +1,298 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2007 Dag Andersen Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTACCOUNT_H #define KPTACCOUNT_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include "kptglobal.h" #include "kpteffortcostmap.h" #include "kptnode.h" #include "kptresource.h" #include class QDomElement; class QStringList; namespace KPlato { class Accounts; class Account; /** * Account holds one account. * An account can have any number of sub-accounts. * Account names must be unique. */ -class KPLATOKERNEL_EXPORT Account +class PLANKERNEL_EXPORT Account { public: /** * Constructor. */ Account(); /** * */ explicit Account(const QString& name, const QString& description=QString()); /** * Destructor. */ ~Account(); QString name() const { return m_name; } void setName(const QString& name); QString description() const { return m_description; } void setDescription(const QString& desc); bool isElement() const { return m_accountList.isEmpty(); } bool isDefaultAccount() const; Accounts *list() const { return m_list; } void setList(Accounts *list) { m_list = list; } Account *parent() const { return m_parent; } void setParent(Account *parent) { m_parent = parent; } void clear() { m_accountList.clear(); } void insert(Account *account, int index = -1); void take(Account *account); bool isChildOf( const Account *account ) const; void insertChildren(); int indexOf( Account *account ) const { return m_accountList.indexOf( account ); } bool isBaselined( long id = BASELINESCHEDULE ) const; bool load(KoXmlElement &element, Project &project); void save(QDomElement &element) const; const QList &accountList() const { return m_accountList; } int childCount() const { return m_accountList.count(); } Account *childAt( int index ) const { return m_accountList.value( index ); } Account *findAccount() const { return findAccount(m_name); } Account *findAccount(const QString &id) const; bool removeId() { return removeId(m_name); } bool removeId(const QString &id); bool insertId(); bool insertId(Account *account); void changed(); class CostPlace { public: /// Create an empty cost place CostPlace() : m_account(0), m_objectId(), m_node(0), m_resource(0), m_running(false), m_startup(false), m_shutdown(false) {} /// Create an empty cost place for account @p acc explicit CostPlace(Account *acc) : m_account(acc), m_objectId(), m_node(0), m_resource(0), m_running(false), m_startup(false), m_shutdown(false) {} /// Create a cost place for a task CostPlace(Account *acc, Node *node, bool running=false, bool strtup=false, bool shutdown=false); /// Create a cost place for a resource CostPlace(Account *acc, Resource *resource, bool running=false); explicit CostPlace(CostPlace *cp) { m_account = cp->m_account; m_objectId = cp->m_objectId; m_node = cp->m_node; m_resource = cp->m_resource; m_running = cp->m_running; m_startup = cp->m_startup; m_shutdown = cp->m_shutdown; } ~CostPlace(); bool isBaselined( long id = BASELINESCHEDULE ) const; bool isEmpty() { return !(m_running || m_startup || m_shutdown); } Node *node() const { return m_node; } void setNode( Node *node ); Resource *resource() const { return m_resource; } void setResource( Resource *resource ); bool running() const { return m_running; } void setRunning(bool on ); bool startup() const { return m_startup; } void setStartup(bool on); bool shutdown() const { return m_shutdown; } void setShutdown(bool on); bool load(KoXmlElement &element, Project &project); void save(QDomElement &element) const; // for loading xml void setObjectId( const QString &id ); QString objectId() const; private: Account *m_account; QString m_objectId; Node *m_node; Resource *m_resource; bool m_running; bool m_startup; bool m_shutdown; }; void append(CostPlace *cp) { m_costPlaces.append(cp); } const QList &costPlaces() const {return m_costPlaces; } Account::CostPlace *findCostPlace(const Node &node) const; Account::CostPlace *findCostPlace(const Resource &resource) const; CostPlace *findRunning(const Resource &resource) const; void removeRunning(const Resource &resource); void addRunning(Resource &resource); CostPlace *findRunning(const Node &node) const; void removeRunning(const Node &node); void addRunning(Node &node); CostPlace *findStartup(const Node &node) const; void removeStartup(const Node &node); void addStartup(Node &node); CostPlace *findShutdown(const Node &node) const; void removeShutdown(const Node &node); void addShutdown(Node &node); void deleteCostPlace(CostPlace *cp); EffortCostMap plannedCost(long id = BASELINESCHEDULE) const; EffortCostMap plannedCost(const QDate &start, const QDate &end, long id = BASELINESCHEDULE) const; EffortCostMap actualCost(long id = BASELINESCHEDULE) const; EffortCostMap actualCost(const QDate &start, const QDate &end, long id = BASELINESCHEDULE) const; protected: EffortCostMap plannedCost(const CostPlace &cp, const QDate &start, const QDate &end, long id ) const; EffortCostMap actualCost(const Account::CostPlace &cp, const QDate &start, const QDate &end, long id) const; private: QString m_name; QString m_description; friend class Accounts; Accounts *m_list; Account *m_parent; QList m_accountList; QList m_costPlaces; #ifndef NDEBUG public: void printDebug(const QString& indent); #endif }; typedef QList AccountList; typedef QListIterator AccountListIterator; /** * Accounts administrates all accounts. */ -class KPLATOKERNEL_EXPORT Accounts : public QObject +class PLANKERNEL_EXPORT Accounts : public QObject { Q_OBJECT public: explicit Accounts(Project &project); ~Accounts(); Account *defaultAccount() const { return m_defaultAccount; } void setDefaultAccount(Account *account); /// Return the planned cost from all cost places of this account added to cost from all sub-accounts EffortCostMap plannedCost(const Account &account, long id = BASELINESCHEDULE) const; /// Return the planned cost from all cost places of this account added to cost from all sub-accounts /// for the interval @p start to @p end inclusive EffortCostMap plannedCost(const Account &account, const QDate &start, const QDate &end, long id = BASELINESCHEDULE) const; /// Return the actual cost from all cost places of this account added to cost from all sub-accounts EffortCostMap actualCost(const Account &account, long id = BASELINESCHEDULE) const; /// Return the actual cost from all cost places of this account added to cost from all sub-accounts /// for the interval @p start to @p end inclusive EffortCostMap actualCost(const Account &account, const QDate &start, const QDate &end, long id = BASELINESCHEDULE) const; void clear() { m_accountList.clear(); m_idDict.clear(); } void insert(Account *account, Account *parent=0, int index = -1); void take(Account *account); bool load(KoXmlElement &element, Project &project); void save(QDomElement &element) const; QStringList costElements() const; QStringList nameList() const; const AccountList &accountList() const { return m_accountList; } int accountCount() const { return m_accountList.count(); } Account *accountAt( int index ) const { return m_accountList.value( index ); } int indexOf( Account *account ) const { return m_accountList.indexOf( account ); } Account *findRunningAccount(const Resource &resource) const; Account *findRunningAccount(const Node &node) const; Account *findStartupAccount(const Node &node) const; Account *findShutdownAccount(const Node &node) const; Account *findAccount(const QString &id) const; bool insertId(Account *account); bool removeId(const QString &id); QString uniqueId( const QString &seed ) const; void accountDeleted(Account *account); void accountChanged( Account *account ); QList allAccounts() const { return m_idDict.values(); } QList allNodes() const; Q_SIGNALS: void accountAdded( const Account * ); void accountToBeAdded( const Account *, int ); void accountRemoved( const Account * ); void accountToBeRemoved( const Account * ); void changed( Account *); void defaultAccountChanged(); private: Project &m_project; AccountList m_accountList; QMap m_idDict; Account *m_defaultAccount; #ifndef NDEBUG public: void printDebug(const QString& indent); #endif }; } //namespace KPlato #endif diff --git a/src/libs/kernel/kptappointment.h b/src/libs/kernel/kptappointment.h index a89035a5..a2b1bc94 100644 --- a/src/libs/kernel/kptappointment.h +++ b/src/libs/kernel/kptappointment.h @@ -1,278 +1,278 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTAPPOINTMENT_H #define KPTAPPOINTMENT_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptglobal.h" #include "kptduration.h" #include "kptdatetime.h" #include #include #include #include #include class QDomElement; namespace KPlato { class Effort; class Appointment; class Node; class Resource; class EffortCost; class EffortCostMap; class Schedule; class XMLLoaderObject; class DateTimeInterval; class TimeInterval; class AppointmentIntervalData : public QSharedData { public: AppointmentIntervalData() : load( 0 ) {} AppointmentIntervalData( const AppointmentIntervalData &other ) : QSharedData( other ), start( other.start ), end( other.end ), load( other.load ) {} ~AppointmentIntervalData() {} DateTime start; DateTime end; double load; //percent }; -class KPLATOKERNEL_EXPORT AppointmentInterval +class PLANKERNEL_EXPORT AppointmentInterval { public: AppointmentInterval(); AppointmentInterval(const AppointmentInterval &AppointmentInterval); AppointmentInterval(const DateTime &start, const DateTime &end, double load=100); AppointmentInterval( QDate date, const TimeInterval &timeInterval, double load=100 ); ~AppointmentInterval(); Duration effort() const; Duration effort(const DateTime &start, const DateTime &end) const; Duration effort(QDate time, bool upto) const; bool loadXML(KoXmlElement &element, XMLLoaderObject &status); void saveXML(QDomElement &element) const; const DateTime &startTime() const; void setStartTime( const DateTime &time ); const DateTime &endTime() const; void setEndTime( const DateTime &time ); double load() const; void setLoad( double load ); bool isValid() const; AppointmentInterval firstInterval(const AppointmentInterval &interval, const DateTime &from) const; bool operator==( const AppointmentInterval &interval ) const; bool operator<( const AppointmentInterval &interval ) const; bool intersects( const AppointmentInterval &other ) const; AppointmentInterval interval( const DateTime &start, const DateTime &end ) const; QString toString() const; private: QSharedDataPointer d; }; -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::AppointmentInterval& i ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::AppointmentInterval& i ); /** * This list is sorted after 1) startdatetime, 2) enddatetime. * The intervals do not overlap, an interval does not start before the * previous interval ends. */ -class KPLATOKERNEL_EXPORT AppointmentIntervalList +class PLANKERNEL_EXPORT AppointmentIntervalList { public: AppointmentIntervalList(); AppointmentIntervalList( const QMultiMap &other ); /// Add @p interval to the list. Handle overlapping with existing intervals. void add( const AppointmentInterval &interval ); /// Add an interval to the list. Handle overlapping with existing intervals. void add( const DateTime &st, const DateTime &et, double load ); /// Load intervals from document bool loadXML(KoXmlElement &element, XMLLoaderObject &status); /// Save intervals to document void saveXML(QDomElement &element) const; AppointmentIntervalList &operator+=( const AppointmentIntervalList &lst ); AppointmentIntervalList &operator-=( const AppointmentIntervalList &lst ); AppointmentIntervalList &operator=( const AppointmentIntervalList &lst ); /// Returns the intervals in the range @p start, @p end AppointmentIntervalList extractIntervals( const DateTime &start, const DateTime &end ) const; /// Return the total effort Duration effort() const; /// Return the effort limited to the interval @p start, @p end Duration effort(const DateTime &start, const DateTime &end) const; QMultiMap map(); const QMultiMap &map() const; bool isEmpty() const { return m_map.isEmpty(); } void clear() { m_map.clear(); } protected: void subtract( const AppointmentInterval &interval ); void subtract( const DateTime &st, const DateTime &et, double load ); private: QMultiMap m_map; }; -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::AppointmentIntervalList& i ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::AppointmentIntervalList& i ); /** * A Resource can be scheduled to be used at any time, * this is represented internally with Appointments * There is one Appointment per resource-task pair. * An appointment can be divided into several intervals, represented with * a list of AppointmentInterval. * This list is sorted after 1) startdatetime, 2) enddatetime. * The intervals do not overlap, an interval does not start before the * previous interval ends. * An interval is a countinous time interval with the same load. It can span dates. */ -class KPLATOKERNEL_EXPORT Appointment { +class PLANKERNEL_EXPORT Appointment { public: explicit Appointment(); Appointment(Schedule *resource, Schedule *node, const DateTime &start, const DateTime &end, double load); Appointment(Schedule *resource, Schedule *node, const DateTime &start, Duration duration, double load); Appointment( const Appointment &app ); ~Appointment(); bool isEmpty() const { return m_intervals.isEmpty(); } void clear(); // get/set member values. Schedule *node() const { return m_node; } void setNode(Schedule *n) { m_node = n; } Schedule *resource() const { return m_resource; } void setResource(Schedule *r) { m_resource = r; } DateTime startTime() const; DateTime endTime() const; double maxLoad() const; const Duration &repeatInterval() const {return m_repeatInterval;} void setRepeatInterval(Duration ri) {m_repeatInterval=ri;} int repeatCount() const { return m_repeatCount; } void setRepeatCount(int rc) { m_repeatCount=rc; } bool isBusy(const DateTime &start, const DateTime &end); /// attach appointment to resource and node bool attach(); /// detach appointment from resource and node void detach(); void addInterval(const AppointmentInterval &a); void addInterval(const DateTime &start, const DateTime &end, double load=100); void addInterval(const DateTime &start, KPlato::Duration duration, double load=100); void setIntervals(const AppointmentIntervalList &lst); const AppointmentIntervalList &intervals() const { return m_intervals; } int count() const { return m_intervals.map().count(); } AppointmentInterval intervalAt( int index ) const { return m_intervals.map().values().value( index ); } /// Return intervals between @p start and @p end AppointmentIntervalList intervals( const DateTime &start, const DateTime &end ) const; bool loadXML(KoXmlElement &element, XMLLoaderObject &status, Schedule &sch); void saveXML(QDomElement &element) const; /** * Returns the planned effort and cost for the interval start to end (inclusive). * Only dates with any planned effort is returned. * If start or end is not valid, startTime.date() respectively endTime().date() is used. */ EffortCostMap plannedPrDay(QDate start, QDate end, EffortCostCalculationType type = ECCT_All) const; /// Returns the planned effort from start to end Duration effort(const DateTime &start, const DateTime &end, EffortCostCalculationType type = ECCT_All) const; /// Returns the planned effort from start for the duration Duration effort(const DateTime &start, KPlato::Duration duration, EffortCostCalculationType type = ECCT_All) const; /// Returns the total planned effort for @p resource on this appointment Duration plannedEffort( const Resource *resource, EffortCostCalculationType type = ECCT_All ) const; /// Returns the total planned effort for this appointment Duration plannedEffort(EffortCostCalculationType type = ECCT_All) const; /// Returns the planned effort on the date Duration plannedEffort(QDate date, EffortCostCalculationType type = ECCT_All) const; /// Returns the planned effort for @p resource on the @p date date Duration plannedEffort( const Resource *resource, QDate date, EffortCostCalculationType type = ECCT_All ) const; /// Returns the planned effort upto and including date Duration plannedEffortTo(QDate date, EffortCostCalculationType type = ECCT_All) const; /// Returns the planned effort upto and including date Duration plannedEffortTo( const Resource *resource, QDate date, EffortCostCalculationType type = ECCT_All ) const; /// Calculates the total planned cost for this appointment EffortCost plannedCost(EffortCostCalculationType type = ECCT_All) const; /// Calculates the planned cost on date double plannedCost(QDate date, EffortCostCalculationType type = ECCT_All); /// Calculates the planned cost upto and including date double plannedCostTo(QDate date, EffortCostCalculationType type = ECCT_All); Appointment &operator=(const Appointment &app); Appointment &operator+=(const Appointment &app); Appointment operator+(const Appointment &app); Appointment &operator-=(const Appointment &app); void setCalculationMode( int mode ) { m_calculationMode = mode; } int calculationMode() const { return m_calculationMode; } void merge(const Appointment &app); Appointment extractIntervals( const DateTimeInterval &interval ) const; void setAuxcilliaryInfo( const QString &info ) { m_auxcilliaryInfo = info; } QString auxcilliaryInfo() const { return m_auxcilliaryInfo; } protected: void copy(const Appointment &app); private: Schedule *m_node; Schedule *m_resource; int m_calculationMode; // Type of appointment Duration m_repeatInterval; int m_repeatCount; QList m_extraRepeats; QList m_skipRepeats; AppointmentIntervalList m_intervals; QString m_auxcilliaryInfo; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptcalendar.h b/src/libs/kernel/kptcalendar.h index 93a26d07..0b3c2ef7 100644 --- a/src/libs/kernel/kptcalendar.h +++ b/src/libs/kernel/kptcalendar.h @@ -1,695 +1,695 @@ /* This file is part of the KDE project Copyright (C) 2003 - 2007 Dag Andersen Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTCALENDAR_H #define KPTCALENDAR_H #include "kptdatetime.h" #include "kptduration.h" #include "kptdebug.h" -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include #include #include #ifdef HAVE_KHOLIDAYS namespace KHolidays { class HolidayRegion; } #endif class KUndo2Command; class QDomElement; class QStringList; /// The main namespace. namespace KPlato { class Calendar; class Project; class IntMap; //class DateTime; class Project; class Schedule; class XMLLoaderObject; class AppointmentIntervalList; -class KPLATOKERNEL_EXPORT DateTimeInterval : public std::pair +class PLANKERNEL_EXPORT DateTimeInterval : public std::pair { public: DateTimeInterval() : std::pair() {} DateTimeInterval( const DateTime &t1, const DateTime &t2 ) : std::pair( t1, t2 ) {} DateTimeInterval &operator=( const DateTimeInterval &other ) { first = other.first; second = other.second; return *this; } bool isValid() const { return first.isValid() && second.isValid(); } void limitTo( const DateTime &start, const DateTime &end ) { if ( ! first.isValid() || ( start.isValid() && start > first ) ) { first = start; } if ( ! second.isValid() || ( end.isValid() && end < second ) ) { second = end; } if ( isValid() && first > second ) { first = second = DateTime(); } } void limitTo( const DateTimeInterval &interval ) { limitTo( interval.first, interval.second ); } DateTimeInterval limitedTo( const DateTime &start, const DateTime &end ) const { DateTimeInterval i = *this; i.limitTo( start, end ); return i; } DateTimeInterval limitedTo( const DateTimeInterval &interval ) const { return limitedTo( interval.first, interval.second ); } QString toString() const { return QStringLiteral( "%1 to %2" ) .arg( first.isValid()?first.toString():QStringLiteral("''") ) .arg( second.isValid()?second.toString():QStringLiteral("''") ); } }; /// TimeInterval is defined as a start time and a length. /// The end time (start + length) must not exceed midnight -class KPLATOKERNEL_EXPORT TimeInterval : public std::pair +class PLANKERNEL_EXPORT TimeInterval : public std::pair { public: TimeInterval() : std::pair( QTime(), -1 ) {} explicit TimeInterval( std::pair value ) : std::pair( value ) { init(); } TimeInterval( QTime start, int length ) : std::pair( start, length ) { init(); } TimeInterval( const TimeInterval &value ) : std::pair( value.first, value.second ) { init(); } /// Return the intervals start time QTime startTime() const { return first; } /// Return the intervals calculated end time. Note: It may return QTime(0,0,0) QTime endTime() const { return first.addMSecs( second ); } double hours() const { return (double)(second) / ( 1000. * 60. * 60. ); } /// Returns true if this interval ends at midnight, and thus endTime() returns QTime(0,0,0) bool endsMidnight() const { return endTime() == QTime( 0, 0, 0 ); } bool isValid() const { return first.isValid() && second > 0; } bool isNull() const { return first.isNull() || second < 0; } TimeInterval &operator=( const TimeInterval &ti ) { first = ti.first; second = ti.second; return *this; } /// Returns true if the intervals overlap in any way bool intersects( const TimeInterval &ti ) const { if ( ! isValid() || ! ti.isValid() ) { return false; } if ( endsMidnight() && ti.endsMidnight() ) { return true; } if ( endsMidnight() ) { return first < ti.endTime(); } if ( ti.endsMidnight() ) { return ti.first < endTime(); } return ( first < ti.endTime() && endTime() > ti.first ) || ( ti.first < endTime() && ti.endTime() > first ); } protected: void init() { int s = QTime( 0, 0, 0 ).msecsTo( first ); if ( ( s + second ) > 86400000 ) { second = 86400000 - s; errorPlan<<"Overflow, limiting length to"< timeIntervals() const { return m_timeIntervals; } void addInterval( QTime t1, int length ) { addInterval( new TimeInterval( t1, length ) ); } /** * Caller needs to ensure that intervals are not overlapping. */ void addInterval(TimeInterval *interval); void addInterval(TimeInterval interval) { addInterval(new TimeInterval(interval)); } void clearIntervals() { m_timeIntervals.clear(); } void setIntervals(const QList &intervals) { m_timeIntervals.clear(); m_timeIntervals = intervals; } void removeInterval( TimeInterval *interval ); bool hasInterval( const TimeInterval *interval ) const; int numIntervals() const; DateTime start() const; DateTime end() const; QDate date() const { return m_date; } void setDate(QDate date) { m_date = date; } int state() const { return m_state; } void setState(int state) { m_state = state; } bool operator==(const CalendarDay *day) const; bool operator==(const CalendarDay &day) const; bool operator!=(const CalendarDay *day) const; bool operator!=(const CalendarDay &day) const; Duration workDuration() const; /** * Returns the amount of 'worktime' that can be done on * this day between the times start and end. */ Duration effort(QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0); /** * Returns the amount of 'worktime' that can be done on * this day between the times start and end. */ Duration effort(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0); /** * Returns the actual 'work interval' for the interval start to end. * If no 'work interval' exists, returns the interval start, end. * Use @ref hasInterval() to check if a 'work interval' exists. */ TimeInterval interval(QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0) const; /** * Returns the actual 'work interval' for the interval start to end. * If no 'work interval' exists, returns the interval start, end. * Use @ref hasInterval() to check if a 'work interval' exists. */ TimeInterval interval(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0) const; bool hasInterval() const; /** * Returns true if at least a part of a 'work interval' exists * for the interval start to end. */ bool hasInterval(QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0) const; /** * Returns true if at least a part of a 'work interval' exists * for the interval @p start to @p start + @p length. * Assumes this day is date. (Used by weekday hasInterval().) * If @p sch is not 0, the schedule is checked for availability. */ bool hasInterval(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0) const; Duration duration() const; const CalendarDay ©(const CalendarDay &day); static QString stateToString( int st, bool trans = false ); static QStringList stateList( bool trans = false ); private: QDate m_date; //NOTE: inValid if used for weekdays int m_state; Calendar *m_calendar; QList m_timeIntervals; #ifndef NDEBUG public: void printDebug(const QString& indent=QString()); #endif }; -class KPLATOKERNEL_EXPORT CalendarWeekdays { +class PLANKERNEL_EXPORT CalendarWeekdays { public: CalendarWeekdays(); explicit CalendarWeekdays( const CalendarWeekdays *weekdays ); ~CalendarWeekdays(); bool load( KoXmlElement &element, XMLLoaderObject &status ); void save(QDomElement &element) const; const QList weekdays() const { QList lst = m_weekdays.values(); return lst; } /** * Returns the pointer to CalendarDay for day. * @param day The weekday number, must be between 1 (monday) and 7 (sunday) */ CalendarDay *weekday(int day) const; CalendarDay *weekday(QDate date) const { return weekday(date.dayOfWeek()); } static int dayOfWeek( const QString &name ); const QMap &weekdayMap() const; IntMap stateMap() const; // void setWeekday(IntMap::iterator it, int state) { m_weekdays.at(it.key())->setState(state); } int state(QDate date) const; int state(int weekday) const; void setState(int weekday, int state); QList intervals(int weekday) const; void setIntervals(int weekday, const QList &intervals); void clearIntervals(int weekday); bool operator==(const CalendarWeekdays *weekdays) const; bool operator!=(const CalendarWeekdays *weekdays) const; Duration effort(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch=0); /** * Returns the actual 'work interval' on the weekday defined by date * for the interval @p start to @p start + @p length. * If no 'work interval' exists, returns the interval start, end. * Use @ref hasInterval() to check if a 'work interval' exists. * If @p sch is not 0, the schedule is checked for availability. */ TimeInterval interval(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch) const; /** * Returns true if at least a part of a 'work interval' exists * on the weekday defined by date for the interval start to end. */ bool hasInterval(QDate date, QTime start, int length, const QTimeZone &timeZone, Schedule *sch) const; bool hasInterval() const; Duration duration() const; Duration duration(int weekday) const; const CalendarWeekdays ©(const CalendarWeekdays &weekdays); int indexOf( const CalendarDay *day ) const; private: Calendar *m_calendar; QMap m_weekdays; #ifndef NDEBUG public: void printDebug(const QString& indent=QString()); #endif }; /** * Calendar defines the working and nonworking days and hours. * A day can have the three states Undefined, NonWorking, or Working. * A calendar can have a parent calendar that defines the days that are * undefined in this calendar. * If a calendar have no parent, an undefined day defaults to Nonworking. * A Working day has one or more work intervals to define the work hours. * * The definition can consist of two parts: Weekdays and Day. * Day has highest priority. * * A typical calendar hierarchy could include calendars on 4 levels: * 1. Definition of normal weekdays and national holidays/vacation days. * 2. Definition of the company's special workdays/-time and vacation days. * 3. Definitions for groups of resources. * 4. Definitions for individual resources. * * A calendar can define a timezone different from the projects. * This enables planning with resources that does not recide in the same place. * */ -class KPLATOKERNEL_EXPORT Calendar : public QObject +class PLANKERNEL_EXPORT Calendar : public QObject { Q_OBJECT public: Calendar(); explicit Calendar(const QString& name, Calendar *parent=0); //Calendar( const Calendar &c ); QObject doesn't allow a copy constructor ~Calendar(); const Calendar &operator=(const Calendar &calendar ) { return copy( calendar ); } QString name() const { return m_name; } void setName(const QString& name); Calendar *parentCal() const { return m_parent; } /** * Set parent calendar to @p parent. * Removes myself from current parent and * inserts myself as child to new parent. */ void setParentCal( Calendar *parent, int pos = -1 ); bool isChildOf( const Calendar *cal ) const; Project *project() const { return m_project; } void setProject(Project *project); QString id() const { return m_id; } void setId(const QString& id); const QList &calendars() const { return m_calendars; } void addCalendar( Calendar *calendar, int pos = -1 ); void takeCalendar( Calendar *calendar ); int indexOf( const Calendar *calendar ) const; /// Return number of children int childCount() const { return m_calendars.count(); } /// Return child calendar at @p index, 0 if index out of bounds Calendar *childAt( int index ) const { return m_calendars.value( index ); } bool load( KoXmlElement &element, XMLLoaderObject &status ); void save(QDomElement &element) const; int state(QDate date) const; void setState( CalendarDay *day, CalendarDay::State state ); void addWorkInterval( CalendarDay *day, TimeInterval *ti ); void takeWorkInterval( CalendarDay *day, TimeInterval *ti ); void setWorkInterval( TimeInterval *ti, const TimeInterval &value ); /** * Find the definition for the day @p date. * If @p skipUndefined = true the day is NOT returned if it has state Undefined. */ CalendarDay *findDay(QDate date, bool skipUndefined=false) const; void addDay(CalendarDay *day); CalendarDay *takeDay(CalendarDay *day); const QList &days() const { return m_days; } QList > consecutiveVacationDays() const; QList workingDays() const; int indexOf( const CalendarDay *day ) const { return m_days.indexOf( const_cast( day ) ); } CalendarDay *dayAt( int index ) { return m_days.value( index ); } int numDays() const { return m_days.count(); } void setDate( CalendarDay *day, QDate date ); CalendarDay *day( QDate date ) const; IntMap weekdayStateMap() const; CalendarWeekdays *weekdays() const { return m_weekdays; } CalendarDay *weekday(int day) const { return m_weekdays->weekday(day); } int indexOfWeekday( const CalendarDay *day ) const { return m_weekdays->indexOf( day ); } const QList weekdayList() const { return m_weekdays->weekdays(); } int numWeekdays() const { return weekdayList().count(); } /// Sets the @p weekday data to the data in @p day void setWeekday( int weekday, const CalendarDay &day ); QString parentId() const { return m_parentId; } void setParentId(const QString& id) { m_parentId = id; } bool hasParent(Calendar *cal); /** * Returns the work intervals in the interval from @p start to @p end * Sets the load of each interval to @p load */ AppointmentIntervalList workIntervals(const DateTime &start, const DateTime &end, double load) const; /** * Returns the amount of 'worktime' that can be done in the * interval from @p start to @p end * If @p sch is not 0, the schedule is checked for availability. */ Duration effort(const DateTime &start, const DateTime &end, Schedule *sch=0) const; /** * Returns the first 'work interval' for the interval * starting at @p start and ending at @p end. * If no 'work interval' exists, returns an interval with invalid DateTime. * You can also use @ref hasInterval() to check if a 'work interval' exists. * If @p sch is not 0, the schedule is checked for availability. */ DateTimeInterval firstInterval(const DateTime &start, const DateTime &end, Schedule *sch=0) const; /** * Returns true if at least a part of a 'work interval' exists * for the interval starting at @p start and ending at @p end. * If @p sch is not 0, the schedule is checked for availability. */ bool hasInterval(const DateTime &start, const DateTime &end, Schedule *sch=0) const; /** * Find the first available time after @p time before @p limit. * Return invalid datetime if not available. * If @p sch is not 0, the schedule is checked for availability. */ DateTime firstAvailableAfter(const DateTime &time, const DateTime &limit, Schedule *sch = 0); /** * Find the first available time backwards from @p time. Search until @p limit. * Return invalid datetime if not available. * If @p sch is not 0, the schedule is checked for availability. */ DateTime firstAvailableBefore(const DateTime &time, const DateTime &limit, Schedule *sch = 0); Calendar *findCalendar() const { return findCalendar(m_id); } Calendar *findCalendar(const QString &id) const; bool removeId() { return removeId(m_id); } bool removeId(const QString &id); void insertId(const QString &id); QTimeZone timeZone() const { return m_timeZone; } void setTimeZone( const QTimeZone &tz ); /// Return the project timezone, or local timezone if no project QTimeZone projectTimeZone() const; void setDefault( bool on ); bool isDefault() const { return m_default; } int cacheVersion() const; void incCacheVersion(); void setCacheVersion( int version ); bool loadCacheVersion( KoXmlElement &element, XMLLoaderObject &status ); void saveCacheVersion( QDomElement &element ) const; /// A calendar can be local to this project, or /// defined externally and shared with other projects bool isShared() const; /// Set calendar to be local if on = false, or shared if on = true void setShared(bool on); #ifdef HAVE_KHOLIDAYS bool isHoliday(QDate date) const; KHolidays::HolidayRegion *holidayRegion() const; void setHolidayRegion(const QString &code); QString holidayRegionCode() const; QStringList holidayRegionCodes() const; #endif Q_SIGNALS: void changed( Calendar* ); void changed( CalendarDay* ); void changed( TimeInterval* ); void weekdayToBeAdded( CalendarDay *day, int index ); void weekdayAdded( CalendarDay *day ); void weekdayToBeRemoved( CalendarDay *day ); void weekdayRemoved( CalendarDay *day ); void dayToBeAdded( CalendarDay *day, int index ); void dayAdded( CalendarDay *day ); void dayToBeRemoved( CalendarDay *day ); void dayRemoved( CalendarDay *day ); void workIntervalToBeAdded( CalendarDay*, TimeInterval*, int index ); void workIntervalAdded( CalendarDay*, TimeInterval* ); void workIntervalToBeRemoved( CalendarDay*, TimeInterval* ); void workIntervalRemoved( CalendarDay*, TimeInterval* ); protected: void init(); const Calendar ©(const Calendar &calendar); /** * Returns the amount of 'worktime' that can be done on * the @p date between the times @p start and @p start + @p length. * The date and times are in timespecification @p spec. * If @p sch is not 0, the schedule is checked for availability. */ Duration effort(QDate date, QTime start, int length, Schedule *sch=0) const; /** * Returns the amount of 'worktime' that can be done in the * interval from @p start to @p end * If @p sch is not 0, the schedule is checked for availability. */ Duration effort(const QDateTime &start, const QDateTime &end, Schedule *sch=0) const; /** * Returns the first 'work interval' on date for the interval * starting at @p start and ending at @p start + @p length. * If no 'work interval' exists, returns a null interval. * You can also use @ref hasInterval() to check if a 'work interval' exists. * The date and times are in timespecification spec. * If @p sch is not 0, the schedule is checked for availability. */ TimeInterval firstInterval(QDate date, QTime start, int length, Schedule *sch=0) const; /** * Returns the first 'work interval' for the interval * starting at @p start and ending at @p end. * If no 'work interval' exists, returns an interval with invalid DateTime. */ DateTimeInterval firstInterval( const QDateTime &start, const QDateTime &end, Schedule *sch=0) const; /** * Returns true if at least a part of a 'work interval' exists * for the interval on date, starting at @p start and ending at @p start + @p length. * If @p sch is not 0, the schedule is checked for availability. */ bool hasInterval(QDate date, QTime start, int length, Schedule *sch=0) const; /** * Returns the work intervals in the interval from @p start to @p end * Sets the load of each interval to @p load */ AppointmentIntervalList workIntervals(const QDateTime &start, const QDateTime &end, double load) const; /** * Find the first available time backwards from @p time. Search until @p limit. * Return invalid datetime if not available. * If @p sch is not 0, the schedule is checked for availability. */ DateTime firstAvailableBefore(const QDateTime &time, const QDateTime &limit, Schedule *sch = 0); private: QString m_name; Calendar *m_parent; Project *m_project; bool m_deleted; QString m_id; QString m_parentId; QList m_days; CalendarWeekdays *m_weekdays; QList m_calendars; QTimeZone m_timeZone; bool m_default; // this is the default calendar, only used for save/load bool m_shared; #ifdef HAVE_KHOLIDAYS KHolidays::HolidayRegion *m_region; QString m_regionCode; #endif int m_cacheversion; // incremented every time a calendar is changed friend class Project; int m_blockversion; // don't update if true #ifndef NDEBUG public: void printDebug(const QString& indent=QString()); #endif }; -class KPLATOKERNEL_EXPORT StandardWorktime +class PLANKERNEL_EXPORT StandardWorktime { public: explicit StandardWorktime( Project *project = 0 ); explicit StandardWorktime(StandardWorktime* worktime); ~StandardWorktime(); /// Set Project void setProject( Project *project ) { m_project = project; } /// The work time of a normal year. Duration durationYear() const { return m_year; } /// The work time of a normal year. double year() const { return m_year.toDouble(Duration::Unit_h); } /// Set the work time of a normal year. void setYear(const Duration year) { m_year = year; } /// Set the work time of a normal year. void setYear(double hours) { m_year = Duration((qint64)(hours*60.0*60.0*1000.0)); } /// The work time of a normal month Duration durationMonth() const { return m_month; } /// The work time of a normal month double month() const { return m_month.toDouble(Duration::Unit_h); } /// Set the work time of a normal month void setMonth(const Duration month) { m_month = month; } /// Set the work time of a normal month void setMonth(double hours) { m_month = Duration((qint64)(hours*60.0*60.0*1000.0)); } /// The work time of a normal week Duration durationWeek() const { return m_week; } /// The work time of a normal week double week() const { return m_week.toDouble(Duration::Unit_h); } /// Set the work time of a normal week void setWeek(const Duration week) { m_week = week; } /// Set the work time of a normal week void setWeek(double hours) { m_week = Duration((qint64)(hours*60.0*60.0*1000.0)); } /// The work time of a normal day Duration durationDay() const { return m_day; } /// The work time of a normal day double day() const { return m_day.toDouble(Duration::Unit_h); } /// Set the work time of a normal day void setDay(const Duration day) { m_day = day; changed(); } /// Set the work time of a normal day void setDay(double hours) { m_day = Duration(hours, Duration::Unit_h); changed(); } QList scales() const; bool load( KoXmlElement &element, XMLLoaderObject &status ); void save(QDomElement &element) const; void changed(); protected: void init(); private: Project *m_project; Duration m_year; Duration m_month; Duration m_week; Duration m_day; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptcommand.h b/src/libs/kernel/kptcommand.h index d36184eb..bdfdd969 100644 --- a/src/libs/kernel/kptcommand.h +++ b/src/libs/kernel/kptcommand.h @@ -1,1988 +1,1988 @@ /* This file is part of the KDE project Copyright (C) 2004-2007 Dag Andersen Copyright (C) 2011 Dag Andersen Copyright (C) 2016 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTCOMMAND_H #define KPTCOMMAND_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include "kptappointment.h" #include "kptnode.h" #include "kptduration.h" #include "kpttask.h" #include "kptwbsdefinition.h" class QString; /** * @file * This file includes undo/redo commands for kernel data structures */ /// The main namespace namespace KPlato { class Locale; class Account; class Accounts; class Project; class Task; class Calendar; class CalendarDay; class Relation; class ResourceGroupRequest; class ResourceRequest; class ResourceGroup; class Resource; class Schedule; class StandardWorktime; -class KPLATOKERNEL_EXPORT NamedCommand : public KUndo2Command +class PLANKERNEL_EXPORT NamedCommand : public KUndo2Command { public: explicit NamedCommand( const KUndo2MagicString& name ) : KUndo2Command( name ) {} virtual void redo() { execute(); } virtual void undo() { unexecute(); } virtual void execute() = 0; virtual void unexecute() = 0; protected: /// Set all scheduled in the m_schedules map to their original scheduled state void setSchScheduled(); /// Set all schedules in the m_schedules map to scheduled state @p state void setSchScheduled( bool state ); /// Add a schedule to the m_schedules map along with its current scheduled state void addSchScheduled( Schedule *sch ); QMap m_schedules; }; -class KPLATOKERNEL_EXPORT MacroCommand : public KUndo2Command +class PLANKERNEL_EXPORT MacroCommand : public KUndo2Command { public: explicit MacroCommand( const KUndo2MagicString& name = KUndo2MagicString() ) : KUndo2Command( name ) {} ~MacroCommand(); void addCommand( KUndo2Command *cmd ); virtual void redo() { execute(); } virtual void undo() { unexecute(); } virtual void execute(); virtual void unexecute(); bool isEmpty() const { return cmds.isEmpty(); } protected: QList cmds; }; -class KPLATOKERNEL_EXPORT CalendarAddCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarAddCmd : public NamedCommand { public: CalendarAddCmd( Project *project, Calendar *cal, int pos, Calendar *parent, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarAddCmd(); void execute(); void unexecute(); private: Project *m_project; Calendar *m_cal; int m_pos; Calendar *m_parent; bool m_mine; }; -class KPLATOKERNEL_EXPORT CalendarRemoveCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarRemoveCmd : public NamedCommand { public: CalendarRemoveCmd( Project *project, Calendar *cal, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarRemoveCmd(); void execute(); void unexecute(); private: Project *m_project; Calendar *m_parent; Calendar *m_cal; int m_index; bool m_mine; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT CalendarMoveCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarMoveCmd : public NamedCommand { public: CalendarMoveCmd( Project *project, Calendar *cal, int position, Calendar *parent, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; Calendar *m_cal; int m_newpos; int m_oldpos; Calendar *m_newparent; Calendar *m_oldparent; }; -class KPLATOKERNEL_EXPORT CalendarModifyNameCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyNameCmd : public NamedCommand { public: CalendarModifyNameCmd( Calendar *cal, const QString& newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Calendar *m_cal; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT CalendarModifyParentCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyParentCmd : public NamedCommand { public: CalendarModifyParentCmd( Project *project, Calendar *cal, Calendar *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyParentCmd(); void execute(); void unexecute(); private: Project *m_project; Calendar *m_cal; Calendar *m_newvalue; Calendar *m_oldvalue; MacroCommand *m_cmd; int m_oldindex; int m_newindex; }; -class KPLATOKERNEL_EXPORT CalendarModifyTimeZoneCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyTimeZoneCmd : public NamedCommand { public: CalendarModifyTimeZoneCmd( Calendar *cal, const QTimeZone &value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyTimeZoneCmd(); void execute(); void unexecute(); private: Calendar *m_cal; QTimeZone m_newvalue; QTimeZone m_oldvalue; MacroCommand *m_cmd; }; #ifdef HAVE_KHOLIDAYS -class KPLATOKERNEL_EXPORT CalendarModifyHolidayRegionCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyHolidayRegionCmd : public NamedCommand { public: CalendarModifyHolidayRegionCmd( Calendar *cal, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyHolidayRegionCmd(); void execute(); void unexecute(); private: Calendar *m_cal; QString m_newvalue; QString m_oldvalue; }; #endif -class KPLATOKERNEL_EXPORT CalendarAddDayCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarAddDayCmd : public NamedCommand { public: CalendarAddDayCmd( Calendar *cal, CalendarDay *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarAddDayCmd(); void execute(); void unexecute(); protected: Calendar *m_cal; CalendarDay *m_newvalue; bool m_mine; }; -class KPLATOKERNEL_EXPORT CalendarRemoveDayCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarRemoveDayCmd : public NamedCommand { public: CalendarRemoveDayCmd( Calendar *cal, CalendarDay *day, const KUndo2MagicString& name = KUndo2MagicString() ); CalendarRemoveDayCmd( Calendar *cal, const QDate &day, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); protected: Calendar *m_cal; CalendarDay *m_value; bool m_mine; private: void init(); }; -class KPLATOKERNEL_EXPORT CalendarModifyDayCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyDayCmd : public NamedCommand { public: CalendarModifyDayCmd( Calendar *cal, CalendarDay *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyDayCmd(); void execute(); void unexecute(); private: Calendar *m_cal; CalendarDay *m_newvalue; CalendarDay *m_oldvalue; bool m_mine; }; -class KPLATOKERNEL_EXPORT CalendarModifyStateCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyStateCmd : public NamedCommand { public: CalendarModifyStateCmd( Calendar *calendar, CalendarDay *day, CalendarDay::State value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyStateCmd(); void execute(); void unexecute(); private: Calendar *m_calendar; CalendarDay *m_day; CalendarDay::State m_newvalue; CalendarDay::State m_oldvalue; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT CalendarModifyTimeIntervalCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyTimeIntervalCmd : public NamedCommand { public: CalendarModifyTimeIntervalCmd( Calendar *calendar, TimeInterval &newvalue, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Calendar *m_calendar; TimeInterval *m_value; TimeInterval m_newvalue; TimeInterval m_oldvalue; }; -class KPLATOKERNEL_EXPORT CalendarAddTimeIntervalCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarAddTimeIntervalCmd : public NamedCommand { public: CalendarAddTimeIntervalCmd( Calendar *calendar, CalendarDay *day, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarAddTimeIntervalCmd(); void execute(); void unexecute(); protected: Calendar *m_calendar; CalendarDay *m_day; TimeInterval *m_value; bool m_mine; }; -class KPLATOKERNEL_EXPORT CalendarRemoveTimeIntervalCmd : public CalendarAddTimeIntervalCmd +class PLANKERNEL_EXPORT CalendarRemoveTimeIntervalCmd : public CalendarAddTimeIntervalCmd { public: CalendarRemoveTimeIntervalCmd( Calendar *calendar, CalendarDay *day, TimeInterval *value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); }; -class KPLATOKERNEL_EXPORT CalendarModifyWeekdayCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyWeekdayCmd : public NamedCommand { public: CalendarModifyWeekdayCmd( Calendar *cal, int weekday, CalendarDay *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~CalendarModifyWeekdayCmd(); void execute(); void unexecute(); private: int m_weekday; Calendar *m_cal; CalendarDay *m_value; CalendarDay m_orig; }; -class KPLATOKERNEL_EXPORT CalendarModifyDateCmd : public NamedCommand +class PLANKERNEL_EXPORT CalendarModifyDateCmd : public NamedCommand { public: CalendarModifyDateCmd( Calendar *cal, CalendarDay *day, const QDate &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Calendar *m_cal; CalendarDay *m_day; QDate m_newvalue, m_oldvalue; }; -class KPLATOKERNEL_EXPORT ProjectModifyDefaultCalendarCmd : public NamedCommand +class PLANKERNEL_EXPORT ProjectModifyDefaultCalendarCmd : public NamedCommand { public: ProjectModifyDefaultCalendarCmd( Project *project, Calendar *cal, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; Calendar *m_newvalue, *m_oldvalue; }; -class KPLATOKERNEL_EXPORT NodeDeleteCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeDeleteCmd : public NamedCommand { public: explicit NodeDeleteCmd( Node *node, const KUndo2MagicString& name = KUndo2MagicString() ); ~NodeDeleteCmd(); void execute(); void unexecute(); private: Node *m_node; Node *m_parent; Project *m_project; int m_index; bool m_mine; QList m_appointments; MacroCommand *m_cmd; MacroCommand *m_relCmd; }; -class KPLATOKERNEL_EXPORT TaskAddCmd : public NamedCommand +class PLANKERNEL_EXPORT TaskAddCmd : public NamedCommand { public: TaskAddCmd( Project *project, Node *node, Node *after, const KUndo2MagicString& name = KUndo2MagicString() ); ~TaskAddCmd(); void execute(); void unexecute(); private: Project *m_project; Node *m_node; Node *m_after; bool m_added; }; -class KPLATOKERNEL_EXPORT SubtaskAddCmd : public NamedCommand +class PLANKERNEL_EXPORT SubtaskAddCmd : public NamedCommand { public: SubtaskAddCmd( Project *project, Node *node, Node *parent, const KUndo2MagicString& name = KUndo2MagicString() ); ~SubtaskAddCmd(); void execute(); void unexecute(); private: Project *m_project; Node *m_node; Node *m_parent; bool m_added; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT NodeModifyNameCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyNameCmd : public NamedCommand { public: NodeModifyNameCmd( Node &node, const QString& nodename, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QString newName; QString oldName; }; -class KPLATOKERNEL_EXPORT NodeModifyLeaderCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyLeaderCmd : public NamedCommand { public: NodeModifyLeaderCmd( Node &node, const QString& leader, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QString newLeader; QString oldLeader; }; -class KPLATOKERNEL_EXPORT NodeModifyDescriptionCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyDescriptionCmd : public NamedCommand { public: NodeModifyDescriptionCmd( Node &node, const QString& description, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QString newDescription; QString oldDescription; }; -class KPLATOKERNEL_EXPORT NodeModifyConstraintCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyConstraintCmd : public NamedCommand { public: NodeModifyConstraintCmd( Node &node, Node::ConstraintType c, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Node::ConstraintType newConstraint; Node::ConstraintType oldConstraint; }; -class KPLATOKERNEL_EXPORT NodeModifyConstraintStartTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyConstraintStartTimeCmd : public NamedCommand { public: NodeModifyConstraintStartTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT NodeModifyConstraintEndTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyConstraintEndTimeCmd : public NamedCommand { public: NodeModifyConstraintEndTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT NodeModifyStartTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyStartTimeCmd : public NamedCommand { public: NodeModifyStartTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT NodeModifyEndTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyEndTimeCmd : public NamedCommand { public: NodeModifyEndTimeCmd( Node &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT NodeModifyIdCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyIdCmd : public NamedCommand { public: NodeModifyIdCmd( Node &node, const QString& id, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; QString newId; QString oldId; }; -class KPLATOKERNEL_EXPORT NodeIndentCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeIndentCmd : public NamedCommand { public: explicit NodeIndentCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); ~NodeIndentCmd(); void execute(); void unexecute(); private: Node &m_node; Node *m_oldparent, *m_newparent; int m_oldindex, m_newindex; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT NodeUnindentCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeUnindentCmd : public NamedCommand { public: explicit NodeUnindentCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Node *m_oldparent, *m_newparent; int m_oldindex, m_newindex; }; -class KPLATOKERNEL_EXPORT NodeMoveUpCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeMoveUpCmd : public NamedCommand { public: explicit NodeMoveUpCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Project *m_project; bool m_moved; }; -class KPLATOKERNEL_EXPORT NodeMoveDownCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeMoveDownCmd : public NamedCommand { public: explicit NodeMoveDownCmd( Node &node, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Project *m_project; bool m_moved; }; -class KPLATOKERNEL_EXPORT NodeMoveCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeMoveCmd : public NamedCommand { public: NodeMoveCmd( Project *project, Node *node, Node *newParent, int newPos, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; Node *m_node; Node *m_newparent; Node *m_oldparent; int m_newpos; int m_oldpos; bool m_moved; MacroCommand m_cmd; }; -class KPLATOKERNEL_EXPORT AddRelationCmd : public NamedCommand +class PLANKERNEL_EXPORT AddRelationCmd : public NamedCommand { public: AddRelationCmd( Project &project, Relation *rel, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddRelationCmd(); void execute(); void unexecute(); private: Relation *m_rel; Project &m_project; bool m_taken; }; -class KPLATOKERNEL_EXPORT DeleteRelationCmd : public NamedCommand +class PLANKERNEL_EXPORT DeleteRelationCmd : public NamedCommand { public: DeleteRelationCmd( Project &project, Relation *rel, const KUndo2MagicString& name = KUndo2MagicString() ); ~DeleteRelationCmd(); void execute(); void unexecute(); private: Relation *m_rel; Project &m_project; bool m_taken; }; -class KPLATOKERNEL_EXPORT ModifyRelationTypeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyRelationTypeCmd : public NamedCommand { public: ModifyRelationTypeCmd( Relation *rel, Relation::Type type, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; Relation *m_rel; Relation::Type m_newtype; Relation::Type m_oldtype; }; -class KPLATOKERNEL_EXPORT ModifyRelationLagCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyRelationLagCmd : public NamedCommand { public: ModifyRelationLagCmd( Relation *rel, Duration lag, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; Relation *m_rel; Duration m_newlag; Duration m_oldlag; }; -class KPLATOKERNEL_EXPORT AddResourceRequestCmd : public NamedCommand +class PLANKERNEL_EXPORT AddResourceRequestCmd : public NamedCommand { public: AddResourceRequestCmd( ResourceGroupRequest *group, ResourceRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddResourceRequestCmd(); void execute(); void unexecute(); private: ResourceGroupRequest *m_group; ResourceRequest *m_request; bool m_mine; }; -class KPLATOKERNEL_EXPORT RemoveResourceRequestCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveResourceRequestCmd : public NamedCommand { public: RemoveResourceRequestCmd( ResourceGroupRequest *group, ResourceRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); ~RemoveResourceRequestCmd(); void execute(); void unexecute(); private: ResourceGroupRequest *m_group; ResourceRequest *m_request; bool m_mine; }; -class KPLATOKERNEL_EXPORT ModifyResourceRequestUnitsCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceRequestUnitsCmd : public NamedCommand { public: ModifyResourceRequestUnitsCmd( ResourceRequest *request, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ResourceRequest *m_request; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceRequestRequiredCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceRequestRequiredCmd : public NamedCommand { public: ModifyResourceRequestRequiredCmd( ResourceRequest *request, const QList &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ResourceRequest *m_request; QList m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceGroupRequestUnitsCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceGroupRequestUnitsCmd : public NamedCommand { public: ModifyResourceGroupRequestUnitsCmd( ResourceGroupRequest *request, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ResourceGroupRequest *m_request; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyEstimateCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyEstimateCmd : public NamedCommand { public: ModifyEstimateCmd( Node &node, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); ~ModifyEstimateCmd(); void execute(); void unexecute(); private: Estimate *m_estimate; double m_oldvalue, m_newvalue; int m_optimistic, m_pessimistic; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT EstimateModifyOptimisticRatioCmd : public NamedCommand +class PLANKERNEL_EXPORT EstimateModifyOptimisticRatioCmd : public NamedCommand { public: EstimateModifyOptimisticRatioCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT EstimateModifyPessimisticRatioCmd : public NamedCommand +class PLANKERNEL_EXPORT EstimateModifyPessimisticRatioCmd : public NamedCommand { public: EstimateModifyPessimisticRatioCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyEstimateTypeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyEstimateTypeCmd : public NamedCommand { public: ModifyEstimateTypeCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyEstimateUnitCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyEstimateUnitCmd : public NamedCommand { public: ModifyEstimateUnitCmd( Node &node, Duration::Unit oldvalue, Duration::Unit newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; Duration::Unit m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT EstimateModifyRiskCmd : public NamedCommand +class PLANKERNEL_EXPORT EstimateModifyRiskCmd : public NamedCommand { public: EstimateModifyRiskCmd( Node &node, int oldvalue, int newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; int m_oldvalue, m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyEstimateCalendarCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyEstimateCalendarCmd : public NamedCommand { public: ModifyEstimateCalendarCmd( Node &node, Calendar *oldvalue, Calendar *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Estimate *m_estimate; Calendar *m_oldvalue, *m_newvalue; }; -class KPLATOKERNEL_EXPORT AddResourceGroupRequestCmd : public NamedCommand +class PLANKERNEL_EXPORT AddResourceGroupRequestCmd : public NamedCommand { public: AddResourceGroupRequestCmd( Task &task, ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Task &m_task; ResourceGroupRequest *m_request; bool m_mine; }; -class KPLATOKERNEL_EXPORT RemoveResourceGroupRequestCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveResourceGroupRequestCmd : public NamedCommand { public: explicit RemoveResourceGroupRequestCmd( ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); RemoveResourceGroupRequestCmd( Task &task, ResourceGroupRequest *request, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Task &m_task; ResourceGroupRequest *m_request; bool m_mine; }; -class KPLATOKERNEL_EXPORT AddResourceCmd : public NamedCommand +class PLANKERNEL_EXPORT AddResourceCmd : public NamedCommand { public: AddResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddResourceCmd(); void execute(); void unexecute(); protected: ResourceGroup *m_group; Resource *m_resource; int m_index; bool m_mine; }; -class KPLATOKERNEL_EXPORT RemoveResourceCmd : public AddResourceCmd +class PLANKERNEL_EXPORT RemoveResourceCmd : public AddResourceCmd { public: RemoveResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); ~RemoveResourceCmd(); void execute(); void unexecute(); private: QList m_requests; QList m_appointments; MacroCommand m_cmd; }; -class KPLATOKERNEL_EXPORT MoveResourceCmd : public NamedCommand +class PLANKERNEL_EXPORT MoveResourceCmd : public NamedCommand { public: MoveResourceCmd( ResourceGroup *group, Resource *resource, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_project; Resource *m_resource; ResourceGroup *m_oldvalue, *m_newvalue; MacroCommand cmd; }; -class KPLATOKERNEL_EXPORT ModifyResourceNameCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceNameCmd : public NamedCommand { public: ModifyResourceNameCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceInitialsCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceInitialsCmd : public NamedCommand { public: ModifyResourceInitialsCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceEmailCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceEmailCmd : public NamedCommand { public: ModifyResourceEmailCmd( Resource *resource, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceAutoAllocateCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceAutoAllocateCmd : public NamedCommand { public: ModifyResourceAutoAllocateCmd( Resource *resource, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; bool m_newvalue; bool m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceTypeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceTypeCmd : public NamedCommand { public: ModifyResourceTypeCmd( Resource *resource, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; int m_newvalue; int m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceUnitsCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceUnitsCmd : public NamedCommand { public: ModifyResourceUnitsCmd( Resource *resource, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; int m_newvalue; int m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceAvailableFromCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceAvailableFromCmd : public NamedCommand { public: ModifyResourceAvailableFromCmd( Resource *resource, const QDateTime& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QDateTime m_newvalue; DateTime m_oldvalue; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT ModifyResourceAvailableUntilCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceAvailableUntilCmd : public NamedCommand { public: ModifyResourceAvailableUntilCmd( Resource *resource, const QDateTime& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QDateTime m_newvalue; DateTime m_oldvalue; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT ModifyResourceNormalRateCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceNormalRateCmd : public NamedCommand { public: ModifyResourceNormalRateCmd( Resource *resource, double value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; double m_newvalue; double m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceOvertimeRateCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceOvertimeRateCmd : public NamedCommand { public: ModifyResourceOvertimeRateCmd( Resource *resource, double value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; double m_newvalue; double m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceCalendarCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceCalendarCmd : public NamedCommand { public: ModifyResourceCalendarCmd( Resource *resource, Calendar *value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; Calendar *m_newvalue; Calendar *m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyRequiredResourcesCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyRequiredResourcesCmd : public NamedCommand { public: ModifyRequiredResourcesCmd( Resource *resource, const QStringList &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QStringList m_newvalue; QStringList m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceAccountCmd : public NamedCommand { public: ModifyResourceAccountCmd( Resource *resource, Account *account, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; Account *m_newvalue; Account *m_oldvalue; }; -class KPLATOKERNEL_EXPORT AddResourceTeamCmd : public NamedCommand +class PLANKERNEL_EXPORT AddResourceTeamCmd : public NamedCommand { public: AddResourceTeamCmd( Resource *team, const QString &member, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_team; QString m_member; }; -class KPLATOKERNEL_EXPORT RemoveResourceTeamCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveResourceTeamCmd : public NamedCommand { public: RemoveResourceTeamCmd( Resource *team, const QString &member, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_team; QString m_member; }; -class KPLATOKERNEL_EXPORT RemoveResourceGroupCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveResourceGroupCmd : public NamedCommand { public: RemoveResourceGroupCmd( Project *project, ResourceGroup *group, const KUndo2MagicString& name = KUndo2MagicString() ); ~RemoveResourceGroupCmd(); void execute(); void unexecute(); protected: ResourceGroup *m_group; Project *m_project; int m_index; bool m_mine; MacroCommand *m_cmd; }; -class KPLATOKERNEL_EXPORT AddResourceGroupCmd : public RemoveResourceGroupCmd +class PLANKERNEL_EXPORT AddResourceGroupCmd : public RemoveResourceGroupCmd { public: AddResourceGroupCmd( Project *project, ResourceGroup *group, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); }; -class KPLATOKERNEL_EXPORT ModifyResourceGroupNameCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceGroupNameCmd : public NamedCommand { public: ModifyResourceGroupNameCmd( ResourceGroup *group, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ResourceGroup *m_group; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyResourceGroupTypeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyResourceGroupTypeCmd : public NamedCommand { public: ModifyResourceGroupTypeCmd( ResourceGroup *group, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ResourceGroup *m_group; int m_newvalue; int m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyCompletionEntrymodeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionEntrymodeCmd : public NamedCommand { public: ModifyCompletionEntrymodeCmd( Completion &completion, Completion::Entrymode value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; Completion::Entrymode oldvalue; Completion::Entrymode newvalue; }; -class KPLATOKERNEL_EXPORT ModifyCompletionStartedCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionStartedCmd : public NamedCommand { public: ModifyCompletionStartedCmd( Completion &completion, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; bool oldvalue; bool newvalue; }; -class KPLATOKERNEL_EXPORT ModifyCompletionFinishedCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionFinishedCmd : public NamedCommand { public: ModifyCompletionFinishedCmd( Completion &completion, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; bool oldvalue; bool newvalue; }; -class KPLATOKERNEL_EXPORT ModifyCompletionStartTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionStartTimeCmd : public NamedCommand { public: ModifyCompletionStartTimeCmd( Completion &completion, const QDateTime &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; DateTime oldvalue; QDateTime newvalue; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT ModifyCompletionFinishTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionFinishTimeCmd : public NamedCommand { public: ModifyCompletionFinishTimeCmd( Completion &completion, const QDateTime &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; DateTime oldvalue; QDateTime newvalue; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT AddCompletionEntryCmd : public NamedCommand +class PLANKERNEL_EXPORT AddCompletionEntryCmd : public NamedCommand { public: AddCompletionEntryCmd( Completion &completion, const QDate &date, Completion::Entry *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddCompletionEntryCmd(); void execute(); void unexecute(); private: Completion &m_completion; QDate m_date; Completion::Entry *newvalue; bool m_newmine; }; -class KPLATOKERNEL_EXPORT RemoveCompletionEntryCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveCompletionEntryCmd : public NamedCommand { public: RemoveCompletionEntryCmd( Completion &completion, const QDate& date, const KUndo2MagicString& name = KUndo2MagicString() ); ~RemoveCompletionEntryCmd(); void execute(); void unexecute(); private: Completion &m_completion; QDate m_date; Completion::Entry *value; bool m_mine; }; -class KPLATOKERNEL_EXPORT ModifyCompletionEntryCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionEntryCmd : public NamedCommand { public: ModifyCompletionEntryCmd( Completion &completion, const QDate &date, Completion::Entry *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~ModifyCompletionEntryCmd(); void execute(); void unexecute(); private: MacroCommand *cmd; }; -class KPLATOKERNEL_EXPORT ModifyCompletionPercentFinishedCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionPercentFinishedCmd : public NamedCommand { public: ModifyCompletionPercentFinishedCmd( Completion &completion, const QDate &date, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; QDate m_date; int m_newvalue, m_oldvalue; MacroCommand cmd; }; -class KPLATOKERNEL_EXPORT ModifyCompletionRemainingEffortCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionRemainingEffortCmd : public NamedCommand { public: ModifyCompletionRemainingEffortCmd( Completion &completion, const QDate &date, const Duration &value, const KUndo2MagicString &name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; QDate m_date; Duration m_newvalue, m_oldvalue; MacroCommand cmd; }; -class KPLATOKERNEL_EXPORT ModifyCompletionActualEffortCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCompletionActualEffortCmd : public NamedCommand { public: ModifyCompletionActualEffortCmd( Completion &completion, const QDate &date, const Duration &value, const KUndo2MagicString &name = KUndo2MagicString() ); void execute(); void unexecute(); private: Completion &m_completion; QDate m_date; Duration m_newvalue, m_oldvalue; MacroCommand cmd; }; /** * Add used effort for @p resource. * Note that the used effort definition in @p value must contain entries for *all* dates. * If used effort is already defined it will be replaced. */ -class KPLATOKERNEL_EXPORT AddCompletionUsedEffortCmd : public NamedCommand +class PLANKERNEL_EXPORT AddCompletionUsedEffortCmd : public NamedCommand { public: AddCompletionUsedEffortCmd( Completion &completion, const Resource *resource, Completion::UsedEffort *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddCompletionUsedEffortCmd(); void execute(); void unexecute(); private: Completion &m_completion; const Resource *m_resource; Completion::UsedEffort *oldvalue; Completion::UsedEffort *newvalue; bool m_newmine, m_oldmine; }; -class KPLATOKERNEL_EXPORT AddCompletionActualEffortCmd : public NamedCommand +class PLANKERNEL_EXPORT AddCompletionActualEffortCmd : public NamedCommand { public: AddCompletionActualEffortCmd( Completion::UsedEffort &ue, const QDate &date, const Completion::UsedEffort::ActualEffort &value, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddCompletionActualEffortCmd(); void execute(); void unexecute(); private: Completion::UsedEffort &m_usedEffort; QDate m_date; Completion::UsedEffort::ActualEffort oldvalue; Completion::UsedEffort::ActualEffort newvalue; }; -class KPLATOKERNEL_EXPORT AddAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT AddAccountCmd : public NamedCommand { public: AddAccountCmd( Project &project, Account *account, Account *parent = 0, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); AddAccountCmd( Project &project, Account *account, const QString& parent, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddAccountCmd(); void execute(); void unexecute(); protected: bool m_mine; private: Project &m_project; Account *m_account; Account *m_parent; int m_index; QString m_parentName; }; -class KPLATOKERNEL_EXPORT RemoveAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT RemoveAccountCmd : public NamedCommand { public: RemoveAccountCmd( Project &project, Account *account, const KUndo2MagicString& name = KUndo2MagicString() ); ~RemoveAccountCmd(); void execute(); void unexecute(); private: Project &m_project; Account *m_account; Account *m_parent; int m_index; bool m_isDefault; bool m_mine; MacroCommand m_cmd; }; -class KPLATOKERNEL_EXPORT RenameAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT RenameAccountCmd : public NamedCommand { public: RenameAccountCmd( Account *account, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Account *m_account; QString m_oldvalue; QString m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyAccountDescriptionCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyAccountDescriptionCmd : public NamedCommand { public: ModifyAccountDescriptionCmd( Account *account, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Account *m_account; QString m_oldvalue; QString m_newvalue; }; -class KPLATOKERNEL_EXPORT NodeModifyStartupCostCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyStartupCostCmd : public NamedCommand { public: NodeModifyStartupCostCmd( Node &node, double value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT NodeModifyShutdownCostCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyShutdownCostCmd : public NamedCommand { public: NodeModifyShutdownCostCmd( Node &node, double value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT NodeModifyRunningAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyRunningAccountCmd : public NamedCommand { public: NodeModifyRunningAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Account *m_oldvalue; Account *m_newvalue; }; -class KPLATOKERNEL_EXPORT NodeModifyStartupAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyStartupAccountCmd : public NamedCommand { public: NodeModifyStartupAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Account *m_oldvalue; Account *m_newvalue; }; -class KPLATOKERNEL_EXPORT NodeModifyShutdownAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT NodeModifyShutdownAccountCmd : public NamedCommand { public: NodeModifyShutdownAccountCmd( Node &node, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Node &m_node; Account *m_oldvalue; Account *m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyDefaultAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyDefaultAccountCmd : public NamedCommand { public: ModifyDefaultAccountCmd( Accounts &acc, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Accounts &m_accounts; Account *m_oldvalue; Account *m_newvalue; }; -class KPLATOKERNEL_EXPORT ResourceModifyAccountCmd : public NamedCommand +class PLANKERNEL_EXPORT ResourceModifyAccountCmd : public NamedCommand { public: ResourceModifyAccountCmd( Resource &resource, Account *oldvalue, Account *newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource &m_resource; Account *m_oldvalue; Account *m_newvalue; }; -class KPLATOKERNEL_EXPORT ProjectModifyConstraintCmd : public NamedCommand +class PLANKERNEL_EXPORT ProjectModifyConstraintCmd : public NamedCommand { public: ProjectModifyConstraintCmd( Project &node, Node::ConstraintType c, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_node; Node::ConstraintType newConstraint; Node::ConstraintType oldConstraint; }; -class KPLATOKERNEL_EXPORT ProjectModifyStartTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT ProjectModifyStartTimeCmd : public NamedCommand { public: ProjectModifyStartTimeCmd( Project &node, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT ProjectModifyEndTimeCmd : public NamedCommand +class PLANKERNEL_EXPORT ProjectModifyEndTimeCmd : public NamedCommand { public: ProjectModifyEndTimeCmd( Project &project, const QDateTime& dt, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_node; QDateTime newTime; DateTime oldTime; QTimeZone m_timeZone; }; -class KPLATOKERNEL_EXPORT AddScheduleManagerCmd : public NamedCommand +class PLANKERNEL_EXPORT AddScheduleManagerCmd : public NamedCommand { public: AddScheduleManagerCmd( Project &project, ScheduleManager *sm, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); AddScheduleManagerCmd( ScheduleManager *parent, ScheduleManager *sm, int index = -1, const KUndo2MagicString& name = KUndo2MagicString() ); ~AddScheduleManagerCmd(); void execute(); void unexecute(); protected: Project &m_node; ScheduleManager *m_parent; ScheduleManager *m_sm; int m_index; MainSchedule *m_exp; bool m_mine; }; -class KPLATOKERNEL_EXPORT DeleteScheduleManagerCmd : public AddScheduleManagerCmd +class PLANKERNEL_EXPORT DeleteScheduleManagerCmd : public AddScheduleManagerCmd { public: DeleteScheduleManagerCmd( Project &project, ScheduleManager *sm, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: MacroCommand cmd; }; -class KPLATOKERNEL_EXPORT MoveScheduleManagerCmd : public NamedCommand +class PLANKERNEL_EXPORT MoveScheduleManagerCmd : public NamedCommand { public: MoveScheduleManagerCmd( ScheduleManager *sm, ScheduleManager *newparent, int newindex, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager *m_sm; ScheduleManager *m_oldparent; int m_oldindex; ScheduleManager *m_newparent; int m_newindex; MacroCommand m_cmd; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerNameCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerNameCmd : public NamedCommand { public: ModifyScheduleManagerNameCmd( ScheduleManager &sm, const QString& value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; QString oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerAllowOverbookingCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerAllowOverbookingCmd : public NamedCommand { public: ModifyScheduleManagerAllowOverbookingCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; bool oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerDistributionCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerDistributionCmd : public NamedCommand { public: ModifyScheduleManagerDistributionCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; bool oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT CalculateScheduleCmd : public NamedCommand +class PLANKERNEL_EXPORT CalculateScheduleCmd : public NamedCommand { public: CalculateScheduleCmd( Project &project, ScheduleManager *sm, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_node; QPointer m_sm; bool m_first; MainSchedule *m_oldexpected; MainSchedule *m_newexpected; }; -class KPLATOKERNEL_EXPORT BaselineScheduleCmd : public NamedCommand +class PLANKERNEL_EXPORT BaselineScheduleCmd : public NamedCommand { public: explicit BaselineScheduleCmd( ScheduleManager &sm, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; }; -class KPLATOKERNEL_EXPORT ResetBaselineScheduleCmd : public NamedCommand +class PLANKERNEL_EXPORT ResetBaselineScheduleCmd : public NamedCommand { public: explicit ResetBaselineScheduleCmd( ScheduleManager &sm, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulingDirectionCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerSchedulingDirectionCmd : public NamedCommand { public: ModifyScheduleManagerSchedulingDirectionCmd( ScheduleManager &sm, bool value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; bool oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulerCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerSchedulerCmd : public NamedCommand { public: ModifyScheduleManagerSchedulerCmd( ScheduleManager &sm, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; int oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT ModifyScheduleManagerSchedulingGranularityCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyScheduleManagerSchedulingGranularityCmd : public NamedCommand { public: ModifyScheduleManagerSchedulingGranularityCmd( ScheduleManager &sm, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: ScheduleManager &m_sm; int oldvalue, newvalue; }; -class KPLATOKERNEL_EXPORT ModifyStandardWorktimeYearCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyStandardWorktimeYearCmd : public NamedCommand { public: ModifyStandardWorktimeYearCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: StandardWorktime *swt; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyStandardWorktimeMonthCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyStandardWorktimeMonthCmd : public NamedCommand { public: ModifyStandardWorktimeMonthCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: StandardWorktime *swt; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyStandardWorktimeWeekCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyStandardWorktimeWeekCmd : public NamedCommand { public: ModifyStandardWorktimeWeekCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: StandardWorktime *swt; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT ModifyStandardWorktimeDayCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyStandardWorktimeDayCmd : public NamedCommand { public: ModifyStandardWorktimeDayCmd( StandardWorktime *wt, double oldvalue, double newvalue, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: StandardWorktime *swt; double m_oldvalue; double m_newvalue; }; -class KPLATOKERNEL_EXPORT DocumentAddCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentAddCmd : public NamedCommand { public: DocumentAddCmd( Documents& docs, Document *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~DocumentAddCmd(); void execute(); void unexecute(); private: Documents& m_docs; Document *m_value; bool m_mine; }; -class KPLATOKERNEL_EXPORT DocumentRemoveCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentRemoveCmd : public NamedCommand { public: DocumentRemoveCmd( Documents& docs, Document *value, const KUndo2MagicString& name = KUndo2MagicString() ); ~DocumentRemoveCmd(); void execute(); void unexecute(); private: Documents& m_docs; Document *m_value; bool m_mine; }; -class KPLATOKERNEL_EXPORT DocumentModifyUrlCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentModifyUrlCmd : public NamedCommand { public: DocumentModifyUrlCmd( Document *doc, const QUrl &url, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Document *m_doc; QUrl m_value; QUrl m_oldvalue; }; -class KPLATOKERNEL_EXPORT DocumentModifyNameCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentModifyNameCmd : public NamedCommand { public: DocumentModifyNameCmd( Document *doc, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Document *m_doc; QString m_value; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT DocumentModifyTypeCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentModifyTypeCmd : public NamedCommand { public: DocumentModifyTypeCmd( Document *doc, Document::Type value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Document *m_doc; Document::Type m_value; Document::Type m_oldvalue; }; -class KPLATOKERNEL_EXPORT DocumentModifyStatusCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentModifyStatusCmd : public NamedCommand { public: DocumentModifyStatusCmd( Document *doc, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Document *m_doc; QString m_value; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT DocumentModifySendAsCmd : public NamedCommand +class PLANKERNEL_EXPORT DocumentModifySendAsCmd : public NamedCommand { public: DocumentModifySendAsCmd( Document *doc, const Document::SendAs value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Document *m_doc; Document::SendAs m_value; Document::SendAs m_oldvalue; }; -class KPLATOKERNEL_EXPORT WBSDefinitionModifyCmd : public NamedCommand +class PLANKERNEL_EXPORT WBSDefinitionModifyCmd : public NamedCommand { public: WBSDefinitionModifyCmd( Project &project, const WBSDefinition value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project &m_project; WBSDefinition m_newvalue, m_oldvalue; }; -class KPLATOKERNEL_EXPORT InsertProjectCmd : public MacroCommand +class PLANKERNEL_EXPORT InsertProjectCmd : public MacroCommand { public: InsertProjectCmd( Project &project, Node *parent, Node *after, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); protected: void addAccounts( Account *account, Account *parent, QList &unused, QMap &all ); void addCalendars( Calendar *calendar, Calendar *parent, QList &unused, QMap &all ); void addChildNodes( Node *node ); private: Project *m_project; Node *m_parent; Node *m_after; }; -class KPLATOKERNEL_EXPORT WorkPackageAddCmd : public NamedCommand +class PLANKERNEL_EXPORT WorkPackageAddCmd : public NamedCommand { public: WorkPackageAddCmd( Project *project, Node *node, WorkPackage *wp, const KUndo2MagicString& name = KUndo2MagicString() ); ~WorkPackageAddCmd(); void execute(); void unexecute(); private: Project *m_project; Node *m_node; WorkPackage *m_wp; bool m_mine; }; -class KPLATOKERNEL_EXPORT ModifyProjectLocaleCmd : public MacroCommand +class PLANKERNEL_EXPORT ModifyProjectLocaleCmd : public MacroCommand { public: ModifyProjectLocaleCmd( Project &project, const KUndo2MagicString &name ); void execute(); void unexecute(); private: Project &m_project; }; -class KPLATOKERNEL_EXPORT ModifyCurrencySymolCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCurrencySymolCmd : public NamedCommand { public: ModifyCurrencySymolCmd( Locale *locale, const QString &value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Locale *m_locale; QString m_newvalue; QString m_oldvalue; }; -class KPLATOKERNEL_EXPORT ModifyCurrencyFractionalDigitsCmd : public NamedCommand +class PLANKERNEL_EXPORT ModifyCurrencyFractionalDigitsCmd : public NamedCommand { public: ModifyCurrencyFractionalDigitsCmd( Locale *locale, int value, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Locale *m_locale; int m_newvalue; int m_oldvalue; }; -class KPLATOKERNEL_EXPORT AddExternalAppointmentCmd : public NamedCommand +class PLANKERNEL_EXPORT AddExternalAppointmentCmd : public NamedCommand { public: AddExternalAppointmentCmd( Resource *resource, const QString &pid, const QString &pname, const QDateTime &start, const QDateTime &end, double load, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Resource *m_resource; QString m_pid; QString m_pname; QDateTime m_start; QDateTime m_end; double m_load; }; -class KPLATOKERNEL_EXPORT ClearExternalAppointmentCmd : public NamedCommand +class PLANKERNEL_EXPORT ClearExternalAppointmentCmd : public NamedCommand { public: ClearExternalAppointmentCmd( Resource *resource, const QString &pid, const KUndo2MagicString& name = KUndo2MagicString() ); ~ClearExternalAppointmentCmd(); void execute(); void unexecute(); private: Resource *m_resource; QString m_pid; Appointment *m_appointments; }; -class KPLATOKERNEL_EXPORT ClearAllExternalAppointmentsCmd : public NamedCommand +class PLANKERNEL_EXPORT ClearAllExternalAppointmentsCmd : public NamedCommand { public: explicit ClearAllExternalAppointmentsCmd( Project *project, const KUndo2MagicString& name = KUndo2MagicString() ); void execute(); void unexecute(); private: Project *m_project; MacroCommand m_cmd; }; -class KPLATOKERNEL_EXPORT SharedResourcesFileCmd : public NamedCommand +class PLANKERNEL_EXPORT SharedResourcesFileCmd : public NamedCommand { public: explicit SharedResourcesFileCmd(Project *project, const QString &newValue, const KUndo2MagicString& name = KUndo2MagicString()); void execute(); void unexecute(); private: Project *m_project; QString m_oldValue; QString m_newValue; }; -class KPLATOKERNEL_EXPORT UseSharedResourcesCmd : public NamedCommand +class PLANKERNEL_EXPORT UseSharedResourcesCmd : public NamedCommand { public: explicit UseSharedResourcesCmd(Project *project, bool newValue, const KUndo2MagicString& name = KUndo2MagicString()); void execute(); void unexecute(); private: Project *m_project; bool m_oldValue; bool m_newValue; }; -class KPLATOKERNEL_EXPORT SharedProjectsUrlCmd : public NamedCommand +class PLANKERNEL_EXPORT SharedProjectsUrlCmd : public NamedCommand { public: explicit SharedProjectsUrlCmd(Project *project, const QUrl &newValue, const KUndo2MagicString& name = KUndo2MagicString()); void execute(); void unexecute(); private: Project *m_project; QUrl m_oldValue; QUrl m_newValue; }; -class KPLATOKERNEL_EXPORT LoadProjectsAtStartupCmd : public NamedCommand +class PLANKERNEL_EXPORT LoadProjectsAtStartupCmd : public NamedCommand { public: explicit LoadProjectsAtStartupCmd(Project *project, bool newValue, const KUndo2MagicString& name = KUndo2MagicString()); void execute(); void unexecute(); private: Project *m_project; bool m_oldValue; bool m_newValue; }; } //KPlato namespace #endif //COMMAND_H diff --git a/src/libs/kernel/kptconfigbase.h b/src/libs/kernel/kptconfigbase.h index 60fdf1ee..62ed6c77 100644 --- a/src/libs/kernel/kptconfigbase.h +++ b/src/libs/kernel/kptconfigbase.h @@ -1,85 +1,85 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTCONFIGBASE_H #define KPTCONFIGBASE_H #include "kpttask.h" namespace KPlato { class Locale; -class KPLATOKERNEL_EXPORT ConfigBase : public QObject +class PLANKERNEL_EXPORT ConfigBase : public QObject { Q_OBJECT public: ConfigBase(); virtual ~ConfigBase(); void setReadWrite(bool readWrite) { m_readWrite = readWrite; } Task &taskDefaults() const { const_cast( this )->setDefaultValues( *m_taskDefaults ); return *m_taskDefaults; } void setTaskDefaults( Task * ); virtual void setDefaultValues( Project & ) {} virtual void setDefaultValues( Task & ) {} virtual QPair durationUnitRange() const { return QPair(); } virtual int minimumDurationUnit() const { return Duration::Unit_h; } virtual int maximumDurationUnit() const { return Duration::Unit_Y; } QBrush summaryTaskLevelColor( int level ) const; virtual bool summaryTaskLevelColorsEnabled() const; virtual QBrush summaryTaskDefaultColor() const; virtual QBrush summaryTaskLevelColor_1() const; virtual QBrush summaryTaskLevelColor_2() const; virtual QBrush summaryTaskLevelColor_3() const; virtual QBrush summaryTaskLevelColor_4() const; virtual QBrush taskNormalColor() const; virtual QBrush taskErrorColor() const; virtual QBrush taskCriticalColor() const; virtual QBrush taskFinishedColor() const; virtual QBrush milestoneNormalColor() const; virtual QBrush milestoneErrorColor() const; virtual QBrush milestoneCriticalColor() const; virtual QBrush milestoneFinishedColor() const; const Locale *locale() const; Locale *locale(); static QBrush gradientBrush( const QColor &c ); protected: bool m_readWrite; private: Task *m_taskDefaults; Locale *m_locale; }; } //KPlato namespace #endif // CONFIGBASE_H diff --git a/src/libs/kernel/kptdatetime.h b/src/libs/kernel/kptdatetime.h index 86606d01..41a52add 100644 --- a/src/libs/kernel/kptdatetime.h +++ b/src/libs/kernel/kptdatetime.h @@ -1,103 +1,103 @@ /* This file is part of the KDE project Copyright (C) 2003-2007 Dag Andersen Copyright (C) 2016 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDATETIME_H #define KPTDATETIME_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptduration.h" #include #include #include /// The main namespace. namespace KPlato { class Duration; /** * DateTime is a QDateTime which knows about Duration * Note that in Plan all datetimes shall be in the time zone specified * in the project. * Exception to this is the calendar related dates and times which has * their own time zone specification. */ -class KPLATOKERNEL_EXPORT DateTime : public QDateTime { +class PLANKERNEL_EXPORT DateTime : public QDateTime { public: /// Create a DateTime. DateTime(); /// Constructs a datetime with the given date, a valid time(00:00:00.000), and sets the timeSpec() to Qt::LocalTime. explicit DateTime( QDate ); ///Constructs a datetime with the given date and time, and sets the timeSpec() to Qt::LocalTime. /// If date is valid and time is not, the time will be set to midnight. DateTime( QDate , QTime ); ///Constructs a datetime with the given date and time in the given timezone. /// If @p timeZone is not valid, local time is used. /// If @p date is valid and @p time is not, the time will be set to midnight. DateTime( QDate , QTime , const QTimeZone &timeZone); /// Constructs a copy of the @p other QDateTime DateTime( const QDateTime &other ); /// Constructs a datetime from @p dt, reinterpreting it to be from timezone @p timeZone. /// dt must be of timespec LocalTime. DateTime( const QDateTime &dt, const QTimeZone &timeZone ); /** * Adds the duration @p duration to the datetime */ DateTime operator+(const Duration &duration) const; /** * Subtracts the duration @p duration from the datetime */ DateTime operator-(const Duration &duration) const ; /** * Returns the absolute duration between the two datetimes */ Duration operator-(const DateTime &dt) const { return duration(dt); } /** * Returns the absolute duration between the two datetimes */ Duration operator-(const DateTime &dt) { return duration(dt); } /// Add @p duration to this datetime. DateTime &operator+=(const Duration &duration); /// Subtract the @p duration from this datetime. DateTime &operator-=(const Duration &duration); /** * Parse a datetime string @p dts and return the DateTime in the given @p timeZone. * The string @p dts should be in Qt::ISODate format and contain no time zone information. */ static DateTime fromString(const QString &dts, const QTimeZone &timeZone = QTimeZone::systemTimeZone()); private: Duration duration(const DateTime &dt) const; void add(const Duration &duration); void subtract(const Duration &duration); }; } //KPlato namespace -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::DateTime &dt ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::DateTime &dt ); #endif diff --git a/src/libs/kernel/kptdebug.h b/src/libs/kernel/kptdebug.h index 106beaf1..81ebaba5 100644 --- a/src/libs/kernel/kptdebug.h +++ b/src/libs/kernel/kptdebug.h @@ -1,54 +1,54 @@ /* This file is part of the KDE project Copyright (C) 2012 Dag Andersen Copyright (C) 2016 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTDEBUG_H #define KPTDEBUG_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include -extern const KPLATOKERNEL_EXPORT QLoggingCategory &PLAN_LOG(); +extern const PLANKERNEL_EXPORT QLoggingCategory &PLAN_LOG(); #define debugPlan qCDebug(PLAN_LOG)< This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDOCUMENTS_H #define KPTDOCUMENTS_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include class KoStore; class QDomElement; namespace KPlato { class XMLLoaderObject; class Node; class Documents; -class KPLATOKERNEL_EXPORT Document +class PLANKERNEL_EXPORT Document { public: enum Type { Type_None, Type_Product, Type_Reference }; enum SendAs { SendAs_None, SendAs_Copy, SendAs_Reference }; Document(); explicit Document( const QUrl &url, Type type = Type_Reference, SendAs sendAs = SendAs_Reference ); ~Document(); bool operator==( const Document &doc ) const; bool operator!=( const Document &doc ) const { return ! operator==( doc ); } QString name() const { return m_name; } void setName( const QString &name ); Type type() const { return m_type; } void setType( Type type ); static QStringList typeList( bool trans = false ); static QString typeToString( Type type, bool trans = false ); SendAs sendAs() const { return m_sendAs; } void setSendAs( SendAs snd ); static QStringList sendAsList( bool trans = false ); static QString sendAsToString( SendAs snd, bool trans = false ); QUrl url() const { return m_url; } void setUrl( const QUrl &url ); bool isValid() const; QString status() const { return m_status; } void setStatus( const QString &sts ); bool load( KoXmlElement &element, XMLLoaderObject &status ); void save(QDomElement &element) const; private: Type m_type; QUrl m_url; QString m_status; SendAs m_sendAs; QString m_name; friend class Documents; Documents *parent; }; -class KPLATOKERNEL_EXPORT Documents +class PLANKERNEL_EXPORT Documents { public: Documents(); explicit Documents( const Documents &docs ); ~Documents(); bool operator==( const Documents &docs ) const; bool operator!=( const Documents &docs ) const { return ! operator==( docs ); } void deleteAll(); QList documents() const { return m_docs; } void addDocument( Document *doc ); void addDocument( const QUrl &url, Document::Type = Document::Type_None ); Document *takeDocument( int index ); Document *takeDocument( Document *doc ); Document *findDocument( const Document *doc ) const; Document *findDocument( const QUrl &url ) const; // Document *document( int index ) const; bool contains( const Document *doc ) const { return m_docs.contains( const_cast( doc ) ); } int indexOf( const Document *doc ) const { return m_docs.indexOf( const_cast( doc ) ); } int count() const { return m_docs.count(); } const Document *at( int index ) const { return m_docs.at( index ); } Document *value( int index ) const { return m_docs.value( index ); } bool load( KoXmlElement &element, XMLLoaderObject &status ); void save(QDomElement &element) const; void saveToStore( KoStore *store ) const; void documentChanged( Document *doc ); protected: QList m_docs; private: friend class Node; Node *node; // owner node }; } //namespace KPlato #endif diff --git a/src/libs/kernel/kptduration.h b/src/libs/kernel/kptduration.h index 9c6c19ac..ea6e454f 100644 --- a/src/libs/kernel/kptduration.h +++ b/src/libs/kernel/kptduration.h @@ -1,175 +1,175 @@ /* This file is part of the KDE project Copyright (C) 2001 Thomas Zander zander@kde.org Copyright (C) 2004 - 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDURATION_H #define KPTDURATION_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include class QString; class QStringList; /// The main namespace. namespace KPlato { /** * The Duration class can be used to store a timespan in a convenient format. * The timespan can be in length in many many hours down to milliseconds. */ -class KPLATOKERNEL_EXPORT Duration +class PLANKERNEL_EXPORT Duration { public: /** * DayTime = d hh:mm:ss.sss * Day = d.ddd * Hour = hh:mm * HourFraction = h.fraction of an hour */ enum Format { Format_DayTime, Format_Year, Format_Month, Format_Week, Format_Day, Format_Hour, Format_HourFraction, Format_i18nDayTime, Format_i18nYear, Format_i18nMonth, Format_i18nWeek, Format_i18nDay, Format_i18nHour, Format_i18nHourFraction }; //NOTE: These must match units in DurationSpinBox! enum Unit { Unit_Y, Unit_M, Unit_w, Unit_d, Unit_h, Unit_m, Unit_s, Unit_ms }; /// Create a zero duration Duration(); /// Create a duration of @p value, the value is in @p unit (defaut unit is milliseconds) explicit Duration(const qint64 value, Unit unit = Unit_ms); /// Create a duration of @p value, the value is in @p unit (default is hours) explicit Duration(double value, Unit unit = Unit_h); /// Create a duration of @p d days, @p h hours, @p m minutes, @p s seconds and @p ms milliseconds Duration(unsigned d, unsigned h, unsigned m, unsigned s=0, unsigned ms=0); /// Return duration in milliseconds qint64 milliseconds() const { return m_ms; } /// Return duration in whole seconds qint64 seconds() const { return m_ms / 1000; } /// Return duration in whole minutes qint64 minutes() const { return seconds() / 60; } /// Return duration in whole hours unsigned hours() const { return minutes() / 60; } /// Return duration in whole days unsigned days() const { return hours() / 24; } /** * Adds @p delta to *this. If @p delta > *this, *this is set to zeroDuration. */ void addMilliseconds(qint64 delta) { add(delta); } /** * Adds @p delta to *this. If @p delta > *this, *this is set to zeroDuration. */ void addSeconds(qint64 delta) { addMilliseconds(delta * 1000); } /** * Adds @p delta to *this. If @p delta > *this, *this is set to zeroDuration. */ void addMinutes(qint64 delta) { addSeconds(delta * 60); } /** * Adds @p delta to *this. If @p delta > *this, *this is set to zeroDuration. */ void addHours(qint64 delta) { addMinutes(delta * 60); } /** * Adds @p delta to *this. If @p delta > *this, *this is set to zeroDuration. */ void addDays(qint64 delta) { addHours(delta * 24); } bool operator==( KPlato::Duration d ) const { return m_ms == d.m_ms; } bool operator==( qint64 d ) const { return m_ms == d; } bool operator!=( KPlato::Duration d ) const { return m_ms != d.m_ms; } bool operator!=( qint64 d ) const { return m_ms != d; } bool operator<( KPlato::Duration d ) const { return m_ms < d.m_ms; } bool operator<( qint64 d ) const { return m_ms < d; } bool operator<=( KPlato::Duration d ) const { return m_ms <= d.m_ms; } bool operator<=( qint64 d ) const { return m_ms <= d; } bool operator>( KPlato::Duration d ) const { return m_ms > d.m_ms; } bool operator>( qint64 d ) const { return m_ms > d; } bool operator>=( KPlato::Duration d ) const { return m_ms >= d.m_ms; } bool operator>=( qint64 d ) const { return m_ms >= d; } Duration operator*(int value) const; Duration operator*(const double value) const; Duration operator*(const Duration value) const; /// Divide duration with the integer @p value Duration operator/(int value) const; /// Divide duration with the duration @p d double operator/(KPlato::Duration d) const; /// Add duration with duration @p d Duration operator+(KPlato::Duration d) const {Duration dur(*this); dur.add(d); return dur; } /// Add duration with duration @p d Duration &operator+=(KPlato::Duration d) {add(d); return *this; } /// Subtract duration with duration @p d Duration operator-(KPlato::Duration d) const {Duration dur(*this); dur.subtract(d); return dur; } /// Subtract duration with duration @p d Duration &operator-=(KPlato::Duration d) {subtract(d); return *this; } /// Format duration into a string with @p unit and @p precision. QString format( Unit unit = Unit_h, int precision = 1 ) const; /// Convert duration to a string with @p format QString toString(Format format = Format_DayTime) const; /// Create a duration from string @p s with @p format static Duration fromString(const QString &s, Format format = Format_DayTime, bool *ok=0); /// Return the duration scaled to hours double toHours() const; /** * Converts Duration into a double and scales it to unit @p u (default unit is hours) */ double toDouble( Unit u = Unit_h ) const; /// Return the list of units. Translated if @p trans is true. static QStringList unitList( bool trans = false ); /// Return @p unit in human readable form. Translated if @p trans is true. static QString unitToString( Duration::Unit unit, bool trans = false ); /// Convert @p unit name into Unit static Unit unitFromString( const QString &unit ); /// Returns value and unit from a coded string in @p rv and @p unit. static bool valueFromString( const QString &value, double &rv, Unit &unit ); /** * This is useful for occasions where we need a zero duration. */ static const Duration zeroDuration; private: friend class DateTime; /** * Duration in milliseconds. Signed to allow for simple calculations which * might go negative for intermediate results. */ qint64 m_ms; private: void add(qint64 delta); void add(KPlato::Duration delta); /** * Subtracts @param delta from *this. If @param delta > *this, *this is set to zeroDuration. */ void subtract(KPlato::Duration delta); }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kpteffortcostmap.h b/src/libs/kernel/kpteffortcostmap.h index 3dfd69f4..29f8957a 100644 --- a/src/libs/kernel/kpteffortcostmap.h +++ b/src/libs/kernel/kpteffortcostmap.h @@ -1,307 +1,307 @@ /* This file is part of the KDE project Copyright (C) 2005 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTEFFORTCOST_H #define KPTEFFORTCOST_H #include #include #include "kptduration.h" #include "kptdebug.h" #include #include namespace KPlato { -class KPLATOKERNEL_EXPORT EffortCost +class PLANKERNEL_EXPORT EffortCost { public: EffortCost() : m_effort(Duration::zeroDuration), m_cost(0), m_bcwpEffort(0.0), m_bcwpCost(0.0) {} EffortCost(KPlato::Duration effort, const double cost) : m_effort(effort), m_cost(cost), m_bcwpEffort(0.0), m_bcwpCost(0.0) { //debugPlan; } ~EffortCost() { //debugPlan; } double hours() const { return m_effort.toDouble( Duration::Unit_h ); } Duration effort() const { return m_effort; } void setEffort( KPlato::Duration effort ) { m_effort = effort; } double cost() const { return m_cost; } void setCost(double cost) { m_cost = cost; } void setBcwpEffort( double value ) { m_bcwpEffort = value; } double bcwpEffort() const { return m_bcwpEffort; } void setBcwpCost( double value ) { m_bcwpCost = value; } double bcwpCost() const { return m_bcwpCost; } void add(const Duration &effort, double cost, double bcwpEffort = 0.0, double bcwpCost = 0.0 ); EffortCost &operator+=(const EffortCost &ec) { add(ec.m_effort, ec.m_cost, ec.m_bcwpEffort, ec.m_bcwpCost); return *this; } #ifndef QT_NO_DEBUG_STREAM QDebug debug( QDebug dbg) const; #endif private: Duration m_effort; double m_cost; double m_bcwpEffort; double m_bcwpCost; }; typedef QMap EffortCostDayMap; -class KPLATOKERNEL_EXPORT EffortCostMap +class PLANKERNEL_EXPORT EffortCostMap { public: EffortCostMap() : m_days() { //debugPlan; } EffortCostMap( const EffortCostMap &map ); ~EffortCostMap() { //debugPlan; m_days.clear(); } void clear() { m_days.clear(); } EffortCost effortCost(QDate date) const { EffortCost ec; if (!date.isValid()) { //errorPlan<<"Date not valid"; return ec; } EffortCostDayMap::const_iterator it = m_days.find(date); if (it != m_days.end()) ec = it.value(); return ec; } void insert(const QDate &date, const EffortCost &ec ); void insert(QDate date, KPlato::Duration effort, const double cost) { if (!date.isValid()) { //errorPlan<<"Date not valid"; return; } m_days.insert(date, EffortCost(effort, cost)); } /** * If data for this date already exists add the new values to the old, * else the new values are inserted. */ EffortCost &add(QDate date, KPlato::Duration effort, const double cost) { return add(date, EffortCost(effort, cost)); } /** * If data for this date already exists add the new values to the old, * else the new value is inserted. */ EffortCost &add(QDate date, const EffortCost &ec) { if (!date.isValid()) { //errorPlan<<"Date not valid"; return zero(); } //debugPlan< date ) { break; } cost += it.value().cost(); } return cost; } Duration effortTo( QDate date ) const { Duration eff; EffortCostDayMap::const_iterator it; for(it = m_days.constBegin(); it != m_days.constEnd(); ++it) { if ( it.key() > date ) { break; } eff += it.value().effort(); } return eff; } double hoursTo( QDate date ) const { double eff = 0.0; EffortCostDayMap::const_iterator it; for(it = m_days.constBegin(); it != m_days.constEnd(); ++it) { if ( it.key() > date ) { break; } eff += it.value().hours(); } return eff; } /// Return the BCWP cost to @p date. (BSWP is cumulative) double bcwpCost( const QDate &date ) const; /// Return the BCWP effort to @p date. (BSWP is cumulative) double bcwpEffort( const QDate &date ) const; /// Return the BCWP total cost. Since BCWP is cumulative this is the last entry. double bcwpTotalCost() const { double cost = 0.0; if ( ! m_days.isEmpty() ) { cost = m_days.values().last().bcwpCost(); } return cost; } /// Return the BCWP total cost. Since BCWP is cumulative this is the last entry. double bcwpTotalEffort() const { double eff = 0.0; if ( ! m_days.isEmpty() ) { eff = m_days.values().last().bcwpEffort(); } return eff; } QDate startDate() const { return m_days.isEmpty() ? QDate() : m_days.keys().first(); } QDate endDate() const { return m_days.isEmpty() ? QDate() : m_days.keys().last(); } #ifndef QT_NO_DEBUG_STREAM QDebug debug( QDebug dbg) const; #endif private: EffortCost &zero() { return m_zero; } private: EffortCost m_zero; EffortCostDayMap m_days; }; } //namespace KPlato Q_DECLARE_METATYPE( KPlato::EffortCost ) Q_DECLARE_METATYPE( KPlato::EffortCostMap ) #ifndef QT_NO_DEBUG_STREAM -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCost &ec ); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCost *ec ); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCostMap &i ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCost &ec ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCost *ec ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::EffortCostMap &i ); #endif #endif diff --git a/src/libs/kernel/kptglobal.h b/src/libs/kernel/kptglobal.h index 295f5e20..9553599f 100644 --- a/src/libs/kernel/kptglobal.h +++ b/src/libs/kernel/kptglobal.h @@ -1,107 +1,107 @@ /* This file is part of the KDE project Copyright (C) 2006, 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTGLOBAL_H #define KPTGLOBAL_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include // for things in Qt namespace // The Plan file syntax is used in parts of the KPlatoWork file, so: // * If you change PLAN_FILE_SYNTAX_VERSION, change PLANWORK_FILE_SYNTAX_VERSION too! // * You don't need to change PLAN_FILE_SYNTAX_VERSION when you change KPLATOWORK_FILE_SYNTAX_VERSION #define PLAN_FILE_SYNTAX_VERSION "0.6.6" #define PLANWORK_FILE_SYNTAX_VERSION "0.6.6" #define CURRENTSCHEDULE -1 #define NOTSCHEDULED -2 #define BASELINESCHEDULE -3 #define ANYSCHEDULED -4 namespace KPlato { /// EffortCostCalculationType controls how effort and cost is calculated enum EffortCostCalculationType { ECCT_All, /// Include both work and material in both effort and cost calculations ECCT_EffortWork, /// Include only Work in effort calculations, both work and material in cost calculations ECCT_Work /// Include only Work in both effort and cost calculations }; enum ObjectType { OT_None = 0, OT_Project, OT_Task, OT_Summarytask, OT_ResourceGroup, OT_Resource, OT_Appointment, OT_External, OT_Interval, OT_ScheduleManager, OT_Schedule, OT_Calendar, OT_CalendarWeek, OT_CalendarDay }; namespace Role { enum Roles { EnumList = Qt::UserRole + 1, EnumListValue, List, ListValues, DurationUnit, DurationScales, Maximum, Minimum, EditorType, ReadWrite, ObjectType, InternalAppointments, ExternalAppointments, ColumnTag, Planned, Actual, Foreground, Object }; } //namespace Role -struct KPLATOKERNEL_EXPORT SchedulingState +struct PLANKERNEL_EXPORT SchedulingState { static QString deleted( bool trans = true ); static QString notScheduled( bool trans = true ); static QString scheduled( bool trans = true ); static QString resourceOverbooked( bool trans = true ); static QString resourceNotAvailable( bool trans = true ); static QString resourceNotAllocated( bool trans = true ); static QString constraintsNotMet( bool trans = true ); static QString effortNotMet( bool trans = true ); static QString schedulingError( bool trans = true ); }; //namespace WhatsThis } //namespace KPlato #endif diff --git a/src/libs/kernel/kptlocale.h b/src/libs/kernel/kptlocale.h index fb8e466e..ef11e70a 100644 --- a/src/libs/kernel/kptlocale.h +++ b/src/libs/kernel/kptlocale.h @@ -1,132 +1,132 @@ /* This file is part of the KDE project Copyright (C) 2015 Friedrich W. H. Kossebau Copyright (C) 2016 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTLOCALE_H #define KPTLOCALE_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include namespace KPlato { /** * Temporary wrapper for KLocale's currency methods. */ -class KPLATOKERNEL_EXPORT Locale +class PLANKERNEL_EXPORT Locale { public: Locale(); ~Locale(); /** * Sets the locale used to get the currency symbol. */ void setCurrencyLocale(QLocale::Language language, QLocale::Country country); /// Return the language used when getting the currency symbol QLocale::Language currencyLanguage() const; /// Return the country used when getting the currency symbol QLocale::Country currencyCountry() const; /** * Changes the current currency symbol. * * This symbol should be consistent with the selected Currency Code * * @param symbol The new currency symbol * @see currencyCode, KCurrency::currencySymbols */ void setCurrencySymbol(const QString &symbol); /** * Returns what the symbol denoting currency in the current locale * is as defined by user settings should look like. * * @return The default currency symbol used by locale. */ QString currencySymbol() const; /** * @since 4.4 * * Changes the number of decimal places used when formatting money. * * @param digits The default number of digits to use. */ void setMonetaryDecimalPlaces(int digits); /** * @since 4.4 * * The number of decimal places to include in monetary values (usually 2). * * @return Default number of monetary decimal places used by locale. */ int monetaryDecimalPlaces() const; /** * Given a double, converts that to a numeric string containing * the localized monetary equivalent. * * e.g. given 123456, return "$ 123,456.00". * * If precision isn't specified or is < 0, then the default monetaryDecimalPlaces() is used. * * @param num The number we want to format * @param currency The currency symbol you want. * @param precision Number of decimal places displayed * * @return The number of money as a localized string * @see monetaryDecimalPlaces() */ QString formatMoney(double num, const QString ¤cy = QString(), int precision = -1) const; /** * Converts a localized monetary string to a double. * * @param numStr the string we want to convert. * @param ok the boolean that is set to false if it's not a number. * If @p ok is 0, it will be ignored * * @return The string converted to a double */ double readMoney(const QString &numStr, bool *ok = 0) const; /** * Returns the explicitly set currency symbol. * Will be empty if not set by the user. */ QString currencySymbolExplicit() const; private: QString m_currencySymbol; int m_decimalPlaces; // to keep track of currency QLocale::Language m_language; QLocale::Country m_country; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptmap.h b/src/libs/kernel/kptmap.h index bcd208a7..41e06f0e 100644 --- a/src/libs/kernel/kptmap.h +++ b/src/libs/kernel/kptmap.h @@ -1,165 +1,165 @@ /* This file is part of the KDE project Copyright (C) 2004 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTMAP_H #define KPTMAP_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptcalendar.h" #include #include #include namespace KPlato { typedef QMap DateMapType; -class KPLATOKERNEL_EXPORT DateMap : public DateMapType +class PLANKERNEL_EXPORT DateMap : public DateMapType { public: DateMap() {} virtual ~DateMap() {} virtual bool contains(QDate date) const { return DateMapType::contains(date.toString(Qt::ISODate)); } void insert(const QString &date, int state=CalendarDay::NonWorking) { //debugPlan< IntMapType; -class KPLATOKERNEL_EXPORT IntMap : public IntMapType +class PLANKERNEL_EXPORT IntMap : public IntMapType { public: IntMap() {} virtual ~IntMap() {} void insert(int key, int state=CalendarDay::NonWorking) { if (state == CalendarDay::None) IntMapType::remove(key); else IntMapType::insert(key, state); } virtual int state(int key) const { IntMapType::ConstIterator it = IntMapType::find(key); if (it == IntMapType::end()) return 0; else return it.value(); } bool operator==(const IntMap &m) const { return keys() == m.keys() && values() == m.values(); } bool operator!=(const IntMap &m) const { return keys() != m.keys() || values() != m.values(); } // boolean use void toggle(int key, int state=CalendarDay::NonWorking) { if ( IntMapType::contains(key) ) remove(key); else insert(key, state); } void toggleClear(int key, int state=CalendarDay::NonWorking) { bool s =contains(key); clear(); if (!s) insert(key, state); } }; -class KPLATOKERNEL_EXPORT WeekMap : public IntMap +class PLANKERNEL_EXPORT WeekMap : public IntMap { public: bool contains(int week, int year) { return IntMap::contains(week*10000 + year); } bool contains(QPair week) { return contains(week.first, week.second); } void insert(int week, int year, int state=CalendarDay::NonWorking) { if (week < 1 || week > 53) { errorPlan<<"Illegal week number: "< week, int state=CalendarDay::NonWorking) { insert(week.first, week.second, state); } void insert(WeekMap::iterator it, int state) { insert(week(it.key()), state); } void remove(QPair week) { IntMap::remove(week.first*10000 + week.second); } static QPair week(int key) { return QPair(key/10000, key%10000); } using IntMap::state; int state(QPair week) const { return IntMap::state(week.first*10000 + week.second); } int state(int week, int year) const { return state(QPair(week, year)); } void toggle(QPair week, int state=CalendarDay::NonWorking) { if (week.first < 1 || week.first > 53) { errorPlan<<"Illegal week number: "< week, int state=CalendarDay::NonWorking) { if (week.first < 1 || week.first > 53) { errorPlan<<"Illegal week number: "< This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTNODE_H #define KPTNODE_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptglobal.h" #include "kptrelation.h" #include "kptduration.h" #include "kptdatetime.h" #include "kptschedule.h" #include "kptdocuments.h" #include "kptresource.h" #include #include #include #include class QDomElement; /// The main namespace. namespace KPlato { class Account; class Project; class Appointment; class ResourceGroup; class Resource; class ResourceGroupRequest; class Estimate; class EffortCostMap; class EffortCost; class Calendar; class KPlatoXmlLoaderBase; /** * This class represents any node in the project, a node can be a project or * a subproject or any task. * This class is basically an abstract interface to make the design more OO. */ -class KPLATOKERNEL_EXPORT Node : public QObject +class PLANKERNEL_EXPORT Node : public QObject { Q_OBJECT public: enum ConstraintType { ASAP, ALAP, MustStartOn, MustFinishOn, StartNotEarlier, FinishNotLater, FixedInterval }; enum State { State_None = 0, State_Started = 1, State_StartedLate = 2, State_StartedEarly = 4, State_Finished = 8, State_FinishedLate = 16, State_FinishedEarly = 32, State_Running = 64, State_RunningLate = 128, State_RunningEarly = 256, State_ReadyToStart = 512, // all preceding tasks finished (if any) State_NotReadyToStart = 1024, // all preceding tasks not finished (must be one or more) State_NotScheduled = 2048, State_Late = 4096 }; enum Properties { Type, StartupCost, ShutdownCost, CompletionEntry, CompletionStarted, CompletionFinished, CompletionStartTime, CompletionFinishTime, CompletionPercentage, CompletionRemainingEffort, CompletionActualEffort, CompletionUsedEffort }; explicit Node(Node *parent = 0); Node(const Node &node, Node *parent = 0); // Declare the class abstract virtual ~Node() = 0; void setId(const QString& id); QString id() const { return m_id; } // unique identity enum NodeTypes { Type_Node = 0, Type_Project = 1, Type_Subproject = 2, Type_Task = 3, Type_Milestone = 4, Type_Periodic = 5, Type_Summarytask = 6 }; virtual int type() const = 0; QString typeToString( bool trans = false ) const; static QString typeToString( NodeTypes typ, bool trans = false ); static QStringList typeToStringList( bool trans ); /** * Returns a pointer to the project node (main- or sub-project) * Returns 0 if no project exists. */ virtual Node *projectNode(); /** * Returns a pointer to the project node (main- or sub-project) * Returns 0 if no project exists. */ virtual const Node *projectNode() const; // The load and save methods virtual bool load(KoXmlElement &, XMLLoaderObject &) { return true; } virtual void save(QDomElement &element) const = 0; /// Save me and my childrens relations. virtual void saveRelations(QDomElement &element) const; /// Save a workpackage document containing @p node with schedule identity @p id virtual void saveWorkPackageXML( QDomElement &element, long id ) const; // simple child node management // Child nodes are things like subtasks, basically a task can exists of // several sub-tasks. Creating a table has 4 subtasks, 1) measuring // 2) cutting 3) building 4) painting. Node *parentNode() const { return m_parent; } void setParentNode( Node* newParent ) { m_parent = newParent;} const QList &childNodeIterator() const { return m_nodes; } int numChildren() const { return m_nodes.count(); } virtual void addChildNode(Node *node, Node *after=0); virtual void insertChildNode(int index, Node *node); void takeChildNode(Node *node ); void takeChildNode(int number ); Node* childNode(int number); const Node* childNode(int number) const; int findChildNode( const Node* node ) const; bool isChildOf( const Node *node ) const; int indexOf( const Node *node ) const; // Time-dependent child-node-management. // list all nodes that are dependent upon this one. // Building a house requires the table to be finished, therefore the // house-building is time dependent on the table-building. So a child // of the table-building node is the house-building node. int numDependChildNodes() const { return m_dependChildNodes.count(); } /// Adds relation of type @p p to both this node and @p node virtual void addDependChildNode( Node *node, Relation::Type p=Relation::FinishStart); /// Adds relation of type @p p with @p lag to both this node and @p node virtual void addDependChildNode( Node *node, Relation::Type p, Duration lag); /// Adds @p relation only to this node virtual bool addDependChildNode( Relation *relation); /// Inserts relation to this node at index @p index and appends relation to @p node virtual void insertDependChildNode( unsigned int index, Node *node, Relation::Type p=Relation::FinishStart); /** * Takes the relation rel from this node only. */ void takeDependChildNode( Relation *rel ); Relation *getDependChildNode( int number ) const { return m_dependChildNodes.at(number); } QList dependChildNodes() const { return m_dependChildNodes; } int numDependParentNodes() const { return m_dependParentNodes.count(); } /// Adds relation if type @p to both this node and @p node virtual void addDependParentNode(Node *node, Relation::Type p=Relation::FinishStart); /// Adds relation to both this node and @p node virtual void addDependParentNode( Node *node, Relation::Type p, Duration lag); /// Adds relation only to this node virtual bool addDependParentNode( Relation *relation); /// Inserts relation to this node at index and appends relation to @p node virtual void insertDependParentNode( unsigned int index, Node *node, Relation::Type p=Relation::FinishStart); /** * Takes the relation @p rel from this node only. */ void takeDependParentNode( Relation *rel ); Relation *getDependParentNode( int number ) const { return m_dependParentNodes.at(number); } QList dependParentNodes() const { return m_dependParentNodes; } QList getParentNodes(); bool isParentOf( const Node *node ) const; bool isDependChildOf( const Node *node ) const; virtual bool canMoveTo( const Node *newParent ) const; Relation *findParentRelation( const Node *node) const; Relation *findChildRelation( const Node *node ) const; Relation *findRelation( const Node *node ) const; /// Set the scheduled start time void setStartTime(const DateTime &startTime, long id = CURRENTSCHEDULE ); /// Return the scheduled start time virtual DateTime startTime( long id = CURRENTSCHEDULE ) const; /// Set the scheduled end time void setEndTime(const DateTime &endTime, long id = CURRENTSCHEDULE ); /// Return the scheduled end time virtual DateTime endTime( long id = CURRENTSCHEDULE ) const; /// Set the scheduled duration void setDuration(const Duration &duration, long id = CURRENTSCHEDULE ); DateTime appointmentStartTime( long id = CURRENTSCHEDULE) const; DateTime appointmentEndTime( long id = CURRENTSCHEDULE ) const; /// Return the estimate for this node Estimate *estimate() const { return m_estimate; } /** * Instead of using the expected duration, generate a random value using * the Distribution of each Task. This can be used for Monte-Carlo * estimation of Project duration. */ virtual Duration *getRandomDuration() = 0; /** * Calculate the delay of this node. * It is the difference between the actual startTime and scheduled startTime. */ Duration *getDelay(); // TODO QString &name() { return m_name; } QString &leader() { return m_leader; } QString &description() { return m_description; } const QString &name() const { return m_name; } const QString &leader() const { return m_leader; } const QString &description() const { return m_description; } void setName(const QString &n); void setLeader(const QString &l); void setDescription(const QString &d); void setConstraint(Node::ConstraintType type); void setConstraint(const QString &type); int constraint() const { return m_constraint; } QString constraintToString( bool trans=false ) const; static QStringList constraintList( bool trans ); virtual void setConstraintStartTime(const DateTime &time) { m_constraintStartTime = time; changed( this ); } virtual void setConstraintEndTime(const DateTime &time) { m_constraintEndTime = time; changed( this ); } virtual DateTime constraintStartTime() const { return m_constraintStartTime; } virtual DateTime constraintEndTime() const { return m_constraintEndTime; } virtual DateTime startNotEarlier() const { return m_constraintStartTime; } virtual DateTime finishNotLater() const { return m_constraintEndTime; } virtual DateTime mustStartOn() const { return m_constraintStartTime; } virtual DateTime mustFinishOn() const { return m_constraintEndTime; } virtual ResourceGroupRequest *resourceGroupRequest(const ResourceGroup * /*group*/) const { return 0; } virtual QStringList requestNameList() const { return QStringList(); } virtual bool containsRequest( const QString &/*identity*/ ) const { return false; } virtual ResourceRequest *resourceRequest( const QString &/*name*/ ) const { return 0; } /// Return the list of resources assigned to this task virtual QStringList assignedNameList( long /*id*/ = CURRENTSCHEDULE ) const { return QStringList(); } virtual void makeAppointments(); /// Calculates if the assigned resource is overbooked /// within the duration of this node virtual void calcResourceOverbooked(); /// Return the scheduling status of schedule @p id. If @p trans is true, text is translated QStringList schedulingStatus( long id, bool trans = false ) const; /// EstimateType == Estimate, but no resource is requested bool resourceError( long id = CURRENTSCHEDULE ) const; /// The assigned resource is overbooked virtual bool resourceOverbooked( long id = CURRENTSCHEDULE ) const; /// The requested resource is not available bool resourceNotAvailable( long id = CURRENTSCHEDULE ) const; /// The task cannot be scheduled to fulfil all the constraints virtual bool constraintError( long id = CURRENTSCHEDULE ) const; /// The task cannot be scheduled correctly virtual bool schedulingError( long id = CURRENTSCHEDULE ) const; /// The node has not been scheduled bool notScheduled( long id = CURRENTSCHEDULE ) const; /// Return a list of overbooked resources virtual QStringList overbookedResources( long id = CURRENTSCHEDULE ) const; /// The assigned resources can not fulfil the estimated effort. virtual bool effortMetError( long /*id*/ = CURRENTSCHEDULE ) const { return false; } virtual EffortCostMap plannedEffortCostPrDay(QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const=0; virtual EffortCostMap plannedEffortCostPrDay(const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const=0; /// Returns the total planned effort for @p resource on this task (or subtasks) virtual Duration plannedEffort( const Resource *resource, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for this task (or subtasks) virtual Duration plannedEffort( long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const { Q_UNUSED(id); return Duration::zeroDuration; } /// Returns the total planned effort for this task (or subtasks) on date virtual Duration plannedEffort(QDate , long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const { Q_UNUSED(id); return Duration::zeroDuration; } /// Returns the total planned effort for @p resource on this task (or subtasks) on date virtual Duration plannedEffort( const Resource *resource, QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the planned effort up to and including date virtual Duration plannedEffortTo(QDate , long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const { Q_UNUSED(id); return Duration::zeroDuration; } /// Returns the planned effort for @p resource up to and including date virtual Duration plannedEffortTo( const Resource *resource, QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total actual effort for this task (or subtasks) virtual Duration actualEffort() const { return Duration::zeroDuration; } /// Returns the total actual effort for this task (or subtasks) on date virtual Duration actualEffort(QDate /*date*/ ) const { return Duration::zeroDuration; } /// Returns the total actual effort for this task (or subtasks) up to and including date virtual Duration actualEffortTo(QDate /*date*/ ) const { return Duration::zeroDuration; } virtual EffortCostMap actualEffortCostPrDay(QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const=0; /// Returns the actual effort and cost pr day used by @p resource virtual EffortCostMap actualEffortCostPrDay(const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const=0; /** * Planned cost is the sum total of all resources and other costs * planned for this node. */ virtual EffortCost plannedCost( long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /** * Planned cost from start of activity up to and including date * is the sum of all resource costs and other costs planned for this node. */ virtual double plannedCostTo(QDate /*date*/, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const { Q_UNUSED(id); return 0; } /// Actual cost up to and including date virtual EffortCost actualCostTo( long int /*id*/, QDate /*date*/) const { return EffortCost(); } /// Returns the effort planned to be used to reach the actual percent finished virtual Duration budgetedWorkPerformed( QDate , long = CURRENTSCHEDULE ) const = 0; /// Returns the cost planned to be used to reach the actual percent finished virtual double budgetedCostPerformed( QDate , long = CURRENTSCHEDULE ) const { return 0.0; }; /// Return map of Budgeted Cost of Work Scheduled pr day virtual EffortCostMap bcwsPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Return map of Budgeted Cost of Work Scheduled pr day virtual EffortCostMap bcwsPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ) const; /// Budgeted Cost of Work Scheduled virtual double bcws( QDate /*date*/, long id = CURRENTSCHEDULE ) const { Q_UNUSED(id); return 0.0; } /// Return map of Budgeted Cost of Work Scheduled pr day (also includes bcws pr day) virtual EffortCostMap bcwpPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Return map of Budgeted Cost of Work Scheduled pr day (also includes bcws pr day) virtual EffortCostMap bcwpPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ) const; /// Budgeted Cost of Work Performed virtual double bcwp( long id ) const { Q_UNUSED(id); return 0.0; } /// Budgeted Cost of Work Performed ( up to @p date ) virtual double bcwp( QDate /*date*/, long id = CURRENTSCHEDULE ) const { Q_UNUSED(id); return 0.0; } /// Return a map of Actual effort and Cost of Work Performed virtual EffortCostMap acwp( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Return a map of Actual effort and Cost of Work Performed virtual EffortCostMap acwp( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ) const; /// Return Actual effort and Cost of Work Performed upto @date virtual EffortCost acwp( QDate date, long id = CURRENTSCHEDULE ) const; /// Effort based performance index virtual double effortPerformanceIndex(QDate /*date*/, long /*id*/ = CURRENTSCHEDULE ) const { return 0.0; } /// Schedule performance index virtual double schedulePerformanceIndex(QDate /*date*/, long /*id*/ = CURRENTSCHEDULE ) const { return 0.0; } /// Cost performance index virtual double costPerformanceIndex( long int /*id*/, QDate /*date*/, bool * /*error=0*/ ) const { return 0.0; } virtual void initiateCalculationLists(MainSchedule &sch) = 0; virtual DateTime calculateForward(int /*use*/) = 0; virtual DateTime calculateEarlyFinish(int /*use*/) { return DateTime(); } virtual DateTime calculateBackward(int /*use*/) = 0; virtual DateTime calculateLateStart(int /*use*/) { return DateTime(); } virtual DateTime scheduleForward(const DateTime &, int /*use*/) = 0; virtual DateTime scheduleFromStartTime(int /*use*/) { return DateTime(); } virtual DateTime scheduleBackward(const DateTime &, int /*use*/) = 0; virtual DateTime scheduleFromEndTime(int /*use*/) { return DateTime(); } virtual void adjustSummarytask() = 0; /// Returns the (previously) calculated duration Duration duration( long id = CURRENTSCHEDULE ) const; /** * The variance is calculated based on * the optimistic/pessimistic ratio specified for the estimate. */ double variance( long id = CURRENTSCHEDULE, Duration::Unit unit = Duration::Unit_ms ) const; /** * The standard deviation is calculated based on * the optimistic/pessimistic ratio specified for the estimate. */ double deviation( long id = CURRENTSCHEDULE, Duration::Unit unit = Duration::Unit_ms ) const; Node *siblingBefore(); Node *childBefore(Node *node); Node *siblingAfter(); Node *childAfter(Node *node); bool moveChildUp(Node *node); bool moveChildDown(Node *node); /// Check if this node can be linked to node bool legalToLink( const Node *node ) const; /// Check if node par can be linked to node child. (Reimplement) virtual bool legalToLink( const Node *, const Node *) const { return false; } /// Save appointments for schedule with id virtual void saveAppointments(QDomElement &element, long id) const; ///Return the list of appointments for schedule with id. QList appointments( long id = CURRENTSCHEDULE ); /// Adds appointment to this node only (not to resource) virtual bool addAppointment(Appointment *appointment, Schedule &main); /// Return list of all resources with appointments to this task for schedule with @p id. QList assignedResources( long id ) const; /// Find the node with my id virtual Node *findNode() const { return findNode(m_id); } /// Find the node with identity id virtual Node *findNode(const QString &id) const { return (m_parent ? m_parent->findNode(id) : 0); } /// Remove myself from the id register virtual bool removeId() { return removeId(m_id); } /// Remove the registered identity @p id virtual bool removeId(const QString &id) { return (m_parent ? m_parent->removeId(id) : false); } /** * This is when work can start on this node in accordance with * the calendar of allocated resources. Normally this is the same * as @ref startTime(), but may differ if timing constraints are set. */ virtual DateTime workStartTime( long id = CURRENTSCHEDULE ) const; void setWorkStartTime(const DateTime &dt, long id = CURRENTSCHEDULE ); /** * This is when work can finish on this node in accordance with * the calendar of allocated resources. Normally this is the same * as @ref endTime(), but may differ if timing constraints are set. */ virtual DateTime workEndTime( long id = CURRENTSCHEDULE ) const; void setWorkEndTime(const DateTime &dt, long id = CURRENTSCHEDULE ); /// Returns true if this node is critical virtual bool isCritical( long id = CURRENTSCHEDULE ) const { Q_UNUSED(id); return false; } /// Returns true if this node is in a critical path virtual bool inCriticalPath( long id = CURRENTSCHEDULE ) const; /// Returns the level this node is in the hierarchy. Top node is level 0. virtual int level() const; /// Generate WBS Code virtual QString generateWBSCode( QList &indexes, bool sortable = false ) const; /// Returns the Work Breakdown Structure Code QString wbsCode(bool sortable = false) const; double startupCost() const { return m_startupCost; } void setStartupCost(double cost); Account *startupAccount() const { return m_startupAccount; } void setStartupAccount(Account *acc); double shutdownCost() const { return m_shutdownCost; } void setShutdownCost(double cost); Account *shutdownAccount() const { return m_shutdownAccount; } void setShutdownAccount(Account *acc); Account *runningAccount() const { return m_runningAccount; } void setRunningAccount(Account *acc); bool isBaselined( long int id = BASELINESCHEDULE ) const; /** * Return schedule with @p id * If @p id == CURRENTSCHEDULE, return m_currentSchedule * Return 0 if schedule with @p id doesn't exist. */ Schedule *schedule( long id = CURRENTSCHEDULE ) const; /// Return current schedule Schedule *currentSchedule() const { return m_currentSchedule; } /// Set current schedule to schedule with identity @p id, for me and my children virtual void setCurrentSchedule(long id); /// Return true if this node has a valid schedule with identity == @p id bool isScheduled( long id = CURRENTSCHEDULE ) const; /// Return the list of schedules for this node QHash &schedules() { return m_schedules; } /// Find schedule matching name and type. Does not return deleted schedule. Schedule *findSchedule(const QString &name, const Schedule::Type type); /// Find schedule matching name. Does not return deleted schedule. Schedule *findSchedule(const QString &name); /// Find schedule matching type. Does not return deleted schedule. Schedule *findSchedule(const Schedule::Type type); /// Find schedule matching id. Also returns deleted schedule. Schedule *findSchedule(long id) const; /// Take, don't delete (as in destruct). void takeSchedule(const Schedule *schedule); /// Add schedule to list, replace if schedule with same id already exists. void addSchedule(Schedule *schedule); /// Create a new schedule. Schedule *createSchedule(const QString& name, Schedule::Type type, long id); /// Create a new schedule. Schedule *createSchedule(Schedule *parent); /// Set deleted = onoff for schedule with id void setScheduleDeleted(long id, bool onoff); /// Set parent schedule recursively virtual void setParentSchedule(Schedule *sch); const ResourceRequestCollection &requests() const { return m_requests; } ResourceRequestCollection &requests() { return m_requests; } virtual uint state( long ) const { return State_None; } const Documents &documents() const { return m_documents; } Documents &documents() { return m_documents; } virtual void emitDocumentAdded( Node *node, Document *doc, int idx ); virtual void emitDocumentRemoved( Node *node, Document *doc, int idx ); virtual void emitDocumentChanged( Node *node, Document *doc, int idx ); void blockChanged(bool on = true); public: // These shouldn't be available to other than those who inherits /// Calculate the critical path virtual bool calcCriticalPath(bool fromEnd); virtual void calcFreeFloat(); /// Check if this node has any dependent child nodes virtual bool isEndNode() const; /// Check if this node has any dependent parent nodes virtual bool isStartNode() const; virtual void initiateCalculation(MainSchedule &sch); virtual void resetVisited(); void propagateEarliestStart(DateTime &time); void propagateLatestFinish(DateTime &time); void moveEarliestStart(DateTime &time); void moveLatestFinish(DateTime &time); // Reimplement this virtual Duration summarytaskDurationForward(const DateTime &/*time*/) { return Duration::zeroDuration; } // Reimplement this virtual DateTime summarytaskEarliestStart() { return DateTime(); } // Reimplement this virtual Duration summarytaskDurationBackward(const DateTime &/*time*/) { return Duration::zeroDuration; } // Reimplement this virtual DateTime summarytaskLatestFinish() { return DateTime(); } /** * earlyStart() returns earliest time this node can start * given the constraints of the network. */ DateTime earlyStart( long id = CURRENTSCHEDULE ) const; /** * setEarlyStart() sets earliest time this node can start */ void setEarlyStart(const DateTime &dt, long id = CURRENTSCHEDULE ); /** * lateStart() returns latest time this node can start * given the constraints of the network. */ DateTime lateStart( long id = CURRENTSCHEDULE ) const; /** * setLateStart() sets the earliest time this node can start */ void setLateStart(const DateTime &dt, long id = CURRENTSCHEDULE ); /** * earlyFinish() returns earliest time this node can finish * given the constraints of the network. */ DateTime earlyFinish( long id = CURRENTSCHEDULE ) const; /** * setEarlyFinish() sets earliest time this node can finish */ void setEarlyFinish(const DateTime &dt, long id = CURRENTSCHEDULE ); /** * lateFinish() returns latest time this node can finish * given the constraints of the network. */ DateTime lateFinish( long id = CURRENTSCHEDULE ) const; /** * setLateFinish() sets latest time this node can finish */ void setLateFinish(const DateTime &dt, long id = CURRENTSCHEDULE ); /// Adds appointment to both this node and resource virtual void addAppointment(ResourceSchedule *resource, const DateTime &start, const DateTime &end, double load=100); virtual void clearProxyRelations() {} virtual void addParentProxyRelations( const QList & ) {} virtual void addChildProxyRelations( const QList & ) {} virtual void addParentProxyRelation(Node *, const Relation *) {} virtual void addChildProxyRelation(Node *, const Relation *) {} virtual void changed( int property = -1 ) { changed( this, property ); } Duration getmDurationForward(){ return this->m_durationForward;} public Q_SLOTS: void slotStandardWorktimeChanged( StandardWorktime* ); protected: friend class KPlatoXmlLoaderBase; /** * Calculates and returns the duration of the node. * Reimplement. */ virtual Duration duration(const DateTime &/*time*/, int /*use*/, bool /*backward*/) { return Duration::zeroDuration; } // NOTE: Cannot use setCurrentSchedule() due to overload/casting problems void setCurrentSchedulePtr(Schedule *schedule) { m_currentSchedule = schedule; } virtual void changed(Node *node, int property = -1 ); QList m_nodes; QList m_dependChildNodes; QList m_dependParentNodes; QListm_parentNodes; Node *m_parent; QString m_id; // unique id QString m_name; // Name of this node QString m_leader; // Person or group responsible for this node QString m_description; // Description of this node Estimate *m_estimate; ConstraintType m_constraint; /** * m_constraintTime is used if any of the constraints * FixedInterval, StartNotEarlier, MustStartOn or FixedInterval is selected */ DateTime m_constraintStartTime; /** * m_constraintEndTime is used if any of the constraints * FixedInterval, FinishNotLater, MustFinishOn or FixedInterval is selected */ DateTime m_constraintEndTime; bool m_visitedForward; bool m_visitedBackward; Duration m_durationForward; Duration m_durationBackward; DateTime m_earlyStart; DateTime m_earlyFinish; DateTime m_lateFinish; QHash m_schedules; Schedule *m_currentSchedule; double m_startupCost; Account *m_startupAccount; double m_shutdownCost; Account *m_shutdownAccount; Account *m_runningAccount; Documents m_documents; ResourceRequestCollection m_requests; private: void init(); bool m_blockChanged; }; //////////////////////////////// Estimate //////////////////////////////// /** * The Estimate class stores how much time (or effort) it takes to complete a Task. * The estimate which is needed to complete the task is not simply a single value but * is stored as an optimistic, a pessimistic and an expected value. * With statistical calculations using the PERT distribution, one can arrive at a more * realistic estimate than when using the expected value alone. */ -class KPLATOKERNEL_EXPORT Estimate { +class PLANKERNEL_EXPORT Estimate { public: /// Constructor explicit Estimate( Node *parent = 0 ); /// Copy constructor. Estimate (const Estimate &estimate, Node *parent = 0); /// Destructor ~Estimate(); /// Reset estimate void clear(); /// Copy values from @p estimate Estimate &operator=( const Estimate &estimate ); /// Type defines the types of estimates enum Type { Type_Effort, /// Changing amount of resources changes the task duration Type_Duration /// Changing amount of resources will not change the tasks duration }; /// Return the node that owns this Estimate Node *parentNode() const { return m_parent; } /// Set the node that owns this Estimate void setParentNode( Node* parent ) { m_parent = parent; } /// Return estimate Type Type type() const { return m_type; } /// Set estimate type to @p type void setType(Type type); /// Set estimate type to type represented by the string @p type void setType(const QString& type); /// Return estimate type as a string. If @p trans is true, it's translated QString typeToString( bool trans=false ) const; /// Return estimate type @p typ as a string. If @p trans is true, it's translated static QString typeToString( Estimate::Type typ, bool trans=false ); /// Return a stringlist of all estimate types. Translated if @p trans = true. static QStringList typeToStringList( bool trans=false ); /// Return the calendar used when Type is Duration Calendar *calendar() const { return m_calendar; } /// Set the calendar to be used when Type is Duration void setCalendar( Calendar *calendar ); enum Risktype { Risk_None, Risk_Low, Risk_High }; Risktype risktype() const { return m_risktype; } void setRisktype(Risktype type); void setRisktype(const QString& type); QString risktypeToString( bool trans=false ) const; static QStringList risktypeToStringList( bool trans=false ); /// Use defines which value to access enum Use { Use_Expected=0, Use_Optimistic=1, Use_Pessimistic=2 }; /// Return estimate (scaled) of type @p valueType. /// If @p pert is true the pert value is calculated and returned Duration value(int valueType, bool pert) const; /// Return unscaled value Duration optimisticValue() const; /// Return unscaled value Duration pessimisticValue() const; /// Return unscaled value Duration expectedValue() const; /// The unit in which the estimates were entered. Duration::Unit unit() const { return m_unit; } /// Set display unit. void setUnit( Duration::Unit unit ); /// Return the expected estimate (normally entered by user) double expectedEstimate() const { return m_expectedEstimate; } /// Return the optimistic estimate (normally entered by user) double optimisticEstimate() const { return m_optimisticEstimate; } /// Return the pessimistic estimate (normally entered by user) double pessimisticEstimate() const { return m_pessimisticEstimate; } /// Set the expected estimate void setExpectedEstimate( double value ); /// Set the optimistic estimate void setOptimisticEstimate( double value ); /// Set the pessimistic estimate void setPessimisticEstimate( double value ); /** * Set the optimistic estimate as a deviation from "expected" in percent * @param percent should be a negative value. */ void setOptimisticRatio(int percent); /** * Return the "optimistic" estimate as deviation from "expected" in percent. * This should be a negative value. */ int optimisticRatio() const; /** * Set the pessimistic estimate as a deviation from "expected" in percent * @param percent should be a positive value. */ void setPessimisticRatio(int percent); /** * Return the "pessimistic" estimate as the deviation from "expected" in percent. * This should be a positive value. */ int pessimisticRatio() const; /** * The variance is calculated based on * the optimistic/pessimistic estimates, scaled to current unit. */ double variance() const; /** * The variance is calculated based on * the optimistic/pessimistic estimates, scaled to @p unit */ double variance( Duration::Unit unit ) const; /** * The standard deviation is calculated based on * the optimistic/pessimistic estimates, scaled to current unit. */ double deviation() const; /** * The standard deviation is calculated based on * the optimistic/pessimistic estimates, scaled to @p unit */ double deviation( Duration::Unit unit ) const; /// Returns the expected duration. Calculated based on the estimates expected, optimistic and pessimistic Duration pertExpected() const; /// Returns the most optimistic duration. Calculated based on the estimates expected, optimistic and pessimistic Duration pertOptimistic() const; /// Returns the most pessimistic duration. Calculated based on the estimates expected, optimistic and pessimistic Duration pertPessimistic() const; /// Convert the duration @p value (in milliseconds) to a value in @p unit, using the scaling factors in @p scales static double scale( const Duration &value, Duration::Unit unit, const QList &scales ); /// Convert the duration @p value (in @p unit) to a value in milliseconds (base unit), using the scaling factors in @p scales static Duration scale( double value, Duration::Unit unit, const QList &scales ); /// Return a list of default scales scaling factors static QList defaultScales(); /// Return a list of scaling factors fetched from the projects standard worktime QList scales() const; /// Load from xml document bool load(KoXmlElement &element, XMLLoaderObject &status); /// Save to xml document void save(QDomElement &element) const; protected: /// Set (calculate) cached value void setOptimisticValue(); /// Set (calculate) cached value void setExpectedValue(); /// Set (calculate) cached value void setPessimisticValue(); /// Notify parent of changes void changed() { if ( m_parent ) m_parent->changed(); } /// Copy @p estimate, parentNode is not copied void copy( const Estimate &estimate ); private: friend class Node; Node *m_parent; /// Holds the unit entered by user Duration::Unit m_unit; /// Holds the value entered by user, in unit m_unit double m_expectedEstimate; /// Holds the value entered by user, in unit m_unit double m_optimisticEstimate; /// Holds the value entered by user, in unit m_unit double m_pessimisticEstimate; mutable bool m_expectedCached, m_optimisticCached, m_pessimisticCached, m_pertCached; /// Cached value in base unit (milliseconds) Duration m_expectedValue; /// Cached value in base unit (milliseconds) Duration m_optimisticValue; /// Cached value in base unit (milliseconds) Duration m_pessimisticValue; /// Cached pert expected value mutable Duration m_pertExpected; Type m_type; Risktype m_risktype; /// Calendar may be used when Type is Type_Duration Calendar *m_calendar; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptpackage.h b/src/libs/kernel/kptpackage.h index 2aed7f9a..7b911119 100644 --- a/src/libs/kernel/kptpackage.h +++ b/src/libs/kernel/kptpackage.h @@ -1,54 +1,54 @@ /* This file is part of the KDE project Copyright (C) 2010, 2011 Dag Andersen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef KPLATO_KPTPACKAGE_H #define KPLATO_KPTPACKAGE_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kpttask.h" #include #include namespace KPlato { class Project; // temporary convenience class -class KPLATOKERNEL_EXPORT Package +class PLANKERNEL_EXPORT Package { public: Package(); QUrl url; Project *project; QDateTime timeTag; QString ownerId; QString ownerName; WorkPackageSettings settings; Task *task; Task *toTask; QMap documents; }; } #endif // KPLATO_KPTPACKAGE_H diff --git a/src/libs/kernel/kptproject.h b/src/libs/kernel/kptproject.h index 6a5752f5..1902976a 100644 --- a/src/libs/kernel/kptproject.h +++ b/src/libs/kernel/kptproject.h @@ -1,716 +1,716 @@ /* This file is part of the KDE project Copyright (C) 2001 Thomas Zander zander@kde.org Copyright (C) 2004 - 2010 Dag Andersen Copyright (C) 2007 Florian Piquemal Copyright (C) 2007 Alexis Ménard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTPROJECT_H #define KPTPROJECT_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptnode.h" #include "kptglobal.h" #include "kptaccount.h" #include "kptcalendar.h" #include "kptdatetime.h" #include "kptduration.h" #include "kptresource.h" #include "kptwbsdefinition.h" #include "kptconfigbase.h" #include #include #include #include #include /// The main namespace. namespace KPlato { class Locale; class Schedule; class StandardWorktime; class ScheduleManager; class XMLLoaderObject; class Task; class SchedulerPlugin; class KPlatoXmlLoaderBase; /** * Project is the main node in a project, it contains child nodes and * possibly sub-projects. A sub-project is just another instantiation of this * node however. * * A note on timezones: * To be able to handle resources working in different timezones and * to facilitate data exchange with other applications like PIMs or * and groupware servers, the project has a timezone that is used for * all datetimes in nodes and schedules. * By default the local timezone is used. * * A resources timezone is defined by the associated calendar. * * Note that a projects datetimes are always displayed/modified in the timezone * it was originally created, not necessarily in your current local timezone. */ -class KPLATOKERNEL_EXPORT Project : public Node +class PLANKERNEL_EXPORT Project : public Node { Q_OBJECT public: explicit Project( Node *parent = 0 ); explicit Project( ConfigBase &config, Node *parent = 0 ); explicit Project( ConfigBase &config, bool useDefaultValues, Node *parent = 0 ); ~Project(); /// Reference this project. void ref() { ++m_refCount; } /// De-reference this project. Deletes project of ref count <= 0 void deref(); /// Returns the node type. Can be Type_Project or Type_Subproject. virtual int type() const; /** * Calculate the schedules managed by the schedule manager * * @param sm Schedule manager */ void calculate( ScheduleManager &sm ); /** * Re-calculate the schedules managed by the schedule manager * * @param sm Schedule manager * @param dt The datetime from when the schedule shall be re-calculated */ void calculate( ScheduleManager &sm, const DateTime &dt ); virtual DateTime startTime( long id = -1 ) const; virtual DateTime endTime( long id = -1 ) const; /// Returns the calculated duration for schedule @p id Duration duration( long id = -1 ) const; using Node::duration; /** * Instead of using the expected duration, generate a random value using * the Distribution of each Task. This can be used for Monte-Carlo * estimation of Project duration. */ Duration *getRandomDuration(); virtual bool load( KoXmlElement &element, XMLLoaderObject &status ); virtual void save( QDomElement &element ) const; using Node::saveWorkPackageXML; /// Save a workpackage document containing @node with schedule identity @p id void saveWorkPackageXML( QDomElement &element, const Node *node, long id ) const; /** * Add the node @p task to the project, after node @p position * If @p position is zero or the project node, it will be added to this project. */ bool addTask( Node* task, Node* position ); /** * Add the node @p task to the @p parent */ bool addSubTask( Node* task, Node* parent ); /** * Add the node @p task to @p parent, in position @p index * If @p parent is zero, it will be added to this project. */ bool addSubTask( Node* task, int index, Node* parent, bool emitSignal = true ); /** * Remove the @p node. * The node is not deleted. */ void takeTask( Node *node, bool emitSignal = true ); bool canMoveTask( Node* node, Node *newParent ); bool moveTask( Node* node, Node *newParent, int newPos ); bool canIndentTask( Node* node ); bool indentTask( Node* node, int index = -1 ); bool canUnindentTask( Node* node ); bool unindentTask( Node* node ); bool canMoveTaskUp( Node* node ); bool moveTaskUp( Node* node ); bool canMoveTaskDown( Node* node ); bool moveTaskDown( Node* node ); /** * Create a task with a unique id. * The task is not added to the project. Do this with addSubTask(). */ Task *createTask(); /** * Create a copy of @p def with a unique id. * The task is not added to the project. Do this with addSubTask(). */ Task *createTask( const Task &def ); int resourceGroupCount() const { return m_resourceGroups.count(); } QList &resourceGroups(); /// Adds the resource group to the project. virtual void addResourceGroup( ResourceGroup *resource, int index = -1 ); /** * Removes the resource group @p resource from the project. * The resource group is not deleted. */ ResourceGroup *takeResourceGroup( ResourceGroup *resource ); int indexOf( ResourceGroup *resource ) const { return m_resourceGroups.indexOf( resource ); } ResourceGroup *resourceGroupAt( int pos ) const { return m_resourceGroups.value( pos ); } int numResourceGroups() const { return m_resourceGroups.count(); } /// Returns the resourcegroup with identity id. ResourceGroup *group( const QString& id ); /// Returns the resource group with the matching name, 0 if no match is found. ResourceGroup *groupByName( const QString& name ) const; /** * Adds the resource to the project and resource group. * Always use this to add resources. */ void addResource( ResourceGroup *group, Resource *resource, int index = -1 ); /** * Removes the resource from the project and resource group. * The resource is not deleted. * Always use this to remove resources. */ Resource *takeResource( ResourceGroup *group, Resource *resource ); /// Move @p resource to the new @p group. Requests are removed. void moveResource( ResourceGroup *group, Resource *resource ); /// Returns the resource with identity id. Resource *resource( const QString& id ); /// Returns the resource with matching name, 0 if no match is found. Resource *resourceByName( const QString& name ) const; QStringList resourceNameList() const; /// Returns a list of all resources QList resourceList() const { return resourceIdDict.values(); } virtual EffortCostMap plannedEffortCostPrDay( QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; virtual EffortCostMap plannedEffortCostPrDay(const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; using Node::plannedEffort; /// Returns the total planned effort for this project (or subproject) virtual Duration plannedEffort( long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for this project (or subproject) on date virtual Duration plannedEffort( QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; using Node::plannedEffortTo; /// Returns the planned effort up to and including date virtual Duration plannedEffortTo( QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the actual effort up to and including @p date virtual Duration actualEffortTo( QDate date ) const; /** * Planned cost up to and including date * @param date The cost is calculated from the start of the project upto including date. * @param id Identity of the schedule to be used. */ virtual double plannedCostTo( QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /** * Actual cost up to and including @p date * @param date The cost is calculated from the start of the project upto including date. */ virtual EffortCost actualCostTo( long int id, QDate date ) const; virtual EffortCostMap actualEffortCostPrDay( QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; virtual EffortCostMap actualEffortCostPrDay( const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; double effortPerformanceIndex( QDate date, long id ) const; double schedulePerformanceIndex( QDate date, long id ) const; /// Returns the effort planned to be used to reach the actual percent finished virtual Duration budgetedWorkPerformed( QDate date, long id = CURRENTSCHEDULE ) const; /// Returns the cost planned to be used to reach the actual percent finished virtual double budgetedCostPerformed( QDate date, long id = CURRENTSCHEDULE ) const; /// Budgeted Cost of Work Scheduled ( up to @p date ) virtual double bcws( QDate date, long id = BASELINESCHEDULE ) const; /// Budgeted Cost of Work Performed virtual double bcwp( long id = BASELINESCHEDULE ) const; /// Budgeted Cost of Work Performed ( up to @p date ) virtual double bcwp( QDate date, long id = BASELINESCHEDULE ) const; Calendar *defaultCalendar() const { return m_defaultCalendar; } void setDefaultCalendar( Calendar *cal ); const QList &calendars() const; void addCalendar( Calendar *calendar, Calendar *parent = 0, int index = -1 ); void takeCalendar( Calendar *calendar ); int indexOf( const Calendar *calendar ) const; /// Returns the calendar with identity id. Calendar *calendar( const QString& id ) const; /// Returns a list of all calendars QStringList calendarNames() const; /// Find calendar by name Calendar *calendarByName( const QString &name ) const; void changed( Calendar *cal ); QList allCalendars() const; /// Return number of calendars int calendarCount() const { return m_calendars.count(); } /// Return the calendar at @p index, 0 if index out of bounds Calendar *calendarAt( int index ) const { return m_calendars.value( index ); } /** * Defines the length of days, weeks, months and years * and the standard working week. * Used for estimation and calculation of effort, * and presentation in gantt chart. */ StandardWorktime *standardWorktime() { return m_standardWorktime; } void setStandardWorktime( StandardWorktime * worktime ); void changed( StandardWorktime* ); /// Check if a link exists between node @p par and @p child. bool linkExists( const Node *par, const Node *child ) const; /// Check if node @p par can be linked to node @p child. bool legalToLink( const Node *par, const Node *child ) const; using Node::legalToLink; virtual const QHash &nodeDict() { return nodeIdDict; } /// Return a list of all nodes in the project (excluding myself) QList allNodes() const; /// Return the number of all nodes in the project (excluding myself) int nodeCount() const { return nodeIdDict.count() - 1; } /// Return a list of all tasks and milestones int the wbs order QList allTasks( const Node *parent = 0 ) const; using Node::findNode; /// Find the node with identity id virtual Node *findNode( const QString &id ) const; using Node::removeId; /// Remove the node with identity id from the registers virtual bool removeId( const QString &id ); /// Reserve @p id for the @p node virtual void reserveId( const QString &id, Node *node ); /// Register @p node. The nodes id must be unique and non-empty. bool registerNodeId( Node *node ); /// Create a unique id. QString uniqueNodeId( int seed = 1 ) const; /// Check if node @p id is used bool nodeIdentExists( const QString &id ) const; /// Create a unique id. QString uniqueNodeId( const QList &existingIds, int seed = 1 ); ResourceGroup *findResourceGroup( const QString &id ) const { if ( resourceGroupIdDict.contains( id ) ) return resourceGroupIdDict[ id ]; return 0; } /// Remove the resourcegroup with identity id from the register bool removeResourceGroupId( const QString &id ) { if ( resourceGroupIdDict.contains( id ) ) return resourceGroupIdDict.remove( id ); return false; } /// Insert the resourcegroup with identity id void insertResourceGroupId( const QString &id, ResourceGroup* group ) { resourceGroupIdDict.insert( id, group ); } /// Generate, set and insert unique id bool setResourceGroupId( ResourceGroup *group); /// returns a unique resourcegroup id QString uniqueResourceGroupId() const; /// Return a list of resources that will be allocated to new tasks QList autoAllocateResources() const; Resource *findResource( const QString &id ) const { if ( resourceIdDict.contains( id ) ) return resourceIdDict[ id ]; return 0; } /// Remove the resource with identity id from the register bool removeResourceId( const QString &id ); /// Insert the resource with identity id void insertResourceId( const QString &id, Resource *resource ); /// Generate, set and insert unique id bool setResourceId( Resource *resource ); /// returns a unique resource id QString uniqueResourceId() const; /// Find the calendar with identity id virtual Calendar *findCalendar( const QString &id ) const { if ( id.isEmpty() || !calendarIdDict.contains( id ) ) return 0; return calendarIdDict[ id ]; } /// Remove the calendar with identity id from the register virtual bool removeCalendarId( const QString &id ); /// Insert the calendar with identity id virtual void insertCalendarId( const QString &id, Calendar *calendar ); /// Set and insert a unique id for calendar bool setCalendarId( Calendar *calendar ); /// returns a unique calendar id QString uniqueCalendarId() const; /// Return reference to WBS Definition WBSDefinition &wbsDefinition(); /// Set WBS Definition to @p def void setWbsDefinition( const WBSDefinition &def ); /// Generate WBS Code virtual QString generateWBSCode( QList &indexes, bool sortable = false ) const; Accounts &accounts() { return m_accounts; } const Accounts &accounts() const { return m_accounts; } /** * Set current schedule to the schedule with identity @p id, for me and my children * Note that this is used (and may be changed) when calculating schedules */ virtual void setCurrentSchedule( long id ); /// Create new schedule with unique name and id of type Expected. MainSchedule *createSchedule(); /// Create new schedule with unique id. MainSchedule *createSchedule( const QString& name, Schedule::Type type ); /// Add the schedule to the project. A fresh id will be generated for the schedule. void addMainSchedule( MainSchedule *schedule ); /// Set parent schedule for my children virtual void setParentSchedule( Schedule *sch ); /// Find the schedule manager that manages the Schedule with @p id ScheduleManager *scheduleManager( long id ) const; /// Find the schedule manager with @p id ScheduleManager *scheduleManager( const QString &id ) const; /// Create a unique schedule name (This may later be changed by the user) QString uniqueScheduleName() const; /// Create a unique schedule manager identity QString uniqueScheduleManagerId() const; ScheduleManager *createScheduleManager(); ScheduleManager *createScheduleManager( const QString &name ); /// Returns a list of all top level schedule managers QList scheduleManagers() const { return m_managers; } int numScheduleManagers() const { return m_managers.count(); } int indexOf( const ScheduleManager *sm ) const { return m_managers.indexOf( const_cast(sm) ); } bool isScheduleManager( void* ptr ) const; void addScheduleManager( ScheduleManager *sm, ScheduleManager *parent = 0, int index = -1 ); int takeScheduleManager( ScheduleManager *sm ); void moveScheduleManager( ScheduleManager *sm, ScheduleManager *newparent = 0, int newindex = -1 ); ScheduleManager *findScheduleManagerByName( const QString &name ) const; /// Returns a list of all schedule managers QList allScheduleManagers() const; /// Return true if schedule with identity @p id is baselined bool isBaselined( long id = ANYSCHEDULED ) const; void changed( ResourceGroup *group ); void changed( Resource *resource ); void changed( ScheduleManager *sm ); void changed( MainSchedule *sch ); void sendScheduleAdded( const MainSchedule *sch ); void sendScheduleToBeAdded( const ScheduleManager *manager, int row ); void sendScheduleRemoved( const MainSchedule *sch ); void sendScheduleToBeRemoved( const MainSchedule *sch ); /// Return the time zone used in this project QTimeZone timeZone() const { return m_timeZone; } /// Set the time zone to be used in this project void setTimeZone( const QTimeZone &tz ) { m_timeZone = tz; } /** * Add a relation between the nodes specified in the relation rel. * Emits signals relationToBeAdded() before the relation is added, * and relationAdded() after it has been added. * @param rel The relation to be added. * @param check If true, the relation is checked for validity * @return true if successful. */ bool addRelation( Relation *rel, bool check=true ); /** * Removes the relation @p rel without deleting it. * Emits signals relationToBeRemoved() before the relation is removed, * and relationRemoved() after it has been removed. */ void takeRelation( Relation *rel ); /** * Modify the @p type of the @p relation. */ void setRelationType( Relation *relation, Relation::Type type ); /** * Modify the @p lag of the @p relation. */ void setRelationLag( Relation *relation, const Duration &lag ); void calcCriticalPathList( MainSchedule *cs ); void calcCriticalPathList( MainSchedule *cs, Node *node ); /** * Returns the list of critical paths for schedule @p id */ const QList< QList > *criticalPathList( long id = CURRENTSCHEDULE ); QList criticalPath( long id = CURRENTSCHEDULE, int index = 0 ); /// Returns a flat list af all nodes QList flatNodeList( Node *parent = 0 ); void generateUniqueNodeIds(); void generateUniqueIds(); const ConfigBase &config() const { return m_config ? *m_config : emptyConfig; } /// Set configuration data void setConfig( ConfigBase *config ) { m_config = config; } const Task &taskDefaults() const { return config().taskDefaults(); } /// Return locale. (Used for currency, everything else is from KGlobal::locale) Locale *locale() { return const_cast(config()).locale(); } /// Return locale. (Used for currency, everything else is from KGlobal::locale) const Locale *locale() const { return config().locale(); } /// Signal that locale data has changed void emitLocaleChanged(); void setSchedulerPlugins( const QMap &plugins ); const QMap &schedulerPlugins() const { return m_schedulerPlugins; } void initiateCalculation( MainSchedule &sch ); void initiateCalculationLists( MainSchedule &sch ); void finishCalculation( ScheduleManager &sm ); void adjustSummarytask(); /// Increments progress and emits signal sigProgress() void incProgress(); /// Emits signal maxProgress() void emitMaxProgress( int value ); bool stopcalculation; /// return a map of all external projects QMap externalProjects() const; void emitDocumentAdded( Node*, Document*, int index ); void emitDocumentRemoved( Node*, Document*, int index ); void emitDocumentChanged( Node*, Document*, int index ); bool useSharedResources() const; void setUseSharedResources(bool on); bool isSharedResourcesLoaded() const; void setSharedResourcesLoaded(bool on); void setSharedResourcesFile(const QString &file); QString sharedResourcesFile() const; void setSharedProjectsUrl(const QUrl &url); QUrl sharedProjectsUrl() const; void setLoadProjectsAtStartup(bool value); bool loadProjectsAtStartup() const; public Q_SLOTS: /// Sets m_progress to @p progress and emits signal sigProgress() /// If @p sm is not 0, progress is also set for the schedule manager void setProgress( int progress, ScheduleManager *sm = 0 ); /// Sets m_maxprogress to @p max and emits signal maxProgress() /// If @p sm is not 0, max progress is also set for the schedule manager void setMaxProgress( int max, ScheduleManager *sm = 0 ); Q_SIGNALS: /// Emitted when the project is about to be deleted (The destroyed signal is disabled) void aboutToBeDeleted(); /// Emitted when anything in the project is changed (use with care) void projectChanged(); /// Emitted when the WBS code definition has changed. This may change all nodes. void wbsDefinitionChanged(); /// Emitted when a schedule has been calculated void projectCalculated( ScheduleManager *sm ); /// Emitted when the pointer to the current schedule has been changed void currentScheduleChanged(); /// Use to show progress during calculation void sigProgress( int ); /// Use to set the maximum progress (minimum always 0) void maxProgress( int ); /// Emitted when calculation starts void sigCalculationStarted( Project *project, ScheduleManager *sm ); /// Emitted when calculation is finished void sigCalculationFinished( Project *project, ScheduleManager *sm ); /// This signal is emitted when one of the nodes members is changed. void nodeChanged( Node* ); /// This signal is emitted when the node is to be added to the project. void nodeToBeAdded( Node*, int ); /// This signal is emitted when the node has been added to the project. void nodeAdded( Node* ); /// This signal is emitted when the node is to be removed from the project. void nodeToBeRemoved( Node* ); /// This signal is emitted when the node has been removed from the project. void nodeRemoved( Node* ); /// This signal is emitted when the node is to be moved up, moved down, indented or unindented. void nodeToBeMoved( Node* node, int pos, Node* newParent, int newPos ); /// This signal is emitted when the node has been moved up, moved down, indented or unindented. void nodeMoved( Node* ); /// This signal is emitted when a document is added void documentAdded( Node*, Document*, int index ); /// This signal is emitted when a document is removed void documentRemoved( Node*, Document*, int index ); /// This signal is emitted when a document is changed void documentChanged( Node*, Document*, int index ); void resourceGroupChanged( ResourceGroup *group ); void resourceGroupAdded( const ResourceGroup *group ); void resourceGroupToBeAdded( const ResourceGroup *group, int row ); void resourceGroupRemoved( const ResourceGroup *group ); void resourceGroupToBeRemoved( const ResourceGroup *group ); void resourceChanged( Resource *resource ); void resourceAdded( const Resource *resource ); void resourceToBeAdded( const ResourceGroup *group, int row ); void resourceRemoved( const Resource *resource ); void resourceToBeRemoved( const Resource *resource ); void scheduleManagerChanged( ScheduleManager *sch ); void scheduleManagerAdded( const ScheduleManager *sch ); void scheduleManagerToBeAdded( const ScheduleManager *sch, int row ); void scheduleManagerRemoved( const ScheduleManager *sch ); void scheduleManagerToBeRemoved( const ScheduleManager *sch ); void scheduleManagerMoved( const ScheduleManager *sch, int row ); void scheduleManagerToBeMoved( const ScheduleManager *sch ); void scheduleChanged( MainSchedule *sch ); void scheduleToBeAdded( const ScheduleManager *manager, int row ); void scheduleAdded( const MainSchedule *sch ); void scheduleToBeRemoved( const MainSchedule *sch ); void scheduleRemoved( const MainSchedule *sch ); // void currentViewScheduleIdChanged( long id ); void calendarChanged( Calendar *cal ); void calendarToBeAdded( const Calendar *cal, int row ); void calendarAdded( const Calendar *cal ); void calendarToBeRemoved( const Calendar *cal ); void calendarRemoved( const Calendar *cal ); /** * Emitted when the default calendar pointer has changed * @parem cal The new default calendar. May be 0. */ void defaultCalendarChanged( Calendar *cal ); /** * Emitted when the standard worktime has been changed. */ void standardWorktimeChanged( StandardWorktime* ); /// Emitted when the relation @p rel is about to be added. void relationToBeAdded( Relation *rel, int parentIndex, int childIndex ); /// Emitted when the relation @p rel has been added. void relationAdded( Relation *rel ); /// Emitted when the relation @p rel is about to be removed. void relationToBeRemoved( Relation *rel ); /// Emitted when the relation @p rel has been removed. void relationRemoved( Relation *rel ); /// Emitted when the relation @p rel shall be modified. void relationToBeModified( Relation *rel ); /// Emitted when the relation @p rel has been modified. void relationModified( Relation *rel ); /// Emitted when locale data has changed void localeChanged(); protected: /// Calculate the schedule. void calculate( Schedule *scedule ); /// Calculate current schedule void calculate(); /// Re-calculate the schedule from @p dt void calculate( Schedule *scedule, const DateTime &dt ); /// Calculate current schedule from @p dt (Always calculates forward) void calculate( const DateTime &dt ); /// Calculate critical path virtual bool calcCriticalPath( bool fromEnd ); /// Prepare task lists for scheduling void tasksForward(); /// Prepare task lists for scheduling void tasksBackward(); protected: friend class KPlatoXmlLoaderBase; using Node::changed; virtual void changed(Node *node, int property = -1); Accounts m_accounts; QList m_resourceGroups; QList m_calendars; Calendar * m_defaultCalendar; StandardWorktime *m_standardWorktime; DateTime calculateForward( int use ); DateTime calculateBackward( int use ); DateTime scheduleForward( const DateTime &earliest, int use ); DateTime scheduleBackward( const DateTime &latest, int use ); DateTime checkStartConstraints( const DateTime &dt ) const; DateTime checkEndConstraints( const DateTime &dt ) const; bool legalParents( const Node *par, const Node *child ) const; bool legalChildren( const Node *par, const Node *child ) const; #ifndef PLAN_NLOGDEBUG private: static bool checkParent( Node *n, const QList &list, QList &checked ); static bool checkChildren( Node *n, const QList &list, QList &checked ); #endif private: void init(); QHash resourceGroupIdDict; QHash resourceIdDict; QHash nodeIdDict; QMap nodeIdReserved; QMap calendarIdDict; QMap m_managerIdMap; QList m_managers; QTimeZone m_timeZone; WBSDefinition m_wbsDefinition; ConfigBase emptyConfig; QPointer m_config; // this one is not owned by me, don't delete int m_progress; QMap m_schedulerPlugins; int m_refCount; // make it possible to use the project by different threads QList m_hardConstraints; QList m_softConstraints; QList m_terminalNodes; bool m_useSharedResources; bool m_sharedResourcesLoaded; QString m_sharedResourcesFile; QUrl m_sharedProjectsUrl; bool m_loadProjectsAtStartup; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptrelation.h b/src/libs/kernel/kptrelation.h index 9c216eca..eb302dee 100644 --- a/src/libs/kernel/kptrelation.h +++ b/src/libs/kernel/kptrelation.h @@ -1,129 +1,129 @@ /* This file is part of the KDE project Copyright (C) 2001 Thomas Zander zander@kde.org Copyright (C) 2004-2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRELATION_H #define KPTRELATION_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptduration.h" #include #include class QDomElement; /// The main namespace namespace KPlato { class Node; class Project; /** * The relation class couples 2 nodes together which are dependent on each other. * If for example you have a project to build a house, the node that represents the * adding of the roof is dependent on the node that represents the building of the walls; * the roof can't be put up if the walls are not there yet. * We actually have a number of relationtypes so this relation can be used in different manners. */ -class KPLATOKERNEL_EXPORT Relation { +class PLANKERNEL_EXPORT Relation { public: enum Type { FinishStart, FinishFinish, StartStart }; Relation(Node *parent, Node *child, Type type, Duration lag); explicit Relation(Node *parent=0, Node *child=0, Type type=FinishStart); explicit Relation(Relation *rel); /** * When deleted the relation will remove itself from * the parent- and child nodes lists */ virtual ~Relation(); /// Set relation type void setType(Type ); /// Set relation type void setType( const QString &type ); /// Return relation type Type type() const { return m_type; } /// Return relation type as a string. Translated if @p trans = true. QString typeToString( bool trans = false ) const; /// Convert @p type to a valid relation type static Type typeFromString( const QString &type ); /// Return a stringlist of relation types. Translated if @p trans = true static QStringList typeList( bool trans = false ); /** * Returns the lag. * The lag of a relation is the time it takes between the parent starting/stopping * and the start of the child. */ const Duration &lag() const { return m_lag; } /// Set relaion time lag void setLag(Duration lag) { m_lag = lag; } /** * @return The parent dependent node. */ Node *parent() const { return m_parent; } void setParent( Node *node ); /** * @return The child dependent node. */ Node *child() const { return m_child; } void setChild( Node *node ); bool load(KoXmlElement &element, Project &project); void save(QDomElement &element) const; protected: // variables Node *m_parent; Node *m_child; Type m_type; Duration m_lag; private: QString m_parentId; #ifndef NDEBUG public: void printDebug(const QByteArray& indent); #endif }; -class KPLATOKERNEL_EXPORT ProxyRelation : public Relation +class PLANKERNEL_EXPORT ProxyRelation : public Relation { public: ProxyRelation(Node *parent, Node *child, Relation::Type type, Duration lag) : Relation(parent, child, type, lag) {} ~ProxyRelation() { m_parent = 0; m_child = 0;} }; } //KPlato namespace -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Relation* r ); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Relation& r ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Relation* r ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Relation& r ); #endif diff --git a/src/libs/kernel/kptresource.h b/src/libs/kernel/kptresource.h index fbfb7a3c..31a76a9b 100644 --- a/src/libs/kernel/kptresource.h +++ b/src/libs/kernel/kptresource.h @@ -1,902 +1,902 @@ /* This file is part of the KDE project Copyright (C) 2001 Thomas Zander zander@kde.org Copyright (C) 2004-2007 Dag Andersen Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCE_H #define KPTRESOURCE_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptglobal.h" #include "kptduration.h" #include "kptdatetime.h" #include "kptappointment.h" #include "kptcalendar.h" #include #include #include #include /// The main namespace. namespace KPlato { class Account; class Risk; class Effort; class Appointment; class Task; class Node; class Project; class Resource; class ResourceRequest; class ResourceGroupRequest; class ResourceRequestCollection; class Schedule; class ResourceSchedule; class Schedule; class XMLLoaderObject; class DateTimeInterval; /** * This class represents a group of similar resources to be assigned to a task * e.g. The list of employees, computer resources, etc */ /* IDEA; lets create a resourceGroup that has the intelligence to import PIM schedules * from the kroupware project and use the schedules to use the factory pattern to build * Resources (probably a derived class) which returns values on getFirstAvailableTime * and friends based on the schedules we got from the PIM projects. * (Thomas Zander mrt-2003 by suggestion of Shaheed) */ -class KPLATOKERNEL_EXPORT ResourceGroup : public QObject +class PLANKERNEL_EXPORT ResourceGroup : public QObject { Q_OBJECT public: /// Default constructor explicit ResourceGroup(); explicit ResourceGroup( const ResourceGroup *group ); ~ResourceGroup(); enum Type { Type_Work, Type_Material }; QString id() const { return m_id; } void setId( const QString& id ); Project *project() { return m_project; } void setName( const QString& n ); const QString &name() const { return m_name;} void setType( Type type ); void setType(const QString &type); Type type() const { return m_type; } QString typeToString( bool trans = false ) const; static QStringList typeToStringList( bool trans = false ); bool isScheduled() const; /// Return true if any resource in this group is baselined bool isBaselined( long id = BASELINESCHEDULE ) const; /** Manage the resources in this list *

At some point we will have to look at not mixing types of resources * (e.g. you can't add a person to a list of computers * *

Risks must always be associated with a resource, so there is no option * to manipulate risks (@ref Risk) separately */ void addResource( int index, Resource*, Risk* ); Resource *takeResource( Resource *resource ); QList resources() const { return m_resources; } int indexOf( const Resource *resource ) const; Resource *resourceAt( int pos ) const { return m_resources.value( pos ); } int numResources() const { return m_resources.count(); } Risk* getRisk( int ); /** Manage the dependent resources. This is a list of the resource * groups that must have available resources for this resource to * perform the work *

see also @ref getRequiredResource, @ref getRequiredResource */ void addRequiredResource( ResourceGroup* ); /** Manage the dependent resources. This is a list of the resource * groups that must have available resources for this resource to * perform the work *

see also @ref addRequiredResource, @ref getRequiredResource */ ResourceGroup* getRequiredResource( int ); /** Manage the dependent resources. This is a list of the resource * groups that must have available resources for this resource to * perform the work *

see also @ref getRequiredResource, @ref addRequiredResource */ void deleteRequiredResource( int ); bool load( KoXmlElement &element, XMLLoaderObject &status ); void save( QDomElement &element ) const; /// Save workpackage document. Include only resources listed in @p lst void saveWorkPackageXML( QDomElement &element, const QList &lst ) const; void initiateCalculation( Schedule &sch ); void addNode( Node *node ) { m_nodes.append( node ); } void clearNodes() { m_nodes.clear(); } Calendar *defaultCalendar() { return m_defaultCalendar; } int units() const; void registerRequest( ResourceGroupRequest *request ) { m_requests.append( request ); } void unregisterRequest( ResourceGroupRequest *request ) { int i = m_requests.indexOf( request ); if ( i != -1 ) m_requests.removeAt( i ); } const QList &requests() const { return m_requests; } ResourceGroup *findId() const { return findId( m_id ); } ResourceGroup *findId( const QString &id ) const; bool removeId() { return removeId( m_id ); } bool removeId( const QString &id ); void insertId( const QString &id ); Appointment appointmentIntervals() const; // m_project is set when the resourcegroup is added to the project, // and reset when the resourcegroup is removed from the project void setProject( Project *project ); void copy( const ResourceGroup *group ); DateTime startTime( long id ) const; DateTime endTime( long id ) const; void blockChanged(bool on = true); /// A resource can be local to this project, or /// defined externally and shared with other projects bool isShared() const; /// Set resource to be shared if on = true, or local if on = false void setShared(bool on); #ifndef NDEBUG void printDebug( const QString& ident ); #endif protected: virtual void changed(); private: Project *m_project; QString m_id; // unique id QString m_name; QList m_resources; QList m_risks; QList m_requires; QList m_nodes; //The nodes that want resources from us Calendar *m_defaultCalendar; Type m_type; QList m_requests; bool m_blockChanged; bool m_shared; }; /** * Any resource that is used by a task. A resource can be a worker, or maybe wood. * If the resources is a worker or a piece of equipment which can be reused but * can only be used by one node in time, then we can use the scheduling methods of the * resource to schedule the resource available time for the project. * The Idea is that all nodes which need this resource point to it and the scheduling * code (partly implemented here) schedules the actual usage. * See also @ref ResourceGroup */ -class KPLATOKERNEL_EXPORT Resource : public QObject +class PLANKERNEL_EXPORT Resource : public QObject { Q_OBJECT public: Resource(); explicit Resource(Resource *resource); virtual ~Resource(); QString id() const { return m_id; } void setId( const QString& id ); enum Type { Type_Work, Type_Material, Type_Team }; void setType( Type type ); void setType( const QString &type ); Type type() const { return m_type; } QString typeToString( bool trans = false ) const; static QStringList typeToStringList( bool trans = false ); void setName( const QString &n ); const QString &name() const { return m_name;} void setInitials( const QString &initials ); const QString &initials() const { return m_initials;} void setEmail( const QString &email ); const QString &email() const { return m_email;} /// Returns true if this resource will be allocated by default to new tasks bool autoAllocate() const; /// Set if this resource will be allocated by default to new tasks void setAutoAllocate( bool on ); void copy( Resource *resource ); void setParentGroup( ResourceGroup *parent ) { m_parent = parent; } ResourceGroup *parentGroup() const { return m_parent; } /// Set the time from when the resource is available to this project void setAvailableFrom( const DateTime &af ) { m_availableFrom = af; changed(); } /// Return the time when the resource is available to this project const DateTime &availableFrom() const { return m_availableFrom;} /// Set the time when the resource is no longer available to this project void setAvailableUntil( const DateTime &au ) { m_availableUntil = au; changed(); } /// Return the time when the resource is no longer available to this project. const DateTime &availableUntil() const { return m_availableUntil;} DateTime firstAvailableAfter( const DateTime &time, const DateTime &limit ) const; DateTime getBestAvailableTime( const Duration &duration ); DateTime getBestAvailableTime( const DateTime &after, const Duration &duration ); bool load( KoXmlElement &element, XMLLoaderObject &status ); void save( QDomElement &element ) const; /// Return the list of appointments for schedule @p id. QList appointments( long id = -1 ) const; /// Return the number of appointments (nodes) int numAppointments( long id = -1 ) const { return appointments( id ).count(); } /// Return the appointment at @p index for schedule @p id Appointment *appointmentAt( int index, long id = -1 ) const { return appointments( id ).value( index ); } int indexOf( Appointment *a, long id = -1 ) const { return appointments( id ).indexOf( a ); } /// Adds appointment to current schedule virtual bool addAppointment( Appointment *appointment ); /// Adds appointment to schedule sch virtual bool addAppointment( Appointment *appointment, Schedule &main ); /// Adds appointment to both this resource and node virtual void addAppointment( Schedule *node, const DateTime &start, const DateTime &end, double load = 100 ); void initiateCalculation( Schedule &sch ); bool isAvailable( Task *task ); void makeAppointment( Schedule *schedule, int load, const QList &required = QList() ); bool isOverbooked() const; /// check if overbooked on date. bool isOverbooked( const QDate &date ) const; /// check if overbooked within the interval start, end. bool isOverbooked( const DateTime &start, const DateTime &end ) const; double normalRate() const { return cost.normalRate; } void setNormalRate( double rate ) { cost.normalRate = rate; changed(); } double overtimeRate() const { return cost.overtimeRate; } void setOvertimeRate( double rate ) { cost.overtimeRate = rate; changed(); } /** * Return available units in percent */ int units() const { return m_units; } /** * Set available units in percent */ void setUnits( int units ); Project *project() const { return m_project; } /// Return the resources timespec. Defaults to local. QTimeZone timeZone() const; /** * Get the calendar for this resource. * Working resources may have a default calendar if the a calendar is marked as default, * this is checked if local=false. * If no calendar can be found for a working resource, the resource is not available. * * Material resources must have calendar explicitly set. * If there is no calendar set for a material resource, the resource is always available. */ Calendar *calendar( bool local = false ) const; //Calendar *calendar( const QString& id ) const; void setCalendar( Calendar *calendar ); /// Delete all requests for me void removeRequests(); /** * Used to clean up requests when the resource is deleted. */ void registerRequest( ResourceRequest *request ) { m_requests.append( request ); } void unregisterRequest( ResourceRequest *request ) { int i = m_requests.indexOf( request ); if ( i != -1 ) m_requests.removeAt( i ); } const QList &requests() const { return m_requests; } /// Returns a list of work intervals in the interval @p from, @p until. /// Appointments are subtracted if @p schedule is not 0 and overbooking is not allowed. AppointmentIntervalList workIntervals( const DateTime &from, const DateTime &until, Schedule *schedule ) const; /// Returns a list of work intervals in the interval @p from, @p until. AppointmentIntervalList workIntervals( const DateTime &from, const DateTime &until ) const; /// Updates work interval cache a list of work intervals extracted from the resource calendar /// with @p load in the interval @p from, @p until. /// The load of the intervals is set to m_units /// Note: The list may contain intervals outside @p from, @p until void calendarIntervals( const DateTime &from, const DateTime &until ) const; /// Load cache from @p element bool loadCalendarIntervalsCache( const KoXmlElement& element, KPlato::XMLLoaderObject& status ); /// Save cache to @p element void saveCalendarIntervalsCache( QDomElement &element ) const; /// Returns the effort that can be done starting at @p start within @p duration. /// The current schedule is used to check for appointments. /// If @p backward is true, checks backward in time. Duration effort( const DateTime &start, const Duration &duration, int units = 100, bool backward = false, const QList &required = QList() ) const; /// Returns the effort that can be done starting at @p start within @p duration. /// The schedule @p sch is used to check for appointments. /// If @p backward is true, checks backward in time. /// Status is returned in @p ok Duration effort( KPlato::Schedule* sch, const DateTime &start, const Duration& duration, int units = 100, bool backward = false, const QList< Resource* >& required = QList() ) const; /** * Find the first available time after @p time, within @p limit. * Returns invalid DateTime if not available. * Uses the current schedule to check for appointments. */ DateTime availableAfter( const DateTime &time, const DateTime &limit = DateTime() ) const; /** * Find the first available time before @p time, within @p limit. * Returns invalid DateTime if not available. * Uses the current schedule to check for appointments. */ DateTime availableBefore( const DateTime &time, const DateTime &limit = DateTime()) const; /** * Find the first available time after @p time, within @p limit. * Returns invalid DateTime if not available. * If @p sch == 0, Appointments are not checked. */ DateTime availableAfter( const DateTime &time, const DateTime &limit, Schedule *sch ) const; /** * Find the first available time before @p time, within @p limit. * Returns invalid DateTime if not available. * If @p sch == 0, Appointments are not checked. */ DateTime availableBefore( const DateTime &time, const DateTime &limit, Schedule *sch ) const; Resource *findId() const { return findId( m_id ); } Resource *findId( const QString &id ) const; bool removeId() { return removeId( m_id ); } bool removeId( const QString &id ); void insertId( const QString &id ); Calendar *findCalendar( const QString &id ) const; Appointment appointmentIntervals( long id ) const; Appointment appointmentIntervals() const; EffortCostMap plannedEffortCostPrDay( const QDate &start, const QDate &end, long id, EffortCostCalculationType = ECCT_All ); Duration plannedEffort( const QDate &date, EffortCostCalculationType = ECCT_All ) const; void setCurrentSchedulePtr( Schedule *schedule ) { m_currentSchedule = schedule; } void setCurrentSchedule( long id ) { m_currentSchedule = findSchedule( id ); } Schedule *currentSchedule() const { return m_currentSchedule; } bool isScheduled() const; QHash schedules() const { return m_schedules; } /** * Return schedule with @id * If @p id == CURRENTSCHEDULE, return m_currentSchedule * Return 0 if schedule with @p id doesn't exist. */ Schedule *schedule( long id = CURRENTSCHEDULE ) const; /// Returns true if schedule with @p id is baselined. /// if Team resource, if any of the team members is baselined /// By default returns true if any schedule is baselined bool isBaselined( long id = BASELINESCHEDULE ) const; /** * Return schedule with @id * Return 0 if schedule with @id doesn't exist. */ Schedule *findSchedule( long id ) const; /// Take, and delete. void deleteSchedule( Schedule *schedule ); /// Take, don't delete. void takeSchedule( const Schedule *schedule ); void addSchedule( Schedule *schedule ); ResourceSchedule *createSchedule( const QString& name, int type, long id ); ResourceSchedule *createSchedule( Schedule *parent ); // m_project is set when the resource (or the parent) is added to the project, // and reset when the resource is removed from the project void setProject( Project *project ); void addExternalAppointment( const QString &id, Appointment *a ); void addExternalAppointment( const QString &id, const QString &name, const DateTime &from, const DateTime &end, double load = 100 ); void subtractExternalAppointment( const QString &id, const DateTime &from, const DateTime &end, double load ); void clearExternalAppointments(); void clearExternalAppointments( const QString &id ); /// Take the external appointments with identity @p id from the list of external appointments Appointment *takeExternalAppointment( const QString &id ); /// Return external appointments with identity @p id AppointmentIntervalList externalAppointments( const QString &id ); AppointmentIntervalList externalAppointments( const DateTimeInterval &interval = DateTimeInterval() ) const; int numExternalAppointments() const { return m_externalAppointments.count(); } QList externalAppointmentList() const { return m_externalAppointments.values(); } /// return a map of project id, project name QMap externalProjects() const; /// Return a measure of how suitable the resource is for allocation long allocationSuitability( const DateTime &time, const Duration &duration, bool backward ); DateTime startTime( long id ) const; DateTime endTime( long id ) const; /// Returns the list of required resources. /// Note: This list is used as default for allocation dialog, not for scheduling. QList requiredResources() const; /// Set the list of the required resources's ids so they can be resolved when used /// A required resource may not exist in the project yet void setRequiredIds( const QStringList &lst ); /// Add a resource id to the required ids list void addRequiredId( const QString &id ); /// Returns the list of required resource ids. QStringList requiredIds() const { return m_requiredIds; } /// Return the list of team members. QList teamMembers() const; /// Return the list of team members. QStringList teamMemberIds() const; /// Clear the list of team members. void clearTeamMembers() { m_teamMembers.clear(); } /// Add resource @p id to the list of team members. void addTeamMemberId( const QString &id ); /// Remove resource @p id from the list of team members. void removeTeamMemberId( const QString &id ); /// Set the list of team members to @p ids void setTeamMemberIds(const QStringList &ids); /// Return the account Account *account() const { return cost.account; } /// Set the @p account void setAccount( Account *account ); void blockChanged(bool on = true); /// A resource group can be local to this project, or /// defined externally and shared with other projects bool isShared() const; /// Set resource group to be shared if on = true, or local if on = false void setShared(bool on); // for xml loading code class WorkInfoCache { public: WorkInfoCache() { clear(); } void clear() { start = end = DateTime(); effort = Duration::zeroDuration; intervals.clear(); version = -1; } bool isValid() const { return start.isValid() && end.isValid(); } DateTime firstAvailableAfter( const DateTime &time, const DateTime &limit, Calendar *cal, Schedule *sch ) const; DateTime firstAvailableBefore( const DateTime &time, const DateTime &limit, Calendar *cal, Schedule *sch ) const; DateTime start; DateTime end; Duration effort; AppointmentIntervalList intervals; int version; bool load( const KoXmlElement& element, KPlato::XMLLoaderObject& status ); void save( QDomElement &element ) const; }; const WorkInfoCache &workInfoCache() const { return m_workinfocache; } Q_SIGNALS: void externalAppointmentToBeAdded( Resource *r, int row ); void externalAppointmentAdded( Resource*, Appointment* ); void externalAppointmentToBeRemoved( Resource *r, int row ); void externalAppointmentRemoved(); void externalAppointmentChanged( Resource *r, Appointment *a ); protected: DateTimeInterval requiredAvailable(Schedule *node, const DateTime &start, const DateTime &end ) const; void makeAppointment( Schedule *node, const DateTime &from, const DateTime &end, int load, const QList &required = QList() ); virtual void changed(); private: Project *m_project; ResourceGroup *m_parent; QHash m_schedules; QString m_id; // unique id QString m_name; QString m_initials; QString m_email; bool m_autoAllocate; DateTime m_availableFrom; DateTime m_availableUntil; QMap m_externalAppointments; int m_units; // available units in percent Type m_type; struct Cost { double normalRate; double overtimeRate; double fixed ; Account *account; } cost; Calendar *m_calendar; QList m_requests; QStringList m_requiredIds; QStringList m_teamMembers; Schedule *m_currentSchedule; mutable WorkInfoCache m_workinfocache; // return this if resource has no calendar and is a material resource Calendar m_materialCalendar; bool m_blockChanged; bool m_shared; #ifndef NDEBUG public: void printDebug( const QString& ident ); #endif }; -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Resource::WorkInfoCache &c ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Resource::WorkInfoCache &c ); /** * Risk is associated with a resource/task pairing to indicate the planner's confidence in the * estimated effort. Risk can be one of none, low, or high. Some factors that may be taken into * account for risk are the experience of the person and the reliability of equipment. */ class Risk { public: enum RiskType { NONE = 0, LOW = 1, HIGH = 2 }; Risk( Node *n, Resource *r, RiskType rt = NONE ); ~Risk(); RiskType riskType() { return m_riskType; } Node *node() { return m_node; } Resource *resource() { return m_resource; } private: Node *m_node; Resource *m_resource; RiskType m_riskType; }; -class KPLATOKERNEL_EXPORT ResourceRequest +class PLANKERNEL_EXPORT ResourceRequest { public: explicit ResourceRequest( Resource *resource = 0, int units = 1 ); explicit ResourceRequest( const ResourceRequest &r ); ~ResourceRequest(); ResourceGroupRequest *parent() const { return m_parent; } void setParent( ResourceGroupRequest *parent ) { m_parent = parent; } Resource *resource() const { return m_resource; } void setResource( Resource* resource ) { m_resource = resource; } bool load( KoXmlElement &element, Project &project ); void save( QDomElement &element ) const; /** * Get amount of requested resource units in percent */ int units() const; void setUnits( int value ); void registerRequest() { if ( m_resource ) m_resource->registerRequest( this ); } void unregisterRequest() { if ( m_resource ) m_resource->unregisterRequest( this ); } void makeAppointment( Schedule *schedule, int amount ); void makeAppointment( Schedule *schedule ); Task *task() const; /// Return the datetime from when the resource is available. /// If it is not valid, the project constraint start time is used. /// For teams the earliest time for any team member is used. DateTime availableFrom(); /// Return the datetime until when the resource is available. /// If it is not valid, the project constraint end time is used. /// For teams the latest time for any team member is used. DateTime availableUntil(); Schedule *resourceSchedule( Schedule *ns, Resource *resource = 0 ); DateTime availableAfter(const DateTime &time, Schedule *ns); DateTime availableBefore(const DateTime &time, Schedule *ns); Duration effort( const DateTime &time, const Duration &duration, Schedule *ns, bool backward ); DateTime workTimeAfter(const DateTime &dt, Schedule *ns = 0); DateTime workTimeBefore(const DateTime &dt, Schedule *ns = 0); /// Resource is allocated dynamically by the group request bool isDynamicallyAllocated() const { return m_dynamic; } /// Set resource is allocated dynamically void setAllocatedDynaically( bool dyn ) { m_dynamic = dyn; } /// Return a measure of how suitable the resource is for allocation long allocationSuitability( const DateTime &time, const Duration &duration, Schedule *ns, bool backward ); /// Returns a list of all the required resources that will be used in scheduling. /// Note: This list overrides the resources own list which is just used as default for allocation dialog. QList requiredResources() const { return m_required; } /// Set the list of required resources that will be used in scheduling. void setRequiredResources( const QList &lst ) { m_required = lst; } private: friend class ResourceGroupRequest; QList teamMembers() const; protected: void changed(); void setCurrentSchedulePtr( Schedule *ns ); void setCurrentSchedulePtr( Resource *resource, Schedule *ns ); private: Resource *m_resource; int m_units; ResourceGroupRequest *m_parent; bool m_dynamic; QList m_required; mutable QList m_teamMembers; #ifndef NDEBUG public: void printDebug( const QString& ident ); #endif }; QDebug &operator<<( QDebug &dbg, const KPlato::ResourceRequest *r ); QDebug &operator<<( QDebug &dbg, const KPlato::ResourceRequest &r ); -class KPLATOKERNEL_EXPORT ResourceGroupRequest +class PLANKERNEL_EXPORT ResourceGroupRequest { public: explicit ResourceGroupRequest( ResourceGroup *group = 0, int units = 0 ); explicit ResourceGroupRequest( const ResourceGroupRequest &group ); ~ResourceGroupRequest(); void setParent( ResourceRequestCollection *parent ) { m_parent = parent;} ResourceRequestCollection *parent() const { return m_parent; } ResourceGroup *group() const { return m_group; } void setGroup( ResourceGroup *group ) { m_group = group; } void unregister( const ResourceGroup *group ) { if ( group == m_group ) m_group = 0; } /// Return a list of resource requests. /// If @p resolveTeam is true, include the team members, /// if @p resolveTeam is false, include the team resource itself. QList resourceRequests( bool resolveTeam=true ) const; void addResourceRequest( ResourceRequest *request ); void deleteResourceRequest( ResourceRequest *request ); int count() const { return m_resourceRequests.count(); } ResourceRequest *requestAt( int idx ) const { return m_resourceRequests.value( idx ); } ResourceRequest *takeResourceRequest( ResourceRequest *request ); ResourceRequest *find( const Resource *resource ) const; ResourceRequest *resourceRequest( const QString &name ); /// Return a list of allocated resources, allocation to group is not included by default. QStringList requestNameList( bool includeGroup = false ) const; /// Return a list of allocated resources. /// Allocations to groups are not included. /// Team resources are included but *not* the team members. /// Any dynamically allocated resource is not included. QList requestedResources() const; bool load( KoXmlElement &element, XMLLoaderObject &status ); void save( QDomElement &element ) const; /// The number of requested resources int units() const; void setUnits( int value ) { m_units = value; changed(); } /** * Returns the duration needed to do the @p effort starting at @p start. */ Duration duration( const DateTime &start, const Duration &effort, Schedule *ns, bool backward = false ); DateTime availableAfter( const DateTime &time, Schedule *ns ); DateTime availableBefore( const DateTime &time, Schedule *ns ); DateTime workTimeAfter(const DateTime &dt, Schedule *ns = 0); DateTime workTimeBefore(const DateTime &dt, Schedule *ns = 0); /** * Makes appointments for task @param task to the * requested resources for the duration found in @ref duration(). */ void makeAppointments( Schedule *schedule ); /** * Reserves the requested resources for the specified interval */ void reserve( const DateTime &start, const Duration &duration ); bool isEmpty() const; Task *task() const; void changed(); /// Reset dynamic resource allocations void resetDynamicAllocations(); /// Allocate dynamic requests. Do nothing if already allocated. void allocateDynamicRequests( const DateTime &time, const Duration &effort, Schedule *ns, bool backward ); private: ResourceGroup *m_group; int m_units; ResourceRequestCollection *m_parent; QList m_resourceRequests; DateTime m_start; Duration m_duration; #ifndef NDEBUG public: void printDebug( const QString& ident ); #endif }; -class KPLATOKERNEL_EXPORT ResourceRequestCollection +class PLANKERNEL_EXPORT ResourceRequestCollection { public: explicit ResourceRequestCollection( Task *task = 0 ); ~ResourceRequestCollection(); QList requests() const { return m_requests; } void addRequest( ResourceGroupRequest *request ); void deleteRequest( ResourceGroupRequest *request ) { int i = m_requests.indexOf( request ); if ( i != -1 ) m_requests.removeAt( i ); delete request; changed(); } int takeRequest( ResourceGroupRequest *request ) { int i = m_requests.indexOf( request ); if ( i != -1 ) { m_requests.removeAt( i ); changed(); } return i; } ResourceGroupRequest *find( const ResourceGroup *resource ) const; ResourceRequest *find( const Resource *resource ) const; ResourceRequest *resourceRequest( const QString &name ) const; /// The ResourceRequestCollection has no requests bool isEmpty() const; /// Empty the ResourceRequestCollection of all requets void clear() { m_requests.clear(); } /// Reset dynamic resource allocations void resetDynamicAllocations(); bool contains( const QString &identity ) const; ResourceGroupRequest *findGroupRequestById( const QString &id ) const; /// Return a list of names of allocated resources. /// Allocations to groups are not included by default. /// Team resources are included but *not* the team members. /// Any dynamically allocated resource is not included. QStringList requestNameList( bool includeGroup = false ) const; /// Return a list of allocated resources. /// Allocations to groups are not included. /// Team resources are included but *not* the team members. /// Any dynamically allocated resource is not included. QList requestedResources() const; /// Return a list of all resource requests. /// If @p resolveTeam is true, include the team members, /// if @p resolveTeam is false, include the team resource itself. QList resourceRequests( bool resolveTeam=true ) const; //bool load(KoXmlElement &element, Project &project); void save( QDomElement &element ) const; /** * Returns the duration needed to do the @p effort starting at @p time. */ Duration duration( const DateTime &time, const Duration &effort, Schedule *sch, bool backward = false ); DateTime availableAfter( const DateTime &time, Schedule *ns ); DateTime availableBefore( const DateTime &time, Schedule *ns ); DateTime workTimeAfter(const DateTime &dt, Schedule *ns = 0) const; DateTime workTimeBefore(const DateTime &dt, Schedule *ns = 0) const; DateTime workStartAfter(const DateTime &time, Schedule *ns); DateTime workFinishBefore(const DateTime &time, Schedule *ns); /** * Makes appointments for the task @param task to the requested resources. * Assumes that @ref duration() has been run. */ void makeAppointments( Schedule *schedule ); /** * Reserves the requested resources for the specified interval */ void reserve( const DateTime &start, const Duration &duration ); Task *task() const { return m_task; } void setTask( Task *t ) { m_task = t; } void changed(); Duration effort( const QList &lst, const DateTime &time, const Duration &duration, Schedule *ns, bool backward ) const; int numDays(const QList &lst, const DateTime &time, bool backward) const; Duration duration(const QList &lst, const DateTime &time, const Duration &_effort, Schedule *ns, bool backward); private: Task *m_task; QList m_requests; }; } //KPlato namespace #endif diff --git a/src/libs/kernel/kptschedule.h b/src/libs/kernel/kptschedule.h index 0ab1836b..45bd22fb 100644 --- a/src/libs/kernel/kptschedule.h +++ b/src/libs/kernel/kptschedule.h @@ -1,735 +1,735 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTSCHEDULE_H #define KPTSCHEDULE_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptglobal.h" #include "kptcalendar.h" #include "kpteffortcostmap.h" #include "kptresource.h" #include #include #include //#include "KoXmlReaderForward.h" class QDomElement; class QStringList; /// The main namespace namespace KPlato { class Appointment; class DateTime; class Duration; class Node; class Project; class Task; class ScheduleManager; class XMLLoaderObject; class SchedulerPlugin; class KPlatoXmlLoaderBase; /// Caches effortcost data (bcws, bcwp, acwp) class EffortCostCache { public: EffortCostCache() : cached( false ) {} bool cached; EffortCostMap effortcostmap; }; /** * The Schedule class holds data calculated during project * calculation and scheduling, eg start- and end-times and * appointments. * There is one Schedule per node (tasks and project ) and one per resource. * Schedule is subclassed into: * MainSchedule Used by the main project. * NodeSchedule Used by all other nodes (tasks). * ResourceSchedule Used by resources. */ -class KPLATOKERNEL_EXPORT Schedule +class PLANKERNEL_EXPORT Schedule { public: //NOTE: Must match Effort::Use atm. enum Type { Expected = 0 //Effort::Use_Expected }; Schedule(); explicit Schedule(Schedule *parent); Schedule( const QString& name, Type type, long id ); virtual ~Schedule(); QString name() const { return m_name; } void setName( const QString& name ) { m_name = name; } Type type() const { return m_type; } void setType( Type type ) { m_type = type; } void setType( const QString& type ); QString typeToString( bool translate = false ) const; long id() const { return m_id; } void setId( long id ) { m_id = id; } void setParent( Schedule *parent ); Schedule *parent() const { return m_parent; } virtual bool isDeleted() const; virtual void setDeleted( bool on ); virtual bool recalculate() const { return m_parent == 0 ? false : m_parent->recalculate(); } virtual DateTime recalculateFrom() const { return m_parent == 0 ? DateTime() : m_parent->recalculateFrom(); } virtual long parentScheduleId() const { return m_parent == 0 ? NOTSCHEDULED : m_parent->parentScheduleId(); } virtual Resource *resource() const { return 0; } virtual Node *node() const { return 0; } virtual bool isBaselined() const; virtual bool usePert() const; enum OBState { OBS_Parent, OBS_Allow, OBS_Deny }; /// Sets whether overbooking resources is allowed locally for this schedule /// If @p state is OBS_Parent, the parent is checked when allowOverbooking() is called virtual void setAllowOverbookingState( OBState state ); OBState allowOverbookingState() const; virtual bool allowOverbooking() const; virtual bool checkExternalAppointments() const; bool isCritical() const { return positiveFloat == Duration::zeroDuration; } virtual bool loadXML( const KoXmlElement &element, XMLLoaderObject &status ); virtual void saveXML( QDomElement &element ) const; void saveCommonXML( QDomElement &element ) const; void saveAppointments( QDomElement &element ) const; /// Return the effort available in the @p interval virtual Duration effort( const DateTimeInterval &interval ) const; virtual DateTimeInterval available( const DateTimeInterval &interval ) const; enum CalculationMode { Scheduling, CalculateForward, CalculateBackward }; /// Set calculation mode void setCalculationMode( int mode ) { m_calculationMode = mode; } /// Return calculation mode int calculationMode() const { return m_calculationMode; } /// Return the list of appointments QList appointments() const { return m_appointments; } /// Return true if the @p which list is not empty bool hasAppointments( int which ) const; /// Return the list of appointments /// @param which specifies which list is returned QList appointments(int which) const; /// Adds appointment to this schedule only virtual bool add( Appointment *appointment ); /// Adds appointment to both this resource schedule and node schedule virtual void addAppointment( Schedule * /*other*/, const DateTime & /*start*/, const DateTime & /*end*/, double /*load*/ = 100 ) {} /// Removes appointment without deleting it. virtual void takeAppointment( Appointment *appointment, int type = Scheduling ); Appointment *findAppointment( Schedule *resource, Schedule *node, int type = Scheduling ); /// Attach the appointment to appropriate list (appointment->calculationMode() specifies list) bool attach( Appointment *appointment ); DateTime appointmentStartTime() const; DateTime appointmentEndTime() const; virtual Appointment appointmentIntervals( int which = Scheduling, const DateTimeInterval &interval = DateTimeInterval() ) const; void copyAppointments( CalculationMode from, CalculationMode to ); virtual bool isOverbooked() const { return false; } virtual bool isOverbooked( const DateTime & /*start*/, const DateTime & /*end*/ ) const { return false; } virtual QStringList overbookedResources() const; /// Returns the first booked interval to @p node that intersects @p interval (limited to @p interval) virtual DateTimeInterval firstBookedInterval( const DateTimeInterval &interval, const Schedule *node ) const; /// Return the resources that has appointments to this schedule virtual QList resources() const; /// Return the resource names that has appointments to this schedule virtual QStringList resourceNameList() const; virtual EffortCostMap bcwsPrDay( EffortCostCalculationType type = ECCT_All ); virtual EffortCostMap bcwsPrDay( EffortCostCalculationType type = ECCT_All ) const; virtual EffortCostMap plannedEffortCostPrDay( const QDate &start, const QDate &end, EffortCostCalculationType type = ECCT_All ) const; virtual EffortCostMap plannedEffortCostPrDay( const Resource *resource, const QDate &start, const QDate &end, EffortCostCalculationType type = ECCT_All ) const; /// Returns the total planned effort for @p resource this schedule virtual Duration plannedEffort( const Resource *resource, EffortCostCalculationType type = ECCT_All) const; /// Returns the total planned effort for this schedule virtual Duration plannedEffort( EffortCostCalculationType type = ECCT_All) const; /// Returns the total planned effort for this schedule on date virtual Duration plannedEffort( const QDate &date, EffortCostCalculationType type = ECCT_All ) const; /// Returns the planned effort for @p resource on the @p date date virtual Duration plannedEffort( const Resource *resource, const QDate &date, EffortCostCalculationType type = ECCT_All ) const; /// Returns the planned effort up to and including date virtual Duration plannedEffortTo( const QDate &date, EffortCostCalculationType type = ECCT_All ) const; /// Returns the planned effort for @p resource up to and including date virtual Duration plannedEffortTo( const Resource *resource, const QDate &date, EffortCostCalculationType type = ECCT_All ) const; /** * Planned cost is the sum total of all resources and other costs * planned for this node. */ virtual EffortCost plannedCost( EffortCostCalculationType type = ECCT_All ) const; /// Planned cost on date virtual double plannedCost( const QDate &date, EffortCostCalculationType type = ECCT_All ) const; /** * Planned cost from start of activity up to and including date * is the sum of all resource costs and other costs planned for this schedule. */ virtual double plannedCostTo( const QDate &date, EffortCostCalculationType type = ECCT_All ) const; virtual double normalRatePrHour() const { return 0.0; } void setEarliestStart( DateTime &dt ) { earlyStart = dt; } void setLatestFinish( DateTime &dt ) { lateFinish = dt; } virtual void initiateCalculation(); virtual void calcResourceOverbooked(); virtual void insertHardConstraint( Node * ) {} virtual void insertSoftConstraint( Node * ) {} virtual void insertForwardNode( Node *node ); virtual void insertBackwardNode( Node *node ); virtual void insertStartNode( Node * ) {} virtual void insertEndNode( Node * ) {} virtual void insertSummaryTask( Node * ) {} void setScheduled( bool on ); bool isScheduled() const { return !notScheduled; } DateTime start() const { return startTime; } DateTime end() const { return endTime; } QStringList state() const; void setResourceError( bool on ) { resourceError = on; } void setResourceOverbooked( bool on ) { resourceOverbooked = on; } void setResourceNotAvailable( bool on ) { resourceNotAvailable = on; } void setConstraintError( bool on ) { constraintError = on; } void setNotScheduled( bool on ) { notScheduled = on; } void setSchedulingError( bool on ) { schedulingError = on; } void setPositiveFloat( KPlato::Duration f ) { positiveFloat = f; } void setNegativeFloat( KPlato::Duration f ) { negativeFloat = f; } void setFreeFloat( KPlato::Duration f ) { freeFloat = f; } void setInCriticalPath( bool on = true ) { inCriticalPath = on; } virtual ScheduleManager *manager() const { return 0; } - class KPLATOKERNEL_EXPORT Log { + class PLANKERNEL_EXPORT Log { public: enum Type { Type_Debug = 0, Type_Info, Type_Warning, Type_Error }; Log() : node( 0 ), resource( 0 ), severity( 0 ), phase( -1 ) {} Log( const Node *n, int sev, const QString &msg, int ph = -1 ); Log( const Node *n, const Resource *r, int sev, const QString &msg, int ph = -1 ); Log( const Log &other ); Log &operator=( const Log &other ); const Node *node; const Resource *resource; QString message; int severity; int phase; QString formatMsg() const; }; virtual void addLog( const Log &log ); virtual void clearLogs() {}; virtual void logError( const QString &, int = -1 ) {} virtual void logWarning( const QString &, int = -1 ) {} virtual void logInfo( const QString &, int = -1 ) {} virtual void logDebug( const QString &, int = -1 ) {} virtual void incProgress() { if ( m_parent ) m_parent->incProgress(); } void clearPerformanceCache(); protected: virtual void changed( Schedule * /*sch*/ ) {} protected: QString m_name; Type m_type; long m_id; bool m_deleted; Schedule *m_parent; OBState m_obstate; int m_calculationMode; QList m_appointments; QList m_forward; QList m_backward; friend class Node; friend class Task; friend class Project; friend class Resource; friend class RecalculateProjectCmd; friend class ScheduleManager; friend class KPlatoXmlLoaderBase; /** * earlyStart is calculated by PERT/CPM. * A task may be scheduled to start later because of constraints * or resource availability etc. */ DateTime earlyStart; /** * lateStart is calculated by PERT/CPM. * A task may not be scheduled to start later. */ DateTime lateStart; /** * earlyFinish is calculated by PERT/CPM. * A task may not be scheduled to finish earlier. */ DateTime earlyFinish; /** * lateFinish is calculated by PERT/CPM. * A task may be scheduled to finish earlier because of constraints * or resource availability etc. */ DateTime lateFinish; /** startTime is the scheduled start time. * It depends on constraints (i.e. ASAP/ALAP) and resource availability. * It will always be later or equal to earliestStart */ DateTime startTime; /** * m_endTime is the scheduled finish time. * It depends on constraints (i.e. ASAP/ALAP) and resource availability. * It will always be earlier or equal to latestFinish */ DateTime endTime; /** * duration is the scheduled duration which depends on * e.g. estimated effort, allocated resources and risk */ Duration duration; /// Set if EffortType == Effort, but no resource is requested bool resourceError; /// Set if the assigned resource is overbooked bool resourceOverbooked; /// Set if the requested resource is not available bool resourceNotAvailable; /// Set if the task cannot be scheduled to fulfil all the constraints bool constraintError; /// Set if the node has not been scheduled bool notScheduled; /// Set if the assigned resource cannot deliver the required estimated effort bool effortNotMet; /// Set if some other scheduling error occurs bool schedulingError; DateTime workStartTime; DateTime workEndTime; bool inCriticalPath; Duration positiveFloat; Duration negativeFloat; Duration freeFloat; EffortCostCache &bcwsPrDayCache( int type ) { return m_bcwsPrDay[ type ]; } EffortCostCache &bcwpPrDayCache( int type ) { return m_bcwpPrDay[ type ]; } EffortCostCache &acwpCache( int type ) { return m_acwp[ type ]; } QMap m_bcwsPrDay; QMap m_bcwpPrDay; QMap m_acwp; }; /** * NodeSchedule holds scheduling information for a node (task). * */ -class KPLATOKERNEL_EXPORT NodeSchedule : public Schedule +class PLANKERNEL_EXPORT NodeSchedule : public Schedule { public: NodeSchedule(); NodeSchedule( Node *node, const QString& name, Schedule::Type type, long id ); NodeSchedule( Schedule *parent, Node *node ); virtual ~NodeSchedule(); virtual bool isDeleted() const { return m_parent == 0 ? true : m_parent->isDeleted(); } void setDeleted( bool on ); virtual bool loadXML( const KoXmlElement &element, XMLLoaderObject &status ); virtual void saveXML( QDomElement &element ) const; // tasks------------> virtual void addAppointment( Schedule *resource, const DateTime &start, const DateTime &end, double load = 100 ); virtual void takeAppointment( Appointment *appointment, int type = Schedule::Scheduling ); virtual Node *node() const { return m_node; } virtual void setNode( Node *n ) { m_node = n; } /// Return the resources that has appointments to this schedule virtual QList resources() const; /// Return the resource names that has appointments to this schedule virtual QStringList resourceNameList() const; virtual void logError( const QString &msg, int phase = -1 ); virtual void logWarning( const QString &msg, int phase = -1 ); virtual void logInfo( const QString &msg, int phase = -1 ); virtual void logDebug( const QString &, int = -1 ); protected: void init(); private: Node *m_node; }; /** * ResourceSchedule holds scheduling information for a resource. * */ -class KPLATOKERNEL_EXPORT ResourceSchedule : public Schedule +class PLANKERNEL_EXPORT ResourceSchedule : public Schedule { public: ResourceSchedule(); ResourceSchedule( Resource *Resource, const QString& name, Schedule::Type type, long id ); ResourceSchedule( Schedule *parent, Resource *Resource ); virtual ~ResourceSchedule(); virtual bool isDeleted() const { return m_parent == 0 ? true : m_parent->isDeleted(); } virtual void addAppointment( Schedule *node, const DateTime &start, const DateTime &end, double load = 100 ); virtual void takeAppointment( Appointment *appointment, int type = Scheduling ); virtual bool isOverbooked() const; virtual bool isOverbooked( const DateTime &start, const DateTime &end ) const; virtual Resource *resource() const { return m_resource; } virtual double normalRatePrHour() const; /// Return the effort available in the @p interval virtual Duration effort( const DateTimeInterval &interval ) const; virtual DateTimeInterval available( const DateTimeInterval &interval ) const; virtual void logError( const QString &msg, int phase = -1 ); virtual void logWarning( const QString &msg, int phase = -1 ); virtual void logInfo( const QString &msg, int phase = -1 ); virtual void logDebug( const QString &, int = -1 ); void setNodeSchedule( const Schedule *sch ) { m_nodeSchedule = sch; } private: Resource *m_resource; Schedule *m_parent; const Schedule *m_nodeSchedule; // used during scheduling }; /** * MainSchedule holds scheduling information for the main project node. * */ -class KPLATOKERNEL_EXPORT MainSchedule : public NodeSchedule +class PLANKERNEL_EXPORT MainSchedule : public NodeSchedule { public: MainSchedule(); MainSchedule( Node *node, const QString& name, Schedule::Type type, long id ); ~MainSchedule(); virtual bool isDeleted() const { return m_deleted; } virtual bool isBaselined() const; virtual bool allowOverbooking() const; virtual bool checkExternalAppointments() const; virtual bool usePert() const; virtual bool loadXML( const KoXmlElement &element, XMLLoaderObject &status ); virtual void saveXML( QDomElement &element ) const; void setManager( ScheduleManager *sm ) { m_manager = sm; } ScheduleManager *manager() const { return m_manager; } virtual bool recalculate() const; virtual DateTime recalculateFrom() const; virtual long parentScheduleId() const; DateTime calculateForward( int use ); DateTime calculateBackward( int use ); DateTime scheduleForward( const DateTime &earliest, int use ); DateTime scheduleBackward( const DateTime &latest, int use ); void clearNodes() { m_hardconstraints.clear(); m_softconstraints.clear(); m_forwardnodes.clear(); m_backwardnodes.clear(); m_startNodes.clear(); m_endNodes.clear(); m_summarytasks.clear(); } virtual void insertHardConstraint( Node *node ) { m_hardconstraints.append( node ); } QList hardConstraints() const { return m_hardconstraints; } virtual void insertSoftConstraint( Node *node ) { m_softconstraints.append( node ); } QList softConstraints() const { return m_softconstraints; } QList forwardNodes() const { return m_forwardnodes; } virtual void insertForwardNode( Node *node ) { m_forwardnodes.append( node ); } QList backwardNodes() const { return m_backwardnodes; } virtual void insertBackwardNode( Node *node ) { m_backwardnodes.append( node ); } virtual void insertStartNode( Node *node ) { m_startNodes.append( node ); } QList startNodes() const { return m_startNodes; } virtual void insertEndNode( Node *node ) { m_endNodes.append( node ); } QList endNodes() const { return m_endNodes; } virtual void insertSummaryTask( Node *node ) { m_summarytasks.append( node ); } QList summaryTasks() const { return m_summarytasks; } void clearCriticalPathList(); QList *currentCriticalPath() const; void addCriticalPath( QList *lst = 0 ); const QList< QList > *criticalPathList() const { return &(m_pathlists); } QList criticalPath( int index = 0 ) { QList lst; return m_pathlists.count() <= index ? lst : m_pathlists[ index ]; } void addCriticalPathNode( Node *node ); QVector logs() const; void setLog( const QVector &log ) { m_log = log; } virtual void addLog( const Schedule::Log &log ); virtual void clearLogs() { m_log.clear(); m_logPhase.clear(); } void setPhaseName( int phase, const QString &name ) { m_logPhase[ phase ] = name; } QString logPhase( int phase ) const { return m_logPhase.value( phase ); } static QString logSeverity( int severity ); QMap phaseNames() const { return m_logPhase; } void setPhaseNames( const QMap &pn ) { m_logPhase = pn; } virtual void incProgress(); QStringList logMessages() const; QList< QList > m_pathlists; bool criticalPathListCached; protected: virtual void changed( Schedule *sch ); private: friend class Project; ScheduleManager *m_manager; QList m_hardconstraints; QList m_softconstraints; QList m_forwardnodes; QList m_backwardnodes; QList m_startNodes; QList m_endNodes; QList m_summarytasks; QList *m_currentCriticalPath; QVector m_log; QMap m_logPhase; }; /** * ScheduleManager is used by the Project class to manage the schedules. * The ScheduleManager is the bases for the user interface to scheduling. * A ScheduleManager can have child manager(s). */ -class KPLATOKERNEL_EXPORT ScheduleManager : public QObject +class PLANKERNEL_EXPORT ScheduleManager : public QObject { Q_OBJECT public: enum CalculationResult { CalculationRunning = 0, CalculationDone, CalculationStopped, CalculationCanceled, CalculationError }; explicit ScheduleManager( Project &project, const QString name = QString() ); ~ScheduleManager(); void setName( const QString& name ); QString name() const { return m_name; } void setManagerId( const QString &id ) { m_id = id; } QString managerId() const { return m_id; } Project &project() const { return m_project; } void setParentManager( ScheduleManager *sm, int index = -1 ); ScheduleManager *parentManager() const { return m_parent; } long scheduleId() const { return m_expected == 0 ? NOTSCHEDULED : m_expected->id(); } int removeChild( const ScheduleManager *sm ); void insertChild( ScheduleManager *sm, int index = -1 ); QList children() const { return m_children; } int childCount() const { return m_children.count(); } ScheduleManager *childAt( int index ) const { return m_children.value( index ); } /// Return list of all child managers (also childrens children) QList allChildren() const; int indexOf( const ScheduleManager* child ) const; bool isParentOf( const ScheduleManager *sm ) const; ScheduleManager *findManager( const QString &name ) const; /// This sub-schedule will be re-calculated based on the parents completion data bool recalculate() const { return m_recalculate; } /// Set re-calculate to @p on. void setRecalculate( bool on ) { m_recalculate = on; } /// The datetime this schedule will be calculated from DateTime recalculateFrom() const { return m_recalculateFrom; } /// Set the datetime this schedule will be calculated from to @p dt void setRecalculateFrom( const DateTime &dt ) { m_recalculateFrom = dt; } long parentScheduleId() const { return m_parent == 0 ? NOTSCHEDULED : m_parent->scheduleId(); } void createSchedules(); void setDeleted( bool on ); bool isScheduled() const { return m_expected == 0 ? false : m_expected->isScheduled(); } void setExpected( MainSchedule *sch ); MainSchedule *expected() const { return m_expected; } QStringList state() const; void setBaselined( bool on ); bool isBaselined() const { return m_baselined; } bool isChildBaselined() const; void setAllowOverbooking( bool on ); bool allowOverbooking() const; void setCheckExternalAppointments( bool on ); bool checkExternalAppointments() const; void setUsePert( bool on ); bool usePert() const { return m_usePert; } void setSchedulingDirection( bool on ); bool schedulingDirection() const { return m_schedulingDirection; } void setScheduling( bool on ); bool scheduling() const { return m_scheduling; } bool loadXML( KoXmlElement &element, XMLLoaderObject &status ); void saveXML( QDomElement &element ) const; /// Save a workpackage document void saveWorkPackageXML( QDomElement &element, const Node &node ) const; void scheduleChanged( MainSchedule *sch ); const QList schedulerPlugins() const; QString schedulerPluginId() const; void setSchedulerPluginId( const QString &id ); SchedulerPlugin *schedulerPlugin() const; QStringList schedulerPluginNames() const; int schedulerPluginIndex() const; void setSchedulerPlugin( int index ); /// Stop calculation. Use result if possible. void stopCalculation(); /// Terminate calculation. Forget any results. void haltCalculation(); void calculateSchedule(); int calculationResult() const { return m_calculationresult; } void setCalculationResult( int r ) { m_calculationresult = r; } /// Increments progress in the project void incProgress(); /// Returns current progress int progress() const { return m_progress; } /// Returns maximum progress value int maxProgress() const { return m_maxprogress; } /// Log added by MainSchedule /// Emits sigLogAdded() to enable synchronization between schedules void logAdded( const Schedule::Log &log ); /// Create and load a MainSchedule MainSchedule *loadMainSchedule( KoXmlElement &element, XMLLoaderObject &status ); /// Load an existing MainSchedule bool loadMainSchedule( MainSchedule *schedule, KoXmlElement &element, XMLLoaderObject &status ); QMap< int, QString > phaseNames() const; /// Return a list of the supported granularities of the current scheduler QList supportedGranularities() const; /// Return current index of supported granularities of the selected scheduler int granularity() const; /// Set current index of supported granularities of the selected scheduler void setGranularity( int duration ); public Q_SLOTS: /// Set maximum progress. Emits signal maxProgressChanged void setMaxProgress( int value ); /// Set progress. Emits signal progressChanged void setProgress( int value ); /// Add the lis of logs @p log to expected() void slotAddLog( const QVector &log ); void setPhaseNames( const QMap &phasenames ); Q_SIGNALS: void maxProgressChanged( int ); void progressChanged( int ); /// Emitted by logAdded() when new log entries are added void logInserted( MainSchedule*, int firstrow, int lastrow ); /// Emitted by logAdded() /// Used by scheduling thread void sigLogAdded( const Schedule::Log &log ); protected: Project &m_project; ScheduleManager *m_parent; QString m_name; QString m_id; bool m_baselined; bool m_allowOverbooking; bool m_checkExternalAppointments; bool m_usePert; bool m_recalculate; DateTime m_recalculateFrom; bool m_schedulingDirection; bool m_scheduling; int m_progress; int m_maxprogress; MainSchedule *m_expected; QList m_children; QString m_schedulerPluginId; int m_calculationresult; }; } //namespace KPlato Q_DECLARE_TYPEINFO(KPlato::Schedule::Log, Q_MOVABLE_TYPE); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule *s ); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule &s ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule *s ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule &s ); -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule::Log &log ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Schedule::Log &log ); #endif diff --git a/src/libs/kernel/kptschedulerplugin.h b/src/libs/kernel/kptschedulerplugin.h index 812c44e4..7471b7a3 100644 --- a/src/libs/kernel/kptschedulerplugin.h +++ b/src/libs/kernel/kptschedulerplugin.h @@ -1,256 +1,256 @@ /* This file is part of the KDE project Copyright (C) 2009, 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTSCHEDULERPLUGIN_H #define KPTSCHEDULERPLUGIN_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptschedule.h" #include #include #include #include #include #include #include namespace KPlato { class SchedulerThread; class Project; class ScheduleManager; class Node; class XMLLoaderObject; /** SchedulerPlugin is the base class for project calculation plugins. Sub-class SchedulerThread to do the actual calculation, then re-implement calculate() to calculate the project, and slotFinished() to fetch the result into your project. There is two ways to show progress:

  • Connect the SchedulerThread::maxProgressChanged() to ScheduleManager::setMaxProgress() and and SchedulerThread::progressChanged() to ScheduleManager::setProgress(). Note that too many progress signals too often may choke the ui thread.
  • Start the m_synctimer. This will fetch progress and log messages every 500 ms (by default).
When the thread has finished scheduling, data can be fetched from its temporary project into the real project by calling the updateProject() method. */ -class KPLATOKERNEL_EXPORT SchedulerPlugin : public QObject +class PLANKERNEL_EXPORT SchedulerPlugin : public QObject { Q_OBJECT public: explicit SchedulerPlugin(QObject *parent); virtual ~SchedulerPlugin(); /// Localized name QString name() const; /// Name is normally set by the plugin loader, from Name in the desktop file void setName( const QString &name ); /// Localized comment QString comment() const; /// Comment is normally set by the plugin loader, from Comment in the desktop file void setComment( const QString &name ); /// A more elaborate description suitable for use in what's this virtual QString description() const { return QString(); } /// The schedulers capabilities enum Capabilities { AvoidOverbooking = 1, AllowOverbooking = 2, ScheduleForward = 4, ScheduleBackward = 8 }; /// Return the schedulers capabilities. /// By default returns all capabilities virtual int capabilities() const; /// Stop calculation of the schedule @p sm. Current result may be used. void stopCalculation( ScheduleManager *sm ); /// Terminate calculation of the schedule @p sm. No results will be available. void haltCalculation( ScheduleManager *sm ); /// Stop calculation of the scheduling @p job. Current result may be used. virtual void stopCalculation( SchedulerThread *job ); /// Terminate calculation of the scheduling @p job. No results will be available. virtual void haltCalculation( SchedulerThread *job ); /// Calculate the project virtual void calculate( Project &project, ScheduleManager *sm, bool nothread = false ) = 0; /// Return the list of supported granularities /// An empty list means granularity is not supported (the default) QList granularities() const; /// Return current index of supported granularities int granularity() const; /// Set current index of supported granularities void setGranularity( int index ); protected Q_SLOTS: virtual void slotSyncData(); protected: void updateProject( const Project *tp, const ScheduleManager *tm, Project *mp, ScheduleManager *sm ) const; void updateNode( const Node *tn, Node *mn, long sid, XMLLoaderObject &status ) const; void updateResource( const KPlato::Resource *tr, Resource *r, XMLLoaderObject &status ) const; void updateAppointments( const Project *tp, const ScheduleManager *tm, Project *mp, ScheduleManager *sm, XMLLoaderObject &status ) const; void updateProgress(); void updateLog(); void updateLog( SchedulerThread *job ); private: class Private; Private *d; protected: QTimer m_synctimer; QList m_jobs; int m_granularity; QList m_granularities; }; /** SchedulerThread is a basic class used to implement project calculation in a separate thread. The scheduling thread is meant to run on a private copy of the project to avoid that the ui thread changes the data while calculations are going on. The constructor creates a KoXmlDocument m_pdoc of the project that can be used to create a private project. This should be done in the reimplemented run() method. When the calculations are done the signal jobFinished() is emitted. This can be used to fetch data from the private calculated project into the actual project. To track progress, the progress() method should be called from the ui thread with an appropriate interval to avoid overload of the ui thread. The progressChanged() signal may also be used but note that async signal handling are very slow so it may affect the ui threads performance too much. */ -class KPLATOKERNEL_EXPORT SchedulerThread : public QThread +class PLANKERNEL_EXPORT SchedulerThread : public QThread { Q_OBJECT public: SchedulerThread( Project *project, ScheduleManager *manager, QObject *parent ); ~SchedulerThread(); Project *mainProject() const { return m_mainproject; } ScheduleManager *mainManager() const { return m_mainmanager; } Project *project() const; ScheduleManager *manager() const; /// Run with no thread void doRun(); /// The scheduling is stopping bool isStopped() const { return m_stopScheduling; } /// The scheduling is halting bool isHalted() const { return m_haltScheduling; } int maxProgress() const; int progress() const; QVector takeLog(); QMap phaseNames() const; /// Save the @p project into @p document static void saveProject( Project *project, QDomDocument &document ); /// Load the @p project from @p document static bool loadProject( Project *project, const KoXmlDocument &document ); ///Add a scheduling error log message void logError( Node *n, Resource *r, const QString &msg, int phase = -1 ); ///Add a scheduling warning log message void logWarning( Node *n, Resource *r, const QString &msg, int phase = -1 ); ///Add a scheduling information log message void logInfo( Node *n, Resource *r, const QString &msg, int phase = -1 ); ///Add a scheduling debug log message void logDebug( Node *n, Resource *r, const QString &msg, int phase = -1 ); Q_SIGNALS: /// Job has started void jobStarted( SchedulerThread *job ); /// Job is finished void jobFinished( SchedulerThread *job ); /// Maximum progress value has changed void maxProgressChanged( int value, ScheduleManager *sm = 0 ); /// Progress has changed void progressChanged( int value, ScheduleManager *sm = 0 ); public Q_SLOTS: /// Stop scheduling. Result may still be used. virtual void stopScheduling(); /// Halt scheduling. Discard result. virtual void haltScheduling(); protected Q_SLOTS: virtual void slotStarted(); virtual void slotFinished(); void setMaxProgress( int ); void setProgress( int ); void slotAddLog( const Schedule::Log &log ); protected: /// Re-implement to do the job virtual void run() {} protected: /// The actual project to be calculated. Not accessed outside constructor. Project *m_mainproject; /// The actual schedule manager to be calculated. Not accessed outside constructor. ScheduleManager *m_mainmanager; /// The schedule manager identity QString m_mainmanagerId; /// The temporary project Project *m_project; mutable QMutex m_projectMutex; /// The temporary schedule manager ScheduleManager *m_manager; mutable QMutex m_managerMutex; bool m_stopScheduling; /// Stop asap, preliminary result may be used bool m_haltScheduling; /// Stop and discrad result. Delete yourself. KoXmlDocument m_pdoc; int m_maxprogress; mutable QMutex m_maxprogressMutex; int m_progress; mutable QMutex m_progressMutex; QVector m_logs; mutable QMutex m_logMutex; QEventLoopLocker m_eventLoopLocker; /// to keep locale around, TODO: check if still needed with QLocale }; } //namespace KPlato #endif diff --git a/src/libs/kernel/kpttask.h b/src/libs/kernel/kpttask.h index 42f5381c..e393b57e 100644 --- a/src/libs/kernel/kpttask.h +++ b/src/libs/kernel/kpttask.h @@ -1,761 +1,761 @@ /* This file is part of the KDE project Copyright (C) 2001 Thomas Zander zander@kde.org Copyright (C) 2004 - 2007 Dag Andersen Copyright (C) 2007 Florian Piquemal Copyright (C) 2007 Alexis Ménard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASK_H #define KPTTASK_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptnode.h" #include "kptglobal.h" #include "kptdatetime.h" #include "kptduration.h" #include "kptresource.h" #include #include #include /// The main namespace. namespace KPlato { class Completion; /** * The Completion class holds information about the tasks progress. */ -class KPLATOKERNEL_EXPORT Completion +class PLANKERNEL_EXPORT Completion { public: - class KPLATOKERNEL_EXPORT UsedEffort + class PLANKERNEL_EXPORT UsedEffort { public: - class KPLATOKERNEL_EXPORT ActualEffort : public std::pair + class PLANKERNEL_EXPORT ActualEffort : public std::pair { public: explicit ActualEffort( KPlato::Duration ne = Duration::zeroDuration, KPlato::Duration oe = Duration::zeroDuration ) : std::pair( ne, oe ) {} ActualEffort( const ActualEffort &e ) : std::pair( e.first, e.second ) {} ~ActualEffort() {} Duration normalEffort() const { return first; } void setNormalEffort( KPlato::Duration e ) { first = e; } Duration overtimeEffort() const { return second; } void setOvertimeEffort( KPlato::Duration e ) { second = e; } /// Returns the sum of normalEffort + overtimeEffort Duration effort() const { return first + second; } void setEffort( KPlato::Duration ne, KPlato::Duration oe = Duration::zeroDuration ) { first = ne; second = oe; } }; UsedEffort(); UsedEffort( const UsedEffort &e ); ~UsedEffort(); bool operator==( const UsedEffort &e ) const; bool operator!=( const UsedEffort &e ) const { return !operator==( e ); } void mergeEffort( const UsedEffort &value ); void setEffort( QDate date, const ActualEffort &value ); /// Returns the total effort up to @p date Duration effortTo( QDate date ) const; /// Returns the total effort on @p date ActualEffort effort( QDate date ) const { return m_actual.value( date ); } ActualEffort takeEffort( QDate date ) { return m_actual.take( date ); } /// Returns the total effort for all registered dates Duration effort() const; QMap actualEffortMap() const { return m_actual; } /// Load from document bool loadXML(KoXmlElement &element, XMLLoaderObject &status ); /// Save to document void saveXML(QDomElement &element) const; bool contains( QDate date ) const { return m_actual.contains( date ); } private: QMap m_actual; }; typedef QMap DateUsedEffortMap; - class KPLATOKERNEL_EXPORT Entry + class PLANKERNEL_EXPORT Entry { public: Entry() : percentFinished( 0 ), remainingEffort( Duration::zeroDuration ), totalPerformed( Duration::zeroDuration ) {} Entry( int percent, Duration remaining, Duration performed ) : percentFinished( percent ), remainingEffort( remaining ), totalPerformed( performed ) {} Entry( const Entry &e ) { copy( e ); } bool operator==( const Entry &e ) const { return percentFinished == e.percentFinished && remainingEffort == e.remainingEffort && totalPerformed == e.totalPerformed && note == e.note; } bool operator!=( const Entry &e ) const { return ! operator==( e ); } Entry &operator=(const Entry &e ) { copy( e ); return *this; } int percentFinished; Duration remainingEffort; Duration totalPerformed; QString note; protected: void copy( const Entry &e ) { percentFinished = e.percentFinished; remainingEffort = e.remainingEffort; totalPerformed = e.totalPerformed; note = e.note; } }; typedef QMap EntryList; typedef QMap ResourceUsedEffortMap; explicit Completion( Node *node = 0 ); // review * or &, or at all? Completion( const Completion © ); virtual ~Completion(); bool operator==(const Completion &p); bool operator!=(Completion &p) { return !(*this == p); } Completion &operator=(const Completion &p); /// Load from document bool loadXML(KoXmlElement &element, XMLLoaderObject &status ); /// Save to document void saveXML(QDomElement &element) const; bool startIsValid() const { return m_started && m_startTime.isValid(); } bool isStarted() const { return m_started; } void setStarted( bool on ); bool finishIsValid() const { return m_finished && m_finishTime.isValid(); } bool isFinished() const { return m_finished; } void setFinished( bool on ); DateTime startTime() const { return m_startTime; } void setStartTime( const DateTime &dt ); DateTime finishTime() const { return m_finishTime; } void setFinishTime( const DateTime &dt ); void setPercentFinished( QDate date, int value ); void setRemainingEffort( QDate date, Duration value ); void setActualEffort( QDate date, Duration value ); /// Return a list of the resource that has done any work on this task QList resources() { return m_usedEffort.keys(); } const EntryList &entries() const { return m_entries; } void addEntry( QDate date, Entry *entry ); Entry *takeEntry( QDate date ) { return m_entries.take( date ); changed(); } Entry *entry( QDate date ) const { return m_entries[ date ]; } /// Returns the date of the latest entry QDate entryDate() const; /// Returns the percentFinished of the latest entry int percentFinished() const; /// Returns the percentFinished on @p date int percentFinished( QDate date ) const; /// Returns the estimated remaining effort Duration remainingEffort() const; /// Returns the estimated remaining effort on @p date Duration remainingEffort( QDate date ) const; /// Returns the total actual effort Duration actualEffort() const; /// Returns the total actual effort on @p date Duration actualEffort( QDate date ) const; /// Returns the total actual effort upto and including @p date Duration actualEffortTo( QDate date ) const; /// Returns the actual effort for @p resource on @p date Duration actualEffort( const Resource *resource, QDate date ) const; /// TODO QString note() const; /// TODO void setNote( const QString &str ); /// Returns the total actual cost double actualCost() const; /// Returns the actual cost for @p resource double actualCost( const Resource *resource ) const; /// Returns the actual cost on @p date double actualCost( QDate date ) const; /// Returns the total actual cost for @p resource on @p date double actualCost( const Resource *resource, QDate date ) const; /// Returns the total actual effort and cost upto and including @p date EffortCost actualCostTo( long int id, QDate date ) const; /** * Returns a map of all actual effort and cost entered */ virtual EffortCostMap actualEffortCost( long id, EffortCostCalculationType type = ECCT_All ) const; void addUsedEffort( const Resource *resource, UsedEffort *value = 0 ); UsedEffort *takeUsedEffort( const Resource *r ) { return m_usedEffort.take( const_cast( r ) ); changed(); } UsedEffort *usedEffort( const Resource *r ) const { return m_usedEffort.value( const_cast( r ) ); } const ResourceUsedEffortMap &usedEffortMap() const { return m_usedEffort; } void changed( int property = -1 ); Node *node() const { return m_node; } void setNode( Node *node ) { m_node = node; } enum Entrymode { FollowPlan, EnterCompleted, EnterEffortPerTask, EnterEffortPerResource }; void setEntrymode( Entrymode mode ) { m_entrymode = mode; } Entrymode entrymode() const { return m_entrymode; } void setEntrymode( const QString &mode ); QString entryModeToString() const; QStringList entrymodeList() const; EffortCostMap effortCostPrDay(QDate start, QDate end, long id = -1 ) const; /// Returns the actual effort and cost pr day used by @p resource EffortCostMap effortCostPrDay(const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE ) const; protected: void copy( const Completion ©); double averageCostPrHour( QDate date, long id ) const; std::pair actualStartEndDates() const; private: Node *m_node; bool m_started, m_finished; DateTime m_startTime, m_finishTime; EntryList m_entries; ResourceUsedEffortMap m_usedEffort; Entrymode m_entrymode; #ifndef NDEBUG public: void printDebug( const QByteArray &ident ) const; #endif }; /** * The WorkPackage class controls work flow for a task */ -class KPLATOKERNEL_EXPORT WorkPackage +class PLANKERNEL_EXPORT WorkPackage { public: /// @enum WPTransmitionStatus describes if this package was sent or received enum WPTransmitionStatus { TS_None, /// Not sent nor received TS_Send, /// Package was sent to resource TS_Receive /// Package was received from resource }; explicit WorkPackage( Task *task = 0 ); explicit WorkPackage( const WorkPackage &wp ); virtual ~WorkPackage(); Task *parentTask() const { return m_task; } void setParentTask( Task *task ) { m_task = task; } /// Returns the transmission status of this package WPTransmitionStatus transmitionStatus() const { return m_transmitionStatus; } void setTransmitionStatus( WPTransmitionStatus sts ) { m_transmitionStatus = sts; } static QString transmitionStatusToString( WPTransmitionStatus sts, bool trans = false ); static WPTransmitionStatus transmitionStatusFromString( const QString &sts ); /// Load from document virtual bool loadXML(KoXmlElement &element, XMLLoaderObject &status ); /// Save the full workpackage virtual void saveXML(QDomElement &element) const; /// Load from document virtual bool loadLoggedXML(KoXmlElement &element, XMLLoaderObject &status ); /// Save the full workpackage virtual void saveLoggedXML(QDomElement &element) const; /// Set schedule manager void setScheduleManager( ScheduleManager *sm ); /// Return schedule manager ScheduleManager *scheduleManager() const { return m_manager; } /// Return the schedule id, or NOTSCHEDULED if no schedule manager is set long id() const { return m_manager ? m_manager->scheduleId() : NOTSCHEDULED; } Completion &completion(); const Completion &completion() const; void addLogEntry( DateTime &dt, const QString &str ); QMap log() const; QStringList log(); /// Return a list of resources fetched from the appointments or requests /// merged with resources added to completion QList fetchResources(); /// Return a list of resources fetched from the appointments or requests /// merged with resources added to completion QList fetchResources( long id ); /// Returns id of the resource that owns this package. If empty, task leader owns it. QString ownerId() const { return m_ownerId; } /// Set the resource that owns this package to @p owner. If empty, task leader owns it. void setOwnerId( const QString &id ) { m_ownerId = id; } /// Returns the name of the resource that owns this package. QString ownerName() const { return m_ownerName; } /// Set the name of the resource that owns this package. void setOwnerName( const QString &name ) { m_ownerName = name; } DateTime transmitionTime() const { return m_transmitionTime; } void setTransmitionTime( const DateTime &dt ) { m_transmitionTime = dt; } /// Clear workpackage data void clear(); private: Task *m_task; ScheduleManager *m_manager; Completion m_completion; QString m_ownerName; QString m_ownerId; WPTransmitionStatus m_transmitionStatus; DateTime m_transmitionTime; QMap m_log; }; -class KPLATOKERNEL_EXPORT WorkPackageSettings +class PLANKERNEL_EXPORT WorkPackageSettings { public: WorkPackageSettings(); bool loadXML( const KoXmlElement &element ); void saveXML( QDomElement &element) const; bool operator==( WorkPackageSettings settings ) const; bool operator!=( WorkPackageSettings settings ) const; bool usedEffort; bool progress; bool documents; }; /** * A task in the scheduling software is represented by this class. A task * can be anything from 'build house' to 'drill hole' It will always mean * an activity. */ -class KPLATOKERNEL_EXPORT Task : public Node { +class PLANKERNEL_EXPORT Task : public Node { Q_OBJECT public: explicit Task(Node *parent = 0); explicit Task(const Task &task, Node *parent = 0); ~Task(); /// Return task type. Can be Type_Task, Type_Summarytask ot Type_Milestone. virtual int type() const; /** * Instead of using the expected duration, generate a random value using * the Distribution of each Task. This can be used for Monte-Carlo * estimation of Project duration. */ Duration *getRandomDuration(); /** * Return the resource request made to group * (There should be only one) */ ResourceGroupRequest *resourceGroupRequest(const ResourceGroup *group) const; void clearResourceRequests(); void addRequest(ResourceGroup *group, int numResources); void addRequest(ResourceGroupRequest *request); void takeRequest(ResourceGroupRequest *request); void makeAppointments(); virtual QStringList requestNameList() const; virtual QList requestedResources() const; virtual bool containsRequest( const QString &/*identity*/ ) const; virtual ResourceRequest *resourceRequest( const QString &/*name*/ ) const; /// Return the list of resources assigned to this task virtual QStringList assignedNameList( long id = CURRENTSCHEDULE ) const; /** * Calculates if the assigned resource is overbooked * within the duration of this task */ void calcResourceOverbooked(); /// Load from document virtual bool load(KoXmlElement &element, XMLLoaderObject &status ); /// Save to document virtual void save(QDomElement &element) const; /// Save appointments for schedule with id virtual void saveAppointments(QDomElement &element, long id) const; /// Save a workpackage document with schedule identity @p id void saveWorkPackageXML( QDomElement &element, long id ) const; /** * Returns a list of planned effort and cost for this task * for the interval start, end inclusive */ virtual EffortCostMap plannedEffortCostPrDay(QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /** * Returns a list of planned effort and cost for the @p resource * for the interval @p start, @p end inclusive, useng schedule with identity @p id */ virtual EffortCostMap plannedEffortCostPrDay(const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for @p resource on this task (or subtasks) virtual Duration plannedEffort( const Resource *resource, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for this task (or subtasks) virtual Duration plannedEffort( long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for this task (or subtasks) on date virtual Duration plannedEffort(QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total planned effort for @p resource on this task (or subtasks) on date virtual Duration plannedEffort( const Resource *resource, QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the planned effort up to and including date virtual Duration plannedEffortTo(QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the planned effort for @p resource up to and including date virtual Duration plannedEffortTo( const Resource *resource, QDate date, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the total actual effort for this task (or subtasks) virtual Duration actualEffort() const; /// Returns the total actual effort for this task (or subtasks) on date virtual Duration actualEffort(QDate date ) const; /// Returns the actual effort up to and including date virtual Duration actualEffortTo(QDate date ) const; /** * Returns the total planned cost for this task (or subtasks) */ virtual EffortCost plannedCost( long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Planned cost up to and including date virtual double plannedCostTo(QDate /*date*/, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns actual effort and cost up to and including @p date virtual EffortCost actualCostTo( long int id, QDate date ) const; /** * Returns a list of actual effort and cost for this task * for the interval start, end inclusive */ virtual EffortCostMap actualEffortCostPrDay( QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the actual effort and cost pr day used by @p resource virtual EffortCostMap actualEffortCostPrDay( const Resource *resource, QDate start, QDate end, long id = CURRENTSCHEDULE, EffortCostCalculationType = ECCT_All ) const; /// Returns the effort planned to be used to reach the actual percent finished virtual Duration budgetedWorkPerformed( QDate date, long id = CURRENTSCHEDULE ) const; /// Returns the cost planned to be used to reach the actual percent finished virtual double budgetedCostPerformed( QDate date, long id = CURRENTSCHEDULE ) const; using Node::bcwsPrDay; /// Return map of Budgeted Cost of Work Scheduled pr day virtual EffortCostMap bcwsPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Budgeted Cost of Work Scheduled virtual double bcws( QDate date, long id = CURRENTSCHEDULE ) const; using Node::bcwpPrDay; /// Return map of Budgeted Cost of Work Performed pr day (also includes bcwsPrDay) virtual EffortCostMap bcwpPrDay( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Budgeted Cost of Work Performed virtual double bcwp( long id = CURRENTSCHEDULE ) const; /// Budgeted Cost of Work Performed ( up to @p date ) virtual double bcwp( QDate date, long id = CURRENTSCHEDULE ) const; using Node::acwp; /// Map of Actual Cost of Work Performed virtual EffortCostMap acwp( long id = CURRENTSCHEDULE, EffortCostCalculationType type = ECCT_All ); /// Actual Cost of Work Performed up to dat virtual EffortCost acwp( QDate date, long id = CURRENTSCHEDULE ) const; /// Effort based performance index virtual double effortPerformanceIndex( QDate date, long id = CURRENTSCHEDULE ) const; /// Schedule performance index virtual double schedulePerformanceIndex( QDate date, long id = CURRENTSCHEDULE ) const; /// Cost performance index virtual double costPerformanceIndex( long int id, QDate date, bool *error=0 ) const; /** * Return the duration that an activity's start can be delayed * without affecting the project completion date. * An activity with positive float is not on the critical path. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ Duration positiveFloat( long id = CURRENTSCHEDULE ) const; void setPositiveFloat( Duration fl, long id = CURRENTSCHEDULE ) const; /** * Return the duration by which the duration of an activity or path * has to be reduced in order to fulfil a timing- or dependency constraint. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ Duration negativeFloat( long id = CURRENTSCHEDULE ) const; void setNegativeFloat( Duration fl, long id = CURRENTSCHEDULE ) const; /** * Return the duration by which an activity can be delayed or extended * without affecting the start of any succeeding activity. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ Duration freeFloat( long id = CURRENTSCHEDULE ) const; void setFreeFloat( Duration fl, long id = CURRENTSCHEDULE ) const; /** * Return the duration from Early Start to Late Start. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ Duration startFloat( long id = CURRENTSCHEDULE ) const; /** * Return the duration from Early Finish to Late Finish. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ Duration finishFloat( long id = CURRENTSCHEDULE ) const; /** * A task is critical if positive float equals 0 * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ virtual bool isCritical( long id = CURRENTSCHEDULE ) const; /** * Set current schedule to schedule with identity id, for me and my children. * @param id Schedule identity */ virtual void setCurrentSchedule(long id); /** * The assigned resources can not fulfil the estimated effort. * @param id Schedule identity. If id is CURRENTSCHEDULE, use current schedule. */ virtual bool effortMetError( long id = CURRENTSCHEDULE ) const; Completion &completion() { return m_workPackage.completion(); } const Completion &completion() const { return m_workPackage.completion(); } WorkPackage &workPackage() { return m_workPackage; } const WorkPackage &workPackage() const { return m_workPackage; } int workPackageLogCount() const { return m_packageLog.count(); } QList workPackageLog() const { return m_packageLog; } void addWorkPackage( WorkPackage *wp ); void removeWorkPackage( WorkPackage *wp ); WorkPackage *workPackageAt( int index ) const; QString wpOwnerName() const; WorkPackage::WPTransmitionStatus wpTransmitionStatus() const; DateTime wpTransmitionTime() const; /** * Returns the state of the task * @param id The identity of the schedule used when calculating the state */ virtual uint state( long id = CURRENTSCHEDULE ) const; /// Check if this node has any dependent child nodes virtual bool isEndNode() const; /// Check if this node has any dependent parent nodes virtual bool isStartNode() const; QList parentProxyRelations() const { return m_parentProxyRelations; } QList childProxyRelations() const { return m_childProxyRelations; } /** * Calculates and returns the duration of the node. * Uses the correct expected-, optimistic- or pessimistic effort * dependent on @p use. * @param time Where to start calculation. * @param use Calculate using expected-, optimistic- or pessimistic estimate. * @param backward If true, time specifies when the task should end. */ virtual Duration duration(const DateTime &time, int use, bool backward); /** * Return the duration calculated on bases of the estimates calendar */ Duration length(const DateTime &time, Duration duration, bool backward); Duration length(const DateTime &time, Duration uration, Schedule *sch, bool backward); /// Copy info from parent schedule void copySchedule(); /// Copy intervals from parent schedule void copyAppointments(); /// Copy intervals from parent schedule in the range @p start, @p end void copyAppointments( const DateTime &start, const DateTime &end = DateTime() ); Q_SIGNALS: void workPackageToBeAdded( Node *node, int row ); void workPackageAdded( Node *node ); void workPackageToBeRemoved( Node *node, int row ); void workPackageRemoved( Node *node ); public: virtual void initiateCalculation(MainSchedule &sch); /** * Sets up the lists used for calculation. * This includes adding summarytasks relations to subtasks * and lists for start- and endnodes. */ virtual void initiateCalculationLists(MainSchedule &sch); /** * Calculates early start and early finish, first for all predeccessors, * then for this task. * @param use Calculate using expected-, optimistic- or pessimistic estimate. */ virtual DateTime calculateForward(int use); /** * Calculates ref m_durationForward from ref earliestStart and * returns the resulting end time (early finish), * which will be used as the successors ref earliestStart. * * @param use Calculate using expected-, optimistic- or pessimistic estimate. */ virtual DateTime calculateEarlyFinish(int use); /** * Calculates late start and late finish, first for all successors, * then for this task. * @param use Calculate using expected-, optimistic- or pessimistic estimate. */ virtual DateTime calculateBackward(int use); /** * Calculates ref m_durationBackward from ref latestFinish and * returns the resulting start time (late start), * which will be used as the predecessors ref latestFinish. * * @param use Calculate using expected-, optimistic- or pessimistic estimate. */ virtual DateTime calculateLateStart(int use); /** * Schedules the task within the limits of earliestStart and latestFinish. * Calculates ref m_startTime, ref m_endTime and ref m_duration, * Assumes ref calculateForward() and ref calculateBackward() has been run. * * @param earliest The task is not scheduled to start earlier than this * @param use Calculate using expected-, optimistic- or pessimistic estimate. * @return The tasks endtime which can be used for scheduling the successor. */ virtual DateTime scheduleForward(const DateTime &earliest, int use); /** * Schedules the task within the limits of start time and latestFinish, * Calculates end time and duration. * Assumes ref calculateForward() and ref calculateBackward() has been run. * * @param use Calculate using expected-, optimistic- or pessimistic estimate. * @return The tasks endtime which can be used for scheduling the successor. */ virtual DateTime scheduleFromStartTime(int use); /** * Schedules the task within the limits of earliestStart and latestFinish. * Calculates ref m_startTime, ref m_endTime and ref m_duration, * Assumes ref calculateForward() and ref calculateBackward() has been run. * * @param latest The task is not scheduled to end later than this * @param use Calculate using expected-, optimistic- or pessimistic estimate. * @return The tasks starttime which can be used for scheduling the predeccessor. */ virtual DateTime scheduleBackward(const DateTime &latest, int use); /** * Schedules the task within the limits of end time and latestFinish. * Calculates endTime and duration. * Assumes ref calculateForward() and ref calculateBackward() has been run. * * @param latest The task is not scheduled to end later than this * @param use Calculate using expected-, optimistic- or pessimistic estimate. * @return The tasks starttime which can be used for scheduling the predeccessor. */ virtual DateTime scheduleFromEndTime(int use); /** * Summarytasks (with milestones) need special treatment because * milestones are always 'glued' to their predecessors. */ virtual void adjustSummarytask(); /// Calculate the critical path virtual bool calcCriticalPath(bool fromEnd); virtual void calcFreeFloat(); // Proxy relations are relations to/from summarytasks. // These relations are distributed to the child tasks before calculation. virtual void clearProxyRelations(); virtual void addParentProxyRelations( const QList & ); virtual void addChildProxyRelations( const QList & ); virtual void addParentProxyRelation(Node *, const Relation *); virtual void addChildProxyRelation(Node *, const Relation *); public: DateTime earlyStartDate(); void setEarlyStartDate(DateTime value); DateTime earlyFinishDate(); void setEarlyFinishDate(DateTime value); DateTime lateStartDate(); void setLateStartDate(DateTime value); DateTime lateFinishDate(); void setLateFinishDate(DateTime value); int activitySlack(); void setActivitySlack(int value); int activityFreeMargin(); void setActivityFreeMargin(int value); protected: /** * Return the duration calculated on bases of the requested resources */ Duration calcDuration(const DateTime &time, Duration effort, bool backward); private: DateTime calculateSuccessors(const QList &list, int use); DateTime calculatePredeccessors(const QList &list, int use); DateTime scheduleSuccessors(const QList &list, int use); DateTime schedulePredeccessors(const QList &list, int use); /// Fixed duration: Returns @p dt /// Duration with calendar: Returns first available after @p dt /// Has working resource(s) allocated: Returns the earliest time a resource can start work after @p dt, and checks appointments if @p sch is not null. DateTime workTimeAfter(const DateTime &dt, Schedule *sch = 0) const; /// Fixed duration: Returns @p dt /// Duration with calendar: Returns first available before @p dt /// Has working resource(s) allocated: Returns the latest time a resource can finish work, and checks appointments if @p sch is not null. DateTime workTimeBefore(const DateTime &dt, Schedule *sch = 0) const; private: QList m_resource; QList m_parentProxyRelations; QList m_childProxyRelations; // This list store pointers to linked task QList m_requiredTasks; WorkPackage m_workPackage; QList m_packageLog; bool m_calculateForwardRun; bool m_calculateBackwardRun; bool m_scheduleForwardRun; bool m_scheduleBackwardRun; }; } //KPlato namespace Q_DECLARE_METATYPE( KPlato::Completion::UsedEffort::ActualEffort ) #ifndef QT_NO_DEBUG_STREAM -KPLATOKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Completion::UsedEffort::ActualEffort &ae ); +PLANKERNEL_EXPORT QDebug operator<<( QDebug dbg, const KPlato::Completion::UsedEffort::ActualEffort &ae ); #endif #endif diff --git a/src/libs/kernel/kptwbsdefinition.h b/src/libs/kernel/kptwbsdefinition.h index 0de26182..72313107 100644 --- a/src/libs/kernel/kptwbsdefinition.h +++ b/src/libs/kernel/kptwbsdefinition.h @@ -1,118 +1,118 @@ /* This file is part of the KDE project Copyright (C) 2005 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTWBSDEFINITION_H #define KPTWBSDEFINITION_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include #include #include #include #include class QStringList; class QDomElement; namespace KPlato { class XMLLoaderObject; -class KPLATOKERNEL_EXPORT WBSDefinition { +class PLANKERNEL_EXPORT WBSDefinition { public: /// Construct a default definition WBSDefinition(); /// Copy constructor WBSDefinition( const WBSDefinition &def ); /// Destructor ~WBSDefinition(); - class KPLATOKERNEL_EXPORT CodeDef { + class PLANKERNEL_EXPORT CodeDef { public: CodeDef() {} CodeDef(const QString &c, const QString &s) { code = c; separator = s; } ~CodeDef() {} void clear() { code.clear(); separator.clear(); } bool isEmpty() { return code.isEmpty(); } QString code; QString separator; }; WBSDefinition &operator=( const WBSDefinition &def ); void clear(); /// Return wbs string. QString wbs(uint index, int level) const; /// Return wbs code. QString code(uint index, int level) const; /// Return wbs separator. QString separator(int level) const; CodeDef &defaultDef() { return m_defaultDef; } void setDefaultDef(const CodeDef &def) { m_defaultDef = def; } bool isLevelsDefEnabled() const { return m_levelsEnabled; } bool level0Enabled() const; void setLevelsDefEnabled(bool on) { m_levelsEnabled = on; } void clearLevelsDef() { m_levelsDef.clear(); } QMap levelsDef() const { return m_levelsDef; } void setLevelsDef(const QMap &def); CodeDef levelsDef(int level) const; void setLevelsDef(int level, const CodeDef &def); void setLevelsDef(int level, const QString& c, const QString& s); QStringList codeList() const; int defaultCodeIndex() const; bool setDefaultCode(uint index); QString defaultSeparator() const { return m_defaultDef.separator; } void setDefaultSeparator(const QString& s); QString projectCode() const { return m_projectCode; } void setProjectCode( const QString &str ) { m_projectCode = str; } QString projectSeparator() const { return m_projectSeparator; } void setProjectSeparator( const QString &str ) { m_projectSeparator = str; } /// Load from document bool loadXML(KoXmlElement &element, XMLLoaderObject &status ); /// Save to document void saveXML(QDomElement &element) const; protected: QString code(const CodeDef &def, uint index) const; QString toRoman(int n, bool upper = false) const; private: QString m_projectCode; QString m_projectSeparator; CodeDef m_defaultDef; bool m_levelsEnabled; QMap m_levelsDef; QList > m_codeLists; }; } //namespace KPlato #endif //WBSDEFINITION_H diff --git a/src/libs/kernel/kptxmlloaderobject.h b/src/libs/kernel/kptxmlloaderobject.h index 8e7154cf..e594216a 100644 --- a/src/libs/kernel/kptxmlloaderobject.h +++ b/src/libs/kernel/kptxmlloaderobject.h @@ -1,139 +1,139 @@ /* This file is part of the KDE project Copyright (C) 2006 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef XMLLOADEROBJECT_H #define XMLLOADEROBJECT_H -#include "kplatokernel_export.h" +#include "plankernel_export.h" #include "kptproject.h" #include "kptdatetime.h" #include #include #include #include #include namespace KPlato { -class KPLATOKERNEL_EXPORT XMLLoaderObject { +class PLANKERNEL_EXPORT XMLLoaderObject { public: enum Severity { None=0, Errors=1, Warnings=2, Diagnostics=3, Debug=4 }; XMLLoaderObject() : m_project(0), m_errors(0), m_warnings(0), m_logLevel(Diagnostics), m_log(), m_baseCalendar( 0 ) {} ~XMLLoaderObject() {} void setProject(Project *proj) { m_project = proj; } Project &project() const { return *m_project; } QString version() const { return m_version; } void setVersion( const QString &ver ) { m_version = ver; } QString workVersion() const { return m_workversion; } void setWorkVersion( const QString &ver ) { m_workversion = ver; } QString mimetype() const { return m_mimetype; } void setMimetype( const QString &mime ) { m_mimetype = mime; } const QTimeZone &projectTimeZone() const { return m_projectTimeZone; } void setProjectTimeZone( const QTimeZone &timeZone ) { m_projectTimeZone = timeZone; } void startLoad() { m_timer.start(); m_starttime = QDateTime::currentDateTime(); m_errors = m_warnings = 0; m_log.clear(); addMsg(QStringLiteral("Loading started at %1").arg(m_starttime.toString())); } void stopLoad() { m_elapsed = m_timer.elapsed(); addMsg(QStringLiteral("Loading finished at %1, took %2").arg(QDateTime::currentDateTime().toString()).arg(formatElapsed())); } QDateTime lastLoaded() const { return m_starttime; } int elapsed() const { return m_elapsed; } QString formatElapsed() { return QStringLiteral("%1 seconds").arg((double)m_elapsed/1000); } void setLogLevel(Severity sev) { m_logLevel = sev; } const QStringList &log() const { return m_log; } void error( const QString &msg ) { addMsg( Errors, msg ); } void warning( const QString &msg ) { addMsg( Errors, msg ); } void diagnostic( const QString &msg ) { addMsg( Diagnostics, msg ); } void debug( const QString &msg ) { addMsg( Debug, msg ); } void message( const QString &msg ) { addMsg( None, msg ); } void addMsg(int sev, const QString& msg) { increment(sev); if (m_logLevel < sev) return; QString s; if (sev == Errors) s = QLatin1String("ERROR"); else if (sev == Warnings) s = QLatin1String("WARNING"); else if (sev == Diagnostics) s = QLatin1String("Diagnostic"); else if (sev == Debug) s = QLatin1String("Debug"); else s = QLatin1String("Message"); m_log< 0; } void incWarnings() { ++m_warnings; } int warnings() const { return m_warnings; } bool warning() const { return m_warnings > 0; } // help to handle version < 0.6 void setBaseCalendar( Calendar *cal ) { m_baseCalendar = cal; } Calendar *baseCalendar() const { return m_baseCalendar; } void setUpdater( KoUpdater *updater ) { m_updater = updater; } void setProgress( int value ) { if ( m_updater ) m_updater->setProgress( value ); } protected: Project *m_project; int m_errors; int m_warnings; int m_logLevel; QStringList m_log; QDateTime m_starttime; QTime m_timer; int m_elapsed; QString m_version; QString m_workversion; QString m_mimetype; QTimeZone m_projectTimeZone; Calendar *m_baseCalendar; // help to handle version < 0.6 QPointer m_updater; }; } //namespace KPlato #endif diff --git a/src/libs/kernel/tests/CMakeLists.txt b/src/libs/kernel/tests/CMakeLists.txt index 4b4d925a..1db1d440 100644 --- a/src/libs/kernel/tests/CMakeLists.txt +++ b/src/libs/kernel/tests/CMakeLists.txt @@ -1,67 +1,67 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( ${PLANKERNEL_INCLUDES} ${PLAN_SOURCE_DIR}/libs/widgetutils ${PLANODF_INCLUDES} ${PLANKUNDO2_INCLUDES} ) # call: plankernel_add_unit_test( LINK_LIBRARIES [ [...]] [GUI]) macro(PLANKERNEL_ADD_UNIT_TEST _TEST_NAME) ecm_add_test( ${ARGN} TEST_NAME "${_TEST_NAME}" NAME_PREFIX "plan-kernel-" ) endmacro() ########### next target ############### -plankernel_add_unit_test(DateTimeTester DateTimeTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(DateTimeTester DateTimeTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########## next target ############### -plankernel_add_unit_test(DurationTester DurationTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(DurationTester DurationTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########## next target ############### -plankernel_add_unit_test(AppointmentIntervalTester AppointmentIntervalTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(AppointmentIntervalTester AppointmentIntervalTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########## next target ############### -plankernel_add_unit_test(EstimateTester EstimateTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(EstimateTester EstimateTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########### next target ############### -plankernel_add_unit_test(CalendarTester CalendarTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(CalendarTester CalendarTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########## next target ############### -plankernel_add_unit_test(ResourceTester ResourceTester.cpp LINK_LIBRARIES kplatokernel plankundo2 planodf Qt5::Test) +plankernel_add_unit_test(ResourceTester ResourceTester.cpp LINK_LIBRARIES plankernel plankundo2 planodf Qt5::Test) ########### next target ############### -plankernel_add_unit_test(ScheduleTester ScheduleTester.cpp LINK_LIBRARIES kplatokernel Qt5::Test) +plankernel_add_unit_test(ScheduleTester ScheduleTester.cpp LINK_LIBRARIES plankernel Qt5::Test) ########### next target ############### -plankernel_add_unit_test(ProjectTester ProjectTester.cpp LINK_LIBRARIES planprivate kplatokernel Qt5::Test) +plankernel_add_unit_test(ProjectTester ProjectTester.cpp LINK_LIBRARIES planprivate plankernel Qt5::Test) ########### next target ############### -plankernel_add_unit_test(AccountsTester AccountsTester.cpp LINK_LIBRARIES planprivate kplatokernel Qt5::Test) +plankernel_add_unit_test(AccountsTester AccountsTester.cpp LINK_LIBRARIES planprivate plankernel Qt5::Test) ########### next target ############### -plankernel_add_unit_test(AccountsCommandTester AccountsCommandTester.cpp LINK_LIBRARIES kplatokernel planmain Qt5::Test) +plankernel_add_unit_test(AccountsCommandTester AccountsCommandTester.cpp LINK_LIBRARIES plankernel planmain Qt5::Test) ########### next target ############### -plankernel_add_unit_test(PerformanceTester PerformanceTester.cpp LINK_LIBRARIES planprivate kplatokernel Qt5::Test) +plankernel_add_unit_test(PerformanceTester PerformanceTester.cpp LINK_LIBRARIES planprivate plankernel Qt5::Test) ########### next target ############### -plankernel_add_unit_test(CommandsTester CommandsTester.cpp LINK_LIBRARIES planprivate kplatokernel plankundo2 Qt5::Test) +plankernel_add_unit_test(CommandsTester CommandsTester.cpp LINK_LIBRARIES planprivate plankernel plankundo2 Qt5::Test) ########### next target ############### -plankernel_add_unit_test(WorkInfoCacheTester WorkInfoCacheTester.cpp LINK_LIBRARIES planprivate kplatokernel Qt5::Test) +plankernel_add_unit_test(WorkInfoCacheTester WorkInfoCacheTester.cpp LINK_LIBRARIES planprivate plankernel Qt5::Test) diff --git a/src/libs/models/CMakeLists.txt b/src/libs/models/CMakeLists.txt index 5e4ecff2..f9221071 100644 --- a/src/libs/models/CMakeLists.txt +++ b/src/libs/models/CMakeLists.txt @@ -1,72 +1,72 @@ if(BUILD_TESTING) add_subdirectory( tests ) endif() include_directories( ${PLANKERNEL_INCLUDES} ${PLANWIDGETS_INCLUDES} ${PLANODF_INCLUDES} ${PLANKUNDO2_INCLUDES} ) if (KF5Contacts_FOUND) add_definitions(-DPLAN_KCONTACTS_FOUND) endif () ########### KPlato data models library ############### -set(kplatomodels_LIB_SRCS +set(planmodels_LIB_SRCS reportgenerator/ReportGenerator.cpp reportgenerator/ReportGeneratorOdt.cpp kptcommonstrings.cpp kpttreecombobox.cpp kcalendar/kdatetable.cpp kcalendar/kdatepicker.cpp kptnodechartmodel.cpp kptflatproxymodel.cpp kptrelationmodel.cpp kptworkpackagemodel.cpp kptdocumentmodel.cpp kptitemmodelbase.cpp kptnodeitemmodel.cpp kptdurationspinbox.cpp kpttaskstatusmodel.cpp kptresourcemodel.cpp kptcalendarmodel.cpp kptschedulemodel.cpp kptaccountsmodel.cpp kptpertcpmmodel.cpp kptresourceappointmentsmodel.cpp kptresourceallocationmodel.cpp kpttaskcompletedelegate.cpp ) -add_library(kplatomodels SHARED ${kplatomodels_LIB_SRCS}) -generate_export_header(kplatomodels) +add_library(planmodels SHARED ${planmodels_LIB_SRCS}) +generate_export_header(planmodels) -target_link_libraries(kplatomodels +target_link_libraries(planmodels PUBLIC - kplatokernel + plankernel planodf KChart KGantt KF5::KIOWidgets PRIVATE KF5::Notifications KF5::TextWidgets ) if(KF5Contacts_FOUND) - target_link_libraries(kplatomodels PRIVATE KF5::Contacts) + target_link_libraries(planmodels PRIVATE KF5::Contacts) endif() -set_target_properties(kplatomodels PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) +set_target_properties(planmodels PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) -install(TARGETS kplatomodels ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS planmodels ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/libs/models/kcalendar/kdatepicker.h b/src/libs/models/kcalendar/kdatepicker.h index 251e1902..124a68ab 100644 --- a/src/libs/models/kcalendar/kdatepicker.h +++ b/src/libs/models/kcalendar/kdatepicker.h @@ -1,187 +1,187 @@ /* -*- C++ -*- This file is part of the KDE libraries Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) (C) 1998-2001 Mirko Boehm (mirko@kde.org) (C) 2007 John Layt This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KP_KDATEPICKER_H #define KP_KDATEPICKER_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include namespace KPlato { class KDateTable; /** * @short A date selection widget. * * Provides a widget for calendar date input. * * Different from the * previous versions, it now emits two types of signals, either * dateSelected() or dateEntered() (see documentation for both * signals). * * A line edit has been added in the newer versions to allow the user * to select a date directly by entering numbers like 19990101 * or 990101. * * \image html kdatepicker.png "KDE Date Widget" * * @author Tim Gilman, Mirko Boehm * **/ -class KPLATOMODELS_EXPORT KDatePicker: public QFrame +class PLANMODELS_EXPORT KDatePicker: public QFrame { Q_OBJECT Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true) Q_PROPERTY(bool closeButton READ hasCloseButton WRITE setCloseButton) Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize) public: /** * The constructor. The current date will be displayed initially. **/ explicit KDatePicker(QWidget *parent = 0); /** * The constructor. The given date will be displayed initially. **/ explicit KDatePicker(const QDate &dt, QWidget *parent = 0); /** * The destructor. **/ virtual ~KDatePicker(); /** The size hint for date pickers. The size hint recommends the * minimum size of the widget so that all elements may be placed * without clipping. This sometimes looks ugly, so when using the * size hint, try adding 28 to each of the reported numbers of * pixels. **/ QSize sizeHint() const Q_DECL_OVERRIDE; /** * Sets the date. * * @returns @p false and does not change anything if the date given is invalid. **/ bool setDate(const QDate &date); /** * @returns the selected date. */ const QDate &date() const; /** * @returns the KDateTable widget child of this KDatePicker * widget. */ KDateTable *dateTable() const; /** * Sets the font size of the widgets elements. **/ void setFontSize(int); /** * Returns the font size of the widget elements. */ int fontSize() const; /** * By calling this method with @p enable = true, KDatePicker will show * a little close-button in the upper button-row. Clicking the * close-button will cause the KDatePicker's topLevelWidget()'s close() * method being called. This is mostly useful for toplevel datepickers * without a window manager decoration. * @see hasCloseButton */ void setCloseButton(bool enable); /** * @returns true if a KDatePicker shows a close-button. * @see setCloseButton */ bool hasCloseButton() const; protected: /// to catch move keyEvents when QLineEdit has keyFocus bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE; /// the resize event void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; void changeEvent(QEvent *event) Q_DECL_OVERRIDE; protected Q_SLOTS: void dateChangedSlot(const QDate &date); void tableClickedSlot(); void monthForwardClicked(); void monthBackwardClicked(); void yearForwardClicked(); void yearBackwardClicked(); void selectMonthClicked(); void selectYearClicked(); void uncheckYearSelector(); void lineEnterPressed(); void todayButtonClicked(); void weekSelected(int); Q_SIGNALS: /** This signal is emitted each time the selected date is changed. * Usually, this does not mean that the date has been entered, * since the date also changes, for example, when another month is * selected. * @see dateSelected */ void dateChanged(const QDate &date); /** This signal is emitted each time a day has been selected by * clicking on the table (hitting a day in the current month). It * has the same meaning as dateSelected() in older versions of * KDatePicker. */ void dateSelected(const QDate &date); /** This signal is emitted when enter is pressed and a VALID date * has been entered before into the line edit. Connect to both * dateEntered() and dateSelected() to receive all events where the * user really enters a date. */ void dateEntered(const QDate &date); /** This signal is emitted when the day has been selected by * clicking on it in the table. */ void tableClicked(); private: void initWidget(const QDate &date); class KDatePickerPrivate; friend class KDatePickerPrivate; KDatePickerPrivate *const d; }; } //namespace KPlato #endif // KP_KDATEPICKER_H diff --git a/src/libs/models/kcalendar/kdatetable.h b/src/libs/models/kcalendar/kdatetable.h index 63a0f114..aa1bd1a1 100644 --- a/src/libs/models/kcalendar/kdatetable.h +++ b/src/libs/models/kcalendar/kdatetable.h @@ -1,339 +1,339 @@ /* -*- C++ -*- This file is part of the KDE libraries Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org) (C) 1998-2001 Mirko Boehm (mirko@kde.org) (C) 2007 John Layt This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KP_KDATETABLE_H #define KP_KDATETABLE_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include #include #include #include class QMenu; namespace KPlato { class KDateTableDataModel; class KDateTableDateDelegate; class KDateTableWeekDayDelegate; class KDateTableWeekNumberDelegate; class StyleOptionHeader; class StyleOptionViewItem; /** * Date selection table. * This is a support class for the KDatePicker class. It just * draws the calendar table without titles, but could theoretically * be used as a standalone. * * When a date is selected by the user, it emits a signal: * dateSelected(QDate) * * @internal * @author Tim Gilman, Mirko Boehm */ -class KPLATOMODELS_EXPORT KDateTable : public QWidget +class PLANMODELS_EXPORT KDateTable : public QWidget { Q_OBJECT Q_PROPERTY( QDate date READ date WRITE setDate ) Q_PROPERTY( bool popupMenu READ popupMenuEnabled WRITE setPopupMenuEnabled ) public: /** * The constructor. */ explicit KDateTable(QWidget* parent = 0); /** * The constructor. */ explicit KDateTable(const QDate&, QWidget* parent = 0); /** * The destructor. */ ~KDateTable(); /** * Returns a recommended size for the widget. * To save some time, the size of the largest used cell content is * calculated in each paintCell() call, since all calculations have * to be done there anyway. The size is stored in maxCell. The * sizeHint() simply returns a multiple of maxCell. */ QSize sizeHint() const Q_DECL_OVERRIDE; /** * Set the font size of the date table. */ void setFontSize(int size); /** * Select and display this date. */ bool setDate(const QDate &date); // KDE5 remove the const & from the returned QDate /** * @returns the selected date. */ const QDate& date() const; /** * Enables a popup menu when right clicking on a date. * * When it's enabled, this object emits a aboutToShowContextMenu signal * where you can fill in the menu items. */ void setPopupMenuEnabled( bool enable ); /** * Returns if the popup menu is enabled or not */ bool popupMenuEnabled() const; enum BackgroundMode { NoBgMode=0, RectangleMode, CircleMode }; /** * Makes a given date be painted with a given foregroundColor, and background * (a rectangle, or a circle/ellipse) in a given color. */ void setCustomDatePainting( const QDate &date, const QColor &fgColor, BackgroundMode bgMode=NoBgMode, const QColor &bgColor = QColor()); /** * Unsets the custom painting of a date so that the date is painted as usual. */ void unsetCustomDatePainting( const QDate &date ); //-----> enum ItemDataRole { DisplayRole_1 = Qt::UserRole + 1 }; enum SelectionMode { SingleSelection, ExtendedSelection }; void setSelectionMode( SelectionMode mode ); void setModel( KDateTableDataModel *model ); KDateTableDataModel *model() const; // datetable takes ownership of delegate void setDateDelegate( KDateTableDateDelegate *delegate ); // datetable takes ownership of delegate void setDateDelegate( const QDate &date, KDateTableDateDelegate *delegate ); // datetable takes ownership of delegate void setWeekDayDelegate( KDateTableWeekDayDelegate *delegate ); // datetable takes ownership of delegate void setWeekNumberDelegate( KDateTableWeekNumberDelegate *delegate ); void setWeekNumbersEnabled( bool enable ); void setStyleOptionDate( const StyleOptionViewItem &so ); void setStyleOptionWeekDay( const StyleOptionHeader &so ); void setStyleOptionWeekNumber( const StyleOptionHeader &so ); void setGridEnabled( bool enable ); //<----- protected: /** * calculate the position of the cell in the matrix for the given date. * The result is the 0-based index. */ virtual int posFromDate( const QDate &date ); /** * calculate the date that is displayed at a given cell in the matrix. pos is the * 0-based index in the matrix. Inverse function to posForDate(). */ virtual QDate dateFromPos( int pos ); void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; /** * React on mouse clicks that select a date. */ void mousePressEvent(QMouseEvent *e ) Q_DECL_OVERRIDE; void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE; void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE; /** * Cell highlight on mouse hovering */ bool event(QEvent *e) Q_DECL_OVERRIDE; Q_SIGNALS: /** * The selected date changed. */ void dateChanged(const QDate &date); /** * This function behaves essentially like the one above. * The selected date changed. * @param cur The current date * @param old The date before the date was changed */ void dateChanged(const QDate& cur, const QDate& old); /** * A date has been selected by clicking on the table. */ void tableClicked(); /** * A popup menu for a given date is about to be shown (as when the user * right clicks on that date and the popup menu is enabled). Connect * the slot where you fill the menu to this signal. */ void aboutToShowContextMenu( QMenu * menu, const QDate &date ); /** * A popup menu for selected dates is about to be shown. * Connect the slot where you fill the menu to this signal. */ void aboutToShowContextMenu( QMenu * menu, const QList& ); //-----> void selectionChanged( const QList& ); protected Q_SLOTS: void slotReset(); void slotDataChanged( const QDate &start, const QDate &end ); //<------ private: Q_PRIVATE_SLOT(d, void nextMonth()) Q_PRIVATE_SLOT(d, void previousMonth()) Q_PRIVATE_SLOT(d, void beginningOfMonth()) Q_PRIVATE_SLOT(d, void endOfMonth()) Q_PRIVATE_SLOT(d, void beginningOfWeek()) Q_PRIVATE_SLOT(d, void endOfWeek()) private: class KDateTablePrivate; friend class KDateTablePrivate; KDateTablePrivate * const d; void initWidget(const QDate &date); void initAccels(); void paintCell(QPainter *painter, int row, int col); Q_DISABLE_COPY(KDateTable) }; //-----> -class KPLATOMODELS_EXPORT KDateTableDataModel : public QObject +class PLANMODELS_EXPORT KDateTableDataModel : public QObject { Q_OBJECT public: KDateTableDataModel( QObject *parent ); ~KDateTableDataModel(); /// Fetch data for @p date, @p dataType specifies the type of data virtual QVariant data( const QDate &date, int role = Qt::DisplayRole, int dataType = -1 ) const; virtual QVariant weekDayData( int day, int role = Qt::DisplayRole ) const; virtual QVariant weekNumberData( int week, int role = Qt::DisplayRole ) const; Q_SIGNALS: void reset(); void dataChanged( const QDate &start, const QDate &end ); }; //------- -class KPLATOMODELS_EXPORT KDateTableDateDelegate : public QObject +class PLANMODELS_EXPORT KDateTableDateDelegate : public QObject { Q_OBJECT public: KDateTableDateDelegate( QObject *parent = 0 ); ~KDateTableDateDelegate() {} virtual QRectF paint( QPainter *painter, const StyleOptionViewItem &option, const QDate &date, KDateTableDataModel *model ); virtual QVariant data( const QDate &date, int role, KDateTableDataModel *model ); }; -class KPLATOMODELS_EXPORT KDateTableCustomDateDelegate : public KDateTableDateDelegate +class PLANMODELS_EXPORT KDateTableCustomDateDelegate : public KDateTableDateDelegate { Q_OBJECT public: KDateTableCustomDateDelegate( QObject *parent = 0 ); ~KDateTableCustomDateDelegate() {} virtual QRectF paint( QPainter *painter, const StyleOptionViewItem &option, const QDate &date, KDateTableDataModel *model ); private: friend class KDateTable; QColor fgColor; QColor bgColor; KDateTable::BackgroundMode bgMode; }; -class KPLATOMODELS_EXPORT KDateTableWeekDayDelegate : public QObject +class PLANMODELS_EXPORT KDateTableWeekDayDelegate : public QObject { Q_OBJECT public: KDateTableWeekDayDelegate( QObject *parent = 0 ); ~KDateTableWeekDayDelegate() {} virtual QRectF paint( QPainter *painter, const StyleOptionHeader &option, int weekday, KDateTableDataModel *model ); virtual QVariant data( int day, int role, KDateTableDataModel *model ); }; -class KPLATOMODELS_EXPORT KDateTableWeekNumberDelegate : public QObject +class PLANMODELS_EXPORT KDateTableWeekNumberDelegate : public QObject { Q_OBJECT public: KDateTableWeekNumberDelegate( QObject *parent = 0 ); ~KDateTableWeekNumberDelegate() {} virtual QRectF paint( QPainter *painter, const StyleOptionHeader &option, int week, KDateTableDataModel *model ); virtual QVariant data( int week, int role, KDateTableDataModel *model ); }; class StyleOptionHeader : public QStyleOptionHeader { public: StyleOptionHeader() : QStyleOptionHeader() {} QRectF rectF; }; class StyleOptionViewItem : public QStyleOptionViewItem { public: StyleOptionViewItem() : QStyleOptionViewItem() {} StyleOptionViewItem( const StyleOptionViewItem &style ) : QStyleOptionViewItem( style ) { rectF = style.rectF; } QRectF rectF; }; } //namespace KPlato #endif // KP_KDATETABLE_H diff --git a/src/libs/models/kptaccountsmodel.h b/src/libs/models/kptaccountsmodel.h index 64aea03d..caa03e50 100644 --- a/src/libs/models/kptaccountsmodel.h +++ b/src/libs/models/kptaccountsmodel.h @@ -1,207 +1,207 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTACCOUNTSMODEL_H #define KPTACCOUNTSMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include "kpteffortcostmap.h" namespace KPlato { class Project; class Account; class ScheduleManager; class AccountItemModel; -class KPLATOMODELS_EXPORT AccountModel : public QObject +class PLANMODELS_EXPORT AccountModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: AccountModel(); ~AccountModel() {} enum Properties { Name = 0, Description }; const QMetaEnum columnMap() const; int propertyCount() const; virtual QVariant data( const Account *a, int property, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int property, int role = Qt::DisplayRole ) const; protected: QVariant name( const Account *account, int role ) const; QVariant description( const Account *account, int role ) const; private: friend class AccountItemModel; Project *m_project; }; -class KPLATOMODELS_EXPORT AccountItemModel : public ItemModelBase +class PLANMODELS_EXPORT AccountItemModel : public ItemModelBase { Q_OBJECT public: explicit AccountItemModel( QObject *parent = 0 ); ~AccountItemModel(); const QMetaEnum columnMap() const; virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const Account* account, int column = 0 ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; Account *account( const QModelIndex &index ) const; QModelIndex insertAccount( Account *account, Account *parent = 0, int index = -1 ); void removeAccounts( QList lst ); protected Q_SLOTS: void slotAccountChanged( Account* ); void slotAccountToBeInserted( const Account *parent, int row ); void slotAccountInserted( const Account *account ); void slotAccountToBeRemoved( const Account *account ); void slotAccountRemoved( const Account *account ); protected: bool setName( Account *account, const QVariant &value, int role ); bool setDescription( Account *account, const QVariant &value, int role ); private: AccountModel m_model; Account *m_account; // test for sane operation }; //--------------- -class KPLATOMODELS_EXPORT CostBreakdownItemModel : public ItemModelBase +class PLANMODELS_EXPORT CostBreakdownItemModel : public ItemModelBase { Q_OBJECT Q_ENUMS( Properties ) public: enum PeriodType { Period_Day = 0, Period_Week = 1, Period_Month = 2 }; enum StartMode { StartMode_Project = 0, StartMode_Date = 1 }; enum EndMode { EndMode_Project = 0, EndMode_Date = 1, EndMode_CurrentDate = 2 }; enum ShowMode { ShowMode_Actual = 0, ShowMode_Planned = 1, ShowMode_Both = 2, ShowMode_Deviation = 3 }; explicit CostBreakdownItemModel( QObject *parent = 0 ); ~CostBreakdownItemModel(); enum Properties { Name = 0, Description, Total, Planned, Actual }; const QMetaEnum columnMap() const; int propertyCount() const; virtual void setProject( Project *project ); virtual void setScheduleManager( ScheduleManager *sm ); long id() const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const Account* account ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; Account *account( const QModelIndex &index ) const; bool cumulative() const; void setCumulative( bool on ); int periodType() const; void setPeriodType( int period ); int startMode() const; void setStartMode( int mode ); int endMode() const; void setEndMode( int mode ); QDate startDate() const; void setStartDate( const QDate &date ); QDate endDate() const; void setEndDate( const QDate &date ); int showMode() const; void setShowMode( int show ); QString formatMoney( double plannedCost, double actualCost ) const; QString format() const { return m_format; } void setFormat( const QString &f ) { m_format = f; } protected: void fetchData(); EffortCostMap fetchPlannedCost( Account *account ); EffortCostMap fetchActualCost( Account *account ); QVariant cost( const Account *a, int offset, int role ) const; protected Q_SLOTS: void slotAccountChanged( Account* ); void slotAccountToBeInserted( const Account *parent, int row ); void slotAccountInserted( const Account *account ); void slotAccountToBeRemoved( const Account *account ); void slotAccountRemoved( const Account *account ); void slotDataChanged(); private: ScheduleManager *m_manager; bool m_cumulative; int m_periodtype; int m_startmode; int m_endmode; QDate m_start; QDate m_end; int m_showmode; QMap m_plannedCostMap; QDate m_plannedStart, m_plannedEnd; QMap m_actualCostMap; QDate m_actualStart, m_actualEnd; QString m_format; }; } //KPlato namespace #endif diff --git a/src/libs/models/kptcalendarmodel.h b/src/libs/models/kptcalendarmodel.h index 7867f10a..971f91b1 100644 --- a/src/libs/models/kptcalendarmodel.h +++ b/src/libs/models/kptcalendarmodel.h @@ -1,273 +1,273 @@ /* This file is part of the KDE project * Copyright (C) 2007 Dag Andersen * Copyright (C) 2017 Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTCALENDARMODEL_H #define KPTCALENDARMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "kptitemmodelbase.h" #include "kptcalendar.h" #include "kptcalendarmodel.h" #include "kcalendar/kdatetable.h" class QPainter; namespace KPlato { class View; class Project; class Calendar; class CalendarDay; -class KPLATOMODELS_EXPORT CalendarDayItemModelBase : public ItemModelBase +class PLANMODELS_EXPORT CalendarDayItemModelBase : public ItemModelBase { Q_OBJECT public: explicit CalendarDayItemModelBase( QObject *parent = 0 ); ~CalendarDayItemModelBase(); virtual void setCalendar( Calendar *calendar ); virtual Calendar *calendar() const { return m_calendar; } virtual void setProject( Project *project ); CalendarDay *day( const QModelIndex &index ) const; // TimeInterval *interval( const QModelIndex &index ) const; // QModelIndex insertInterval ( TimeInterval *ti, CalendarDay *day ); // void removeInterval( TimeInterval *ti ); // CalendarDay *parentDay( const TimeInterval *ti ) const { return m_days.value( const_cast( ti ) ); } protected Q_SLOTS: void slotCalendarToBeRemoved( const Calendar *calendar ); protected: Calendar *m_calendar; // current calendar // QMap m_days; }; -class KPLATOMODELS_EXPORT CalendarItemModel : public ItemModelBase +class PLANMODELS_EXPORT CalendarItemModel : public ItemModelBase { Q_OBJECT Q_ENUMS( Properties ) public: explicit CalendarItemModel( QObject *parent = 0 ); ~CalendarItemModel(); enum Properties { Name = 0, Scope, TimeZone #ifdef HAVE_KHOLIDAYS , HolidayRegion #endif }; const QMetaEnum columnMap() const; virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const Calendar *calendar, int column = 0 ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); using ItemModelBase::dropAllowed; bool dropAllowed( Calendar *on, const QMimeData *data ); Calendar *calendar( const QModelIndex &index ) const; QModelIndex insertCalendar( Calendar *calendar, int pos, Calendar *parent = 0 ); void removeCalendar( QList lst ); void removeCalendar( Calendar *calendar ); protected Q_SLOTS: void slotCalendarChanged( Calendar* ); void slotCalendarToBeInserted( const Calendar *parent, int row ); void slotCalendarInserted( const Calendar *calendar ); void slotCalendarToBeRemoved( const Calendar *calendar ); void slotCalendarRemoved( const Calendar *calendar ); protected: QVariant name( const Calendar *calendar, int role ) const; bool setName( Calendar *calendar, const QVariant &value, int role ); QVariant scope( const Calendar *calendar, int role ) const; QVariant timeZone( const Calendar *calendar, int role ) const; bool setTimeZone( Calendar *calendar, const QVariant &value, int role ); #ifdef HAVE_KHOLIDAYS QVariant holidayRegion( const Calendar *calendar, int role ) const; bool setHolidayRegion( Calendar *calendar, const QVariant &value, int role ); #endif QList calendarList( QDataStream &stream ) const; private: Calendar *m_calendar; // test for sane operation }; -class KPLATOMODELS_EXPORT CalendarDayItemModel : public CalendarDayItemModelBase +class PLANMODELS_EXPORT CalendarDayItemModel : public CalendarDayItemModelBase { Q_OBJECT public: explicit CalendarDayItemModel( QObject *parent = 0 ); ~CalendarDayItemModel(); virtual void setCalendar( Calendar *calendar ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual bool hasChildren( const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const CalendarDay* day ) const; QModelIndex index( const TimeInterval* ti ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; CalendarDay *day( const QModelIndex &index ) const; TimeInterval *interval( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; QModelIndex insertInterval ( TimeInterval *ti, CalendarDay *day ); void removeInterval( TimeInterval *ti ); QModelIndex insertDay ( CalendarDay *day ); void removeDay ( CalendarDay *day ); bool isDate( const CalendarDay *day ) const; bool isWeekday( const CalendarDay *day ) const; protected Q_SLOTS: void slotDayChanged( CalendarDay *day ); void slotTimeIntervalChanged( TimeInterval *ti ); /* void slotDayToBeAdded( CalendarDay *day, int row ); void slotDayAdded( CalendarDay *day ); void slotDayToBeRemoved( CalendarDay *day ); void slotDayRemoved( CalendarDay *day );*/ // void slotWorkIntervalToBeAdded( CalendarDay *day, TimeInterval *ti, int row ); void slotWorkIntervalAdded( CalendarDay *day, TimeInterval *ti ); // void slotWorkIntervalToBeRemoved( CalendarDay *day, TimeInterval *ti ); void slotWorkIntervalRemoved( CalendarDay *day, TimeInterval *ti ); protected: /* QVariant date( const CalendarDay *day, int role ) const; bool setDate( CalendarDay *day, const QVariant &value, int role );*/ QVariant name( int weekday, int role ) const; QVariant dayState( const CalendarDay *day, int role ) const; bool setDayState( CalendarDay *day, const QVariant &value, int role ); /* QVariant intervalStart( const TimeInterval *ti, int role ) const; bool setIntervalStart( TimeInterval *ti, const QVariant &value, int role ); QVariant intervalEnd( const TimeInterval *ti, int role ) const; bool setIntervalEnd( TimeInterval *ti, const QVariant &value, int role );*/ QVariant workDuration( const CalendarDay *day, int role ) const; // QVariant intervalDuration( const TimeInterval *ti, int role ) const; void addIntervals( CalendarDay *day ); void removeIntervals( CalendarDay *day ); }; //-----> -class KPLATOMODELS_EXPORT DateTableDataModel : public KDateTableDataModel +class PLANMODELS_EXPORT DateTableDataModel : public KDateTableDataModel { Q_OBJECT public: explicit DateTableDataModel(QObject *parent); /// Fetch data for @p date, @p dataType specifies the type of data virtual QVariant data( const QDate &date, int role = Qt::DisplayRole, int dataType = -1 ) const; virtual QVariant weekDayData( int day, int role = Qt::DisplayRole ) const; virtual QVariant weekNumberData( int week, int role = Qt::DisplayRole ) const; public Q_SLOTS: void setCalendar( Calendar *calendar ); Q_SIGNALS: void reset(); void dataChanged( const QDate &start, const QDate &end ); protected: QVariant data( const Calendar &cal, const QDate &date, int role ) const; private: Calendar *m_calendar; }; //------- -class KPLATOMODELS_EXPORT DateTableDateDelegate : public KDateTableDateDelegate +class PLANMODELS_EXPORT DateTableDateDelegate : public KDateTableDateDelegate { Q_OBJECT public: explicit DateTableDateDelegate(QObject *parent = 0); ~DateTableDateDelegate() {} virtual QRectF paint( QPainter *painter, const StyleOptionViewItem &option, const QDate &date, KDateTableDataModel *model ); }; -class KPLATOMODELS_EXPORT CalendarExtendedItemModel : public CalendarItemModel +class PLANMODELS_EXPORT CalendarExtendedItemModel : public CalendarItemModel { Q_OBJECT public: explicit CalendarExtendedItemModel( QObject *parent = 0 ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; using CalendarItemModel::index; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; int columnNumber( const QString &name ) const; }; } //KPlato namespace #endif diff --git a/src/libs/models/kptcommonstrings.h b/src/libs/models/kptcommonstrings.h index 8a20db68..9381419b 100644 --- a/src/libs/models/kptcommonstrings.h +++ b/src/libs/models/kptcommonstrings.h @@ -1,171 +1,171 @@ /* This file is part of the KDE project Copyright (C) 2009, 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTCOMMONSTRINGS_H #define KPTCOMMONSTRINGS_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" class KUndo2MagicString; class QString; namespace KPlato { -struct KPLATOMODELS_EXPORT ToolTip +struct PLANMODELS_EXPORT ToolTip { static QString nodeName(); static QString nodeType(); static QString nodeResponsible(); static QString allocation(); static QString nodeConstraint(); static QString nodeConstraintStart(); static QString nodeConstraintEnd(); static QString nodeDescription(); static QString nodeWBS(); static QString nodeLevel(); static QString nodeRisk(); static QString nodeRunningAccount(); static QString nodeStartupAccount(); static QString nodeStartupCost(); static QString nodeShutdownAccount(); static QString nodeShutdownCost(); static QString nodeStartTime(); static QString nodeEndTime(); static QString nodeEarlyStart(); static QString nodeEarlyFinish(); static QString nodeLateStart(); static QString nodeLateFinish(); static QString nodeDuration(); static QString nodeVarianceDuration(); static QString nodeOptimisticDuration(); static QString nodePessimisticDuration(); static QString nodePositiveFloat(); static QString nodeNegativeFloat(); static QString nodeFreeFloat(); static QString nodeStartFloat(); static QString nodeFinishFloat(); static QString nodeAssignment(); static QString nodeStatus(); static QString nodeCompletion(); static QString nodePlannedEffortTo(); static QString nodeActualEffortTo(); static QString nodeRemainingEffort(); static QString nodePlannedCostTo(); static QString nodeActualCostTo(); static QString completionStartedTime(); static QString completionStarted(); static QString completionFinishedTime(); static QString completionFinished(); static QString completionStatusNote(); static QString estimateExpected(); static QString estimateVariance(); static QString estimateOptimistic(); static QString estimatePessimistic(); static QString estimateType(); static QString estimateCalendar(); static QString estimate(); static QString optimisticRatio(); static QString pessimisticRatio(); static QString riskType(); static QString nodeSchedulingStatus(); static QString nodeNotScheduled(); static QString nodeAssignmentMissing(); static QString nodeResourceOverbooked(); static QString nodeResourceUnavailable(); static QString nodeConstraintsError(); static QString nodeEffortNotMet(); static QString nodeSchedulingError(); static QString nodeBCWS(); static QString nodeBCWP(); static QString nodeACWP(); static QString nodePerformanceIndex(); static QString resourceName(); static QString resourceScope(); static QString resourceType(); static QString resourceInitials(); static QString resourceEMail(); static QString resourceCalendar(); static QString resourceUnits(); static QString resourceAvailableFrom(); static QString resourceAvailableUntil(); static QString resourceNormalRate(); static QString resourceOvertimeRate(); static QString resourceFixedCost(); static QString resourceAccount(); static QString accountName(); static QString accountDescription(); static QString scheduleName(); static QString scheduleState(); static QString scheduleOverbooking(); static QString scheduleDistribution(); static QString scheduleCalculate(); static QString scheduleStart(); static QString scheduleFinish(); static QString schedulingDirection(); static QString scheduleScheduler(); static QString scheduleGranularity(); static QString documentUrl(); static QString documentType(); static QString documentStatus(); static QString documentSendAs(); static QString calendarName(); static QString calendarTimeZone(); static QString relationParent(); static QString relationChild(); static QString relationType(); static QString relationLag(); }; //namespace ToolTip -struct KPLATOMODELS_EXPORT WhatsThis +struct PLANMODELS_EXPORT WhatsThis { static QString nodeNegativeFloat(); static QString nodeFreeFloat(); static QString nodeStartFloat(); static QString nodeFinishFloat(); static QString scheduleOverbooking(); static QString scheduleDistribution(); static QString schedulingDirection(); static QString scheduleScheduler(); }; //namespace WhatsThis -struct KPLATOMODELS_EXPORT UndoText +struct PLANMODELS_EXPORT UndoText { static KUndo2MagicString removeDocument(); }; //namespace Undo } //namespace KPlato #endif diff --git a/src/libs/models/kptdocumentmodel.h b/src/libs/models/kptdocumentmodel.h index f867f218..86cf73cc 100644 --- a/src/libs/models/kptdocumentmodel.h +++ b/src/libs/models/kptdocumentmodel.h @@ -1,126 +1,126 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDOCUMENTMODEL_H #define KPTDOCUMENTMODEL_H #include "kptitemmodelbase.h" namespace KPlato { class Document; class Documents; -class KPLATOMODELS_EXPORT DocumentModel : public QObject +class PLANMODELS_EXPORT DocumentModel : public QObject { Q_OBJECT public: enum Properties { Property_Url = 0, Property_Name, Property_Type, Property_SendAs, Property_Status }; DocumentModel() : QObject() {} ~DocumentModel() {} QVariant data( const Document *doc, int property, int role = Qt::DisplayRole ) const; static bool setData( Document *doc, int property, const QVariant & value, int role = Qt::EditRole ); static QVariant headerData( int section, int role = Qt::DisplayRole ); static int propertyCount(); QVariant url( const Document *doc, int role ) const; QVariant name( const Document *doc, int role ) const; bool setName( Document *doc, const QVariant &value, int role ); QVariant type( const Document *doc, int role ) const; bool setType( Document *doc, const QVariant &value, int role ); QVariant status( const Document *doc, int role ) const; QVariant sendAs( const Document *doc, int role ) const; bool setSendAs( Document *doc, const QVariant &value, int role ); }; -class KPLATOMODELS_EXPORT DocumentItemModel : public ItemModelBase +class PLANMODELS_EXPORT DocumentItemModel : public ItemModelBase { Q_OBJECT public: explicit DocumentItemModel( QObject *parent = 0 ); ~DocumentItemModel(); virtual void setDocuments( Documents *docs ); Documents *documents() const; virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex index( const Document *doc ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); Document *document( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; QModelIndex insertDocument( Document *doc, Document *after ); bool dropAllowed( Document *on, const QMimeData *data ); virtual bool dropAllowed( const QModelIndex &index, int dropIndicatorPosition, const QMimeData *data ); protected Q_SLOTS: void slotDocumentChanged( Document* ); void slotDocumentToBeInserted( Documents*, int row ); void slotDocumentInserted( Document* ); void slotDocumentToBeRemoved( Document* ); void slotDocumentRemoved( Document* ); protected: bool setUrl( Document *doc, const QVariant &value, int role ); bool setName( Document *doc, const QVariant &value, int role ); bool setType( Document *doc, const QVariant &value, int role ); bool setSendAs( Document *doc, const QVariant &value, int role ); private: Documents *m_documents; DocumentModel m_model; }; } //namespace KPlato #endif diff --git a/src/libs/models/kptdurationspinbox.h b/src/libs/models/kptdurationspinbox.h index 624806ba..9c9c870b 100644 --- a/src/libs/models/kptdurationspinbox.h +++ b/src/libs/models/kptdurationspinbox.h @@ -1,97 +1,97 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDURATIONSPINBOX_H #define KPTDURATIONSPINBOX_H #include "kptduration.h" -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include namespace KPlato { /** * The DurationSpinBox provides a spinbox and a line edit to display and edit durations. * * DurationSpinBox is a QDoubleSpinBox with the addition of adjustable units, * defined as Duration::Unit. * The unit can be Day, Hour, Minute, Second and Millisecond. * The user can select the unit the duration is displayed in by placing the cursor * on the unit and step up or -down. * Maximum- and minimum unit can be set with setMaximumUnit() and setMinimumUnit(). * Defaults are: maximum unit Day, minimum unit Hour. * */ -class KPLATOMODELS_EXPORT DurationSpinBox : public QDoubleSpinBox +class PLANMODELS_EXPORT DurationSpinBox : public QDoubleSpinBox { Q_OBJECT public: explicit DurationSpinBox(QWidget *parent = 0); /// Return the current unit Duration::Unit unit() const { return m_unit; } /// step the value steps step. If inside unit, steps unit +/- 1 step. virtual void stepBy( int steps ); /// Set maximum unit to @p unit. void setMaximumUnit( Duration::Unit unit ); /// Set maximum unit to @p unit. void setMinimumUnit( Duration::Unit unit ); double valueFromText( const QString & text ) const; QString textFromValue ( double value ) const; QValidator::State validate ( QString & input, int & pos ) const; Q_SIGNALS: void unitChanged( int ); public Q_SLOTS: /// Set the current unit. /// If unit is outside minimum- or maximum unit, the limit is adjusted. void setUnit( Duration::Unit unit); protected Q_SLOTS: void editorTextChanged( const QString &text ); protected: void keyPressEvent( QKeyEvent * event ); StepEnabled stepEnabled () const; void stepUnitUp(); void stepUnitDown(); QString extractUnit ( const QString &text ) const; QString extractValue ( const QString &text ) const; /// If unit is outside minimum- or maximum unit, the limit is used. void updateUnit( Duration::Unit unit); bool isOnUnit() const; private: Duration::Unit m_unit; Duration::Unit m_minunit; Duration::Unit m_maxunit; }; } //namespace KPlato #endif diff --git a/src/libs/models/kptflatproxymodel.h b/src/libs/models/kptflatproxymodel.h index 0ad2c09e..ac96ce8a 100644 --- a/src/libs/models/kptflatproxymodel.h +++ b/src/libs/models/kptflatproxymodel.h @@ -1,119 +1,119 @@ /* This file is part of the KDE project Copyright (C) 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTFLATPROXYMODEL_H #define KPTFLATPROXYMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include /// The main namespace namespace KPlato { /** FlatProxyModel is a proxy model that makes a tree source model flat. This might be useful to present data from a tree model in e.g. a table view or a report. Note that the source model should have the same number of columns for all parent indices, since a flat model obviously have the same number of columns for all indices. If this is not the case, the behavior is undefined. The row sequence of the flat model is the same as if the source model was fully expanded. The flat model adds a Parent column at the end of the source model columns, to make it possible to access the parent index's data at column 0. */ -class KPLATOMODELS_EXPORT FlatProxyModel : public QAbstractProxyModel +class PLANMODELS_EXPORT FlatProxyModel : public QAbstractProxyModel { Q_OBJECT public: explicit FlatProxyModel(QObject *parent = 0); virtual QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const; virtual QItemSelection mapSelectionFromSource ( const QItemSelection & sourceSelection ) const; virtual QItemSelection mapSelectionToSource ( const QItemSelection & proxySelection ) const; virtual QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const; virtual void setSourceModel ( QAbstractItemModel * sourceModel ); QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; QModelIndex parent(const QModelIndex &child) const; int rowCount( const QModelIndex &parent = QModelIndex() ) const; int columnCount(const QModelIndex &parent = QModelIndex() ) const; bool hasChildren(const QModelIndex &parent = QModelIndex() ) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole ) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole); QMimeData *mimeData(const QModelIndexList &indexes) const; QStringList mimeTypes() const; Qt::DropActions supportedDropActions() const; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent = QModelIndex()); bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); public Q_SLOTS: void sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right); void sourceHeaderDataChanged(Qt::Orientation orientation, int start, int end); void sourceReset(); void sourceLayoutAboutToBeChanged(); void sourceLayoutChanged(); void sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end); void sourceRowsInserted(const QModelIndex &source_parent, int start, int end); void sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end); void sourceRowsRemoved(const QModelIndex &source_parent, int start, int end); void sourceRowsAboutToBeMoved( const QModelIndex &source_parent, int start, int end, const QModelIndex &destParent, int destStart ); void sourceRowsMoved( const QModelIndex &source_parent, int start, int end, const QModelIndex &destParent, int destStart ); protected: int mapFromSourceRow( const QModelIndex & sourceIndex ) const; int mapToSourceRow( const QModelIndex & sourceIndex ) const; private Q_SLOTS: void initiateMaps( const QModelIndex &sourceParent = QModelIndex() ); void sourceModelDestroyed(); private: /// List of sourceIndexes QList m_sourceIndexList; /// Map of sourceIndexes (parent, index) QMultiMap m_sourceIndexMap; }; } //namespace KPlato #endif diff --git a/src/libs/models/kptitemmodelbase.h b/src/libs/models/kptitemmodelbase.h index 5d3719de..38c19bc0 100644 --- a/src/libs/models/kptitemmodelbase.h +++ b/src/libs/models/kptitemmodelbase.h @@ -1,323 +1,323 @@ /* This file is part of the KDE project Copyright (C) 2006 - 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTITEMMODELBASE_H #define KPTITEMMODELBASE_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "kptglobal.h" #include "kpttreecombobox.h" #include #include #include #include class KUndo2Command; /// The main namespace namespace KPlato { class Project; class ScheduleManager; /// Namespace for item delegate specific enums namespace Delegate { /// For selector delegate enum EditorType { EnumEditor, TimeEditor }; /// Controls action when editor is closed. See QAbstractItemDelegate::EndEditHint. enum EndEditHint { NoHint = QAbstractItemDelegate::NoHint, EditNextItem = QAbstractItemDelegate::EditNextItem, EditPreviousItem = QAbstractItemDelegate::EditPreviousItem, SubmitModelCache = QAbstractItemDelegate::SubmitModelCache, RevertModelCache = QAbstractItemDelegate::RevertModelCache, EditLeftItem = 100, EditRightItem = 101, EditDownItem = 102, EditUpItem = 103 }; } /// ItemDelegate implements improved control over closeEditor -class KPLATOMODELS_EXPORT ItemDelegate : public QStyledItemDelegate +class PLANMODELS_EXPORT ItemDelegate : public QStyledItemDelegate { Q_OBJECT public: /// Constructor explicit ItemDelegate(QObject *parent = 0) : QStyledItemDelegate( parent ), m_lastHint( Delegate::NoHint ) {} /// Extend EndEditHint for movement from edited item to next item to edit Delegate::EndEditHint endEditHint() const { return m_lastHint; } /// Increase the sizehint height a little to give room for editors QSize sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const; protected: /// Implements arrow key navigation bool eventFilter(QObject *object, QEvent *event); /// Draw custom focus // virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect ) const; private: Delegate::EndEditHint m_lastHint; }; -class KPLATOMODELS_EXPORT CheckStateItemDelegate : public ItemDelegate +class PLANMODELS_EXPORT CheckStateItemDelegate : public ItemDelegate { Q_OBJECT public: explicit CheckStateItemDelegate(QObject *parent = 0); protected: bool editorEvent( QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index ); }; -class KPLATOMODELS_EXPORT DateTimeCalendarDelegate : public ItemDelegate +class PLANMODELS_EXPORT DateTimeCalendarDelegate : public ItemDelegate { Q_OBJECT public: explicit DateTimeCalendarDelegate(QObject *parent = 0); QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const; void setEditorData( QWidget *editor, const QModelIndex &index ) const; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const; void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index ) const; }; -class KPLATOMODELS_EXPORT ProgressBarDelegate : public ItemDelegate +class PLANMODELS_EXPORT ProgressBarDelegate : public ItemDelegate { Q_OBJECT public: explicit ProgressBarDelegate(QObject *parent = 0); ~ProgressBarDelegate(); void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const; QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const; void setEditorData( QWidget *editor, const QModelIndex &index ) const; void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const; void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index ) const; protected: void initStyleOptionProgressBar( QStyleOptionProgressBar *option, const QModelIndex &index ) const; }; class Slider : public QSlider { Q_OBJECT public: explicit Slider( QWidget *parent ); private Q_SLOTS: void updateTip( int value ); }; -class KPLATOMODELS_EXPORT SelectorDelegate : public ItemDelegate +class PLANMODELS_EXPORT SelectorDelegate : public ItemDelegate { Q_OBJECT public: explicit SelectorDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT EnumDelegate : public ItemDelegate +class PLANMODELS_EXPORT EnumDelegate : public ItemDelegate { Q_OBJECT public: explicit EnumDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; //------------------------------------ -class KPLATOMODELS_EXPORT RequieredResourceDelegate : public ItemDelegate +class PLANMODELS_EXPORT RequieredResourceDelegate : public ItemDelegate { Q_OBJECT public: explicit RequieredResourceDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT DurationSpinBoxDelegate : public ItemDelegate +class PLANMODELS_EXPORT DurationSpinBoxDelegate : public ItemDelegate { Q_OBJECT public: explicit DurationSpinBoxDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT SpinBoxDelegate : public ItemDelegate +class PLANMODELS_EXPORT SpinBoxDelegate : public ItemDelegate { Q_OBJECT public: explicit SpinBoxDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT DoubleSpinBoxDelegate : public ItemDelegate +class PLANMODELS_EXPORT DoubleSpinBoxDelegate : public ItemDelegate { Q_OBJECT public: explicit DoubleSpinBoxDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT MoneyDelegate : public ItemDelegate +class PLANMODELS_EXPORT MoneyDelegate : public ItemDelegate { Q_OBJECT public: explicit MoneyDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT TimeDelegate : public ItemDelegate +class PLANMODELS_EXPORT TimeDelegate : public ItemDelegate { Q_OBJECT public: explicit TimeDelegate(QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; }; -class KPLATOMODELS_EXPORT ItemModelBase : public QAbstractItemModel +class PLANMODELS_EXPORT ItemModelBase : public QAbstractItemModel { Q_OBJECT public: // FIXME: Refactor, This is a copy from protected enum in QAbstractItemView enum DropIndicatorPosition { OnItem, /*QAbstractItemView::OnItem*/ /// The item will be dropped on the index. AboveItem, /*QAbstractItemView::AboveItem*/ /// The item will be dropped above the index. BelowItem, /*QAbstractItemView::BelowItem*/ /// The item will be dropped below the index. OnViewport /*QAbstractItemView::OnViewport*/ /// The item will be dropped onto a region of the viewport with no items if acceptDropsOnView is set. }; explicit ItemModelBase( QObject *parent = 0 ); virtual ~ItemModelBase(); virtual const QMetaEnum columnMap() const { return QMetaEnum(); } Project *project() const { return m_project; } ScheduleManager *scheduleManager() const { return m_manager; } bool isReadWrite() { return m_readWrite; } void setReadOnly( int column, bool ro ) { m_columnROMap[ column ] = ro; } /// Returns true if @p column has been set to ReadOnly. bool isColumnReadOnly( int column ) const { return m_columnROMap.contains( column ) && m_columnROMap[ column ]; } /** * Check if the @p data is allowed to be dropped on @p index, * @p dropIndicatorPosition indicates position relative @p index. * * Base implementation checks flags and mimetypes. */ virtual bool dropAllowed( const QModelIndex &index, int dropIndicatorPosition, const QMimeData *data ); /// Create the correct delegate for @p column. @p parent is the delegates parent widget. /// If default should be used, return 0. virtual QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const { Q_UNUSED(column); Q_UNUSED(parent); return 0; } QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; bool setData( const QModelIndex &index, const QVariant &value, int role ); QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; /// Return the sortorder to be used for @p column virtual int sortRole( int /*column*/ ) const { return Qt::DisplayRole; } Q_SIGNALS: /// Connect to this signal if your model modifies data using undo commands. void executeCommand( KUndo2Command* ); public Q_SLOTS: virtual void setProject( Project *project ); virtual void setScheduleManager( ScheduleManager *sm ); virtual void setReadWrite( bool rw ) { m_readWrite = rw; } /// Reimplement if your model can be refreshed virtual void refresh() {} protected Q_SLOTS: virtual void slotLayoutToBeChanged(); virtual void slotLayoutChanged(); void projectDeleted(); protected: Project *m_project; ScheduleManager *m_manager; bool m_readWrite; QMap m_columnROMap; }; } // namespace KPlato #endif diff --git a/src/libs/models/kptnodechartmodel.h b/src/libs/models/kptnodechartmodel.h index dbcef8c1..39cf37b1 100644 --- a/src/libs/models/kptnodechartmodel.h +++ b/src/libs/models/kptnodechartmodel.h @@ -1,177 +1,177 @@ /* This file is part of the Calligra project * Copyright (c) 2008 Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTNODECHARTMODEL_H #define KPTNODECHARTMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "kptitemmodelbase.h" #include "kpteffortcostmap.h" #include #include "kptdebug.h" #include namespace KPlato { class Resource; class Project; class ScheduleManager; class Node; -class KPLATOMODELS_EXPORT ChartProxyModel : public QSortFilterProxyModel +class PLANMODELS_EXPORT ChartProxyModel : public QSortFilterProxyModel { Q_OBJECT public: explicit ChartProxyModel(QObject *parent = 0) : QSortFilterProxyModel( parent ) {} QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const { //if ( role == Qt::DisplayRole && orientation == Qt::Vertical ) debugPlan<<"fetch:"< &columns ) { m_rejects = columns; invalidateFilter(); } QList rejectColumns() const { return m_rejects; } void setZeroColumns( const QList &columns ) { m_zerocolumns = columns; } QList zeroColumns() const { return m_zerocolumns; } void reset() { beginResetModel(); endResetModel(); } protected: bool filterAcceptsColumn ( int source_column, const QModelIndex &/*source_parent */) const { //debugPlan< m_rejects; QList m_zerocolumns; }; -class KPLATOMODELS_EXPORT ChartItemModel : public ItemModelBase +class PLANMODELS_EXPORT ChartItemModel : public ItemModelBase { Q_OBJECT Q_ENUMS( Properties ) public: enum Properties { BCWSCost, BCWPCost, ACWPCost, BCWSEffort, BCWPEffort, ACWPEffort, SPICost, CPICost, SPIEffort, CPIEffort }; const QMetaEnum columnMap() const; explicit ChartItemModel(QObject *parent = 0); // virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; const EffortCostMap &bcwp() const { return m_bcws; } const EffortCostMap &acwp() const { return m_acwp; } void setProject( Project *project ); void setNodes( const QList &nodes ); void addNode( Node *node ); void clearNodes(); QDate startDate() const; QDate endDate() const; void calculate(); void setLocalizeValues( bool on ); public Q_SLOTS: void setScheduleManager( ScheduleManager *sm ); void slotNodeRemoved( Node *node ); void slotNodeChanged( Node *node ); void slotResourceChanged( Resource *resource ); void slotResourceChanged( const Resource *resource ); protected: double bcwsEffort( int day ) const; double bcwpEffort( int day ) const; double acwpEffort( int day ) const; double bcwsCost( int day ) const; double bcwpCost( int day ) const; double acwpCost( int day ) const; double spiEffort( int day ) const; double cpiEffort( int day ) const; double spiCost( int day ) const; double cpiCost( int day ) const; protected: QList m_nodes; EffortCostMap m_bcws; EffortCostMap m_acwp; bool m_localizeValues; }; -class KPLATOMODELS_EXPORT PerformanceDataCurrentDateModel : public ChartItemModel +class PLANMODELS_EXPORT PerformanceDataCurrentDateModel : public ChartItemModel { Q_OBJECT public: explicit PerformanceDataCurrentDateModel(QObject *parent); int rowCount( const QModelIndex &parent = QModelIndex() ) const; int columnCount( const QModelIndex &parent = QModelIndex() ) const; QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; QVariant data( const QModelIndex &proxyIndex, int role = Qt::DisplayRole ) const; QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QModelIndex mapIndex( const QModelIndex &idx ) const; }; } //namespace KPlato #endif diff --git a/src/libs/models/kptnodeitemmodel.h b/src/libs/models/kptnodeitemmodel.h index e747d9c7..4d136503 100644 --- a/src/libs/models/kptnodeitemmodel.h +++ b/src/libs/models/kptnodeitemmodel.h @@ -1,532 +1,532 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef NODEITEMMODEL_H #define NODEITEMMODEL_H #include "kptitemmodelbase.h" #include "kptschedule.h" #include "kptworkpackagemodel.h" #include #include #include #include class QMimeData; class KUndo2Command; class KoXmlWriter; class KoStore; class KoOdfWriteStore; namespace KPlato { class Project; class Node; class Estimate; -class KPLATOMODELS_EXPORT NodeModel : public QObject +class PLANMODELS_EXPORT NodeModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: NodeModel(); ~NodeModel() {} enum SpecialRoles { SortableRole = Qt::UserRole + 5024 // unlikely high number }; enum Properties { NodeName = 0, NodeType, NodeResponsible, NodeAllocation, NodeEstimateType, NodeEstimateCalendar, NodeEstimate, NodeOptimisticRatio, NodePessimisticRatio, NodeRisk, NodeConstraint, NodeConstraintStart, NodeConstraintEnd, NodeRunningAccount, NodeStartupAccount, NodeStartupCost, NodeShutdownAccount, NodeShutdownCost, NodeDescription, // Based on edited values NodeExpected, NodeVarianceEstimate, NodeOptimistic, NodePessimistic, // After scheduling NodeStartTime, NodeEndTime, NodeEarlyStart, NodeEarlyFinish, NodeLateStart, NodeLateFinish, NodePositiveFloat, NodeFreeFloat, NodeNegativeFloat, NodeStartFloat, NodeFinishFloat, NodeAssignments, // Based on scheduled values NodeDuration, NodeVarianceDuration, NodeOptimisticDuration, NodePessimisticDuration, // Completion NodeStatus, NodeCompleted, NodePlannedEffort, NodeActualEffort, NodeRemainingEffort, NodePlannedCost, NodeActualCost, NodeActualStart, NodeStarted, NodeActualFinish, NodeFinished, NodeStatusNote, // Scheduling errors NodeSchedulingStatus, NodeNotScheduled, NodeAssignmentMissing, NodeResourceOverbooked, NodeResourceUnavailable, NodeConstraintsError, NodeEffortNotMet, NodeSchedulingError, NodeWBSCode, NodeLevel, // Performance NodeBCWS, NodeBCWP, NodeACWP, NodePerformanceIndex, // NodeCritical, NodeCriticalPath, // Info from latest work package transmission WPOwnerName, WPTransmitionStatus, WPTransmitionTime }; const QMetaEnum columnMap() const; void setProject( Project *project ); void setManager( ScheduleManager *sm ); Project *project() const { return m_project; } ScheduleManager *manager() const { return m_manager; } long id() const { return m_manager == 0 ? -1 : m_manager->scheduleId(); } QVariant data( const Node *node, int property, int role = Qt::DisplayRole ) const; KUndo2Command *setData( Node *node, int property, const QVariant & value, int role = Qt::EditRole ); static QVariant headerData( int section, int role = Qt::DisplayRole ); int propertyCount() const; void setNow( const QDate &now ) { m_now = now; } QDate now() const { return m_now; } QVariant name( const Node *node, int role ) const; QVariant leader( const Node *node, int role ) const; QVariant allocation( const Node *node, int role ) const; QVariant description( const Node *node, int role ) const; QVariant type( const Node *node, int role ) const; QVariant constraint( const Node *node, int role ) const; QVariant constraintStartTime( const Node *node, int role ) const; QVariant constraintEndTime( const Node *node, int role ) const; QVariant estimateType( const Node *node, int role ) const; QVariant estimateCalendar( const Node *node, int role ) const; QVariant estimate( const Node *node, int role ) const; QVariant optimisticRatio( const Node *node, int role ) const; QVariant pessimisticRatio( const Node *node, int role ) const; QVariant riskType( const Node *node, int role ) const; QVariant runningAccount( const Node *node, int role ) const; QVariant startupAccount( const Node *node, int role ) const; QVariant startupCost( const Node *node, int role ) const; QVariant shutdownAccount( const Node *node, int role ) const; QVariant shutdownCost( const Node *node, int role ) const; QVariant startTime( const Node *node, int role ) const; QVariant endTime( const Node *node, int role ) const; QVariant duration( const Node *node, int role ) const; QVariant varianceDuration( const Node *node, int role ) const; QVariant varianceEstimate( const Estimate *est, int role ) const; QVariant optimisticDuration( const Node *node, int role ) const; QVariant optimisticEstimate( const Estimate *est, int role ) const; QVariant pertExpected( const Estimate *est, int role ) const; QVariant pessimisticDuration( const Node *node, int role ) const; QVariant pessimisticEstimate( const Estimate *est, int role ) const; QVariant earlyStart( const Node *node, int role ) const; QVariant earlyFinish( const Node *node, int role ) const; QVariant lateStart( const Node *node, int role ) const; QVariant lateFinish( const Node *node, int role ) const; QVariant positiveFloat( const Node *node, int role ) const; QVariant freeFloat( const Node *node, int role ) const; QVariant negativeFloat( const Node *node, int role ) const; QVariant startFloat( const Node *node, int role ) const; QVariant finishFloat( const Node *node, int role ) const; QVariant assignedResources( const Node *node, int role ) const; QVariant status( const Node *node, int role ) const; QVariant completed( const Node *node, int role ) const; QVariant startedTime( const Node *node, int role ) const; QVariant isStarted( const Node *node, int role ) const; QVariant finishedTime( const Node *node, int role ) const; QVariant isFinished( const Node *node, int role ) const; QVariant plannedEffortTo( const Node *node, int role ) const; QVariant actualEffortTo( const Node *node, int role ) const; QVariant remainingEffort( const Node *node, int role ) const; QVariant plannedCostTo( const Node *node, int role ) const; QVariant actualCostTo( const Node *node, int role ) const; QVariant note( const Node *node, int role ) const; /// The nodes scheduling status QVariant nodeSchedulingStatus( const Node *node, int role ) const; /// Set if the node has not been scheduled QVariant nodeIsNotScheduled( const Node *node, int role ) const; /// Set if EffortType == Effort, but no resource is requested QVariant resourceIsMissing( const Node *node, int role ) const; /// Set if the assigned resource is overbooked QVariant resourceIsOverbooked( const Node *node, int role ) const; /// Set if the requested resource is not available QVariant resourceIsNotAvailable( const Node *node, int role ) const; /// Set if the task cannot be scheduled to fulfil all the constraints QVariant schedulingConstraintsError( const Node *node, int role ) const; /// Resources could not fulfil estimate QVariant effortNotMet( const Node *node, int role ) const; /// Other scheduling error occurred QVariant schedulingError( const Node *node, int role ) const; QVariant wbsCode( const Node *node, int role ) const; QVariant nodeLevel( const Node *node, int role ) const; QVariant nodeBCWS( const Node *node, int role ) const; QVariant nodeBCWP( const Node *node, int role ) const; QVariant nodeACWP( const Node *node, int role ) const; QVariant nodePerformanceIndex( const Node *node, int role ) const; QVariant nodeIsCritical( const Node *node, int role ) const; QVariant nodeInCriticalPath( const Node *node, int role ) const; QVariant wpOwnerName( const Node *node, int role ) const; QVariant wpTransmitionStatus( const Node *node, int role ) const; QVariant wpTransmitionTime( const Node *node, int role ) const; KUndo2Command *setName( Node *node, const QVariant &value, int role ); KUndo2Command *setLeader( Node *node, const QVariant &value, int role ); KUndo2Command *setAllocation( Node *node, const QVariant &value, int role ); KUndo2Command *setDescription( Node *node, const QVariant &value, int role ); KUndo2Command *setType( Node *node, const QVariant &value, int role ); KUndo2Command *setConstraint( Node *node, const QVariant &value, int role ); KUndo2Command *setConstraintStartTime( Node *node, const QVariant &value, int role ); KUndo2Command *setConstraintEndTime( Node *node, const QVariant &value, int role ); KUndo2Command *setEstimateType( Node *node, const QVariant &value, int role ); KUndo2Command *setEstimateCalendar( Node *node, const QVariant &value, int role ); KUndo2Command *setEstimate( Node *node, const QVariant &value, int role ); KUndo2Command *setOptimisticRatio( Node *node, const QVariant &value, int role ); KUndo2Command *setPessimisticRatio( Node *node, const QVariant &value, int role ); KUndo2Command *setRiskType( Node *node, const QVariant &value, int role ); KUndo2Command *setRunningAccount( Node *node, const QVariant &value, int role ); KUndo2Command *setStartupAccount( Node *node, const QVariant &value, int role ); KUndo2Command *setStartupCost( Node *node, const QVariant &value, int role ); KUndo2Command *setShutdownAccount( Node *node, const QVariant &value, int role ); KUndo2Command *setShutdownCost( Node *node, const QVariant &value, int role ); KUndo2Command *setCompletion( Node *node, const QVariant &value, int role ); KUndo2Command *setActualEffort( Node *node, const QVariant &value, int role ); KUndo2Command *setRemainingEffort( Node *node, const QVariant &value, int role ); KUndo2Command *setStartedTime( Node *node, const QVariant &value, int role ); KUndo2Command *setFinishedTime( Node *node, const QVariant &value, int role ); private: Project *m_project; ScheduleManager *m_manager; QDate m_now; int m_prec; }; -class KPLATOMODELS_EXPORT NodeItemModel : public ItemModelBase +class PLANMODELS_EXPORT NodeItemModel : public ItemModelBase { Q_OBJECT public: explicit NodeItemModel( QObject *parent = 0 ); ~NodeItemModel(); /// Returns a column number/- name map for this model virtual const QMetaEnum columnMap() const { return m_nodemodel.columnMap(); } ScheduleManager *manager() const { return m_nodemodel.manager(); } long id() const { return m_nodemodel.id(); } virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex index( const Node *node, int column = 0 ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); Node *node( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; QModelIndex insertTask( Node *node, Node *after ); QModelIndex insertSubtask( Node *node, Node *parent ); QList nodeList( QDataStream &stream ); QList resourceList( QDataStream &stream ); static QList removeChildNodes( const QList &nodes ); bool dropAllowed( Node *on, const QMimeData *data ); virtual bool dropAllowed( const QModelIndex &index, int dropIndicatorPosition, const QMimeData *data ); bool projectShown() const { return m_projectshown; } /// Return the sortorder to be used for @p column virtual int sortRole( int column ) const; Q_SIGNALS: void nodeInserted( Node *node ); void projectShownChanged( bool ); public Q_SLOTS: virtual void setProject( Project *project ); virtual void setScheduleManager( ScheduleManager *sm ); void setShowProject( bool on ); protected Q_SLOTS: virtual void slotWbsDefinitionChanged(); virtual void slotNodeChanged( Node* ); virtual void slotNodeToBeInserted( Node *node, int row ); virtual void slotNodeInserted( Node *node ); virtual void slotNodeToBeRemoved( Node *node ); virtual void slotNodeRemoved( Node *node ); virtual void slotNodeToBeMoved( Node *node, int pos, Node *newParent, int newPos ); virtual void slotNodeMoved( Node *node ); virtual void slotLayoutChanged(); virtual void slotProjectCalculated( ScheduleManager *sm ); protected: virtual bool setType( Node *node, const QVariant &value, int role ); bool setCompletion( Node *node, const QVariant &value, int role ); bool setAllocation( Node *node, const QVariant &value, int role ); bool dropResourceMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); bool dropProjectMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); KUndo2Command *createAllocationCommand( Task &task, const QList &lst ); bool dropUrlMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); bool importProjectFile( const QUrl &url, Qt::DropAction action, int row, int column, const QModelIndex &parent ); protected: Node *m_node; // for sanity check NodeModel m_nodemodel; bool m_projectshown; }; //-------------------------------------- -class KPLATOMODELS_EXPORT GanttItemModel : public NodeItemModel +class PLANMODELS_EXPORT GanttItemModel : public NodeItemModel { Q_OBJECT public: enum GanttModelRoles { SpecialItemTypeRole = Qt::UserRole + 123 }; //FIXME explicit GanttItemModel(QObject *parent = 0); ~GanttItemModel(); virtual int rowCount( const QModelIndex &parent ) const; using NodeItemModel::index; virtual QModelIndex index( int row, int column, const QModelIndex &parent ) const; QModelIndex parent( const QModelIndex &idx ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; void setShowSpecial( bool on ) { m_showSpecial = on; } bool showSpecial() const { return m_showSpecial; } private: bool m_showSpecial; QMap parentmap; }; // TODO: Rename, this is now a flat node item model -class KPLATOMODELS_EXPORT MilestoneItemModel : public ItemModelBase +class PLANMODELS_EXPORT MilestoneItemModel : public ItemModelBase { Q_OBJECT public: explicit MilestoneItemModel( QObject *parent = 0 ); ~MilestoneItemModel(); /// Returns a column number/- name map for this model virtual const QMetaEnum columnMap() const { return m_nodemodel.columnMap(); } ScheduleManager *manager() const { return m_nodemodel.manager(); } long id() const { return m_nodemodel.id(); } virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex index( const Node *node ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); Node *node( const QModelIndex &index ) const; virtual QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; QModelIndex insertTask( Node *node, Node *after ); QModelIndex insertSubtask( Node *node, Node *parent ); QList nodeList( QDataStream &stream ); static QList removeChildNodes( const QList &nodes ); bool dropAllowed( Node *on, const QMimeData *data ); virtual bool dropAllowed( const QModelIndex &index, int dropIndicatorPosition, const QMimeData *data ); QList mileStones() const; int sortRole(int column) const; public Q_SLOTS: virtual void setProject( Project *project ); virtual void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void slotNodeChanged( Node* ); void slotNodeToBeInserted( Node *node, int row ); void slotNodeInserted( Node *node ); void slotNodeToBeRemoved( Node *node ); void slotNodeRemoved( Node *node ); void slotNodeToBeMoved( Node *node, int pos, Node *newParent, int newPos ); void slotNodeMoved( Node *node ); void slotLayoutChanged(); void slotWbsDefinitionChanged(); protected: bool resetData(); void resetModel(); private: NodeModel m_nodemodel; QMap m_nodemap; }; -class KPLATOMODELS_EXPORT NodeSortFilterProxyModel : public QSortFilterProxyModel +class PLANMODELS_EXPORT NodeSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: NodeSortFilterProxyModel( ItemModelBase* model, QObject *parent, bool filterUnscheduled = true ); ItemModelBase *itemModel() const; void setFilterUnscheduled( bool on ); bool filterUnscheduled() const { return m_filterUnscheduled; } void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); protected: bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const; private: NodeItemModel *m_model; bool m_filterUnscheduled; }; -class KPLATOMODELS_EXPORT TaskModuleModel : public QAbstractItemModel +class PLANMODELS_EXPORT TaskModuleModel : public QAbstractItemModel { Q_OBJECT public: explicit TaskModuleModel(QObject *parent = 0); void addTaskModule(Project *project , const QUrl &url); Qt::ItemFlags flags( const QModelIndex &idx ) const; int columnCount( const QModelIndex &idx = QModelIndex() ) const; int rowCount( const QModelIndex &idx = QModelIndex() ) const; QVariant data( const QModelIndex &idx, int role = Qt::DisplayRole ) const; QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QModelIndex parent( const QModelIndex &idx ) const; QModelIndex index( int row, int column, const QModelIndex &parent ) const; QStringList mimeTypes() const; bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); QMimeData *mimeData( const QModelIndexList &idx ) const; bool importProject( const QUrl &url, bool emitsignal = true ); public Q_SLOTS: void loadTaskModules( const QStringList &files ); Q_SIGNALS: void executeCommand( KUndo2Command *cmd ); void saveTaskModule( const QUrl &url, Project *project ); void removeTaskModule( const QUrl &url ); protected: void stripProject( Project *project ) const; private: QList m_modules; QList m_urls; }; } //namespace KPlato #endif //NODEITEMMODEL_H diff --git a/src/libs/models/kptpertcpmmodel.h b/src/libs/models/kptpertcpmmodel.h index 08e92186..bac73a18 100644 --- a/src/libs/models/kptpertcpmmodel.h +++ b/src/libs/models/kptpertcpmmodel.h @@ -1,179 +1,179 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTPERTCPMMODEL_H #define KPTPERTCPMMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include /// The main namespace namespace KPlato { class Duration; class Node; class Project; class ScheduleManager; class Task; typedef QList NodeList; -class KPLATOMODELS_EXPORT CriticalPathItemModel : public ItemModelBase +class PLANMODELS_EXPORT CriticalPathItemModel : public ItemModelBase { Q_OBJECT public: explicit CriticalPathItemModel( QObject *parent = 0 ); ~CriticalPathItemModel(); const QMetaEnum columnMap() const { return m_nodemodel.columnMap(); } virtual void setProject( Project *project ); virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; Node *node( const QModelIndex &index ) const; void setManager( ScheduleManager *sm ); ScheduleManager *manager() const { return m_manager; } /// Select a proper unit for total path values, dependent on @p duration Duration::Unit presentationUnit( const Duration &duration ) const; protected Q_SLOTS: void slotNodeChanged( Node* ); void slotNodeToBeInserted( Node *node, int row ); void slotNodeInserted( Node *node ); void slotNodeToBeRemoved( Node *node ); void slotNodeRemoved( Node *node ); public: QVariant alignment( int column ) const; QVariant name( int role ) const; QVariant duration( int role ) const; QVariant variance( int role ) const; QVariant notUsed( int role ) const; private: ScheduleManager *m_manager; QList m_path; NodeModel m_nodemodel; }; //-------------------- /** This model displays results from project scheduling. */ -class KPLATOMODELS_EXPORT PertResultItemModel : public ItemModelBase +class PLANMODELS_EXPORT PertResultItemModel : public ItemModelBase { Q_OBJECT public: explicit PertResultItemModel( QObject *parent = 0 ); ~PertResultItemModel(); const QMetaEnum columnMap() const { return m_nodemodel.columnMap(); } virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; // virtual QModelIndex index( const Node *node ) const; virtual QModelIndex index( const NodeList *lst ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); NodeList *list( const QModelIndex &index ) const; Node *node( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; NodeList nodeList( QDataStream &stream ); using ItemModelBase::dropAllowed; bool dropAllowed( Node *on, const QMimeData *data ); void clear(); void refresh(); void setManager( ScheduleManager *sm ); ScheduleManager *manager() const { return m_manager; } protected Q_SLOTS: void slotAboutToBeReset(); void slotReset(); void slotNodeChanged( Node* ); void slotNodeToBeInserted( Node *node, int row ); void slotNodeInserted( Node *node ); void slotNodeToBeRemoved( Node *node ); void slotNodeRemoved( Node *node ); protected: QVariant alignment( int column ) const; QVariant name( int row, int role ) const; QVariant name( const Node *node, int role ) const; QVariant earlyStart( const Task *node, int role ) const; QVariant earlyFinish( const Task *node, int role ) const; QVariant lateStart( const Task *node, int role ) const; QVariant lateFinish( const Task *node, int role ) const; QVariant positiveFloat( const Task *node, int role ) const; QVariant freeFloat( const Task *node, int role ) const; QVariant negativeFloat( const Task *node, int role ) const; QVariant startFloat( const Task *node, int role ) const; QVariant finishFloat( const Task *node, int role ) const; private: QStringList m_topNames; QList m_top; NodeList m_cp; NodeList m_critical; NodeList m_noncritical; NodeList m_dummyList; ScheduleManager *m_manager; NodeModel m_nodemodel; }; } //KPlato namespace #endif diff --git a/src/libs/models/kptrelationmodel.h b/src/libs/models/kptrelationmodel.h index c55e6e49..098520ed 100644 --- a/src/libs/models/kptrelationmodel.h +++ b/src/libs/models/kptrelationmodel.h @@ -1,114 +1,114 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef RELATIONMODEL_H #define RELATIONMODEL_H #include "kptitemmodelbase.h" #include "kptschedule.h" class QModelIndex; class KUndo2Command; namespace KPlato { class Project; class Node; class Relation; -class KPLATOMODELS_EXPORT RelationModel : public QObject +class PLANMODELS_EXPORT RelationModel : public QObject { Q_OBJECT public: RelationModel() : QObject() {} ~RelationModel() {} QVariant data( const Relation *relation, int property, int role = Qt::DisplayRole ) const; static QVariant headerData( int section, int role = Qt::DisplayRole ); static int propertyCount(); QVariant parentName( const Relation *r, int role ) const; QVariant childName( const Relation *r, int role ) const; QVariant type( const Relation *r, int role ) const; QVariant lag( const Relation *r, int role ) const; }; -class KPLATOMODELS_EXPORT RelationItemModel : public ItemModelBase +class PLANMODELS_EXPORT RelationItemModel : public ItemModelBase { Q_OBJECT public: explicit RelationItemModel( QObject *parent = 0 ); ~RelationItemModel(); virtual void setProject( Project *project ); virtual void setNode( Node *node ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; Relation *relation( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; Q_SIGNALS: void executeCommand( KUndo2Command* ); protected Q_SLOTS: void slotNodeChanged( Node* ); void slotNodeToBeRemoved( Node *node ); void slotNodeRemoved( Node *node ); void slotRelationToBeRemoved( Relation *r ); void slotRelationRemoved( Relation *r ); void slotRelationToBeAdded( Relation *r, int, int ); void slotRelationAdded( Relation *r ); void slotRelationModified( Relation *r ); void slotLayoutChanged(); protected: bool setType( Relation *r, const QVariant &value, int role ); bool setLag( Relation *r, const QVariant &value, int role ); private: Node *m_node; RelationModel m_relationmodel; Relation *m_removedRelation; // to control endRemoveRows() }; } //namespace KPlato #endif diff --git a/src/libs/models/kptresourceallocationmodel.h b/src/libs/models/kptresourceallocationmodel.h index 38464740..53de0ce2 100644 --- a/src/libs/models/kptresourceallocationmodel.h +++ b/src/libs/models/kptresourceallocationmodel.h @@ -1,176 +1,176 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEALLOCATIONMODEL_H #define KPTRESOURCEALLOCATIONMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include #include namespace KPlato { class Project; class Task; class Resource; class ResourceGroup; class ResourceRequest; class ResourceGroupRequest; /** The ResourceAllocationModel gives access to resource requests */ -class KPLATOMODELS_EXPORT ResourceAllocationModel : public QObject +class PLANMODELS_EXPORT ResourceAllocationModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: explicit ResourceAllocationModel( QObject *parent = 0 ); ~ResourceAllocationModel(); enum Properties { RequestName = 0, RequestType, RequestAllocation, RequestMaximum, RequestRequired }; const QMetaEnum columnMap() const; void setProject( Project *project ); Task *task() const { return m_task; } void setTask( Task *task ); int propertyCount() const; QVariant data( const ResourceGroup *group, const Resource *resource, int property, int role = Qt::DisplayRole ) const; QVariant data( const ResourceGroup *group, int property, int role = Qt::DisplayRole ) const; static QVariant headerData( int section, int role = Qt::DisplayRole ); QVariant name( const Resource *res, int role ) const; QVariant type( const Resource *res, int role ) const; QVariant allocation( const ResourceGroup *group, const Resource *res, int role ) const; QVariant maximum( const Resource *res, int role ) const; QVariant required( const Resource *res, int role ) const; QVariant name( const ResourceGroup *res, int role ) const; QVariant type( const ResourceGroup *res, int role ) const; QVariant allocation( const ResourceGroup *res, int role ) const; QVariant maximum( const ResourceGroup *res, int role ) const; private: Project *m_project; Task *m_task; }; /** The ResourceAllocationItemModel facilitates viewing and modifying resource allocations for a task. */ -class KPLATOMODELS_EXPORT ResourceAllocationItemModel : public ItemModelBase +class PLANMODELS_EXPORT ResourceAllocationItemModel : public ItemModelBase { Q_OBJECT public: explicit ResourceAllocationItemModel( QObject *parent = 0 ); ~ResourceAllocationItemModel(); virtual const QMetaEnum columnMap() const { return m_model.columnMap(); } virtual void setProject( Project *project ); Task *task() const { return m_model.task(); } virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const ResourceGroup *group ) const; QModelIndex index( const Resource *resource ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QAbstractItemDelegate *createDelegate( int col, QWidget *parent ) const; QObject *object( const QModelIndex &index ) const; const QMap &resourceCache() const { return m_resourceCache; } const QMap &groupCache() const { return m_groupCache; } Resource *resource( const QModelIndex &idx ) const; void setRequired( const QModelIndex &idx, const QList &lst ); QList required( const QModelIndex &idx ) const; public Q_SLOTS: void setTask( Task *task ); protected Q_SLOTS: void slotResourceChanged( Resource* ); void slotResourceGroupChanged( ResourceGroup * ); void slotResourceGroupToBeInserted( const ResourceGroup *group, int row ); void slotResourceGroupInserted( const ResourceGroup *group ); void slotResourceGroupToBeRemoved( const ResourceGroup *group ); void slotResourceGroupRemoved( const ResourceGroup *group ); void slotResourceToBeInserted( const ResourceGroup *group, int row ); void slotResourceInserted( const Resource *resource ); void slotResourceToBeRemoved( const Resource *resource ); void slotResourceRemoved( const Resource *resource ); protected: void filldata( Task *task ); QVariant notUsed( const ResourceGroup *res, int role ) const; QVariant allocation( const ResourceGroup *group, const Resource *res, int role ) const; QVariant allocation( const ResourceGroup *res, int role ) const; bool setAllocation( ResourceGroup *res, const QVariant &value, int role ); bool setAllocation( Resource *res, const QVariant &value, int role ); QVariant maximum( const ResourceGroup *res, int role ) const; bool setRequired( const QModelIndex &idx, const QVariant &value, int role ); QVariant required( const QModelIndex &idx, int role ) const; private: int requestedResources( const ResourceGroup *res ) const; bool hasMaterialResources() const; private: ResourceAllocationModel m_model; QMap m_resourceCache; QMap m_requiredChecked; QMap m_groupCache; }; } //KPlato namespace #endif diff --git a/src/libs/models/kptresourceappointmentsmodel.h b/src/libs/models/kptresourceappointmentsmodel.h index f694e3f6..d5246127 100644 --- a/src/libs/models/kptresourceappointmentsmodel.h +++ b/src/libs/models/kptresourceappointmentsmodel.h @@ -1,263 +1,263 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2007, 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEAPPOINTMENTSMODEL_H #define KPTRESOURCEAPPOINTMENTSMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include "kpteffortcostmap.h" namespace KPlato { class Project; class Node; class Appointment; class AppointmentInterval; class Resource; class ResourceGroup; class ScheduleManager; class MainSchedule; class Calendar; /** The ResourceAppointmentsItemModel organizes appointments as hours booked per day (or week, month). It handles both internal and external appointments. */ -class KPLATOMODELS_EXPORT ResourceAppointmentsItemModel : public ItemModelBase +class PLANMODELS_EXPORT ResourceAppointmentsItemModel : public ItemModelBase { Q_OBJECT public: explicit ResourceAppointmentsItemModel( QObject *parent = 0 ); ~ResourceAppointmentsItemModel(); virtual void setProject( Project *project ); long id() const; virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const ResourceGroup *group ) const; QModelIndex index( const Resource *resource ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QObject *object( const QModelIndex &index ) const; Node *node( const QModelIndex &index ) const; Appointment *appointment( const QModelIndex &index ) const; QModelIndex createAppointmentIndex( int row, int col, void *ptr ) const; Appointment *externalAppointment( const QModelIndex &index ) const; QModelIndex createExternalAppointmentIndex( int row, int col, void *ptr ) const; Resource *resource( const QModelIndex &index ) const; QModelIndex createResourceIndex( int row, int col, void *ptr ) const; ResourceGroup *resourcegroup( const QModelIndex &index ) const; QModelIndex createGroupIndex( int row, int col, void *ptr ) const; void refresh(); void refreshData(); QDate startDate() const; QDate endDate() const; Resource *parent( const Appointment *a ) const; int rowNumber( Resource *res, Appointment *a ) const; void setShowInternalAppointments( bool show ); bool showInternalAppointments() const { return m_showInternal; } void setShowExternalAppointments( bool show ); bool showExternalAppointments() const { return m_showExternal; } Q_SIGNALS: void refreshed(); void appointmentInserted( Resource*, Appointment* ); public Q_SLOTS: virtual void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void slotResourceChanged( Resource* ); void slotResourceGroupChanged( ResourceGroup * ); void slotResourceGroupToBeInserted( const ResourceGroup *group, int row ); void slotResourceGroupInserted( const ResourceGroup *group ); void slotResourceGroupToBeRemoved( const ResourceGroup *group ); void slotResourceGroupRemoved( const ResourceGroup *group ); void slotResourceToBeInserted( const ResourceGroup *group, int row ); void slotResourceInserted( const Resource *resource ); void slotResourceToBeRemoved( const Resource *resource ); void slotResourceRemoved( const Resource *resource ); void slotCalendarChanged( Calendar* cal ); void slotProjectCalculated( ScheduleManager *sm ); void slotAppointmentToBeInserted( Resource *r, int row ); void slotAppointmentInserted( Resource*, Appointment* ); void slotAppointmentToBeRemoved( Resource *r, int row ); void slotAppointmentRemoved(); void slotAppointmentChanged( Resource *r, Appointment *a ); protected: QVariant notUsed( const ResourceGroup *res, int role ) const; QVariant name( const Resource *res, int role ) const; QVariant name( const ResourceGroup *res, int role ) const; QVariant name( const Node *node, int role ) const; QVariant name( const Appointment *appointment, int role ) const; QVariant total( const Resource *res, int role ) const; QVariant total( const Resource *res, const QDate &date, int role ) const; QVariant total( const Appointment *a, int role ) const; QVariant assignment( const Appointment *a, const QDate &date, int role ) const; private: int m_columnCount; QMap m_effortMap; QMap m_externalEffortMap; QDate m_start; QDate m_end; ResourceGroup *m_group; // Used for sanity checks Resource *m_resource; // Used for sanity checks bool m_showInternal; bool m_showExternal; }; /** The ResourceAppointmentsRowModel returns each appointment interval as a new row. */ -class KPLATOMODELS_EXPORT ResourceAppointmentsRowModel : public ItemModelBase +class PLANMODELS_EXPORT ResourceAppointmentsRowModel : public ItemModelBase { Q_OBJECT Q_ENUMS( Properties ) public: enum Properties { Name = 0, Type, StartTime, EndTime, Load }; const QMetaEnum columnMap() const; explicit ResourceAppointmentsRowModel( QObject *parent = 0 ); ~ResourceAppointmentsRowModel(); virtual void setProject( Project *project ); long id() const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; QModelIndex parent( const QModelIndex &idx = QModelIndex() ) const; QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; /// If @p index is a resource, return it's parent group, else 0 ResourceGroup *parentGroup( const QModelIndex &index ) const; /// If @p idx is a resource group, return it, else 0 ResourceGroup *resourcegroup( const QModelIndex &idx ) const; /// If @p idx is an appointment, return it's parent resource, else 0 Resource *parentResource( const QModelIndex &idx ) const; /// If @p idx is a resource, return it, else 0 Resource *resource( const QModelIndex &idx ) const; /// If @p idx is an appointment interval, return it's parent appointment, else 0 Appointment *parentAppointment( const QModelIndex &idx ) const; /// If @p idx is an appointment, return it, else 0 Appointment *appointment( const QModelIndex &idx ) const; /// If @p idx is an appointment interval, return it, else 0 AppointmentInterval *interval( const QModelIndex &idx ) const; QModelIndex index( ResourceGroup *g ) const; QModelIndex index( Resource *r ) const; QModelIndex index( Appointment *a ) const; /// If @p idx is an appointment, return the node, else 0 Node *node( const QModelIndex &idx ) const; /// Return the sortorder to be used for @p column virtual int sortRole( int column ) const; class Private; public Q_SLOTS: virtual void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void slotResourceToBeInserted( const ResourceGroup *group, int row ); void slotResourceInserted( const Resource *r ); void slotResourceToBeRemoved( const Resource *r ); void slotResourceRemoved( const Resource *resource ); void slotResourceGroupToBeInserted( const ResourceGroup *group, int row ); void slotResourceGroupInserted( const ResourceGroup* ); void slotResourceGroupToBeRemoved( const ResourceGroup *group ); void slotResourceGroupRemoved( const ResourceGroup *group ); void slotAppointmentToBeInserted( Resource *r, int row ); void slotAppointmentInserted( Resource *r, Appointment *a ); void slotAppointmentToBeRemoved( Resource *r, int row ); void slotAppointmentRemoved(); void slotAppointmentChanged( Resource *r, Appointment *a ); void slotProjectCalculated( ScheduleManager *sm ); protected: QModelIndex createGroupIndex( int row, int column, Project *project ); QModelIndex createResourceIndex( int row, int column, ResourceGroup *g ); QModelIndex createAppointmentIndex( int row, int column, Resource *r ); QModelIndex createIntervalIndex( int row, int column, Appointment *a ); protected: QMap m_datamap; MainSchedule *m_schedule; }; /** The ResourceAppointmentsGanttModel specialized for use by KGantt */ -class KPLATOMODELS_EXPORT ResourceAppointmentsGanttModel : public ResourceAppointmentsRowModel +class PLANMODELS_EXPORT ResourceAppointmentsGanttModel : public ResourceAppointmentsRowModel { Q_OBJECT public: explicit ResourceAppointmentsGanttModel( QObject *parent = 0 ); ~ResourceAppointmentsGanttModel(); virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; protected: QVariant data( const ResourceGroup *g, int column, int role = Qt::DisplayRole ) const; QVariant data( const Resource *r, int column, int role = Qt::DisplayRole ) const; QVariant data( const Appointment *a, int column, int role = Qt::DisplayRole ) const; QVariant data( const AppointmentInterval *a, int column, int role = Qt::DisplayRole ) const; }; } //KPlato namespace #endif // KPTRESOURCEAPPOINTMENTSMODEL_H diff --git a/src/libs/models/kptresourcemodel.h b/src/libs/models/kptresourcemodel.h index 3fbc2924..47762fd0 100644 --- a/src/libs/models/kptresourcemodel.h +++ b/src/libs/models/kptresourcemodel.h @@ -1,260 +1,260 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEMODEL_H #define KPTRESOURCEMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include #include class QByteArray; namespace KIO { class Job; } class KJob; namespace KPlato { class Project; class Resource; class ResourceGroup; class Calendar; class Task; class Node; -class KPLATOMODELS_EXPORT ResourceModel : public QObject +class PLANMODELS_EXPORT ResourceModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: explicit ResourceModel( QObject *parent = 0 ); ~ResourceModel(); enum Properties { ResourceName = 0, ResourceScope, ResourceType, ResourceInitials, ResourceEmail, ResourceCalendar, ResourceLimit, ResourceAvailableFrom, ResourceAvailableUntil, ResourceNormalRate, ResourceOvertimeRate, ResourceAccount }; const QMetaEnum columnMap() const; void setProject( Project *project ); int propertyCount() const; QVariant data( const Resource *resource, int property, int role = Qt::DisplayRole ) const; QVariant data( const ResourceGroup *group, int property, int role = Qt::DisplayRole ) const; static QVariant headerData( int section, int role = Qt::DisplayRole ); QVariant name( const Resource *res, int role ) const; QVariant scope( const Resource *res, int role ) const; QVariant type( const Resource *res, int role ) const; QVariant initials( const Resource *res, int role ) const; QVariant email( const Resource *res, int role ) const; QVariant calendar( const Resource *res, int role ) const; QVariant units( const Resource *res, int role ) const; QVariant availableFrom( const Resource *res, int role ) const; QVariant availableUntil( const Resource *res, int role ) const; QVariant normalRate( const Resource *res, int role ) const; QVariant overtimeRate( const Resource *res, int role ) const; QVariant account( const Resource *res, int role ) const; QVariant name( const ResourceGroup *res, int role ) const; QVariant scope( const ResourceGroup *res, int role ) const; QVariant type( const ResourceGroup *res, int role ) const; private: Project *m_project; }; -class KPLATOMODELS_EXPORT ResourceItemModel : public ItemModelBase +class PLANMODELS_EXPORT ResourceItemModel : public ItemModelBase { Q_OBJECT public: explicit ResourceItemModel( QObject *parent = 0 ); ~ResourceItemModel(); virtual const QMetaEnum columnMap() const { return m_model.columnMap(); } virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const ResourceGroup *group, int column = 0 ) const; QModelIndex index( const Resource *resource, int column = 0 ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropAllowed( const QModelIndex &index, int dropIndicatorPosition, const QMimeData *data ); virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); QMimeData *mimeData( const QModelIndexList & indexes ) const; QAbstractItemDelegate *createDelegate( int col, QWidget *parent ) const; QObject *object( const QModelIndex &index ) const; ResourceGroup *group( const QModelIndex &index ) const; Resource *resource( const QModelIndex &index ) const; QModelIndex insertGroup( ResourceGroup *g ); QModelIndex insertResource( ResourceGroup *g, Resource *r, Resource *after = 0 ); virtual int sortRole( int column ) const; protected Q_SLOTS: void slotResourceChanged( Resource* ); void slotResourceGroupChanged( ResourceGroup * ); void slotResourceGroupToBeInserted( const ResourceGroup *group, int row ); void slotResourceGroupInserted( const ResourceGroup *group ); void slotResourceGroupToBeRemoved( const ResourceGroup *group ); void slotResourceGroupRemoved( const ResourceGroup *group ); void slotResourceToBeInserted( const ResourceGroup *group, int row ); void slotResourceInserted( const Resource *resource ); void slotResourceToBeRemoved( const Resource *resource ); void slotResourceRemoved( const Resource *resource ); void slotCalendarChanged( Calendar* cal ); void slotLayoutChanged(); void slotDataArrived( KIO::Job *job, const QByteArray &data ); void slotJobFinished( KJob *job ); protected: QVariant notUsed( const ResourceGroup *res, int role ) const; QVariant name( const ResourceGroup *res, int role ) const; bool setName( Resource *res, const QVariant &value, int role ); bool setName( ResourceGroup *res, const QVariant &value, int role ); QVariant type( const ResourceGroup *res, int role ) const; bool setType( Resource *res, const QVariant &value, int role ); bool setType( ResourceGroup *res, const QVariant &value, int role ); bool setInitials( Resource *res, const QVariant &value, int role ); bool setEmail( Resource *res, const QVariant &value, int role ); bool setCalendar( Resource *res, const QVariant &value, int role ); bool setUnits( Resource *res, const QVariant &value, int role ); bool setAvailableFrom( Resource *res, const QVariant &value, int role ); bool setAvailableUntil( Resource *res, const QVariant &value, int role ); bool setNormalRate( Resource *res, const QVariant &value, int role ); bool setOvertimeRate( Resource *res, const QVariant &value, int role ); bool setAccount( Resource *res, const QVariant &value, int role ); QList resourceList( QDataStream &stream ); bool createResources( ResourceGroup *group, const QByteArray &data ); private: ResourceGroup *m_group; // Used for sanity checks Resource *m_resource; // Used for sanity checks ResourceModel m_model; struct DropData { Qt::DropAction action; int row; int column; QModelIndex parent; QByteArray data; } m_dropData; QMap m_dropDataMap; }; -class KPLATOMODELS_EXPORT ResourceItemSFModel : public QSortFilterProxyModel +class PLANMODELS_EXPORT ResourceItemSFModel : public QSortFilterProxyModel { Q_OBJECT public: explicit ResourceItemSFModel(QObject *parent = 0); void setProject( Project *project ); Resource *resource( const QModelIndex &index ) const; using QAbstractProxyModel::index; QModelIndex index( Resource *r ) const; Qt::ItemFlags flags( const QModelIndex & index ) const; void addFilteredResource( const Resource *r ); protected: bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const; QList m_filteredResources; }; -class KPLATOMODELS_EXPORT AllocatedResourceItemModel : public QSortFilterProxyModel +class PLANMODELS_EXPORT AllocatedResourceItemModel : public QSortFilterProxyModel { Q_OBJECT public: explicit AllocatedResourceItemModel(QObject *parent = 0); int columnCount( const QModelIndex &idx ) const; Project *project() const; Task *task() const; Resource *resource( const QModelIndex &index ) const; using QAbstractProxyModel::index; QModelIndex index( Resource *r ) const; Qt::ItemFlags flags( const QModelIndex & index ) const; QVariant headerData( int section, Qt::Orientation orientation, int role ) const; QVariant data( const QModelIndex &idx, int role ) const; public Q_SLOTS: void setProject( Project *project ); void setTask( Task *task ); Q_SIGNALS: void expandAll(); void resizeColumnToContents( int ); protected Q_SLOTS: void slotNodeChanged( Node *n ); protected: bool filterAcceptsRow( int source_row, const QModelIndex & source_parent ) const; void reset(); QObject *object( const QModelIndex &idx ) const; QVariant allocation( const Resource *r, int role ) const; QVariant allocation( const ResourceGroup *g, int role ) const; Task *m_task; }; } //KPlato namespace #endif diff --git a/src/libs/models/kptschedulemodel.h b/src/libs/models/kptschedulemodel.h index b1083361..529fbe25 100644 --- a/src/libs/models/kptschedulemodel.h +++ b/src/libs/models/kptschedulemodel.h @@ -1,221 +1,221 @@ /* This file is part of the KDE project Copyright (C) 2007, 2008 Dag Andersen Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTSCHEDULEMODEL_H #define KPTSCHEDULEMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "kptitemmodelbase.h" #include "kptschedule.h" #include #include namespace KPlato { class Project; class ScheduleManager; class MainSchedule; class Schedule; -class KPLATOMODELS_EXPORT ScheduleModel : public QObject +class PLANMODELS_EXPORT ScheduleModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: explicit ScheduleModel( QObject *parent = 0 ); ~ScheduleModel(); enum Properties { ScheduleName = 0, ScheduleState, ScheduleDirection, ScheduleOverbooking, ScheduleDistribution, SchedulePlannedStart, SchedulePlannedFinish, ScheduleScheduler, ScheduleGranularity, ScheduleScheduled }; const QMetaEnum columnMap() const; int propertyCount() const; }; -class KPLATOMODELS_EXPORT ScheduleItemModel : public ItemModelBase +class PLANMODELS_EXPORT ScheduleItemModel : public ItemModelBase { Q_OBJECT public: explicit ScheduleItemModel( QObject *parent = 0 ); ~ScheduleItemModel(); const QMetaEnum columnMap() const { return m_model.columnMap(); } virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; QModelIndex index( const ScheduleManager *manager ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder ); virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; ScheduleManager *manager( const QModelIndex &index ) const; void setFlat( bool flat ); Q_SIGNALS: void scheduleManagerAdded( ScheduleManager* ); protected Q_SLOTS: void slotManagerChanged( ScheduleManager *sch ); void slotScheduleChanged( MainSchedule *sch ); void slotScheduleManagerToBeInserted( const ScheduleManager *manager, int row ); void slotScheduleManagerInserted( const ScheduleManager *manager ); void slotScheduleManagerToBeRemoved( const ScheduleManager *manager ); void slotScheduleManagerRemoved( const ScheduleManager *manager ); void slotScheduleManagerToBeMoved( const ScheduleManager *manager ); void slotScheduleManagerMoved( const ScheduleManager *manager, int index ); void slotScheduleToBeInserted( const ScheduleManager *manager, int row ); void slotScheduleInserted( const MainSchedule *schedule ); void slotScheduleToBeRemoved( const MainSchedule *schedule ); void slotScheduleRemoved( const MainSchedule *schedule ); protected: int row( const Schedule *sch ) const; QVariant name( const QModelIndex &index, int role ) const; bool setName( const QModelIndex &index, const QVariant &value, int role ); QVariant state( const QModelIndex &index, int role ) const; bool setState( const QModelIndex &index, const QVariant &value, int role ); QVariant allowOverbooking( const QModelIndex &index, int role ) const; bool setAllowOverbooking( const QModelIndex &index, const QVariant &value, int role ); QVariant usePert( const QModelIndex &index, int role ) const; bool setUsePert( const QModelIndex &index, const QVariant &value, int role ); QVariant projectStart( const QModelIndex &index, int role ) const; QVariant projectEnd( const QModelIndex &index, int role ) const; QVariant schedulingDirection( const QModelIndex &index, int role ) const; bool setSchedulingDirection( const QModelIndex &index, const QVariant &value, int role ); QVariant schedulingStartTime( const QModelIndex &index, int role ) const; bool setSchedulingStartTime( const QModelIndex &index, const QVariant &value, int role ); QVariant scheduler( const QModelIndex &index, int role ) const; bool setScheduler( const QModelIndex &index, const QVariant &value, int role ); QVariant isScheduled( const QModelIndex &index, int role ) const; QVariant granularity( const QModelIndex &index, int role ) const; bool setGranularity( const QModelIndex &index, const QVariant &value, int role ); private: ScheduleManager *m_manager; // for sanity check bool m_flat; ScheduleModel m_model; QList m_managerlist; }; //---------------------------------------- -class KPLATOMODELS_EXPORT ScheduleSortFilterModel : public QSortFilterProxyModel +class PLANMODELS_EXPORT ScheduleSortFilterModel : public QSortFilterProxyModel { Q_OBJECT public: explicit ScheduleSortFilterModel( QObject *parent = 0 ); ~ScheduleSortFilterModel(); ScheduleManager *manager( const QModelIndex &index ) const; }; //---------------------------------------- -class KPLATOMODELS_EXPORT ScheduleLogItemModel : public QStandardItemModel +class PLANMODELS_EXPORT ScheduleLogItemModel : public QStandardItemModel { Q_OBJECT public: enum DataRoles { SeverityRole = Qt::UserRole + 1, IdentityRole }; explicit ScheduleLogItemModel( QObject *parent = 0 ); ~ScheduleLogItemModel(); void setProject( Project *project ); Project *project() const { return m_project; } void setManager( ScheduleManager *manager ); ScheduleManager *manager() const { return m_manager; } virtual Qt::ItemFlags flags( const QModelIndex & index ) const; void refresh(); QString identity( const QModelIndex &idx ) const; protected Q_SLOTS: void slotManagerChanged( ScheduleManager *sch ); void slotScheduleChanged( MainSchedule *sch ); void slotScheduleManagerToBeRemoved( const ScheduleManager *manager ); void slotScheduleManagerRemoved( const ScheduleManager *manager ); void slotScheduleToBeInserted( const ScheduleManager *manager, int row ); void slotScheduleInserted( const MainSchedule *schedule ); void slotScheduleToBeRemoved( const MainSchedule *schedule ); void slotScheduleRemoved( const MainSchedule *schedule ); void slotLogInserted( MainSchedule*, int firstrow, int lastrow ); void projectDeleted(); protected: void addLogEntry( const Schedule::Log &log, int row ); private: Project *m_project; ScheduleManager *m_manager; MainSchedule *m_schedule; }; } //KPlato namespace #endif diff --git a/src/libs/models/kpttaskcompletedelegate.h b/src/libs/models/kpttaskcompletedelegate.h index 92befa6e..bcf02728 100644 --- a/src/libs/models/kpttaskcompletedelegate.h +++ b/src/libs/models/kpttaskcompletedelegate.h @@ -1,44 +1,44 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTTASKCOMPLETEDELEGATE_H #define KPTTASKCOMPLETEDELEGATE_H #include "kptitemmodelbase.h" class QModelIndex; namespace KPlato { -class KPLATOMODELS_EXPORT TaskCompleteDelegate : public ProgressBarDelegate +class PLANMODELS_EXPORT TaskCompleteDelegate : public ProgressBarDelegate { Q_OBJECT public: explicit TaskCompleteDelegate(QObject *parent = 0); ~TaskCompleteDelegate(); void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const; }; } //namespace KPlato #endif diff --git a/src/libs/models/kpttaskstatusmodel.h b/src/libs/models/kpttaskstatusmodel.h index 3d1e18ae..5a1d5e95 100644 --- a/src/libs/models/kpttaskstatusmodel.h +++ b/src/libs/models/kpttaskstatusmodel.h @@ -1,154 +1,154 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef TASKSTATUSMODEL_H #define TASKSTATUSMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "kptitemmodelbase.h" #include "kptnodeitemmodel.h" namespace KPlato { class Project; class Node; class Task; typedef QMap NodeMap; -class KPLATOMODELS_EXPORT TaskStatusItemModel : public ItemModelBase +class PLANMODELS_EXPORT TaskStatusItemModel : public ItemModelBase { Q_OBJECT public: explicit TaskStatusItemModel( QObject *parent = 0 ); ~TaskStatusItemModel(); enum PeriodType { UseCurrentDate, UseWeekday }; int periodType() const { return m_periodType; } void setPeriodType( int type ) { m_periodType = type; } /// Returns a column number/- name map for this model virtual const QMetaEnum columnMap() const { return m_nodemodel.columnMap(); } virtual void setProject( Project *project ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QModelIndex parent( const QModelIndex & index ) const; virtual QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex index( const Node *node ) const; virtual QModelIndex index( const NodeMap *lst ) const; virtual int columnCount( const QModelIndex & parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual QMimeData * mimeData( const QModelIndexList & indexes ) const; virtual QStringList mimeTypes () const; virtual Qt::DropActions supportedDropActions() const; virtual bool dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent ); NodeMap *list( const QModelIndex &index ) const; Node *node( const QModelIndex &index ) const; QAbstractItemDelegate *createDelegate( int column, QWidget *parent ) const; NodeMap nodeList( QDataStream &stream ); using ItemModelBase::dropAllowed; bool dropAllowed( Node *on, const QMimeData *data ); void clear(); void setNow(); void setPeriod( int days ) { m_period = days; } int period() const { return m_period; } void setWeekday( int day ) { m_weekday = day; } int weekday() const { return m_weekday; } /// Return the sortorder to be used for @p column virtual int sortRole( int column ) const; public Q_SLOTS: virtual void setScheduleManager( ScheduleManager *sm ); virtual void refresh(); protected Q_SLOTS: void slotAboutToBeReset(); void slotReset(); void slotNodeChanged( Node* ); void slotNodeToBeInserted( Node *node, int row ); void slotNodeInserted( Node *node ); void slotNodeToBeRemoved( Node *node ); void slotNodeRemoved( Node *node ); void slotNodeToBeMoved( Node *node, int pos, Node *newParent, int newPos ); void slotNodeMoved( Node *node ); void slotWbsDefinitionChanged(); void slotLayoutChanged(); protected: // keep in sync with order in m_top enum TaskStatus { TaskUnknownStatus = -1, TaskNotStarted = 0, TaskRunning = 1, TaskFinished = 2, TaskUpcoming = 3 }; QVariant alignment( int column ) const; QVariant name( int row, int role ) const; TaskStatusItemModel::TaskStatus taskStatus(const Task *task, const QDate &begin, const QDate &end); bool setCompletion( Node *node, const QVariant &value, int role ); bool setRemainingEffort( Node *node, const QVariant &value, int role ); bool setActualEffort( Node *node, const QVariant &value, int role ); bool setStartedTime( Node *node, const QVariant &value, int role ); bool setFinishedTime( Node *node, const QVariant &value, int role ); private: NodeModel m_nodemodel; QStringList m_topNames; QStringList m_topTips; QList m_top; NodeMap m_notstarted; NodeMap m_running; NodeMap m_finished; NodeMap m_upcoming; long m_id; // schedule id int m_period; // days int m_periodType; int m_weekday; }; } //namespace KPlato #endif diff --git a/src/libs/models/kpttreecombobox.h b/src/libs/models/kpttreecombobox.h index 8b3bcdd9..853a324a 100644 --- a/src/libs/models/kpttreecombobox.h +++ b/src/libs/models/kpttreecombobox.h @@ -1,82 +1,82 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTTREECOMBOBOX_H #define KPTTREECOMBOBOX_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include #include class QModelIndex; class QPersistentModelIndex; class QPaintEvent; class QTreeView; class QAbstractItemModel; namespace KPlato { -class KPLATOMODELS_EXPORT TreeComboBox : public KComboBox +class PLANMODELS_EXPORT TreeComboBox : public KComboBox { Q_OBJECT public: explicit TreeComboBox(QWidget *parent = 0); QTreeView *view() const; void setModel( QAbstractItemModel *model ); QAbstractItemModel *model() const; QList currentIndexes() const { return m_currentIndexes; } void setSelectionMode( QAbstractItemView::SelectionMode mode ); void showPopup(); Q_SIGNALS: void changed(); public Q_SLOTS: void setCurrentIndexes( const QModelIndexList &lst ); void setCurrentIndexes( const QList &lst ); protected: void paintEvent( QPaintEvent *event ); protected Q_SLOTS: void updateCurrentIndexes( const QModelIndexList &lst ); void slotSelectionChanged(); private: void updateView(); private: QAbstractItemView::SelectionMode m_selectionmode; QList m_showcolumns; bool m_showheader; QList m_currentIndexes; }; } //namespace KPlato #endif diff --git a/src/libs/models/kptworkpackagemodel.h b/src/libs/models/kptworkpackagemodel.h index 0b689cc3..1d890273 100644 --- a/src/libs/models/kptworkpackagemodel.h +++ b/src/libs/models/kptworkpackagemodel.h @@ -1,146 +1,146 @@ /* This file is part of the KDE project Copyright (C) 2007, 2012 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef WORKPACKAGEMODEL_H #define WORKPACKAGEMODEL_H -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include class QModelIndex; class QVariant; /// The main namespace namespace KPlato { class WorkPackage; class Node; class Task; class Project; class ScheduleManager; class NodeItemModel; -class KPLATOMODELS_EXPORT WorkPackageModel : public QObject +class PLANMODELS_EXPORT WorkPackageModel : public QObject { Q_OBJECT Q_ENUMS( Properties ) public: explicit WorkPackageModel( QObject *parent = 0 ) : QObject( parent ) {} ~WorkPackageModel() {} QVariant data( const WorkPackage *wp, int column, int role = Qt::DisplayRole ) const; protected: QVariant nodeName(const WorkPackage *wp, int role ) const; QVariant ownerName(const WorkPackage *wp, int role ) const; QVariant transmitionStatus(const WorkPackage *wp, int role ) const; QVariant transmitionTime(const WorkPackage *wp, int role ) const; QVariant completion( const WorkPackage *wp, int role ) const; }; /** The WPSortFilterProxyModel only accepts scheduled tasks. */ class WPSortFilterProxyModel : public QSortFilterProxyModel { Q_OBJECT public: explicit WPSortFilterProxyModel(QObject *parent = 0) : QSortFilterProxyModel( parent ) {} protected: /// Only accept scheduled tasks bool filterAcceptsRow(int source_row, const QModelIndex &sourceParent) const; }; /** The WorkPackageProxyModel offers a flat list of tasks with workpackage log entries as children. The tasks is fetched from the WPSortFilterProxyModel, the work packages is added by this model. It uses the NodeItemModel to get the tasks, the FlatProxyModel to convert to a flat list, and the WPSortFilterProxyModel to accept only scheduled tasks. It depends on the fact that the WPSortFilterProxyModel holds a flat list. */ -class KPLATOMODELS_EXPORT WorkPackageProxyModel : public QAbstractProxyModel +class PLANMODELS_EXPORT WorkPackageProxyModel : public QAbstractProxyModel { Q_OBJECT public: explicit WorkPackageProxyModel(QObject *parent = 0); Qt::ItemFlags flags(const QModelIndex &index) const; void setSourceModel( QAbstractItemModel *sourceModel ); bool hasChildren(const QModelIndex &parent) const; int rowCount( const QModelIndex &parent = QModelIndex() ) const; int columnCount( const QModelIndex &parent = QModelIndex() ) const; QModelIndex parent( const QModelIndex &child ) const; QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const; QVariant data( const QModelIndex &idx, int role = Qt::DisplayRole ) const; NodeItemModel *baseModel() const; QModelIndex mapToSource(const QModelIndex &proxyIndex) const; QModelIndex mapFromSource(const QModelIndex &sourceIndex) const; Task *taskFromIndex( const QModelIndex &idx ) const; QModelIndex indexFromTask( const Node *node ) const; public Q_SLOTS: void setProject( Project *project ); void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void sourceDataChanged(const QModelIndex& start, const QModelIndex& end); void sourceModelAboutToBeReset(); void sourceModelReset(); void sourceRowsAboutToBeInserted(const QModelIndex&, int, int ); void sourceRowsInserted(const QModelIndex&, int, int end); void sourceRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end); void sourceRowsRemoved(const QModelIndex& parent, int start, int); void sourceRowsAboutToBeMoved( const QModelIndex&, int sourceStart, int sourceEnd, const QModelIndex&, int destStart ); void sourceRowsMoved( const QModelIndex&, int , int , const QModelIndex&, int ); void workPackageToBeAdded(Node*, int); void workPackageAdded(Node*); void workPackageToBeRemoved(Node*, int); void workPackageRemoved(Node*); protected: QModelIndex mapFromBaseModel( const QModelIndex &idx ) const; void detachTasks( Task *task = 0 ); void attachTasks( Task *task = 0 ); inline bool isTaskIndex( const QModelIndex &idx ) const { return idx.isValid() && ! idx.internalPointer(); } inline bool isWorkPackageIndex( const QModelIndex &idx ) const { return idx.isValid() && idx.internalPointer(); } private: WorkPackageModel m_model; NodeItemModel *m_nodemodel; QList m_proxies; }; } //namespace KPlato #endif //WORKPACKAGEMODEL_H diff --git a/src/libs/models/reportgenerator/ReportGenerator.cpp b/src/libs/models/reportgenerator/ReportGenerator.cpp index 1659c419..e721c30a 100644 --- a/src/libs/models/reportgenerator/ReportGenerator.cpp +++ b/src/libs/models/reportgenerator/ReportGenerator.cpp @@ -1,107 +1,107 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "ReportGenerator.h" #include "ReportGeneratorOdt.h" #include namespace KPlato { ReportGenerator::ReportGenerator() : m_project(0) , m_manager(0) , m_reportGenerator(0) { } ReportGenerator::~ReportGenerator() { close(); } void ReportGenerator::setReportType(const QString &type) { m_reportType = type; } void ReportGenerator::setTemplateFile(const QString &file) { m_templateFile = file; } void ReportGenerator::setReportFile(const QString &file) { m_reportFile = file; } void ReportGenerator::setProject(Project *project) { m_project = project; } void ReportGenerator::setScheduleManager(ScheduleManager *manager) { m_manager = manager; } bool ReportGenerator::open() { m_lastError.clear(); if (m_reportType == "odt") { m_reportGenerator = new ReportGeneratorOdt(); m_reportGenerator->setTemplateFile(m_templateFile); m_reportGenerator->setReportFile(m_reportFile); m_reportGenerator->setProject(m_project); m_reportGenerator->setScheduleManager(m_manager); return m_reportGenerator->open(); } m_lastError = i18n("Unknown report type: %1", m_reportType); return false; } void ReportGenerator::close() { delete m_reportGenerator; m_reportGenerator = 0; } bool ReportGenerator::createReport() { if (!m_reportGenerator) { m_lastError = i18n("The report generator has not been opened successfully."); return false; } return m_reportGenerator->createReport(); } QString ReportGenerator::lastError() const { if (m_reportGenerator) { return m_reportGenerator->lastError(); } return m_lastError; } } //namespace KPlato diff --git a/src/libs/models/reportgenerator/ReportGenerator.h b/src/libs/models/reportgenerator/ReportGenerator.h index 29912a27..0aa9fad9 100644 --- a/src/libs/models/reportgenerator/ReportGenerator.h +++ b/src/libs/models/reportgenerator/ReportGenerator.h @@ -1,79 +1,79 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef REPORTGENERATOR_H #define REPORTGENERATOR_H #include #include #include #include class QIODevice; class QString; class KoXmlWriter; class KoStore; class KoOdfWriteStore; class KoOdfReadStore; namespace KPlato { class Project; class ScheduleManager; class ItemModelBase; -class KPLATOMODELS_EXPORT ReportGenerator +class PLANMODELS_EXPORT ReportGenerator { public: explicit ReportGenerator(); virtual ~ReportGenerator(); void setReportType(const QString &type); void setTemplateFile(const QString &file); void setReportFile(const QString &file); void setProject(Project *project); void setScheduleManager(ScheduleManager *manager); virtual bool open(); virtual void close(); virtual bool createReport(); QString lastError() const; protected: QString m_lastError; QString m_reportType; QString m_templateFile; QString m_reportFile; Project *m_project; ScheduleManager *m_manager; ReportGenerator *m_reportGenerator; }; } //namespace KPlato #endif // REPORTGENERATOR_H diff --git a/src/libs/models/reportgenerator/ReportGeneratorOdt.cpp b/src/libs/models/reportgenerator/ReportGeneratorOdt.cpp index 452d07c7..e2a4e6eb 100644 --- a/src/libs/models/reportgenerator/ReportGeneratorOdt.cpp +++ b/src/libs/models/reportgenerator/ReportGeneratorOdt.cpp @@ -1,1337 +1,1337 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "kplatomodels_export.h" +#include "planmodels_export.h" #include "ReportGeneratorOdt.h" #include "kptproject.h" #include "kptschedule.h" #include "kptnodeitemmodel.h" #include "kpttaskstatusmodel.h" #include "kptitemmodelbase.h" #include "kptnodechartmodel.h" #include "kptschedulemodel.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define HeaderRole Qt::UserRole + 543 const QLoggingCategory &PLANRG_LOG() { static const QLoggingCategory category("calligra.plan.reportodt"); return category; } #define dbgRG qCDebug(PLANRG_LOG)<(p->sourceModel())) { ChartItemModel *c = qobject_cast(p->sourceModel()); if (c) { return c; } } return 0; } bool startsWith(const QStringList &keys, const QString &key) { for (const QString k : keys) { if (key.startsWith(k)) { return true; } } return false; } QStringList trimmed(const QStringList &lst) { QStringList rlst; for (const QString &s : lst) { QString r = s.trimmed(); if (!r.isEmpty()) { rlst << r; } } return rlst; } bool addDataToFile(QByteArray &buffer, const QString &destName, KoStore &to) { QBuffer file(&buffer); if (!file.open(QIODevice::ReadOnly)) { dbgRG<<"Failed to open buffer"; return false; } if (!to.open(destName)) { dbgRG<<"Failed to open file for writing:"< 0; total += block) { data.resize(block); if (to.write(data) != block) { dbgRG<<"Failed to write block of data"; return false; } data.resize(8*1024); } to.close(); file.close(); return true; } QAbstractItemModel *translationModel() { QStandardItemModel *model = new QStandardItemModel(); QMap names; names["Project"] = i18n("Project"); names["Manager"] = i18n("Manager"); names["Schedule"] = i18n("Schedule"); names["BCWS"] = xi18nc("@title:column Budgeted Cost of Work Scheduled", "BCWS"); names["BCWP"] = xi18nc("@title:column Budgeted Cost of Work Performed", "BCWP"); names["ACWP"] = xi18nc("@title:column Actual Cost of Work Performed", "ACWP"); names["SPI"] = xi18nc("@title:column Schedule Performance Index", "SPI"); names["CPI"] = xi18nc("@title:column Cost Performance Index", "CPI"); for (int column = 0; column < names.count(); ++column) { model->setHeaderData(column, Qt::Horizontal, names.values().at(column)); model->setHeaderData(column, Qt::Horizontal, names.keys().at(column), HeaderRole); } return model; } QAbstractItemModel *projectModel() { QList > names; names << QPair("Name", i18n("Name")) << QPair("Manager", i18n("Manager")) << QPair("BCWS Cost", i18nc("Cost based Budgeted Cost of Work Scheduled", "BCWS Cost")) << QPair("BCWP Cost", i18nc("Cost based Budgeted Cost of Work Performed", "BCWP Cost")) << QPair("ACWP Cost", i18nc("Cost based Actual Cost of Work Performed", "ACWP Cost")) << QPair("SPI Cost", i18nc("Cost based Schedule Performance Index", "SPI Cost")) << QPair("CPI Cost", i18nc("Cost based Cost Performance Index", "CPI Cost")) << QPair("BCWS Effort", i18nc("Effort based Budgeted Cost of Work Scheduled", "BCWS Effort")) << QPair("BCWP Effort", i18nc("Effort based Budgeted Cost of Work Performed", "BCWP Effort")) << QPair("ACWP Effort", i18nc("Effort based Actual Cost of Work Performed", "ACWP Effort")) << QPair("SPI Effort", i18nc("Effort based Schedule Performance Index", "SPI Effort")) << QPair("CPI Effort", i18nc("Effort based Cost Performance Index", "CPI Effort")); QStandardItemModel *model = new QStandardItemModel(0, names.count()); for (int column = 0; column < names.count(); ++column) { model->setHeaderData(column, Qt::Horizontal, names.at(column).first, HeaderRole); model->setHeaderData(column, Qt::Horizontal, names.at(column).second); } return model; } void initProjectModel(QAbstractItemModel *model, Project *project, ScheduleManager *sm) { if (model->rowCount() == 0) { model->insertRow(0); } QModelIndex idx = model->index(0, 0); model->setData(idx, project->name()); idx = model->index(0, 1); model->setData(idx, project->leader()); PerformanceDataCurrentDateModel m(0); m.setProject(project); m.setScheduleManager(sm); m.setNodes(QList() << project); int col = 2; // column of BCWS Cost for (int r = 0; r < 2; ++r) { for (int c = 0; c < 5; ++c) { idx = model->index(0, col++); QModelIndex cidx = m.index(r, c); model->setData(idx, cidx.data()); } } } QAbstractItemModel *scheduleModel() { ScheduleItemModel m; QStandardItemModel *model = new QStandardItemModel(0, m.columnCount()); for (int c = 0; c < m.columnCount(); ++c) { model->setHeaderData(c, Qt::Horizontal, m.headerData(c, Qt::Horizontal)); model->setHeaderData(c, Qt::Horizontal, m.headerData(c, Qt::Horizontal, Qt::EditRole), HeaderRole); } return model; } void initScheduleModel(QAbstractItemModel *model, Project *project, ScheduleManager *sm) { ScheduleItemModel m; m.setProject(project); QModelIndex idx = m.index(sm); if (idx.isValid()) { if (model->rowCount() == 0) { model->insertRow(0); } for (QModelIndex i = idx; i.isValid(); i = i.sibling(i.row(), i.column() + 1)) { QModelIndex midx = model->index(0, i.column()); model->setData(midx, i.data()); dbgRGVariable<headerData(midx.column(), Qt::Horizontal, HeaderRole).toString()<<'='<rowCount()<columnCount(); } //-------------------------------------- ReportGeneratorOdt::ReportGeneratorOdt() : ReportGenerator() , m_templateStore(0) { m_keys = QStringList() << "table" << "chart"; m_variables = QStringList() << "project" << "schedule"; m_basemodels << new NodeItemModel() << new TaskStatusItemModel() << new ChartItemModel() << new ScheduleItemModel(); m_datamodels["tasks"] = m_basemodels.at(0); m_headerrole["tasks"] = Qt::EditRole; m_datamodels["taskstatus"] = m_basemodels.at(1); m_headerrole["taskstatus"] = Qt::EditRole; m_datamodels["chart.project"] = m_basemodels.at(2); m_headerrole["chart.project"] = Qt::EditRole; m_datamodels["projects"] = projectModel(); m_headerrole["projects"] = HeaderRole; m_datamodels["schedules"] = m_basemodels.at(3); m_headerrole["schedules"] = Qt::EditRole; m_datamodels["project"] = projectModel(); m_headerrole["project"] = HeaderRole; m_datamodels["schedule"] = scheduleModel(); m_headerrole["schedule"] = HeaderRole; m_datamodels["tr"] = translationModel(); m_headerrole["tr"] = HeaderRole; } ReportGeneratorOdt::~ReportGeneratorOdt() { for (QAbstractItemModel *m : m_datamodels) { if (!m_basemodels.contains(qobject_cast(m))) { delete m; } } qDeleteAll(m_basemodels); close(); } bool ReportGeneratorOdt::open() { m_lastError.clear(); if (m_templateFile.isEmpty()) { m_lastError = i18n("Missing report template file"); return false; } if (m_reportFile.isEmpty()) { m_lastError = i18n("Missing report result file"); return false; } if (m_templateStore) { m_lastError = i18n("Report generator is already open"); return false; } m_templateStore = KoStore::createStore(m_templateFile, KoStore::Read); if (!m_templateStore) { dbgRG<<"Failed to open store:"<setProject(m_project); m->setScheduleManager(m_manager); if (qobject_cast(m)) { qobject_cast(m)->setNodes(QList() << m_project); dbgRGChart<<"chart:"<urlOfStore(); KoOdfReadStore reader(m_templateStore); if (!reader.loadAndParse(m_lastError)) { dbgRG<<"Failed to loadAndParse:"<endElement(); // office:document-content writer->endDocument(); if (!outStore->addDataToFile(buffer.buffer(), "content.xml")) { dbgRG<<"Failed to open 'content.xml' for writing"; m_lastError = i18n("Failed to write to store: %1", QString("content.xml")); delete writer; delete outStore; return false; } buffer.close(); if (m_manifestfiles.contains("styles.xml")) { dbgRG << endl << "---- treat styles.xml (for master-page headers/footers) ----" << endl; QBuffer buffer2; KoXmlWriter *styles = createOasisXmlWriter(reader, &buffer2, "styles.xml", "office:document-styles"); if (!styles) { dbgRG<<"Failed to create styles.xml writer"; return false; } KoXmlDocument stylesDoc; if (!reader.loadAndParse("styles.xml", stylesDoc, m_lastError)) { debugPlan<<"Failed to read styles.xml"<endElement(); // office:document-styles styles->endDocument(); if (!outStore->addDataToFile(buffer2.buffer(), "styles.xml")) { dbgRG<<"Failed to open 'styles.xml' for writing"; m_lastError = i18n("Failed to write to store: %1", QString("styles.xml")); delete writer; delete outStore; } m_manifestfiles.removeAt(m_manifestfiles.indexOf("styles.xml")); } dbgRG << endl << "---- treat the embedded files ----" << endl; treatEmbededObjects(reader, *outStore); dbgRG << endl << "---- copy rest of files ----" << endl; for (const QString &f : m_manifestfiles) { copyFile(*reader.store(), *outStore, f); } if (!outStore->finalize()) { dbgRG<<"Failed to write store:"<urlOfStore(); m_lastError = i18n("Failed to write report file: %1", outStore->urlOfStore().path()); delete writer; delete outStore; return false; } delete writer; delete outStore; dbgRG<<"finished"; return true; } bool ReportGeneratorOdt::handleTextP(KoXmlWriter &writer, const KoXmlElement &textp) { Q_UNUSED(writer); dbgRG<<"Check:"<type + '.' + field->dataName; field->setModel(dataModel(modelName), m_headerrole[modelName]); dbgRGChart<<"Found chart:"<seqNr = -1; dbgRGTable<type != "table") { return false; } dbgRGTable; UserField *field = m_userfields[m_activefields.last()]; field->seqNr = 0; // we are in header row return false; } bool ReportGeneratorOdt::treatTableRow(KoXmlWriter &writer, const KoXmlElement &rowElement) { if (m_activefields.isEmpty() || m_userfields[m_activefields.last()]->type != "table") { return false; } UserField *field = m_userfields[m_activefields.last()]; dbgRGTable<seqNr; if (field->seqNr == -1) { // there is no header row, so start with data rows directly field->seqNr = 1; } if (field->seqNr == 0) { // header row writer.startElement("table:table-row"); writeElementAttributes(writer, rowElement); writeChildElements(writer, rowElement); writer.endElement(); field->seqNr = 1; // next is first row } else { dbgRGTable<<" add rows:"<rowCount(); for (field->begin(); field->next();) { writer.startElement("table:table-row"); writeElementAttributes(writer, rowElement); writeChildElements(writer, rowElement); writer.endElement(); } } return true; } ReportGeneratorOdt::UserField *ReportGeneratorOdt::findUserField(const KoXmlElement &decl) const { UserField *field = 0; QString name = decl.attributeNS(KoXmlNS::text, "name"); // eg: table1 or table1.Type or project.name or tr.bcws field = m_userfields.value(name); // if Variable or Translation if (!field) { QStringList lst = name.split('.'); for (const QString k : m_userfields.keys()) { if (lst.first().startsWith(k)) { field = m_userfields[k]; break; } } } return field; } void ReportGeneratorOdt::treatUserFieldGet(KoXmlWriter &writer, const KoXmlElement &e) { dbgRG<variant() == UserField::Rows) { QString name = e.attributeNS(KoXmlNS::text, "name"); // eg: table1.type QString value = e.text(); // eg: type or name QString data = field->data(value); writer.addTextNode(data); dbgRGTable<<"rows:"<variant() == UserField::Header) { QString name = e.attributeNS(KoXmlNS::text, "name"); // eg: table1.type QString value = e.text(); // eg: type or BCWS Cost QString data = field->headerData(value); writer.addTextNode(data); dbgRGTable<<"header row:"<variant() == UserField::Variable) { QString name = e.attributeNS(KoXmlNS::text, "name"); // eg: project.name dbgRGVariable<<"variable:"<columns.value(0)<data(field->columns.value(0)); writer.addTextNode(field->data(field->columns.value(0))); // a variable has only one column } else if (field->variant() == UserField::Translation) { QString name = e.attributeNS(KoXmlNS::text, "name"); // eg: tr.bcws QString data = i18n(field->dataName.toLatin1()); if (field->headerNames.contains(field->dataName)) { data = field->data(field->dataName); } dbgRGTr<<"translation:"<dataName<<'='<name = name; m_userfields[field->name] = field; field->dataName = value; field->seqNr = -3; field->columns << value; field->setModel(dataModel("tr"), m_headerrole["tr"]); dbgRGTr<<" added translation"<name<dataName; } else if (m_variables.contains(tags.first())) { Q_ASSERT(tags.count() >= 2); Q_ASSERT(!m_userfields.contains(tags.first())); UserField *field = new UserField(); field->name = name; m_userfields[field->name] = field; field->dataName = tags.first(); field->seqNr = -2; QStringList vl = value.split(';'); if (!vl.isEmpty()) { field->columns << vl.takeFirst(); field->properties = vl; } field->setModel(dataModel(field->dataName), m_headerrole[field->dataName]); dbgRGVariable<<" added variable"<name<columns<properties; } else { for (const QString k : m_keys) { const QString vname = tags.first(); if (!vname.startsWith(k)) { continue; } if (tags.count() == 1) { // this is the main definition (eg: name: "table1", value: "tasks ...") if (!m_userfields.contains(vname)) { m_userfields[vname] = new UserField(); } UserField *field = m_userfields[vname]; field->name = vname; field->type = k; QStringList vl = trimmed(value.toLower().split(';', QString::SkipEmptyParts)); field->dataName = vl.takeFirst(); field->properties += vl; field->setModel(dataModel(field->dataName), m_headerrole[field->dataName]); if (k == "chart") { dbgRGChart<<" "<<"added tag:"<properties; } else { dbgRG<<" "<<"added tag:"<properties; } } else { // this is the fields column definitions (eg: name: "table1.type" value: "") if (!m_userfields.contains(vname)) { m_userfields[vname] = new UserField(); } UserField *field = m_userfields[vname]; field->name = vname; field->columns << value.trimmed().toLower(); dbgRG<<" "<<"added column:"<name<columns; } } } } writer.startElement("text:user-field-decls"); writeElementAttributes(writer, decls); writeChartElements(writer, decls); writer.endElement(); } void ReportGeneratorOdt::writeElementAttributes(KoXmlWriter &writer, const KoXmlElement &element, const QStringList &exclude) { for (const QPair &a : element.attributeFullNames()) { QString prefix = KoXmlNS::nsURI2NS(a.first); if (prefix.isEmpty()) { dbgRG<<" Skipping unknown namespace:"<"<hasFile("META-INF/manifest.xml")) { dbgRG<<"No manifest file"; return 0; } KoXmlDocument manifest; if (!reader.loadAndParse("META-INF/manifest.xml", manifest, m_lastError)) { dbgRG<<"Failed to read manifest:"<hasFile("mimetype")) { if (!copyFile(*reader.store(), *out, "mimetype")) { m_lastError = i18n("Failed to load manifest file"); delete out; return 0; } } if (!copyFile(*reader.store(), *out, "META-INF/manifest.xml")) { m_lastError = i18n("Failed to write manifest file"); delete out; return 0; } KoXmlElement e; forEachElement(e, manifest.documentElement()) { dbgRG<hasFile(fileName); if (reader.store()->isOpen()) { reader.store()->close(); } if (!reader.store()->open(fileName)) { dbgRG << "Entry " << fileName << " not found!"; m_lastError = xi18nc("@info", "Failed to open file %1 from store.", fileName); return 0; } if (!reader.store()->device()->isOpen()) { reader.store()->device()->open(QIODevice::ReadOnly); } KoXmlWriter *writer = 0; QXmlStreamReader xml(reader.store()->device()); xml.setNamespaceProcessing(true); while (!xml.atEnd()) { xml.readNext(); if (xml.tokenType() == QXmlStreamReader::StartElement && !xml.namespaceDeclarations().isEmpty()) { writer = new KoXmlWriter(buffer); writer->startDocument(rootElementName); writer->startElement(rootElementName); writer->addAttribute("xmlns:calligra", KoXmlNS::calligra); // Note: windows needs this type of iteration QXmlStreamNamespaceDeclarations dcl = xml.namespaceDeclarations(); for (int ns = 0; ns < dcl.count(); ++ns) { dbgRGTmp<<"add namespace:"<<("xmlns:" + dcl[ns].prefix())<addAttribute(("xmlns:" + dcl[ns].prefix()).toLatin1(), dcl[ns].namespaceUri().toUtf8()); } QXmlStreamAttributes attr = xml.attributes(); for (int a = 0; a < attr.count(); ++a) { dbgRGTmp<<"add attribute:"<addAttribute(attr[a].qualifiedName().toLatin1(), attr[a].value().toUtf8()); } } } reader.store()->close(); if (!writer) { dbgRG<<"Failed to find a start elemet with namespace declarations in"<%1", fileName); } return writer; } void ReportGeneratorOdt::treatEmbededObjects(KoOdfReadStore &reader, KoStore &outStore) { dbgRGChart; {QMap::const_iterator it; for (it = m_embededcharts.constBegin(); it != m_embededcharts.constEnd(); ++it) { treatChart(reader, outStore, it.key(), it.value()); }} {QMap::const_iterator it; for (it = m_embededgantts.constBegin(); it != m_embededgantts.constEnd(); ++it) { treatGantt(reader, outStore, it.key(), it.value()); }} } void ReportGeneratorOdt::treatChart(KoOdfReadStore &reader, KoStore &outStore, const QString &name, const QString &dir) { dbgRGChart<dataName == "project") { ChartItemModel *m = findChartItemModel(field->model); if (m) { m->setNodes(QList() << m_project); } if (field->properties.isEmpty()) { // default: take all for (const QString &c : field->headerNames) { field->columns << c; } } else { QStringList values; for (const QString &p : field->properties) { if (p.startsWith("values")) { QStringList vl = p.split("="); Q_ASSERT(vl.count() > 1); Q_ASSERT(vl.at(0) == "values"); for (const QString &v : vl.at(1).split(',')) { values << v.toLower().trimmed(); } } } field->columns = values; } dbgRGChart<endElement(); // office:document-content writer->endDocument(); dbgRGChart<toString(); if (!outStore.addDataToFile(buffer.buffer(), file)) { dbgRGChart<<"Failed to open"<hasLabels = e.attributeNS(KoXmlNS::chart, "data-source-has-labels"); writer.startElement(tag.constData()); writeElementAttributes(writer, e); writeChartElements(writer, e); writer.endElement(); } else if (tag == "chart:categories") { // assume this is x-axis UserField *field = m_userfields[m_activefields.last()]; int columns = field->columnCount(); if (columns > 0) { writer.startElement(tag.constData()); writeElementAttributes(writer, e, QStringList() << "table:cell-range-address"); int startRow = 1; if (field->hasLabels == "both" || field->hasLabels == "primary-x") { ++startRow; } QString end = QString("local-table.$A$%1:$A$%2").arg(startRow).arg(startRow+field->rowCount()-1); writer.addAttribute("table:cell-range-address", end); writeChartElements(writer, e); writer.endElement(); } } else if (tag == "chart:series") { UserField *field = m_userfields[m_activefields.last()]; int columns = field->columnCount(); if (columns > 0 && field->serieNr < columns) { int startRow = 1; if (field->hasLabels == "both" || field->hasLabels == "primary-x") { ++startRow; } char startColumn = 'A'; if (field->hasLabels == "both" || field->hasLabels == "primary-y") { ++startColumn; } writer.startElement(tag.constData()); writeElementAttributes(writer, e, QStringList() << "chart:values-cell-range-address"<<"chart:label-cell-address"); QChar c(startColumn + field->serieNr); QString lab = QString("local-table.$%1$1").arg(c); writer.addAttribute("chart:values-cell-address", lab); QString end = QString("local-table.$%1$%2:$%1$%3").arg(c).arg(startRow).arg(startRow+field->rowCount()-1); writer.addAttribute("chart:values-cell-range-address", end); writer.startElement("chart:data-point"); writer.addAttribute("chart:repeated", field->rowCount()); writer.endElement(); writer.endElement(); ++field->serieNr; } } else if (tag == "chart:data-point") { // do nothing handled under chart:series } else if (tag == "table:table-header-columns") { writer.startElement(tag.constData()); writer.startElement("table:table-column"); // just an empty tag writer.endElement(); writer.endElement(); } else if (tag == "table:table-columns") { writer.startElement(tag.constData()); writeChartElements(writer, e); writer.endElement(); } else if (tag == "table:table-column") { int columns = m_userfields[m_activefields.last()]->columnCount(); writer.startElement(tag.constData()); writer.addAttribute("table:number-columns-repeated", columns); writer.endElement(); } else if (tag == "table:table-header-rows") { writer.startElement(tag.constData()); writer.startElement("table:table-row"); // first column not used, just an empty cell writer.startElement("table:table-cell"); writer.startElement("text:p"); writer.endElement(); writer.endElement(); // write legends UserField *field = m_userfields[m_activefields.last()]; for (const QString &name : field->columns) { QString value = field->headerData(name); writer.startElement("table:table-cell"); writer.addAttribute("office:value-type", "string"); writer.startElement("text:p"); writer.addTextNode(value); writer.endElement(); writer.endElement(); } writer.endElement(); writer.endElement(); } else if (tag == "table:table-rows") { writer.startElement(tag.constData()); UserField *field = m_userfields[m_activefields.last()]; int columns = field->columnCount(); if (columns > 0) { int rows = field->model.rowCount(); for (int r = 0; r < rows; ++r) { writer.startElement("table:table-row"); // first x-axis labels QDate date = QDate(field->model.headerData(r, Qt::Vertical, Qt::EditRole).toDate()); // NOTE: 1899-12-30 is the reference date, but could it depend on style? int day = QDate(1899, 12, 30).daysTo(date); writer.startElement("table:table-cell"); writer.addAttribute("office:value", day); writer.addAttribute("office:value-type", "float"); writer.startElement("text:p"); writer.addTextNode(QString::number(day)); writer.endElement(); writer.endElement(); // then the data for (const QString &name : field->columns) { QVariant value = field->model.index(r, field->column(name)).data(); writer.startElement("table:table-cell"); writer.addAttribute("office:value-type", "float"); writer.addAttribute("office:value", value.toDouble()); writer.startElement("text:p"); writer.addTextNode(QString::number(value.toDouble())); writer.endElement(); writer.endElement(); } writer.endElement(); } } writer.endElement(); } else if (tag == "chart:legend") { writer.startElement(tag.constData()); if (!e.hasAttributeNS(KoXmlNS::chart, "legend-align") && e.hasAttributeNS(KoXmlNS::chart, "legend-position")) { // lowriter does not specify this attribute // If legend-position is start, end, top or bottom // we need to have legend-align == center so that words // repositions the legend correctly QStringList lst = QStringList() << "start" << "end" << "top" << "bottom"; if (lst.contains(e.attributeNS(KoXmlNS::chart, "legend-position"))) { writer.addAttribute("chart:legend-align", "center"); dbgRGChart<<"adding legend-align"; } } writeElementAttributes(writer, e); writeChartElements(writer, e); writer.endElement(); } else { writer.startElement(tag.constData()); writeElementAttributes(writer, e); writeChartElements(writer, e); writer.endElement(); } } } void ReportGeneratorOdt::listChildNodes(const QDomNode &parent) { QDomNodeList lst = parent.childNodes(); for (int i = 0; i < lst.count(); ++i) { if (lst.at(i).isElement()) { QDomElement e = lst.at(i).toElement(); dbgRG<<"Element:"<model.setSourceModel(model); for (int c = 0; c < this->model.columnCount(); ++c) { headerNames << this->model.headerData(c, Qt::Horizontal, role).toString().toLower(); } } int ReportGeneratorOdt::UserField::column(const QString &columnName) const { QStringList l = columnName.split('.'); int c = l.isEmpty() ? -1 : headerNames.indexOf(l.last().toLower()); dbgRGTable<<" column:"<column(column), currentIndex.parent()); } else { idx = model.index(0, this->column(column)); } QString s = "No data"; if (idx.isValid()) { s = model.data(idx).toString(); } dbgRG< This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef REPORTGENERATORODT_H #define REPORTGENERATORODT_H #include "ReportGenerator.h" #include #include #include #include class QIODevice; class QString; class QBuffer; class KoXmlWriter; class KoStore; class KoOdfWriteStore; class KoOdfReadStore; namespace KPlato { class Project; class ScheduleManager; class ItemModelBase; -class KPLATOMODELS_EXPORT ReportGeneratorOdt : public ReportGenerator +class PLANMODELS_EXPORT ReportGeneratorOdt : public ReportGenerator { public: explicit ReportGeneratorOdt(); ~ReportGeneratorOdt(); bool open(); void close(); bool createReport(); protected: bool createReportOdt(); bool handleTextP(KoXmlWriter &writer, const KoXmlElement &textp); void handleDrawFrame(KoXmlWriter &writer, const KoXmlElement &frame); void treatText(KoXmlWriter &writer, const KoXmlText &text); void treatTable(KoXmlWriter &writer, const KoXmlElement &tableElement); bool treatTableHeaderRows(KoXmlWriter &writer, const KoXmlElement &headerRowElement); bool treatTableRow(KoXmlWriter &writer, const KoXmlElement &rowElement); void treatUserFieldGet(KoXmlWriter &writer, const KoXmlElement &e); void writeElementAttributes(KoXmlWriter &writer, const KoXmlElement &element, const QStringList &exclude = QStringList()); void writeChildElements(KoXmlWriter &writer, const KoXmlElement &parent); bool copyFile(KoStore &from, KoStore &to, const QString &file); KoStore *copyStore(KoOdfReadStore &reader, const QString &outfile); KoXmlWriter *createOasisXmlWriter(KoOdfReadStore &reader, QBuffer *buffer, const QString fileName, const char *rootElementName); void treatEmbededObjects(KoOdfReadStore &reader, KoStore &outStore); void treatChart(KoOdfReadStore &reader, KoStore &outStore, const QString &name, const QString &file); void treatGantt(KoOdfReadStore &reader, KoStore &outStore, const QString &name, const QString &file); void writeChartElements(KoXmlWriter &writer, const KoXmlElement &parent); void listChildNodes(const QDomNode &parent); void handleUserFieldDecls(KoXmlWriter &writer, const KoXmlElement &decls); QAbstractItemModel *dataModel(const QString &name) const; public: class UserField { public: enum Variant { None, Header, Rows, Variable, Translation }; UserField() : seqNr(-1), serieNr(0) {} int variant() const; void begin(); bool next(); QString headerData(const QString &columnName) const; QString data(const QString &columnName) const; int rowCount(); int columnCount() const {return columns.count();} void setModel(QAbstractItemModel *model, int role); int column(const QString &columnName) const; QString name; // Name of this field (eg: table1) QString type; // Type of field (eg: table) QString dataName; // Name associated with the data (eg: tasks) QStringList properties; // Info on how to handle the data (eg: values=bcws,bcwp,acwp) QStringList headerNames; // Lowercase list of all header names QStringList columns; // Lowercase list of headernames that shall be used QSortFilterProxyModel model; int seqNr; // A sequence number used to tabulate column names (eg: seqNr=2: table1.name2) int serieNr; // A chart needs to know which data serie it works with QString hasLabels; // A chart needs to know if data shall contain legends/labels QModelIndex currentIndex; }; UserField *findUserField(const KoXmlElement &decl) const; private: KoStore *m_templateStore; QStringList m_manifestfiles; QList m_sortedfields; QList m_activefields; QMap m_userfields; QMap m_embededcharts; QMap m_embededgantts; QStringList m_keys; QStringList m_variables; QMap m_datamodels; QMap m_headerrole; QList m_basemodels; QList m_tags; // cache tags for survival }; QDebug operator<<(QDebug dbg, ReportGeneratorOdt::UserField *f); QDebug operator<<(QDebug dbg, ReportGeneratorOdt::UserField &f); } //namespace KPlato #endif // REPORTGENERATOR_H diff --git a/src/libs/models/tests/CMakeLists.txt b/src/libs/models/tests/CMakeLists.txt index 92f7aaa2..9c2e9da2 100644 --- a/src/libs/models/tests/CMakeLists.txt +++ b/src/libs/models/tests/CMakeLists.txt @@ -1,22 +1,22 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) include_directories( .. ../../kernel ${KOODF_INCLUDES} ${KUNDO2_INCLUDES}) # call: planmodels_add_unit_test( LINK_LIBRARIES [ [...]] [GUI]) macro(PLANMODELS_ADD_UNIT_TEST _TEST_NAME) ecm_add_test( ${ARGN} TEST_NAME "${_TEST_NAME}" NAME_PREFIX "plan-models-" ) endmacro() ########### next target ############### -planmodels_add_unit_test(ResourceModelTester ResourceModelTester.cpp LINK_LIBRARIES kplatomodels Qt5::Test) +planmodels_add_unit_test(ResourceModelTester ResourceModelTester.cpp LINK_LIBRARIES planmodels Qt5::Test) ########## next target ############### -planmodels_add_unit_test(FlatProxyModelTester FlatProxyModelTester.cpp LINK_LIBRARIES kplatomodels Qt5::Test) +planmodels_add_unit_test(FlatProxyModelTester FlatProxyModelTester.cpp LINK_LIBRARIES planmodels Qt5::Test) ########## next target ############### -planmodels_add_unit_test(WorkPackageProxyModelTester WorkPackageProxyModelTester.cpp LINK_LIBRARIES kplatomodels Qt5::Test) +planmodels_add_unit_test(WorkPackageProxyModelTester WorkPackageProxyModelTester.cpp LINK_LIBRARIES planmodels Qt5::Test) diff --git a/src/libs/ui/CMakeLists.txt b/src/libs/ui/CMakeLists.txt index 758fbaef..9842049c 100644 --- a/src/libs/ui/CMakeLists.txt +++ b/src/libs/ui/CMakeLists.txt @@ -1,183 +1,183 @@ include_directories( ${PLANKERNEL_INCLUDES} ${PLANMODELS_INCLUDES} ${PLANMAIN_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIR} ) #add_subdirectory( tests ) ########### KPlato private library ############### if (PLAN_USE_KREPORT) message(STATUS "-- Building plan with reports capability") add_subdirectory(reports/items) set(planreports_LIB_SRC reports/reportview.cpp reports/reportdata.cpp reports/reportsourceeditor.cpp reports/reportscripts.cpp ) set(planreports_ui_LIB_SRCS reports/reportsourceeditor.ui reports/reportnavigator.ui reports/reportsectionswidget.ui reports/reportgroupsectionswidget.ui reports/reporttoolswidget.ui ) endif() -set(kplatoui_LIB_SRCS +set(planui_LIB_SRCS ${planreports_LIB_SRC} Help.cpp TasksEditController.cpp TasksEditDialog.cpp welcome/WelcomeView.cpp reportsgenerator/ReportsGeneratorView.cpp kptganttitemdelegate.cpp kptworkpackagesendpanel.cpp kptworkpackagesenddialog.cpp kptdocumentseditor.cpp kptdocumentspanel.cpp kptitemviewsettup.cpp kptsplitterview.cpp kptrelationeditor.cpp kptdependencyeditor.cpp kptusedefforteditor.cpp kpttaskstatusview.cpp kptcalendareditor.cpp kptviewbase.cpp kptaccountseditor.cpp kptperteditor.cpp kptpertresult.cpp kpttaskeditor.cpp kptresourceeditor.cpp kptscheduleeditor.cpp kptsummarytaskdialog.cpp kptsummarytaskgeneralpanel.cpp kptresourceappointmentsview.cpp kptaccountsviewconfigdialog.cpp kptaccountsview.cpp kpttaskcostpanel.cpp kptmilestoneprogresspanel.cpp kptmilestoneprogressdialog.cpp kpttaskdialog.cpp kptmainprojectdialog.cpp kptmainprojectpanel.cpp kptganttview.cpp kptrelationdialog.cpp kptrequestresourcespanel.cpp kptresourcedialog.cpp kptstandardworktimedialog.cpp kptintervaledit.cpp kpttaskgeneralpanel.cpp kpttaskprogresspanel.cpp kpttaskprogressdialog.cpp kpttaskdescriptiondialog.cpp kptwbsdefinitiondialog.cpp kptwbsdefinitionpanel.cpp kptresourceassignmentview.cpp kptperformancetablewidget.cpp kptresourceallocationeditor.cpp kptworkpackagemergedialog.cpp kptrecalculatedialog.cpp kpthtmlview.cpp locale/localemon.cpp kptlocaleconfigmoneydialog.cpp ResourceAllocationView.cpp ) -ki18n_wrap_ui(kplatoui_LIB_SRCS +ki18n_wrap_ui(planui_LIB_SRCS ${planreports_ui_LIB_SRCS} welcome/WelcomeView.ui kptresourceappointmentsdisplayoptions.ui kptganttchartdisplayoptions.ui kptprintingheaderfooter.ui kptganttprintingoptions.ui kptworkpackagesendpanel.ui kptdocumentspanel.ui kptperformancestatus.ui kptcpmwidget.ui kptitemviewsettings.ui kptpertresult.ui standardworktimedialogbase.ui kptwbsdefinitionpanelbase.ui kptaccountsviewconfigurepanelbase.ui kptintervaleditbase.ui kpttaskcostpanelbase.ui kpttaskdescriptionpanelbase.ui kptsummarytaskgeneralpanelbase.ui kptmilestoneprogresspanelbase.ui resourcedialogbase.ui kptmainprojectpanelbase.ui relationpanel.ui kpttaskgeneralpanelbase.ui kpttaskprogresspanelbase.ui kptperteditor.ui kptresourceassignmentview.ui kpttaskstatusviewsettingspanel.ui kptperformancestatusviewsettingspanel.ui kptworkpackagemergepanel.ui kptrecalculatedialog.ui kptscheduleeditor.ui locale/localemon.ui ) -add_library(kplatoui SHARED ${kplatoui_LIB_SRCS}) -generate_export_header(kplatoui) +add_library(planui SHARED ${planui_LIB_SRCS}) +generate_export_header(planui) -target_link_libraries(kplatoui +target_link_libraries(planui PUBLIC planmain - kplatomodels + planmodels KF5::KHtml PRIVATE KChart KF5::ItemViews KF5::IconThemes KF5::Archive KF5::TextWidgets # Qt5::Sql ) if (PLAN_USE_KREPORT) - target_link_libraries(kplatoui PUBLIC KReport PRIVATE KPropertyWidgets) + target_link_libraries(planui PUBLIC KReport PRIVATE KPropertyWidgets) endif() if(KF5AkonadiContact_FOUND) - target_link_libraries(kplatoui PRIVATE KF5::AkonadiContact) + target_link_libraries(planui PRIVATE KF5::AkonadiContact) endif() -set_target_properties(kplatoui PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) +set_target_properties(planui PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) -install(TARGETS kplatoui ${INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS planui ${INSTALL_TARGETS_DEFAULT_ARGS}) # reports files install(FILES reportsgenerator/ProjectPerformanceCost.odt reportsgenerator/ProjectPerformance.odt reportsgenerator/TaskStatus.odt DESTINATION ${DATA_INSTALL_DIR}/calligraplan/reports ) diff --git a/src/libs/ui/Help.h b/src/libs/ui/Help.h index 65a44f33..c9815b2a 100644 --- a/src/libs/ui/Help.h +++ b/src/libs/ui/Help.h @@ -1,62 +1,62 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef WHATSTHIS_H #define WHATSTHIS_H -#include "kplatoui_export.h" +#include "planui_export.h" #include class QEvent; // FIXME: do not leak this namespace KPlato { -class KPLATOUI_EXPORT Help +class PLANUI_EXPORT Help { public: Help(const QString &docpath); static void add(QWidget *widget, const QString &text); static QString page(const QString &page = QString()); protected: ~Help(); private: static Help* self; QString m_docpath; }; -class KPLATOUI_EXPORT WhatsThisClickedEventHandler : public QObject +class PLANUI_EXPORT WhatsThisClickedEventHandler : public QObject { Q_OBJECT public: WhatsThisClickedEventHandler(QObject *parent=0); bool eventFilter(QObject *object, QEvent *event); }; } // namespace KPlato #endif // WHATSTHIS_H diff --git a/src/libs/ui/TasksEditController.h b/src/libs/ui/TasksEditController.h index 43066329..73726018 100644 --- a/src/libs/ui/TasksEditController.h +++ b/src/libs/ui/TasksEditController.h @@ -1,74 +1,74 @@ /* This file is part of the KDE project Copyright (C) 2002 Bo Thorsen bo@sonofthor.dk Copyright (C) 2004 -2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef TASKSEDITCONTROLLER_H #define TASKSEDITCONTROLLER_H -#include "kplatoui_export.h" +#include "planui_export.h" #include class KUndo2Command; namespace KPlato { class Accounts; class TaskGeneralPanel; class RequestResourcesPanel; class DocumentsPanel; class TaskCostPanel; class TaskDescriptionPanel; class Node; class Task; class Project; class MacroCommand; class TasksEditDialog; /** * The dialog that allows you to alter multiple tasks. */ -class KPLATOUI_EXPORT TasksEditController : public QObject +class PLANUI_EXPORT TasksEditController : public QObject { Q_OBJECT public: TasksEditController(Project &project, const QList &tasks, QObject *parent = 0); ~TasksEditController(); public Q_SLOTS: void activate(); Q_SIGNALS: void addCommand(KUndo2Command *cmd); private Q_SLOTS: void finish(int result); private: Project &m_project; const QList m_tasks; TasksEditDialog *m_dlg; }; } //KPlato namespace #endif // TASKSEDITCONTROLLER_H diff --git a/src/libs/ui/TasksEditDialog.h b/src/libs/ui/TasksEditDialog.h index 1be76cfc..89106d99 100644 --- a/src/libs/ui/TasksEditDialog.h +++ b/src/libs/ui/TasksEditDialog.h @@ -1,74 +1,74 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TASKSEDITDIALOGWIDGET_H #define TASKSEDITDIALOGWIDGET_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class Accounts; class TaskGeneralPanel; class RequestResourcesPanel; class DocumentsPanel; class TaskCostPanel; class TaskDescriptionPanel; class Node; class Task; class Project; class MacroCommand; /** * The dialog that shows and allows you to alter any task. */ -class KPLATOUI_EXPORT TasksEditDialog : public KPageDialog { +class PLANUI_EXPORT TasksEditDialog : public KPageDialog { Q_OBJECT public: /** * The constructor for the tasks settings dialog. * @param tasks the list of tasks to be edited * @param parent parent widget */ TasksEditDialog(Project &project, const QList &tasks, QWidget *parent=0); virtual MacroCommand *buildCommand(); protected Q_SLOTS: void accept(); void setButtonOkEnabled(bool enabled); void slotTaskRemoved( Node *node ); void slotCurrentChanged( KPageWidgetItem*, KPageWidgetItem* ); protected: Project &m_project; const QList m_tasks; Task *m_task; RequestResourcesPanel *m_resourcesTab; }; } //KPlato namespace #endif // TASKSEDITDIALOGWIDGET_H diff --git a/src/libs/ui/TasksGeneralPanel.h b/src/libs/ui/TasksGeneralPanel.h index 758a713d..f83623e1 100644 --- a/src/libs/ui/TasksGeneralPanel.h +++ b/src/libs/ui/TasksGeneralPanel.h @@ -1,121 +1,121 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef TASKSGENERALPANEL_H #define TASKSGENERALPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_TaskGeneralPanel.h" #include "kptduration.h" #include namespace KPlato { class TasksGeneralPanel; class Task; class MacroCommand; class Calendar; class Project; class TasksGeneralPanelImpl : public QWidget, public Ui_TasksGeneralPanel { Q_OBJECT public: TasksGeneralPanelImpl(QWidget *parent, const char *name); virtual int schedulingType() const; virtual int estimationType() const; virtual int optimistic() const; virtual int pessimistic(); virtual double estimationValue(); virtual QDateTime startDateTime(); virtual QDateTime endDateTime(); virtual QTime startTime() const; virtual QTime endTime(); virtual QDate startDate(); virtual QDate endDate(); virtual int risktype() const; virtual Calendar *calendar() const; public Q_SLOTS: virtual void setSchedulingType( int type ); virtual void changeLeader(); virtual void setEstimationType( int type ); virtual void setOptimistic( int value ); virtual void setPessimistic( int value ); virtual void enableDateTime( int scheduleType ); virtual void estimationTypeChanged( int type ); virtual void setEstimate( double duration ); virtual void setEstimateType( int type ); virtual void checkAllFieldsFilled(); // virtual void setEstimateScales( double day ); virtual void startDateChanged(); virtual void startTimeChanged( const QTime & time ); virtual void endDateChanged(); virtual void endTimeChanged( const QTime & time ); virtual void scheduleTypeChanged( int value ); virtual void setStartTime( const QTime & time ); virtual void setEndTime( const QTime & time ); virtual void setStartDateTime( const QDateTime & dt ); virtual void setEndDateTime( const QDateTime & dt ); virtual void setStartDate( const QDate & date ); virtual void setEndDate( const QDate & date ); virtual void setRisktype( int r ); virtual void calendarChanged( int /*index*/ ); Q_SIGNALS: void obligatedFieldsFilled( bool ); void schedulingTypeChanged( int ); void changed(); protected: bool useTime; QList m_calendars; }; class TasksGeneralPanel : public TasksGeneralPanelImpl { Q_OBJECT public: explicit TasksGeneralPanel(Project &project, QList &tasks, QWidget *parent=0, const char *name=0); MacroCommand *buildCommand(); bool ok(); void setStartValues(Task *task); public Q_SLOTS: virtual void estimationTypeChanged(int type); virtual void scheduleTypeChanged(int value); private: QList m_tasks; Project &m_project; Duration m_estimate; Duration m_duration; }; } //KPlato namespace #endif // TASKSGENERALPANEL_H diff --git a/src/libs/ui/kptaccountseditor.h b/src/libs/ui/kptaccountseditor.h index 40423d2e..87e9898f 100644 --- a/src/libs/ui/kptaccountseditor.h +++ b/src/libs/ui/kptaccountseditor.h @@ -1,152 +1,152 @@ /* This file is KoDocument of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTACCOUNTSEDITOR_H #define KPTACCOUNTSEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include "kptaccountsmodel.h" #include class KoPageLayoutWidget; class KoDocument; class QPoint; namespace KPlato { class Project; class Account; class AccountTreeView; class AccountseditorConfigDialog : public KPageDialog { Q_OBJECT public: AccountseditorConfigDialog( ViewBase *view, AccountTreeView *treeview, QWidget *parent, bool selectPrint = false ); public Q_SLOTS: void slotOk(); private: ViewBase *m_view; AccountTreeView *m_treeview; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; }; -class KPLATOUI_EXPORT AccountTreeView : public TreeViewBase +class PLANUI_EXPORT AccountTreeView : public TreeViewBase { Q_OBJECT public: explicit AccountTreeView(QWidget *parent); AccountItemModel *model() const { return static_cast( TreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } Account *currentAccount() const; Account *selectedAccount() const; QList selectedAccounts() const; Q_SIGNALS: void currentChanged( const QModelIndex& ); void currentColumnChanged( const QModelIndex&, const QModelIndex& ); void selectionChanged( const QModelIndexList& ); void contextMenuRequested( const QModelIndex&, const QPoint& ); protected Q_SLOTS: void headerContextMenuRequested( const QPoint &pos ); virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); protected: void contextMenuEvent ( QContextMenuEvent * event ); }; -class KPLATOUI_EXPORT AccountsEditor : public ViewBase +class PLANUI_EXPORT AccountsEditor : public ViewBase { Q_OBJECT public: AccountsEditor(KoPart *part, KoDocument *document, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void draw( Project &project ); virtual void draw(); AccountItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); virtual Account *currentAccount() const; KoPrintJob *createPrintJob(); bool loadContext(const KoXmlElement &context); void saveContext(QDomElement &context) const; Q_SIGNALS: void addAccount( Account *account ); void deleteAccounts( const QList& ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected: void updateActionsEnabled( bool on ); void insertAccount( Account *account, Account *parent, int row ); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotHeaderContextMenuRequested( const QPoint &pos ); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void slotEnableActions( bool on ); void slotAddAccount(); void slotAddSubAccount(); void slotDeleteSelection(); void slotAccountsOk(); private: AccountTreeView *m_view; QAction *actionAddAccount; QAction *actionAddSubAccount; QAction *actionDeleteSelection; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptaccountsview.h b/src/libs/ui/kptaccountsview.h index 81fddd80..1ef2f68b 100644 --- a/src/libs/ui/kptaccountsview.h +++ b/src/libs/ui/kptaccountsview.h @@ -1,117 +1,117 @@ /* This file is part of the KDE project Copyright (C) 2005 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTACCOUNTSVIEW_H #define KPTACCOUNTSVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include #include #include "kptaccount.h" #include "kpteffortcostmap.h" namespace KPlato { class Account; class Project; class ScheduleManager; class CostBreakdownItemModel; -class KPLATOUI_EXPORT AccountsTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT AccountsTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit AccountsTreeView( QWidget *parent = 0 ); CostBreakdownItemModel *model() const; bool cumulative() const; void setCumulative( bool on ); int periodType() const; void setPeriodType( int period ); int startMode() const; void setStartMode( int mode ); int endMode() const; void setEndMode( int mode ); QDate startDate() const; void setStartDate( const QDate &date ); QDate endDate() const; void setEndDate( const QDate &date ); int showMode() const; void setShowMode( int show ); protected Q_SLOTS: void slotModelReset(); private: QList m_leftHidden; }; -class KPLATOUI_EXPORT AccountsView : public ViewBase +class PLANUI_EXPORT AccountsView : public ViewBase { Q_OBJECT public: AccountsView(KoPart *part, Project *project, KoDocument *doc, QWidget *parent); //~AccountsView(); void setupGui(); Project *project() const { return m_project; } virtual void setZoom( double zoom ); virtual void setProject( Project *project ); virtual bool loadContext( const KoXmlElement &context ); virtual void saveContext( QDomElement &context ) const; CostBreakdownItemModel *model() const; KoPrintJob *createPrintJob(); public Q_SLOTS: void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void slotContextMenuRequested( const QModelIndex&, const QPoint &pos ); void slotHeaderContextMenuRequested( const QPoint &pos ); virtual void slotOptions(); private: void init(); private: Project *m_project; ScheduleManager *m_manager; AccountsTreeView *m_view; QDate m_date; int m_period; bool m_cumulative; QDomDocument m_domdoc; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptcalendareditor.h b/src/libs/ui/kptcalendareditor.h index bc8543d6..0f307ef9 100644 --- a/src/libs/ui/kptcalendareditor.h +++ b/src/libs/ui/kptcalendareditor.h @@ -1,228 +1,228 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTCALENDAREDITOR_H #define KPTCALENDAREDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptitemmodelbase.h" #include "kptcalendar.h" #include "kptcalendarmodel.h" #include class QPoint; class KUndo2Command; class KoDocument; namespace KPlato { class View; class Project; class Calendar; class CalendarDay; class DateTableDataModel; class KDatePicker; -class KPLATOUI_EXPORT CalendarTreeView : public TreeViewBase +class PLANUI_EXPORT CalendarTreeView : public TreeViewBase { Q_OBJECT public: explicit CalendarTreeView(QWidget *parent); CalendarItemModel *model() const { return static_cast( TreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } Calendar *currentCalendar() const; Calendar *selectedCalendar() const; QList selectedCalendars() const; Q_SIGNALS: void currentChanged( const QModelIndex& ); void currentColumnChanged( const QModelIndex&, const QModelIndex& ); void selectionChanged( const QModelIndexList& ); void contextMenuRequested( const QModelIndex&, const QPoint& ); void focusChanged(); protected Q_SLOTS: void headerContextMenuRequested( const QPoint &pos ); virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); protected: void contextMenuEvent ( QContextMenuEvent * event ); void focusInEvent ( QFocusEvent * event ); void focusOutEvent ( QFocusEvent * event ); void dragMoveEvent(QDragMoveEvent *event); }; -class KPLATOUI_EXPORT CalendarDayView : public QTableView +class PLANUI_EXPORT CalendarDayView : public QTableView { Q_OBJECT public: explicit CalendarDayView(QWidget *parent); CalendarDayItemModel *model() const { return m_model; } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } CalendarDay *selectedDay() const; TimeInterval *selectedInterval() const; QSize sizeHint() const; void setReadWrite( bool on ) { m_readwrite = on; } bool isReadWrite() const { return m_readwrite; } Q_SIGNALS: void currentChanged( const QModelIndex& ); void currentColumnChanged( const QModelIndex&, const QModelIndex& ); void selectionChanged( const QModelIndexList& ); void contextMenuRequested( const QModelIndex&, const QPoint& ); void focusChanged(); void executeCommand( KUndo2Command *cmd ); public Q_SLOTS: void setCurrentCalendar( Calendar *calendar ); protected Q_SLOTS: void headerContextMenuRequested( const QPoint &pos ); virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); void slotSetWork(); void slotSetVacation(); void slotSetUndefined(); void slotIntervalEditDialogFinished( int result ); protected: void contextMenuEvent ( QContextMenuEvent * event ); void focusInEvent ( QFocusEvent * event ); void focusOutEvent ( QFocusEvent * event ); private: CalendarDayItemModel *m_model; QAction *actionSetUndefined; QAction *actionSetVacation; QAction *actionSetWork; bool m_readwrite; }; -class KPLATOUI_EXPORT CalendarEditor : public ViewBase +class PLANUI_EXPORT CalendarEditor : public ViewBase { Q_OBJECT public: CalendarEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const { return m_calendarview->project(); } virtual void draw( Project &project ); virtual void draw(); virtual void updateReadWrite( bool readwrite ); virtual Calendar *currentCalendar() const; /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. virtual void saveContext( QDomElement &/*context*/ ) const; Q_SIGNALS: void addCalendar( Calendar *calendar ); void deleteCalendar( const QList& ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected: void updateActionsEnabled( bool on ); void insertCalendar( Calendar *calendar, Calendar *parent, int pos = -1 ); protected Q_SLOTS: void slotIntervalEditDialogFinished( int result ); void slotOptions(); private Q_SLOTS: void slotContextMenuCalendar( const QModelIndex& index, const QPoint& pos ); void slotContextMenuDay( const QModelIndex& index, const QPoint& pos ); void slotContextMenuDate( QMenu*, const QDate& ); void slotContextMenuDate( QMenu*, const QList& ); void slotCalendarSelectionChanged( const QModelIndexList& ); void slotCurrentCalendarChanged( const QModelIndex& ); void slotDaySelectionChanged( const QModelIndexList& ); void slotCurrentDayChanged( const QModelIndex& ); void slotEnableActions(); void slotAddCalendar(); void slotAddSubCalendar(); void slotDeleteCalendar(); void slotAddDay(); void slotAddInterval(); void slotDeleteDaySelection(); void slotSetWork(); void slotSetVacation(); void slotSetUndefined(); private: CalendarTreeView *m_calendarview; CalendarDayView *m_dayview; KDatePicker *m_datePicker; DateTableDataModel *m_model; QAction *actionAddCalendar; QAction *actionAddSubCalendar; QAction *actionDeleteSelection; QAction *actionAddDay; QAction *actionAddWorkInterval; QAction *actionDeleteDaySelection; QAction *actionSetUndefined; QAction *actionSetVacation; QAction *actionSetWork; QList m_currentMenuDateList; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptdependencyeditor.cpp b/src/libs/ui/kptdependencyeditor.cpp index dd2d5177..71b08201 100644 --- a/src/libs/ui/kptdependencyeditor.cpp +++ b/src/libs/ui/kptdependencyeditor.cpp @@ -1,2443 +1,2443 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "kptdependencyeditor.h" #include "kptglobal.h" #include "kptcommonstrings.h" #include "kptitemmodelbase.h" #include "kptcommand.h" #include "kptproject.h" #include "kptrelation.h" #include "kptschedule.h" #include "kptdebug.h" #include "config.h" #include "Help.h" #include "KoPageLayoutWidget.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ConnectCursor Qt::DragLinkCursor namespace KPlato { -void kplato_paintFocusSelectedItem( QPainter *painter, const QStyleOptionGraphicsItem *option ) +void plan_paintFocusSelectedItem( QPainter *painter, const QStyleOptionGraphicsItem *option ) { if ( option->state & ( QStyle::State_Selected | QStyle::State_HasFocus ) ) { painter->save(); if (option->state & QStyle::State_Selected) { debugPlanDepEditor<<"selected"; QPalette::ColorGroup cg = option->state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(option->state & QStyle::State_Active)) cg = QPalette::Inactive; QLinearGradient g( 0.0, option->rect.top(), 0.0, option->rect.bottom() ); QColor col = option->palette.brush(cg, QPalette::Highlight).color(); g.setColorAt( 0.0, col.lighter( 125 ) ); g.setColorAt( 1.0, col.lighter( 60 ) ); painter->setPen( Qt::NoPen ); painter->setBrush( QBrush( g ) ); painter->drawRect( option->exposedRect ); } if ( option->state & QStyle::State_HasFocus ) { debugPlanDepEditor<<"has focus"; QPalette::ColorGroup cg = option->state & QStyle::State_Enabled ? QPalette::Active : QPalette::Disabled; if (cg == QPalette::Active && !(option->state & QStyle::State_Active)) cg = QPalette::Inactive; QPen p( Qt::DotLine ); p.setWidthF( 2. ); if ( option->state & QStyle::State_Selected ) { p.setColor( option->palette.color( cg, QPalette::Shadow ) ); debugPlanDepEditor<<"focus: selected"<palette.color( cg, QPalette::Highlight ) ); debugPlanDepEditor<<"focus: not selected"<setPen( p ); painter->setBrush( Qt::NoBrush ); painter->drawRect( option->exposedRect ); } painter->restore(); } } //---------------------- DependecyViewPrintingDialog::DependecyViewPrintingDialog( ViewBase *parent, DependencyView *view ) : PrintingDialog( parent ), m_depview( view ) { debugPlanDepEditor< DependecyViewPrintingDialog::createOptionWidgets() const { QList lst; lst << createPageLayoutWidget(); lst += PrintingDialog::createOptionWidgets(); return lst; } void DependecyViewPrintingDialog::printPage( int page, QPainter &painter ) { painter.save(); QRect hRect = headerRect(); QRect fRect = footerRect(); QRect pageRect = printer().pageRect(); pageRect.moveTo( 0, 0 ); debugPlanDepEditor<project()) ); int gap = 8; int pageHeight = pageRect.height(); if ( hRect.isValid() ) { pageHeight -= ( hRect.height() + gap ); } if ( fRect.isValid() ) { pageHeight -= ( fRect.height() + gap ); } painter.translate( 0, hRect.height() + gap ); QRect r( 0, 0, pageRect.width(), pageHeight ); m_depview->itemScene()->render( &painter, r ); painter.restore(); } DependencyLinkItemBase::DependencyLinkItemBase( QGraphicsItem *parent ) : QGraphicsPathItem( parent ), m_editable( false ), predItem( 0 ), succItem( 0 ), relation( 0 ), m_arrow( new QGraphicsPathItem( this ) ) { } DependencyLinkItemBase::DependencyLinkItemBase( DependencyNodeItem *predecessor, DependencyNodeItem *successor, Relation *rel, QGraphicsItem *parent ) : QGraphicsPathItem( parent ), m_editable( false ), predItem( predecessor ), succItem( successor ), relation( rel ), m_arrow( new QGraphicsPathItem( this ) ) { } DependencyLinkItemBase::~DependencyLinkItemBase() { } DependencyScene *DependencyLinkItemBase::itemScene() const { return static_cast( scene() ); } void DependencyLinkItemBase::createPath( const QPointF &sp, int starttype, const QPointF &ep, int endtype ) { //if ( predItem && succItem ) debugPlanDepEditor<text()<<" ->"<text()<<" visible="<horizontalGap(); bool up = sp.y() > ep.y(); bool right = sp.x() < ep.x(); bool same = sp.x() == ep.x(); QPainterPath link( sp ); qreal x = sp.x(); qreal y = sp.y(); if ( right && starttype == DependencyNodeItem::Finish) { x = ep.x(); x += endtype == DependencyNodeItem::Start ? - hgap/2 - 6 : hgap/2 - 6; link.lineTo( x, y ); x += 6; QPointF cp( x, y ); y += up ? -6 : +6; link.quadTo( cp, QPointF( x, y ) ); y = up ? ep.y() + 6 : ep.y() - 6; link.lineTo( x, y ); y = ep.y(); cp = QPointF( x, y ); x += endtype == DependencyNodeItem::Start ? 6 : -6; link.quadTo( cp, QPointF( x, y ) ); } else if ( right && starttype == DependencyNodeItem::Start ) { x = sp.x() - hgap/2 + 6; link.lineTo( x, y ); x -= 6; QPointF cp( x, y ); y += up ? -6 : +6; link.quadTo( cp, QPointF( x, y ) ); y = up ? ep.y() + 6 : ep.y() - 6; link.lineTo( x, y ); y = ep.y(); cp = QPointF( x, y ); x += endtype == DependencyNodeItem::Start ? 6 : -6; link.quadTo( cp, QPointF( x, y ) ); } else if ( same ) { x = ep.x(); x += endtype == DependencyNodeItem::Start ? - hgap/2 + 6 : hgap/2 - 6; link.lineTo( x, y ); x += endtype == DependencyNodeItem::Start ? -6 : +6; QPointF cp( x, y ); y += up ? -6 : 6; link.quadTo( cp, QPointF( x, y ) ); y = up ? ep.y() + 6 : ep.y() - 6; link.lineTo( x, y ); y = ep.y(); cp = QPointF( x, y ); if ( endtype == DependencyNodeItem::Start ) { x += 6; } else { x -= 6; } link.quadTo( cp, QPointF( x, y ) ); } else { x = ep.x(); x += endtype == DependencyNodeItem::Start ? - hgap/2 + 6 : hgap/2 + 6; link.lineTo( x, y ); x -= 6; QPointF cp( x, y ); y += up ? -6 : 6; link.quadTo( cp, QPointF( x, y ) ); y = up ? ep.y() + 6 : ep.y() - 6; link.lineTo( x, y ); y = ep.y(); cp = QPointF( x, y ); x += endtype == DependencyNodeItem::Start ? 6 : -6; link.quadTo( cp, QPointF( x, y ) ); } link.lineTo( ep ); setPath( link ); QPainterPath arrow; x = endtype == DependencyNodeItem::Start ? -6 : 6; arrow.moveTo( ep ); arrow.lineTo( ep.x() + x, ep.y() - 3 ); arrow.lineTo( ep.x() + x, ep.y() + 3 ); arrow.lineTo( ep ); m_arrow->setPath( arrow ); m_arrow->show(); } //-------------------------------- DependencyLinkItem::DependencyLinkItem( DependencyNodeItem *predecessor, DependencyNodeItem *successor, Relation *rel, QGraphicsItem *parent ) : DependencyLinkItemBase( predecessor, successor, rel, parent ) { setZValue( 100.0 ); setAcceptHoverEvents( true ); //debugPlanDepEditor<text()<<"("<column()<<") -"<text(); predItem->addChildRelation( this ); succItem->addParentRelation( this ); succItem->setColumn(); m_arrow->setBrush( Qt::black ); m_pen = pen(); } DependencyLinkItem::~DependencyLinkItem() { if ( predItem ) { predItem->takeChildRelation( this ); } if ( succItem ) { succItem->takeParentRelation( this ); } } int DependencyLinkItem::newChildColumn() const { int col = predItem->column(); if ( relation->type() == Relation::FinishStart ) { ++col; } //debugPlanDepEditor<<"new col="<isVisible() && succItem->isVisible() ); } void DependencyLinkItem::createPath() { setVisible( predItem->isVisible() && succItem->isVisible() ); if ( ! isVisible() ) { //debugPlanDepEditor<<"Visible="<node()->name()<<" -"<node()->name(); return; } QPointF sp = startPoint(); QPointF ep = endPoint(); int stype = 0, etype = 0; switch ( relation->type() ) { case Relation::StartStart: stype = DependencyNodeItem::Start; etype = DependencyNodeItem::Start; break; case Relation::FinishStart: stype = DependencyNodeItem::Finish; etype = DependencyNodeItem::Start; break; case Relation::FinishFinish: stype = DependencyNodeItem::Finish; etype = DependencyNodeItem::Finish; break; default: break; } DependencyLinkItemBase::createPath( sp, stype, ep, etype ); } QPointF DependencyLinkItem::startPoint() const { if ( relation->type() == Relation::StartStart ) { return predItem->connectorPoint( DependencyNodeItem::Start ); } return predItem->connectorPoint( DependencyNodeItem::Finish ); } QPointF DependencyLinkItem::endPoint() const { if ( relation->type() == Relation::FinishFinish ) { return succItem->connectorPoint( DependencyNodeItem::Finish ); } return succItem->connectorPoint( DependencyNodeItem::Start ); } void DependencyLinkItem::hoverEnterEvent( QGraphicsSceneHoverEvent * /*event*/ ) { setZValue( zValue() + 1 ); setPen( QPen( Qt::black, 2 ) ); m_arrow->setPen( pen() ); update(); } void DependencyLinkItem::hoverLeaveEvent( QGraphicsSceneHoverEvent * /*event*/ ) { resetHooverIndication(); } void DependencyLinkItem::resetHooverIndication() { setZValue( zValue() - 1 ); setPen( m_pen ); m_arrow->setPen( m_pen ); update(); } void DependencyLinkItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { //debugPlanDepEditor; QGraphicsItem::GraphicsItemFlags f = flags(); if ( isEditable() && itemScene()->connectionMode() ) { itemScene()->clearConnection(); setFlags( f & ~QGraphicsItem::ItemIsSelectable ); } QGraphicsPathItem::mousePressEvent( event ); if ( f != flags() ) { setFlags( f ); } } //-------------------- DependencyCreatorItem::DependencyCreatorItem( QGraphicsItem *parent ) : DependencyLinkItemBase( parent ), predConnector( 0 ), succConnector( 0 ), m_editable( false ) { setZValue( 1000.0 ); clear(); setPen( QPen( Qt::blue, 2 ) ); m_arrow->setBrush( Qt::blue ); m_arrow->setPen( QPen( Qt::blue, 2 ) ); } void DependencyCreatorItem::clear() { hide(); if ( predConnector && predConnector->parentItem() ) { static_cast( predConnector->parentItem() )->setConnectorHoverMode( true ); } else if ( succConnector && succConnector->parentItem() ) { static_cast( succConnector->parentItem() )->setConnectorHoverMode( true ); } predConnector = 0; succConnector = 0; setPath( QPainterPath() ); m_arrow->setPath( QPainterPath() ); } void DependencyCreatorItem::setPredConnector( DependencyConnectorItem *item ) { predConnector = item; //static_cast( item->parentItem() )->setConnectorHoverMode( false ); } void DependencyCreatorItem::setSuccConnector( DependencyConnectorItem *item ) { succConnector = item; } void DependencyCreatorItem::createPath() { if ( predConnector == 0 ) { return; } if ( succConnector == 0 ) { return; } QPointF sp = predConnector->connectorPoint(); QPointF ep = succConnector->connectorPoint(); DependencyLinkItemBase::createPath( sp, predConnector->ctype(), ep, succConnector->ctype() ); } void DependencyCreatorItem::createPath( const QPointF &ep ) { m_arrow->hide(); if ( succConnector ) { return createPath(); } if ( predConnector == 0 ) { return; } QPointF sp = predConnector->connectorPoint(); QPainterPath link( sp ); link.lineTo( ep ); setPath( link ); } QPointF DependencyCreatorItem::startPoint() const { return predConnector == 0 ? QPointF() : predConnector->connectorPoint(); } QPointF DependencyCreatorItem::endPoint() const { return succConnector == 0 ? QPointF() : succConnector->connectorPoint(); } //-------------------- DependencyConnectorItem::DependencyConnectorItem( DependencyNodeItem::ConnectorType type, DependencyNodeItem *parent ) : QGraphicsRectItem( parent ), m_ctype( type ), m_editable( false ) { setCursor( ConnectCursor); setAcceptHoverEvents( true ); setZValue( 500.0 ); setFlag( QGraphicsItem::ItemIsFocusable ); } DependencyScene *DependencyConnectorItem::itemScene() const { return static_cast( scene() ); } DependencyNodeItem *DependencyConnectorItem::nodeItem() const { return static_cast( parentItem() ); } Node *DependencyConnectorItem::node() const { return static_cast( parentItem() )->node(); } QPointF DependencyConnectorItem::connectorPoint() const { QRectF r = rect(); return QPointF( r.x()+r.width(), r.y() + r.height()/2 ); } void DependencyConnectorItem::hoverEnterEvent( QGraphicsSceneHoverEvent * /*event*/ ) { itemScene()->connectorEntered( this, true ); } void DependencyConnectorItem::hoverLeaveEvent( QGraphicsSceneHoverEvent * /*event*/ ) { itemScene()->connectorEntered( this, false ); } void DependencyConnectorItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if ( ! isEditable() ) { event->ignore(); return; } if (event->button() == Qt::LeftButton ) { m_mousePressPos = event->pos(); } else { event->ignore(); } } void DependencyConnectorItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { m_mousePressPos = QPointF(); if (event->button() != Qt::LeftButton ) { event->ignore(); return; } if ( rect().contains( event->scenePos() ) ) { // user clicked on this item bool multiSelect = (event->modifiers() & Qt::ControlModifier) != 0; if (multiSelect) { itemScene()->multiConnectorClicked( this ); } else { itemScene()->singleConnectorClicked( this ); } return; } QGraphicsItem *item = 0; foreach ( QGraphicsItem *i, itemScene()->items( event->scenePos() ) ) { if ( i->type() == DependencyConnectorItem::Type ) { item = i; break; } } if ( item == 0 || item == itemScene()->fromItem() ) { itemScene()->setFromItem( 0 ); return; } itemScene()->singleConnectorClicked( static_cast( item ) ); } void DependencyConnectorItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if (event->buttons() == Qt::LeftButton ) { if ( ! m_mousePressPos.isNull() ) { itemScene()->setFromItem( this ); m_mousePressPos = QPointF(); } QGraphicsItem *item = 0; foreach ( QGraphicsItem *i, itemScene()->items( event->scenePos() ) ) { if ( i->type() == DependencyConnectorItem::Type ) { item = i; break; } } if ( item != this ) { itemScene()->connectorEntered( this, false ); } if ( item != 0 ) { itemScene()->connectorEntered( static_cast( item ), true ); } } else { event->ignore(); } } void DependencyConnectorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget */*widget*/) { //debugPlanDepEditor; QStyleOptionGraphicsItem opt( *option ); opt.exposedRect = rect(); if ( itemScene()->fromItem() == this ) { opt.state |= QStyle::State_Selected; } if ( itemScene()->focusItem() == this ) { opt.state |= QStyle::State_HasFocus; } - kplato_paintFocusSelectedItem( painter, &opt ); + plan_paintFocusSelectedItem( painter, &opt ); QRectF r = rect(); if ( ctype() == DependencyNodeItem::Start ) { r.setRect( r.right() - (r.width()/2.0) + 1.0, r.y() + ( r.height() * 0.33 ), r.width() / 2.0, r.height() * 0.33 ); } else { r.setRect( r.right() - (r.width()/2.0) - 1.0, r.y() + ( r.height() * 0.33 ), r.width() / 2.0, r.height() * 0.33 ); } painter->fillRect( r, Qt::black ); } QList DependencyConnectorItem::predecessorItems() const { return nodeItem()->predecessorItems( m_ctype ); } QList DependencyConnectorItem::successorItems() const { return nodeItem()->successorItems( m_ctype ); } //-------------------- DependencyNodeItem::DependencyNodeItem( Node *node, DependencyNodeItem *parent ) : QGraphicsRectItem( parent ), m_node( node ), m_parent( 0 ), m_editable( false ) { setAcceptHoverEvents( true ); setZValue( 400.0 ); setParentItem( parent ); m_start = new DependencyConnectorItem( DependencyNodeItem::Start, this ); m_finish = new DependencyConnectorItem( DependencyNodeItem::Finish, this ); m_text = new QGraphicsTextItem( this ); m_textFont = m_text->font(); m_textFont.setPointSize( 10 ); m_text->setFont( m_textFont ); setText(); setFlags( QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable ); // do not attach this item to the scene as it gives continuous paint events when a node item is selected m_symbol = new DependencyNodeSymbolItem(); m_symbol->setZValue( zValue() + 10.0 ); setSymbol(); m_treeIndicator = new QGraphicsPathItem( this ); m_treeIndicator->setPen( QPen( Qt::gray ) ); } DependencyNodeItem::~DependencyNodeItem() { qDeleteAll( m_childrelations ); qDeleteAll( m_parentrelations ); //qDeleteAll( m_children ); delete m_symbol; } void DependencyNodeItem::setText() { m_text->setPlainText( m_node == 0 ? QString() : QString( "%1 %2").arg( m_node->wbsCode() ).arg(m_node->name() ) ); } DependencyScene *DependencyNodeItem::itemScene() const { return static_cast( scene() ); } void DependencyNodeItem::setSymbol() { m_symbol->setSymbol( m_node->type(), itemScene()->symbolRect() ); } QPointF DependencyNodeItem::connectorPoint( DependencyNodeItem::ConnectorType type ) const { QRectF r; if ( type == Start ) { return m_start->connectorPoint(); } return m_finish->connectorPoint(); } void DependencyNodeItem::setConnectorHoverMode( bool mode ) { m_start->setAcceptHoverEvents( mode ); m_finish->setAcceptHoverEvents( mode ); } void DependencyNodeItem::setParentItem( DependencyNodeItem *parent ) { if ( m_parent ) { m_parent->takeChild( this ); } m_parent = parent; if ( m_parent ) { m_parent->addChild( this ); } } void DependencyNodeItem::setExpanded( bool mode ) { foreach ( DependencyNodeItem *ch, m_children ) { itemScene()->setItemVisible( ch, mode ); ch->setExpanded( mode ); } } void DependencyNodeItem::setItemVisible( bool show ) { setVisible( show ); //debugPlanDepEditor<name(); foreach ( DependencyLinkItem *i, m_parentrelations ) { i->setItemVisible( show ); } foreach ( DependencyLinkItem *i, m_childrelations ) { i->setItemVisible( show ); } } DependencyNodeItem *DependencyNodeItem::takeChild( DependencyNodeItem *ch ) { int i = m_children.indexOf( ch ); if ( i == -1 ) { return 0; } return m_children.takeAt( i ); } void DependencyNodeItem::setRectangle( const QRectF &rect ) { //debugPlanDepEditor<( scene() )->connectorWidth(); m_start->setRect( rect.x() + connection, rect.y(), -connection, rect.height() ); m_finish->setRect( rect.right() - connection, rect.y(), connection, rect.height() ); m_text->setPos( m_finish->rect().right() + 2.0, itemScene()->gridY( row() ) ); m_symbol->setPos( rect.topLeft() + QPointF( connection, 0 ) + QPointF( 2.0, 2.0 ) ); } void DependencyNodeItem::moveToY( qreal y ) { QRectF r = rect(); r. moveTop( y ); setRectangle( r ); //debugPlanDepEditor<createPath(); } foreach ( DependencyLinkItem *i, m_childrelations ) { i->createPath(); } DependencyNodeItem *par = this; while ( par->parentItem() ) { par = par->parentItem(); } par->setTreeIndicator( true ); } void DependencyNodeItem::setRow( int row ) { moveToY( itemScene()->itemY( row ) ); } int DependencyNodeItem::row() const { return itemScene()->row( rect().y() ); } void DependencyNodeItem::moveToX( qreal x ) { QRectF r = rect(); r. moveLeft( x ); setRectangle( r ); //debugPlanDepEditor<toPlainText()<<" to="<createPath(); } foreach ( DependencyLinkItem *i, m_childrelations ) { i->createPath(); } DependencyNodeItem *par = this; while ( par->parentItem() ) { par = par->parentItem(); } par->setTreeIndicator( true ); } void DependencyNodeItem::setColumn() { int col = m_parent == 0 ? 0 : m_parent->column() + 1; //debugPlanDepEditor<newChildColumn() ); } if ( col != column() ) { setColumn( col ); foreach ( DependencyLinkItem *i, m_childrelations ) { i->succItem->setColumn(); } //debugPlanDepEditor<setColumn(); } } } void DependencyNodeItem::setColumn( int col ) { moveToX( itemScene()->itemX( col ) ); } int DependencyNodeItem::column() const { return itemScene()->column( rect().x() ); } DependencyLinkItem *DependencyNodeItem::takeParentRelation( DependencyLinkItem *r ) { int i = m_parentrelations.indexOf( r ); if ( i == -1 ) { return 0; } DependencyLinkItem *dep = m_parentrelations.takeAt( i ); setColumn(); return dep; } DependencyLinkItem *DependencyNodeItem::takeChildRelation( DependencyLinkItem *r ) { int i = m_childrelations.indexOf( r ); if ( i == -1 ) { return 0; } return m_childrelations.takeAt( i ); } void DependencyNodeItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { debugPlanDepEditor; QGraphicsItem::GraphicsItemFlags f = flags(); if ( itemScene()->connectionMode() ) { itemScene()->clearConnection(); setFlags( f & ~QGraphicsItem::ItemIsSelectable ); } QGraphicsRectItem::mousePressEvent( event ); if ( f != flags() ) { setFlags( f ); } } void DependencyNodeItem::paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget * ) { //debugPlanDepEditor; QLinearGradient g( 0.0, rect().top(), 0.0, rect().bottom() ); g.setColorAt( 0.0, option->palette.color( QPalette::Midlight ) ); g.setColorAt( 1.0, option->palette.color( QPalette::Dark ) ); QBrush b( g ); painter->setBrush( b ); painter->setPen( QPen( Qt::NoPen ) ); painter->drawRect( rect() ); QStyleOptionGraphicsItem opt( *option ); opt.exposedRect = rect().adjusted( -m_start->rect().width(), 0.0, -m_finish->rect().width(), 0.0 ); if ( this == itemScene()->focusItem() ) { opt.state |= QStyle::State_HasFocus; } - kplato_paintFocusSelectedItem( painter, &opt ); + plan_paintFocusSelectedItem( painter, &opt ); // paint the symbol m_symbol->paint( itemScene()->project(), painter, &opt ); } DependencyConnectorItem *DependencyNodeItem::connectorItem( ConnectorType ctype ) const { switch ( ctype ) { case Start: return m_start; case Finish: return m_finish; default: break; } return 0; } QList DependencyNodeItem::predecessorItems( ConnectorType ctype ) const { QList lst; foreach ( DependencyLinkItem *i, m_parentrelations ) { if ( ctype == Start && ( i->relation->type() == Relation::StartStart || i->relation->type() == Relation::FinishStart ) ) { lst << i; } if ( ctype == Finish && i->relation->type() == Relation::FinishFinish ) { lst << i; } } return lst; } QList DependencyNodeItem::successorItems( ConnectorType ctype ) const { QList lst; foreach ( DependencyLinkItem *i, m_childrelations ) { if ( ctype == Start && i->relation->type() == Relation::StartStart ) { lst << i; } if ( ctype == Finish && ( i->relation->type() == Relation::FinishFinish || i->relation->type() == Relation::FinishStart ) ) { lst << i; } } return lst; } qreal DependencyNodeItem::treeIndicatorX() const { return rect().x() + 18.0; } void DependencyNodeItem::setTreeIndicator( bool on ) { paintTreeIndicator( on ); foreach ( DependencyNodeItem *i, m_children ) { if ( i->isVisible() ) { i->setTreeIndicator( on ); } } } void DependencyNodeItem::paintTreeIndicator( bool on ) { if ( ! on ) { m_treeIndicator->hide(); return; } QPainterPath p; qreal y1 = itemScene()->gridY( row() ); qreal y2 = itemScene()->gridY( row() + 1 ); for ( DependencyNodeItem *par = m_parent; par; par = par->parentItem() ) { qreal x = par->treeIndicatorX(); p.moveTo( x, y1 ); if ( par == m_parent ) { p.lineTo( x, (y1 + y2) / 2.0 ); p.lineTo( x + 6, (y1 + y2) / 2.0 ); if ( m_node->siblingAfter() ) { p.moveTo( x, (y1 + y2) / 2.0 ); p.lineTo( x, y2 ); } } else if ( par->children().last()->rect().y() > rect().y() ) { p.lineTo( x, (y1 + y2) / 2.0 ); p.lineTo( x, y2 ); } } if ( ! m_children.isEmpty() ) { qreal x = treeIndicatorX(); qreal y = rect().bottom(); p.moveTo( x, y ); p.lineTo( x, itemScene()->gridY( row() + 1 ) ); } if ( p.isEmpty() ) { m_treeIndicator->hide(); } else { m_treeIndicator->setPath( p ); m_treeIndicator->show(); } //debugPlanDepEditor<setBrush( p->config().summaryTaskDefaultColor() ); break; case Node::Type_Task: painter->setBrush( p->config().taskNormalColor() ); break; case Node::Type_Milestone: painter->setBrush( p->config().milestoneNormalColor() ); break; default: painter->setBrush( m_delegate.defaultBrush( m_itemtype ) ); break; } } else { painter->setBrush( m_delegate.defaultBrush( m_itemtype ) ); } painter->setPen( Qt::NoPen ); painter->translate( option->exposedRect.x() + 2.0, option->exposedRect.y() + 2.0 ); painter->drawPath( path() ); } //-------------------- DependencyScene::DependencyScene( QWidget *parent ) : QGraphicsScene( parent ), m_model( 0 ), m_readwrite( false ) { setSceneRect( QRectF() ); m_connectionitem = new DependencyCreatorItem(); addItem( m_connectionitem ); //debugPlanDepEditor; m_connectionitem->hide(); } DependencyScene::~DependencyScene() { //debugPlanDepEditor<<" DELETED"; clearScene(); } void DependencyScene::setFromItem( DependencyConnectorItem *item ) { DependencyConnectorItem *old = fromItem(); m_connectionitem->clear(); if ( old && old->parentItem() ) { old->parentItem()->update(); } if ( item ) { foreach ( QGraphicsItem *i, items() ) { if ( i != m_connectionitem && i->type() != DependencyConnectorItem::Type ) { i->setAcceptHoverEvents( false ); if ( i->type() == DependencyLinkItem::Type ) { static_cast( i )->resetHooverIndication(); } } } item->setCursor( ConnectCursor ); m_connectionitem->setPredConnector( item ); m_connectionitem->show(); } else { foreach ( QGraphicsItem *i, items() ) { if ( i != m_connectionitem && i->type() != DependencyConnectorItem::Type ) i->setAcceptHoverEvents( true ); } } if ( item && item->parentItem() ) { item->parentItem()->update(); } } bool DependencyScene::connectionIsValid( DependencyConnectorItem *pred, DependencyConnectorItem *succ ) { if ( pred->ctype() == DependencyNodeItem::Start && succ->ctype() == DependencyNodeItem::Finish ) { return false; } Node *par = static_cast( pred->parentItem() )->node(); Node *ch = static_cast( succ->parentItem() )->node(); return m_project->linkExists( par, ch ) || m_project->legalToLink( par, ch ); } void DependencyScene::connectorEntered( DependencyConnectorItem *item, bool entered ) { //debugPlanDepEditor<setCursor( ConnectCursor ); if ( ! entered ) { // when we leave a connector we don't have a successor m_connectionitem->setSuccConnector( 0 ); return; } if ( m_connectionitem->predConnector == item ) { // when inside the predecessor, clicking is allowed (deselects connector) item->setCursor( ConnectCursor ); return; } if ( ! m_connectionitem->isVisible() ) { // we are not in connection mode return; } if ( m_connectionitem->predConnector == 0 ) { // nothing we can do if we don't have a predecessor (shouldn't happen) return; } if ( item->parentItem() == m_connectionitem->predConnector->parentItem() ) { // not allowed to connect to the same node item->setCursor( Qt::ForbiddenCursor ); return; } if ( ! ( connectionIsValid( m_connectionitem->predConnector, item ) ) ) { // invalid connection (circular dependency, connecting to parent node, etc) item->setCursor( Qt::ForbiddenCursor ); return; } m_connectionitem->setSuccConnector( item ); m_connectionitem->createPath(); } void DependencyScene::drawBackground ( QPainter *painter, const QRectF &rect ) { QGraphicsScene::drawBackground( painter, rect ); QStyleOptionViewItem opt; QBrush br( opt.palette.brush( QPalette::AlternateBase ) ); int first = row( rect.y() ); int last = row( rect.bottom() ); for ( int r = first; r <= last; ++r ) { if ( r % 2 == 1 ) { qreal oy = gridY( r ); QRectF rct( rect.x(), oy, rect.width(), gridHeight() ); painter->fillRect( rct, br ); //debugPlanDepEditor< DependencyScene::itemList( int type ) const { QList lst; foreach ( QGraphicsItem *i, items() ) { if ( i->type() == type ) { lst << i; } } return lst; } void DependencyScene::clearScene() { m_connectionitem->clear(); QList its, deps; foreach ( QGraphicsItem *i, items() ) { if ( i->type() == DependencyNodeItem::Type && i->parentItem() == 0 ) { its << i; } else if ( i->type() == DependencyLinkItem::Type ) { deps << i; } } qDeleteAll( deps ); qDeleteAll( its ); removeItem( m_connectionitem ); qDeleteAll( items() ); setSceneRect( QRectF() ); addItem( m_connectionitem ); //debugPlanDepEditor; } QList DependencyScene::removeChildItems( DependencyNodeItem *item ) { QList lst; foreach ( DependencyNodeItem *i, item->children() ) { m_allItems.removeAt( m_allItems.indexOf( i ) ); lst << i; lst += removeChildItems( i ); } return lst; } void DependencyScene::moveItem( DependencyNodeItem *item, const QList &lst ) { //debugPlanDepEditor<text(); int idx = m_allItems.indexOf( item ); int ndx = lst.indexOf( item->node() ); Q_ASSERT( idx != -1 && ndx != -1 ); Node *oldParent = item->parentItem() == 0 ? 0 : item->parentItem()->node(); Node *newParent = item->node()->parentNode(); if ( newParent == m_project ) { newParent = 0; } else debugPlanDepEditor<name()<level(); if ( idx != ndx || oldParent != newParent ) { // If I have children, these must be moved too. QList items = removeChildItems( item ); m_allItems.removeAt( idx ); m_allItems.insert( ndx, item ); item->setParentItem( m_allItems.value( lst.indexOf( newParent ) ) ); item->setColumn(); //debugPlanDepEditor<text()<<":"<"<column()<setColumn(); //debugPlanDepEditor<text()<<": ->"<column()<flatNodeList() ); // might have been moved } m_hiddenItems.clear(); m_visibleItems.clear(); int viewrow = 0; for ( int i = 0; i < m_allItems.count(); ++i ) { DependencyNodeItem *itm = m_allItems[ i ]; if ( itm->isVisible() ) { m_visibleItems.insert( i, itm ); //debugPlanDepEditor<text()<<":"<setRow( viewrow ); ++viewrow; } else { m_hiddenItems.insert( i, itm ); } } } DependencyNodeItem *DependencyScene::findPrevItem( Node *node ) const { if ( node->numChildren() == 0 ) { return findItem( node ); } return findPrevItem( node->childNodeIterator().last() ); } DependencyNodeItem *DependencyScene::itemBefore( DependencyNodeItem *parent, Node *node ) const { Node *sib = node->siblingBefore(); DependencyNodeItem *bef = parent; if ( sib ) { bef = findPrevItem( sib ); } return bef; } DependencyNodeItem *DependencyScene::createItem( Node *node ) { DependencyNodeItem *parent = findItem( node->parentNode() ); DependencyNodeItem *after = itemBefore( parent, node ); int i = m_allItems.count()-1; if ( after ) { i = m_allItems.indexOf( after ); //debugPlanDepEditor<<"after="<node()->name()<<" pos="<scene() != this ) { addItem( item ); } item->setEditable( m_readwrite ); item->startConnector()->setEditable( m_readwrite ); item->finishConnector()->setEditable( m_readwrite ); //debugPlanDepEditor<text()<column() + 1; } item->setRectangle( QRectF( itemX( col ), itemY(), itemWidth(), itemHeight() ) ); m_allItems.insert( i+1, item ); setItemVisible( item, true ); return item; } DependencyLinkItem *DependencyScene::findItem( const Relation* rel ) const { foreach ( QGraphicsItem *i, itemList( DependencyLinkItem::Type ) ) { if ( static_cast( i )->relation == rel ) { return static_cast( i ); } } return 0; } DependencyLinkItem *DependencyScene::findItem( const DependencyConnectorItem *c1, const DependencyConnectorItem *c2, bool exact ) const { DependencyNodeItem *n1 = c1->nodeItem(); DependencyNodeItem *n2 = c2->nodeItem(); foreach ( QGraphicsItem *i, itemList( DependencyLinkItem::Type ) ) { DependencyLinkItem *link = static_cast( i ); if ( link->predItem == n1 && link->succItem == n2 ) { switch ( link->relation->type() ) { case Relation::StartStart: if ( c1->ctype() == DependencyNodeItem::Start && c2->ctype() == DependencyNodeItem::Start ) { return link; } break; case Relation::FinishStart: if ( c1->ctype() == DependencyNodeItem::Finish && c2->ctype() == DependencyNodeItem::Start ) { return link; } break; case Relation::FinishFinish: if ( c1->ctype() == DependencyNodeItem::Finish && c2->ctype() == DependencyNodeItem::Finish ) { return link; } break; default: break; } return 0; } if ( link->predItem == n2 && link->succItem == n1 ) { if ( exact ) { return 0; } switch ( link->relation->type() ) { case Relation::StartStart: if ( c2->ctype() == DependencyNodeItem::Start && c1->ctype() == DependencyNodeItem::Start ) { return link; } break; case Relation::FinishStart: if ( c1->ctype() == DependencyNodeItem::Finish && c1->ctype() == DependencyNodeItem::Start ) { return link; } break; case Relation::FinishFinish: if ( c1->ctype() == DependencyNodeItem::Finish && c1->ctype() == DependencyNodeItem::Finish ) { return link; } break; default: break; } return 0; } } return 0; } DependencyNodeItem *DependencyScene::findItem( const Node *node ) const { foreach ( QGraphicsItem *i, itemList( DependencyNodeItem::Type ) ) { if ( static_cast( i )->node() == node ) { return static_cast( i ); } } return 0; } void DependencyScene::createLinks() { foreach ( DependencyNodeItem *i, m_allItems ) { createLinks( i ); } } void DependencyScene::createLinks( DependencyNodeItem *item ) { foreach ( Relation *rel, item->node()->dependChildNodes() ) { createLink( item, rel ); } } void DependencyScene::createLink( DependencyNodeItem *parent, Relation *rel ) { DependencyNodeItem *child = findItem( rel->child() ); if ( parent == 0 || child == 0 ) { return; } DependencyLinkItem *dep = new DependencyLinkItem( parent, child, rel ); dep->setEditable( m_readwrite ); addItem( dep ); //debugPlanDepEditor; dep->createPath(); } void DependencyScene::mouseMoveEvent( QGraphicsSceneMouseEvent *mouseEvent ) { if ( m_connectionitem->isVisible() ) { int x = qMin( qMax( sceneRect().left() + 2, mouseEvent->scenePos().x() ), sceneRect().right() - 4 ); int y = qMin( qMax( sceneRect().top() + 2, mouseEvent->scenePos().y() ), sceneRect().bottom() - 4 ); m_connectionitem->createPath( QPoint( x, y ) ); } QGraphicsScene::mouseMoveEvent( mouseEvent ); //debugPlanDepEditor<scenePos()<<","<isAccepted(); } void DependencyScene::keyPressEvent( QKeyEvent *keyEvent ) { //debugPlanDepEditor<update(); } emit focusItemChanged( focusItem() ); return; } switch ( keyEvent->key() ) { case Qt::Key_Left: { if ( fitem->type() == DependencyNodeItem::Type ) { DependencyConnectorItem *item = static_cast( fitem )->startConnector(); if ( item ) { setFocusItem( item ); } } else if ( fitem->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *citem = static_cast( fitem ); if ( citem->ctype() == DependencyNodeItem::Start ) { //Goto prev nodes finishConnector DependencyNodeItem *nitem = static_cast( citem->parentItem() ); DependencyNodeItem *item = nodeItem( nitem->row() - 1 ); if ( item ) { setFocusItem( item->finishConnector() ); } } else { // Goto node item (parent) setFocusItem( citem->parentItem() ); } } break; } case Qt::Key_Right: { if ( fitem->type() == DependencyNodeItem::Type ) { DependencyConnectorItem *item = static_cast( fitem )->finishConnector(); if ( item ) { setFocusItem( item ); } } else if ( fitem->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *citem = static_cast( fitem ); if ( citem->ctype() == DependencyNodeItem::Finish ) { //Goto prev nodes startConnector DependencyNodeItem *nitem = static_cast( citem->parentItem() ); DependencyNodeItem *item = nodeItem( nitem->row() + 1 ); if ( item ) { setFocusItem( item->startConnector() ); } } else { // Goto node item (parent) setFocusItem( citem->parentItem() ); } } break; } case Qt::Key_Up: { if ( fitem->type() == DependencyNodeItem::Type ) { DependencyNodeItem *item = nodeItem( static_cast( fitem )->row() - 1 ); if ( item ) { setFocusItem( item ); } } else if ( fitem->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *citem = static_cast( fitem ); DependencyNodeItem *nitem = static_cast( citem->parentItem() ); if ( citem->ctype() == DependencyNodeItem::Finish ) { DependencyNodeItem *item = nodeItem( nitem->row() - 1 ); if ( item ) { setFocusItem( item->finishConnector() ); } } else { DependencyNodeItem *item = nodeItem( static_cast( fitem )->row() - 1 ); if ( item ) { setFocusItem( item->startConnector() ); } } } break; } case Qt::Key_Down: { if ( fitem->type() == DependencyNodeItem::Type ) { DependencyNodeItem *item = nodeItem( static_cast( fitem )->row() + 1 ); if ( item ) { setFocusItem( item ); } } else if ( fitem->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *citem = static_cast( fitem ); DependencyNodeItem *nitem = static_cast( citem->parentItem() ); if ( citem->ctype() == DependencyNodeItem::Finish ) { DependencyNodeItem *item = nodeItem( nitem->row() + 1 ); if ( item ) { setFocusItem( item->finishConnector() ); } } else { DependencyNodeItem *item = nodeItem( static_cast( fitem )->row() + 1 ); if ( item ) { setFocusItem( item->startConnector() ); } } } break; } case Qt::Key_Space: case Qt::Key_Select: { if ( fitem->type() == DependencyConnectorItem::Type ) { singleConnectorClicked( static_cast( fitem ) ); } else if ( fitem->type() == DependencyNodeItem::Type ) { singleConnectorClicked( 0 ); foreach ( QGraphicsItem *i, selectedItems() ) { i->setSelected( false ); } fitem->setSelected( true ); } return; } default: QGraphicsScene::keyPressEvent( keyEvent ); } if ( fitem ) { fitem->parentItem() ? fitem->parentItem()->update() : fitem->update(); } if ( focusItem() ) { focusItem()->parentItem() ? focusItem()->parentItem()->update() : focusItem()->update(); } if ( fitem != focusItem() ) { emit focusItemChanged( focusItem() ); } } DependencyNodeItem *DependencyScene::nodeItem( int row ) const { if ( row < 0 || m_visibleItems.isEmpty() ) { return 0; } foreach ( DependencyNodeItem *i, m_visibleItems ) { if ( i->row() == row ) { return i; } } return 0; } void DependencyScene::singleConnectorClicked( DependencyConnectorItem *item ) { //debugPlanDepEditor; clearSelection(); QList lst; if ( item == 0 || item == fromItem() ) { setFromItem( 0 ); m_clickedItems = lst; } else if ( fromItem() == 0 ) { setFromItem( item ); } else if ( connectionIsValid( fromItem(), item ) ) { emit connectItems( fromItem(), item ); setFromItem( 0 ); } else { setFromItem( 0 ); } emit connectorClicked( item ); } void DependencyScene::multiConnectorClicked( DependencyConnectorItem *item ) { //debugPlanDepEditor; singleConnectorClicked( item ); } void DependencyScene::clearConnection() { setFromItem( 0 ); m_clickedItems.clear(); } void DependencyScene::mousePressEvent( QGraphicsSceneMouseEvent *mouseEvent ) { //debugPlanDepEditor; QGraphicsScene::mousePressEvent( mouseEvent ); if ( ! mouseEvent->isAccepted() ) { clearConnection(); } } void DependencyScene::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *event ) { //debugPlanDepEditor<pos()<scenePos()<screenPos(); QGraphicsScene::mouseDoubleClickEvent( event ); emit itemDoubleClicked( itemAt( event->scenePos(), QTransform() ) ); } void DependencyScene::contextMenuEvent ( QGraphicsSceneContextMenuEvent *event ) { if ( event->reason() == QGraphicsSceneContextMenuEvent::Mouse ) { debugPlanDepEditor<<"Mouse:"<scenePos(), QTransform())<pos()<scenePos()<screenPos(); emit contextMenuRequested( itemAt( event->scenePos(), QTransform() ), event->screenPos() ); return; } if ( focusItem() ) { if ( focusItem()->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *to = static_cast( focusItem() ); DependencyConnectorItem *from = fromItem(); debugPlanDepEditor<<"DependencyConnectorItem:"<type() == DependencyConnectorItem::Type ) { static_cast( i )->setEditable( on ); } else if ( i->type() == DependencyLinkItem::Type ) { static_cast( i )->setEditable( on ); } } } //-------------------- DependencyView::DependencyView( QWidget *parent ) : QGraphicsView( parent ), m_project( 0 ), m_dirty( false ), m_active( false ) { setItemScene( new DependencyScene( this ) ); setAlignment( Qt::AlignLeft | Qt::AlignTop ); connect( scene(), SIGNAL(selectionChanged()), this, SLOT(slotSelectionChanged()) ); connect( scene(), SIGNAL(connectItems(DependencyConnectorItem*,DependencyConnectorItem*)), this, SIGNAL(makeConnection(DependencyConnectorItem*,DependencyConnectorItem*)) ); connect( scene(), SIGNAL(contextMenuRequested(QGraphicsItem*)), this, SLOT(slotContextMenuRequested(QGraphicsItem*)) ); connect( scene(), SIGNAL(dependencyContextMenuRequested(DependencyLinkItem*,DependencyConnectorItem*)), this, SLOT(slotDependencyContextMenuRequested(DependencyLinkItem*,DependencyConnectorItem*)) ); connect( scene(), SIGNAL(contextMenuRequested(QGraphicsItem*,QPoint)), this, SIGNAL(contextMenuRequested(QGraphicsItem*,QPoint)) ); connect( itemScene(), SIGNAL(focusItemChanged(QGraphicsItem*)), this, SLOT(slotFocusItemChanged(QGraphicsItem*)) ); m_autoScrollTimer.start( 100 ); connect( &m_autoScrollTimer, SIGNAL(timeout()), SLOT(slotAutoScroll()) ); } void DependencyView::slotContextMenuRequested( QGraphicsItem *item ) { if ( item ) { debugPlanDepEditor<boundingRect()<<(item->mapToScene( item->pos() ).toPoint())<<(mapToGlobal( item->mapToParent( item->pos() ).toPoint())); emit contextMenuRequested( item, mapToGlobal( item->mapToScene( item->boundingRect().topRight() ).toPoint() ) ); } } void DependencyView::slotDependencyContextMenuRequested( DependencyLinkItem *item, DependencyConnectorItem */*connector */) { if ( item ) { debugPlanDepEditor<boundingRect()<<(item->mapToScene( item->pos() ).toPoint())<<(mapToGlobal( item->mapToParent( item->pos() ).toPoint())); emit contextMenuRequested( item, mapToGlobal( item->mapToScene( item->boundingRect().topRight() ).toPoint() ) ); } } void DependencyView::slotConnectorClicked( DependencyConnectorItem *item ) { if ( itemScene()->fromItem() == 0 ) { itemScene()->setFromItem( item ); } else { //debugPlanDepEditor<<"emit makeConnection:"<( item->parentItem() )->text(); emit makeConnection( itemScene()->fromItem(), item ); } } void DependencyView::slotSelectionChanged() { //HACK because of tt bug 160653 QTimer::singleShot(0, this, SLOT(slotSelectedItems())); } void DependencyView::slotSelectedItems() { emit selectionChanged( itemScene()->selectedItems() ); } void DependencyView::slotFocusItemChanged( QGraphicsItem *item ) { ensureVisible( item, 10, 10 ); } void DependencyView::setItemScene( DependencyScene *scene ) { setScene( scene ); scene->setProject( m_project ); //slotResizeScene( m_treeview->viewport()->size() ); if ( m_project ) { createItems(); } } void DependencyView::setActive( bool activate ) { m_active = activate; if ( m_active && m_dirty ) { createItems(); } } void DependencyView::setProject( Project *project ) { if ( m_project ) { disconnect( m_project, SIGNAL(relationAdded(Relation*)), this, SLOT(slotRelationAdded(Relation*)) ); disconnect( m_project, SIGNAL(relationRemoved(Relation*)), this, SLOT(slotRelationRemoved(Relation*)) ); disconnect( m_project, SIGNAL(relationModified(Relation*)), this, SLOT(slotRelationModified(Relation*)) ); disconnect( m_project, SIGNAL(nodeAdded(Node*)), this, SLOT(slotNodeAdded(Node*)) ); disconnect( m_project, SIGNAL(nodeRemoved(Node*)), this, SLOT(slotNodeRemoved(Node*)) ); disconnect( m_project, SIGNAL(nodeChanged(Node*)), this, SLOT(slotNodeChanged(Node*)) ); disconnect( m_project, SIGNAL(nodeMoved(Node*)), this, SLOT(slotNodeMoved(Node*)) ); if ( itemScene() ) { itemScene()->clearScene(); } } m_project = project; if ( project ) { connect( m_project, SIGNAL(relationAdded(Relation*)), this, SLOT(slotRelationAdded(Relation*)) ); connect( m_project, SIGNAL(relationRemoved(Relation*)), this, SLOT(slotRelationRemoved(Relation*)) ); connect( m_project, SIGNAL(relationModified(Relation*)), this, SLOT(slotRelationModified(Relation*)) ); connect( m_project, SIGNAL(nodeAdded(Node*)), this, SLOT(slotNodeAdded(Node*)) ); connect( m_project, SIGNAL(nodeRemoved(Node*)), this, SLOT(slotNodeRemoved(Node*)) ); connect( m_project, SIGNAL(nodeChanged(Node*)), this, SLOT(slotNodeChanged(Node*)) ); connect( m_project, SIGNAL(nodeMoved(Node*)), this, SLOT(slotNodeMoved(Node*)) ); connect( m_project, SIGNAL(wbsDefinitionChanged()), this, SLOT(slotWbsCodeChanged()) ); if ( itemScene() ) { itemScene()->setProject( project ); if ( m_active ) { createItems(); } else { m_dirty = true; } } } } DependencyLinkItem *DependencyView::findItem( const Relation* rel ) const { return itemScene()->findItem( rel ); } DependencyNodeItem *DependencyView::findItem( const Node *node ) const { return itemScene()->findItem( node ); } void DependencyView::slotRelationAdded( Relation* rel ) { if ( m_dirty ) { return; } DependencyLinkItem *item = findItem( rel ); if ( item == 0 ) { DependencyNodeItem *p = findItem( rel->parent() ); DependencyNodeItem *c = findItem( rel->child() ); DependencyLinkItem *r = new DependencyLinkItem( p, c, rel ); scene()->addItem( r ); //debugPlanDepEditor; r->createPath(); r->setVisible( c->isVisible() && p->isVisible() ); } else debugPlanDepEditor<<"Relation already exists!"; } void DependencyView::slotRelationRemoved( Relation* rel ) { if ( m_dirty ) { return; } DependencyLinkItem *item = findItem( rel ); if ( item ) { scene()->removeItem( item ); delete item; } else debugPlanDepEditor<<"Relation does not exist!"; } void DependencyView::slotRelationModified( Relation* rel ) { //debugPlanDepEditor; if ( m_dirty ) { return; } slotRelationRemoved( rel ); slotRelationAdded( rel ); } void DependencyView::slotNodeAdded( Node *node ) { //debugPlanDepEditor; if ( m_dirty ) { return; } DependencyNodeItem *item = findItem( node ); if ( item == 0 ) { item = createItem( node ); } else { //debugPlanDepEditor<name(); itemScene()->setItemVisible( item, true ); } ensureVisible( item ); slotWbsCodeChanged(); } void DependencyView::slotNodeRemoved( Node *node ) { if ( m_dirty ) { return; } DependencyNodeItem *item = findItem( node ); if ( item ) { //debugPlanDepEditor<name(); itemScene()->setItemVisible( item, false ); } else debugPlanDepEditor<<"Node does not exist!"; slotWbsCodeChanged(); } void DependencyView::slotNodeChanged( Node *node ) { if ( m_dirty ) { return; } DependencyNodeItem *item = findItem( node ); if ( item && item->isVisible() ) { item->setText(); item->setSymbol(); } else debugPlanDepEditor<<"Node does not exist!"; } void DependencyView::slotWbsCodeChanged() { if ( m_dirty ) { return; } foreach( DependencyNodeItem *i, itemScene()->nodeItems() ) { if ( i->isVisible() ) { i->setText(); } } } void DependencyView::slotNodeMoved( Node *node ) { if ( m_dirty ) { return; } slotNodeRemoved( node ); slotNodeAdded( node ); } void DependencyView::setItemExpanded( int , bool ) { } void DependencyView::createItems() { itemScene()->clearScene(); m_dirty = false; if ( m_project == 0 ) { return; } scene()->addLine( 0.0, 0.0, 1.0, 0.0 ); createItems( m_project ); createLinks(); } DependencyNodeItem *DependencyView::createItem( Node *node ) { return itemScene()->createItem( node ); } void DependencyView::createItems( Node *node ) { if ( node != m_project ) { //debugPlanDepEditor<name()<<" ("<numChildren()<<")"; DependencyNodeItem *i = createItem( node ); if ( i == 0 ) { return; } } foreach ( Node *n, node->childNodeIterator() ) { createItems( n ); } } void DependencyView::createLinks() { //debugPlanDepEditor; itemScene()->createLinks(); } void DependencyView::keyPressEvent(QKeyEvent *event) { if ( event->modifiers() & Qt::ControlModifier ) { switch ( event->key() ) { case Qt::Key_Plus: return scale( 1.1, 1.1 ); case Qt::Key_Minus: return scale( 0.9, 0.9 ); default: break; } } QGraphicsView::keyPressEvent(event); } void DependencyView::mouseMoveEvent( QMouseEvent *mouseEvent ) { m_cursorPos = mouseEvent->pos(); if ( itemScene()->connectionMode() && itemScene()->mouseGrabberItem() ) { QPointF spos = mapToScene( m_cursorPos ); Qt::CursorShape c = Qt::ArrowCursor; foreach ( QGraphicsItem *i, itemScene()->items( spos ) ) { if ( i->type() == DependencyConnectorItem::Type ) { if ( i == itemScene()->fromItem() ) { c = ConnectCursor; } else { if ( itemScene()->connectionIsValid( itemScene()->fromItem(), static_cast( i ) ) ) { c = ConnectCursor; } else { c = Qt::ForbiddenCursor; } } } } if ( viewport()->cursor().shape() != c ) { viewport()->setCursor( c ); } } QGraphicsView::mouseMoveEvent( mouseEvent ); //debugPlanDepEditor<scenePos()<<","<isAccepted(); } void DependencyView::slotAutoScroll() { if ( itemScene()->connectionMode() ) { ensureVisible( QRectF( mapToScene( m_cursorPos ), QSizeF( 1, 1 ) ), 2, 2 ); } } //----------------------------------- DependencyeditorConfigDialog::DependencyeditorConfigDialog( ViewBase *view, QWidget *p, bool selectPrint) : KPageDialog(p), m_view( view ) { setWindowTitle( i18n("Settings") ); QTabWidget *tab = new QTabWidget(); QWidget *w = ViewBase::createPageLayoutWidget( view ); tab->addTab( w, w->windowTitle() ); m_pagelayout = w->findChild(); Q_ASSERT( m_pagelayout ); m_headerfooter = ViewBase::createHeaderFooterWidget( view ); m_headerfooter->setOptions( view->printingOptions() ); tab->addTab( m_headerfooter, m_headerfooter->windowTitle() ); KPageWidgetItem *page = addPage( tab, i18n( "Printing" ) ); page->setHeader( i18n( "Printing Options" ) ); if (selectPrint) { setCurrentPage(page); } connect( this, SIGNAL(accepted()), this, SLOT(slotOk())); } void DependencyeditorConfigDialog::slotOk() { debugPlan; m_view->setPageLayout( m_pagelayout->pageLayout() ); m_view->setPrintingOptions( m_headerfooter->options() ); } //-------------------- DependencyEditor::DependencyEditor(KoPart *part, KoDocument *doc, QWidget *parent ) : ViewBase(part, doc, parent), m_currentnode( 0 ), m_manager( 0 ) { setupGui(); QVBoxLayout * l = new QVBoxLayout( this ); l->setMargin( 0 ); m_view = new DependencyView( this ); l->addWidget( m_view ); connect( m_view, SIGNAL(makeConnection(DependencyConnectorItem*,DependencyConnectorItem*)), this, SLOT(slotCreateRelation(DependencyConnectorItem*,DependencyConnectorItem*)) ); connect( m_view, SIGNAL(selectionChanged(QList)), this, SLOT(slotSelectionChanged(QList)) ); connect( m_view->itemScene(), SIGNAL(itemDoubleClicked(QGraphicsItem*)), this, SLOT(slotItemDoubleClicked(QGraphicsItem*)) ); connect( m_view, SIGNAL(contextMenuRequested(QGraphicsItem*,QPoint)), this, SLOT(slotContextMenuRequested(QGraphicsItem*,QPoint)) ); Help::add(this, xi18nc("@info:whatsthis", "Task Dependency Editor" "" "Edit dependencies between tasks." "Dependencies can be added by dragging a connection area (start or finish)" " from one task to a connection area of a different task." " You can edit or delete a dependency using the context menu." "" "This view supports printing using the context menu." "More..." "", Help::page("Manual/Task_Dependency_Editor_(Graphical)"))); } void DependencyEditor::updateReadWrite( bool on ) { m_view->itemScene()->setReadWrite( on ); ViewBase::updateReadWrite( on ); } void DependencyEditor::slotItemDoubleClicked( QGraphicsItem *item ) { //debugPlanDepEditor; if ( ! isReadWrite() ) { return; } if ( item && item->type() == DependencyLinkItem::Type ) { emit modifyRelation( static_cast( item )->relation ); return; } if ( item && item->type() == DependencyNodeItem::Type ) { emit editNode( static_cast( item )->node() ); return; } if ( item && item->type() == DependencyNodeSymbolItem::Type ) { emit editNode( static_cast( item->parentItem() )->node() ); return; } } void DependencyEditor::slotCreateRelation( DependencyConnectorItem *pred, DependencyConnectorItem *succ ) { //debugPlanDepEditor; if ( ! isReadWrite() ) { return; } Node *par = pred->node(); Node *ch = succ->node(); Relation::Type type = Relation::FinishStart; if ( pred->ctype() == DependencyNodeItem::Start ) { if ( succ->ctype() == DependencyNodeItem::Start ) { type = Relation::StartStart; } } else { if ( succ->ctype() == DependencyNodeItem::Start ) { type = Relation::FinishStart; } else { type = Relation::FinishFinish; } } Relation *rel = ch->findRelation( par ); if ( rel == 0 ) { //debugPlanDepEditor<<"New:"<name()<<" ->"<name()<<","<type() != type ) { //debugPlanDepEditor<<"Mod:"<name()<<" ->"<name()<<","<setProject( &project ); } void DependencyEditor::draw() { } void DependencyEditor::setGuiActive( bool activate ) { //debugPlanDepEditor<setActive( activate ); /* if ( activate && !m_view->selectionModel()->currentIndex().isValid() ) { m_view->selectionModel()->setCurrentIndex(m_view->model()->index( 0, 0 ), QItemSelectionModel::NoUpdate); }*/ } void DependencyEditor::slotCurrentChanged( const QModelIndex &, const QModelIndex & ) { //debugPlanDepEditor<& ) { //debugPlanDepEditor< DependencyEditor::selectedNodes() const { QList lst; foreach ( QGraphicsItem *i, m_view->itemScene()->selectedItems() ) { if ( i->type() == DependencyNodeItem::Type ) { lst << static_cast( i )->node(); } } return lst; } Node *DependencyEditor::selectedNode() const { QList lst = selectedNodes(); if ( lst.count() != 1 ) { return 0; } return lst.first(); } Node *DependencyEditor::currentNode() const { return m_currentnode; /* Node * n = 0; QGraphicsItem *i = m_view->itemScene()->focusItem(); if ( i && i->type() == DependencyNodeItem::Type ) { n = static_cast( i )->node(); } if ( n == 0 || n->type() == Node::Type_Project ) { return 0; } return n;*/ } Relation *DependencyEditor::currentRelation() const { return m_currentrelation; } void DependencyEditor::setScheduleManager( ScheduleManager *sm ) { m_manager = sm; } void DependencyEditor::slotContextMenuRequested( QGraphicsItem *item, const QPoint& pos ) { //debugPlanDepEditor<type() == DependencyNodeSymbolItem::Type ) { item = item->parentItem(); } if ( item ) { if ( item->type() == DependencyNodeItem::Type ) { m_currentnode = static_cast( item )->node(); if ( m_currentnode == 0 ) { //debugPlanDepEditor<<"No node"; return; } bool scheduled = m_manager != 0 && m_currentnode->isScheduled( m_manager->scheduleId() ); switch ( m_currentnode->type() ) { case Node::Type_Task: name = scheduled ? "task_popup" : "task_edit_popup"; break; case Node::Type_Milestone: name = scheduled ? "taskeditor_milestone_popup" : "task_edit_popup"; break; case Node::Type_Summarytask: name = "summarytask_popup"; break; default: break; } //debugPlanDepEditor<name()<<" :"<type() == DependencyLinkItem::Type ) { m_currentrelation = static_cast( item )->relation; if ( m_currentrelation ) { name = "relation_popup"; } } else if ( item->type() == DependencyConnectorItem::Type ) { DependencyConnectorItem *c = static_cast( item ); QList items; QList actions; QMenu menu; foreach ( DependencyLinkItem *i, c->predecessorItems() ) { items << i; actions << menu.addAction(koIcon("document-properties"), i->predItem->text()); } menu.addSeparator(); foreach ( DependencyLinkItem *i, c->successorItems() ) { items << i; actions << menu.addAction(koIcon("document-properties"), i->succItem->text()); } if ( ! actions.isEmpty() ) { QAction *action = menu.exec( pos ); if ( action && actions.contains( action ) ) { emit modifyRelation( items[ actions.indexOf( action ) ]->relation ); return; } } } } //debugPlanDepEditor< lst = contextActionList(); if ( ! lst.isEmpty() ) { QMenu::exec( lst, pos, lst.first() ); } } m_currentnode = 0; m_currentrelation = 0; } void DependencyEditor::slotEnableActions() { updateActionsEnabled( true ); } void DependencyEditor::updateActionsEnabled( bool on ) { if ( ! on || ! isReadWrite() ) { //FIXME: read-write is not set properly menuAddTask->setEnabled( false ); actionAddTask->setEnabled( false ); actionAddMilestone->setEnabled( false ); menuAddSubTask->setEnabled( false ); actionAddSubtask->setEnabled( false ); actionAddSubMilestone->setEnabled( false ); actionDeleteTask->setEnabled( false ); return; } int selCount = selectedNodeCount(); if ( selCount == 0 ) { menuAddTask->setEnabled( true ); actionAddTask->setEnabled( true ); actionAddMilestone->setEnabled( true ); menuAddSubTask->setEnabled( false ); actionAddSubtask->setEnabled( false ); actionAddSubMilestone->setEnabled( false ); actionDeleteTask->setEnabled( false ); return; } Node *n = selectedNode(); if ( n && n->type() != Node::Type_Task && n->type() != Node::Type_Milestone && n->type() != Node::Type_Summarytask ) { n = 0; } if ( selCount == 1 && n == 0 ) { // only project selected menuAddTask->setEnabled( true ); actionAddTask->setEnabled( true ); actionAddMilestone->setEnabled( true ); menuAddSubTask->setEnabled( true ); actionAddSubtask->setEnabled( true ); actionAddSubMilestone->setEnabled( true ); actionDeleteTask->setEnabled( false ); return; } bool baselined = false; Project *p = m_view->project(); if ( p && p->isBaselined() ) { foreach ( Node *n, selectedNodes() ) { if ( n->isBaselined() ) { baselined = true; break; } } } if ( selCount == 1 ) { menuAddTask->setEnabled( true ); actionAddTask->setEnabled( true ); actionAddMilestone->setEnabled( true ); menuAddSubTask->setEnabled( ! baselined || n->type() == Node::Type_Summarytask ); actionAddSubtask->setEnabled( ! baselined || n->type() == Node::Type_Summarytask ); actionAddSubMilestone->setEnabled( ! baselined || n->type() == Node::Type_Summarytask ); actionDeleteTask->setEnabled( ! baselined ); return; } // selCount > 1 menuAddTask->setEnabled( false ); actionAddTask->setEnabled( false ); actionAddMilestone->setEnabled( false ); menuAddSubTask->setEnabled( false ); actionAddSubtask->setEnabled( false ); actionAddSubMilestone->setEnabled( false ); actionDeleteTask->setEnabled( ! baselined ); } void DependencyEditor::setupGui() { KActionCollection *coll = actionCollection(); QString name = "taskeditor_add_list"; menuAddTask = new KActionMenu(koIcon("view-task-add"), i18n("Add Task"), this); coll->addAction("add_task", menuAddTask ); connect( menuAddTask, SIGNAL(triggered(bool)), SLOT(slotAddTask()) ); addAction( name, menuAddTask ); actionAddTask = new QAction( i18n("Add Task..."), this); actionAddTask->setShortcut( Qt::CTRL + Qt::Key_I ); connect( actionAddTask, SIGNAL(triggered(bool)), SLOT(slotAddTask()) ); menuAddTask->addAction( actionAddTask ); actionAddMilestone = new QAction( i18n("Add Milestone..."), this ); actionAddMilestone->setShortcut( Qt::CTRL + Qt::ALT + Qt::Key_I ); connect( actionAddMilestone, SIGNAL(triggered(bool)), SLOT(slotAddMilestone()) ); menuAddTask->addAction( actionAddMilestone ); menuAddSubTask = new KActionMenu(koIcon("view-task-child-add"), i18n("Add Sub-Task"), this); coll->addAction("add_subtask", menuAddTask ); connect( menuAddSubTask, SIGNAL(triggered(bool)), SLOT(slotAddSubtask()) ); addAction( name, menuAddSubTask ); actionAddSubtask = new QAction( i18n("Add Sub-Task..."), this ); actionAddSubtask->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_I ); connect( actionAddSubtask, SIGNAL(triggered(bool)), SLOT(slotAddSubtask()) ); menuAddSubTask->addAction( actionAddSubtask ); actionAddSubMilestone = new QAction( i18n("Add Sub-Milestone..."), this ); actionAddSubMilestone->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::ALT + Qt::Key_I ); connect( actionAddSubMilestone, SIGNAL(triggered(bool)), SLOT(slotAddSubMilestone()) ); menuAddSubTask->addAction( actionAddSubMilestone ); actionDeleteTask = new QAction(koIcon("edit-delete"), xi18nc("@action", "Delete"), this); coll->addAction("delete_task", actionDeleteTask ); coll->setDefaultShortcut(actionDeleteTask, Qt::Key_Delete); connect( actionDeleteTask, SIGNAL(triggered(bool)), SLOT(slotDeleteTask()) ); addAction( name, actionDeleteTask ); createOptionActions(ViewBase::OptionPrint | ViewBase::OptionPrintPreview | ViewBase::OptionPrintPdf | ViewBase::OptionPrintConfig); } void DependencyEditor::slotOptions() { debugPlan; DependencyeditorConfigDialog *dlg = new DependencyeditorConfigDialog( this, this, sender()->objectName() == "print options" ); connect(dlg, SIGNAL(finished(int)), SLOT(slotOptionsFinished(int))); dlg->show(); dlg->raise(); dlg->activateWindow(); } void DependencyEditor::slotAddTask() { //debugPlanDepEditor; m_currentnode = selectedNode(); emit addTask(); m_currentnode = 0; } void DependencyEditor::slotAddMilestone() { //debugPlanDepEditor; m_currentnode = selectedNode(); // sibling emit addMilestone(); m_currentnode = 0; } void DependencyEditor::slotAddSubtask() { //debugPlanDepEditor; m_currentnode = selectedNode(); if ( m_currentnode == 0 ) { return; } emit addSubtask(); m_currentnode = 0; } void DependencyEditor::slotAddSubMilestone() { debugPlanDepEditor; m_currentnode = selectedNode(); if ( m_currentnode == 0 ) { return; } emit addSubMilestone(); m_currentnode = 0; } void DependencyEditor::edit( const QModelIndex &i ) { if ( i.isValid() ) { /* QModelIndex p = m_view->itemModel()->parent( i ); m_view->treeView()->setExpanded( p, true ); m_view->treeView()->selectionModel()->setCurrentIndex( i, QItemSelectionModel::NoUpdate ); m_view->treeView()->edit( i );*/ } } void DependencyEditor::slotDeleteTask() { //debugPlanDepEditor; QList lst = selectedNodes(); while ( true ) { // remove children of selected tasks, as parents delete their children Node *ch = 0; foreach ( Node *n1, lst ) { foreach ( Node *n2, lst ) { if ( n2->isChildOf( n1 ) ) { ch = n2; break; } } if ( ch != 0 ) { break; } } if ( ch == 0 ) { break; } lst.removeAt( lst.indexOf( ch ) ); } foreach ( Node* n, lst ) { debugPlanDepEditor<name(); } emit deleteTaskList( lst ); } KoPrintJob *DependencyEditor::createPrintJob() { DependecyViewPrintingDialog *dia = new DependecyViewPrintingDialog( this, m_view ); dia->printer().setCreator( QString( "Plan %1" ).arg( PLAN_VERSION_STRING ) ); // dia->printer().setFullPage(true); // ignore printer margins return dia; } } // namespace KPlato diff --git a/src/libs/ui/kptdependencyeditor.h b/src/libs/ui/kptdependencyeditor.h index b422496a..7b425a58 100644 --- a/src/libs/ui/kptdependencyeditor.h +++ b/src/libs/ui/kptdependencyeditor.h @@ -1,587 +1,587 @@ /* This file is part of the KDE project Copyright (C) 2006 -2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDEPENDENCYEDITOR_H #define KPTDEPENDENCYEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptglobal.h" #include "kptitemmodelbase.h" #include "kpttaskeditor.h" #include "kptviewbase.h" #include "kptnode.h" #include "kptganttitemdelegate.h" #include #include #include #include #include class KoPageLayoutWidget; class QModelIndex; namespace KPlato { class Project; //class Node; class Relation; class ScheduleManager; class DependencyNodeSymbolItem; class DependencyConnectorItem; class DependencyNodeItem; class DependencyScene; class DependencyView; -class KPLATOUI_EXPORT DependecyViewPrintingDialog : public PrintingDialog +class PLANUI_EXPORT DependecyViewPrintingDialog : public PrintingDialog { Q_OBJECT public: DependecyViewPrintingDialog( ViewBase *parent, DependencyView *view ); int documentLastPage() const; void printPage( int page, QPainter &painter ); QList createOptionWidgets() const; private: DependencyView *m_depview; }; -class KPLATOUI_EXPORT DependencyLinkItemBase : public QGraphicsPathItem +class PLANUI_EXPORT DependencyLinkItemBase : public QGraphicsPathItem { public: explicit DependencyLinkItemBase ( QGraphicsItem * parent = 0 ); DependencyLinkItemBase ( DependencyNodeItem *predecessor, DependencyNodeItem *successor, Relation *rel, QGraphicsItem * parent = 0 ); ~DependencyLinkItemBase(); enum { Type = QGraphicsItem::UserType + 10 }; int type() const { return Type; } DependencyScene *itemScene() const; virtual void createPath() {} virtual void createPath( const QPointF &sp, int stype, const QPointF &dp, int dtype ); virtual QPointF startPoint() const { return QPointF(); } virtual QPointF endPoint() const { return QPointF(); } bool isEditable() const { return m_editable; } void setEditable( bool on ) { m_editable = on; } public: bool m_editable; DependencyNodeItem *predItem; DependencyNodeItem *succItem; Relation *relation; QGraphicsPathItem *m_arrow; }; -class KPLATOUI_EXPORT DependencyLinkItem : public DependencyLinkItemBase +class PLANUI_EXPORT DependencyLinkItem : public DependencyLinkItemBase { public: explicit DependencyLinkItem ( DependencyNodeItem *predecessor, DependencyNodeItem *successor, Relation *rel, QGraphicsItem * parent = 0 ); ~DependencyLinkItem(); enum { Type = QGraphicsItem::UserType + 11 }; int type() const { return Type; } int newChildColumn() const; using DependencyLinkItemBase::createPath; virtual void createPath(); virtual QPointF startPoint() const; virtual QPointF endPoint() const; void setItemVisible( bool show ); void resetHooverIndication(); protected: virtual void hoverEnterEvent( QGraphicsSceneHoverEvent *event ); virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent *event ); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); private: QPen m_pen; }; -class KPLATOUI_EXPORT DependencyCreatorItem : public DependencyLinkItemBase +class PLANUI_EXPORT DependencyCreatorItem : public DependencyLinkItemBase { public: explicit DependencyCreatorItem ( QGraphicsItem * parent = 0 ); ~DependencyCreatorItem() {} enum { Type = QGraphicsItem::UserType + 12 }; int type() const { return Type; } void clear(); using DependencyLinkItemBase::createPath; virtual void createPath(); void createPath( const QPointF &ep ); virtual QPointF startPoint() const; virtual QPointF endPoint() const; void setItemVisible( bool show ); void setPredConnector( DependencyConnectorItem *item ); void setSuccConnector( DependencyConnectorItem *item ); bool isEditable() const { return m_editable; } void setEditable( bool on ) { m_editable = on; } public: DependencyConnectorItem *predConnector; DependencyConnectorItem *succConnector; bool m_editable; }; //----------------------- -class KPLATOUI_EXPORT DependencyNodeItem : public QGraphicsRectItem +class PLANUI_EXPORT DependencyNodeItem : public QGraphicsRectItem { public: explicit DependencyNodeItem( Node *node, DependencyNodeItem *parent = 0 ); ~DependencyNodeItem(); enum { Type = QGraphicsItem::UserType + 1 }; int type() const { return Type; } DependencyNodeItem *parentItem() const { return m_parent; } void setParentItem( DependencyNodeItem *parent ); void addChild( DependencyNodeItem *ch ) { m_children.append( ch ); } DependencyNodeItem *takeChild( DependencyNodeItem *ch ); QList children() const { return m_children; } DependencyScene *itemScene() const; void setRectangle( const QRectF &rect ); void setRow( int row ); int row() const; void setColumn(); void setColumn( int column ); int column() const; Node *node() const { return m_node; } QString text() const { return m_text->toPlainText(); } void setText( const QString &text ) const { m_text->setPlainText( text ); } void setText(); enum ConnectorType { Start, Finish }; QPointF connectorPoint( ConnectorType type ) const; void setConnectorHoverMode( bool mode ); void addParentRelation( DependencyLinkItem *r ) { m_parentrelations.append( r ); } DependencyLinkItem *takeParentRelation( DependencyLinkItem *r ); QList parentRelations() const { return m_parentrelations; } void addChildRelation( DependencyLinkItem *r ) { m_childrelations.append( r ); } DependencyLinkItem *takeChildRelation( DependencyLinkItem *r ); QList childRelations() const { return m_childrelations; } void setExpanded( bool mode ); void setItemVisible( bool show ); void setSymbol(); int nodeLevel() const { return m_node == 0 ? 0 : m_node->level() - 1; } DependencyConnectorItem *startConnector() const { return m_start; } DependencyConnectorItem *finishConnector() const { return m_finish; } DependencyConnectorItem *connectorItem( ConnectorType ctype ) const; QList predecessorItems( ConnectorType ctype ) const; QList successorItems( ConnectorType ctype ) const; bool isEditable() const { return m_editable; } void setEditable( bool on ) { m_editable = on; } qreal treeIndicatorX() const; void setTreeIndicator( bool on ); protected: void moveToY( qreal y ); void moveToX( qreal x ); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); void paint( QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget ); void paintTreeIndicator( bool on ); private: Node *m_node; DependencyConnectorItem *m_start; DependencyConnectorItem *m_finish; QGraphicsTextItem *m_text; DependencyNodeSymbolItem *m_symbol; QFont m_textFont; DependencyNodeItem *m_parent; QList m_children; QList m_dependParents; QList m_dependChildren; QList m_parentrelations; QList m_childrelations; bool m_editable; QGraphicsPathItem *m_treeIndicator; }; //----------------------- -class KPLATOUI_EXPORT DependencyNodeSymbolItem : public QGraphicsPathItem +class PLANUI_EXPORT DependencyNodeSymbolItem : public QGraphicsPathItem { public: explicit DependencyNodeSymbolItem( DependencyNodeItem *parent = 0 ) : QGraphicsPathItem( parent ), m_editable( false ) {} enum { Type = QGraphicsItem::UserType + 3 }; int type() const { return Type; } void setSymbol( int type, const QRectF &rect ); bool isEditable() const { return m_editable; } void setEditable( bool on ) { m_editable = on; } using QGraphicsPathItem::paint; /// Special paint method as the default cannot be used void paint( Project *p, QPainter *painter, const QStyleOptionGraphicsItem *option ); private: GanttItemDelegate m_delegate; bool m_editable; int m_nodetype; KGantt::ItemType m_itemtype; }; //----------------------- -class KPLATOUI_EXPORT DependencyConnectorItem : public QGraphicsRectItem +class PLANUI_EXPORT DependencyConnectorItem : public QGraphicsRectItem { public: DependencyConnectorItem( DependencyNodeItem::ConnectorType type, DependencyNodeItem *parent ); enum { Type = QGraphicsItem::UserType + 2 }; int type() const { return Type; } DependencyNodeItem::ConnectorType ctype() const { return m_ctype; } DependencyScene *itemScene() const; Node* node() const; QPointF connectorPoint() const; DependencyNodeItem *nodeItem() const; QList predecessorItems() const; QList successorItems() const; bool isEditable() const { return m_editable; } void setEditable( bool on ) { m_editable = on; } protected: void hoverEnterEvent ( QGraphicsSceneHoverEvent *event ); void hoverLeaveEvent ( QGraphicsSceneHoverEvent *event ); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private: DependencyNodeItem::ConnectorType m_ctype; QPointF m_mousePressPos; bool m_editable; }; //----------------------- -class KPLATOUI_EXPORT DependencyScene : public QGraphicsScene +class PLANUI_EXPORT DependencyScene : public QGraphicsScene { Q_OBJECT public: explicit DependencyScene(QWidget *parent = 0); ~DependencyScene(); void setProject( Project *p ) { m_project = p; } Project *project() const { return m_project; } QList itemList( int type ) const; void clearScene(); qreal horizontalGap() const { return 40.0; } qreal verticalGap() const { return 6.0; } qreal itemWidth() const { return 50.0; } qreal itemHeight() const { return 26.0; } QRectF symbolRect() const { return QRectF( 1.0, 1.0, 15.0, 15.0 ); } qreal connectorWidth() const { return 8.0; } qreal totalItemWidth() const { return itemWidth(); } qreal columnWidth() const { return horizontalGap() + totalItemWidth(); } qreal gridHeight() const { return verticalGap() + itemHeight(); } qreal gridWidth() const { return horizontalGap() + totalItemWidth(); } qreal gridX( int col ) const { return col * gridWidth(); } qreal itemX( int col=0 ) const { return ( horizontalGap() / 2 ) + ( gridWidth() * col ); } int column( qreal x ) const { return (int)( x / columnWidth() ); } qreal gridY( int row ) const { return row * gridHeight(); } qreal itemY( int row=0 ) const { return ( verticalGap() / 2 ) + ( gridHeight() * row ); } int row( qreal y ) const { return (int)( y / gridHeight() ); } DependencyLinkItem *findItem( const Relation *rel ) const; DependencyLinkItem *findItem( const DependencyConnectorItem *c1, const DependencyConnectorItem *c2, bool exact = true ) const; DependencyNodeItem *findItem( const Node *node ) const; DependencyNodeItem *findPrevItem( Node *node ) const; DependencyNodeItem *itemBefore( DependencyNodeItem *parent, Node *node ) const; DependencyNodeItem *createItem( Node *node ); void setItemVisible( DependencyNodeItem *item, bool show ); void createLinks(); void createLinks( DependencyNodeItem *item ); void createLink( DependencyNodeItem *parent, Relation *rel ); void connectorEntered( DependencyConnectorItem *item, bool entered ); void setFromItem( DependencyConnectorItem *item ); DependencyConnectorItem *fromItem() const { return m_connectionitem->predConnector; } bool connectionMode() const { return m_connectionitem->isVisible(); } void singleConnectorClicked( DependencyConnectorItem *item ); void multiConnectorClicked( DependencyConnectorItem *item ); bool connectionIsValid( DependencyConnectorItem *pred, DependencyConnectorItem *succ ); void clearConnection(); /// Used when a node has been moved void moveItem( DependencyNodeItem *item, const QList &lst ); QList removeChildItems( DependencyNodeItem *item ); DependencyNodeItem *nodeItem( int row ) const; const QList &nodeItems() const { return m_allItems; } void setReadWrite( bool on ); Q_SIGNALS: void connectorClicked( DependencyConnectorItem *item ); void connectItems( DependencyConnectorItem *pred, DependencyConnectorItem *succ ); void itemDoubleClicked( QGraphicsItem * ); void contextMenuRequested( QGraphicsItem*, const QPoint& ); void contextMenuRequested( QGraphicsItem* ); void dependencyContextMenuRequested( DependencyLinkItem*, DependencyConnectorItem* ); void focusItemChanged( QGraphicsItem* ); protected: virtual void drawBackground ( QPainter * painter, const QRectF & rect ); virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *mouseEvent ); virtual void mousePressEvent( QGraphicsSceneMouseEvent *mouseEvent ); virtual void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *mouseEvent ); virtual void keyPressEvent ( QKeyEvent *keyEvent ); virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent *contextMenuEvent ); private: Project *m_project; NodeItemModel *m_model; bool m_readwrite; QList m_allItems; QMap m_visibleItems; QMap m_hiddenItems; DependencyCreatorItem *m_connectionitem; QList m_clickedItems; }; //----------------------- -class KPLATOUI_EXPORT DependencyView : public QGraphicsView +class PLANUI_EXPORT DependencyView : public QGraphicsView { Q_OBJECT public: explicit DependencyView(QWidget *parent); void setProject( Project *project ); Project *project() const { return m_project; } void setItemExpanded( int x, bool mode ); DependencyNodeItem *createItem( Node *node ); void createItems( Node *node ); void createItems(); void createLinks(); DependencyLinkItem *findItem( const Relation *rel ) const; DependencyNodeItem *findItem( const Node *node ) const; DependencyScene *itemScene() const { return static_cast( scene() ); } void setItemScene(DependencyScene *scene ); void setActive( bool activate ); Q_SIGNALS: void selectionChanged(); void selectionChanged( QGraphicsItem * ); void selectionChanged( const QList& ); void makeConnection( DependencyConnectorItem *pred, DependencyConnectorItem *succ ); void contextMenuRequested( QGraphicsItem*, const QPoint& ); public Q_SLOTS: void slotNodeAdded( Node *node ); void slotNodeRemoved( Node *node ); void slotNodeChanged( Node *node ); void slotNodeMoved( Node *node ); protected: void keyPressEvent(QKeyEvent *event); void mouseMoveEvent( QMouseEvent *mouseEvent ); protected Q_SLOTS: void slotSelectionChanged(); void slotRelationAdded( Relation* rel ); void slotRelationRemoved( Relation* rel ); void slotRelationModified( Relation* rel ); void slotWbsCodeChanged(); void slotSelectedItems(); // HACK due to tt bug 160653 void slotConnectorClicked( DependencyConnectorItem *item ); void slotContextMenuRequested( QGraphicsItem* ); void slotDependencyContextMenuRequested( DependencyLinkItem *item, DependencyConnectorItem *connector ); void slotFocusItemChanged( QGraphicsItem* ); private Q_SLOTS: void slotAutoScroll(); private: Project *m_project; bool m_dirty; bool m_active; QPoint m_cursorPos; QTimer m_autoScrollTimer; }; //-------------------- class DependencyeditorConfigDialog : public KPageDialog { Q_OBJECT public: DependencyeditorConfigDialog( ViewBase *view, QWidget *parent, bool selectPrint = false ); public Q_SLOTS: void slotOk(); private: ViewBase *m_view; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; }; //------------------------------ -class KPLATOUI_EXPORT DependencyEditor : public ViewBase +class PLANUI_EXPORT DependencyEditor : public ViewBase { Q_OBJECT public: DependencyEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void draw( Project &project ); virtual void draw(); virtual Node *currentNode() const; QList selectedNodes() const ; Node *selectedNode() const; virtual Relation *currentRelation() const; virtual void updateReadWrite( bool readwrite ); virtual KoPrintJob *createPrintJob(); DependencyView *view() const { return m_view; } Q_SIGNALS: void requestPopupMenu( const QString&, const QPoint & ); void openNode(); void editNode( Node *node ); void addTask(); void addMilestone(); void addSubtask(); void addSubMilestone(); void deleteTaskList( const QList& ); void addRelation( Node*, Node*, int ); void modifyRelation( Relation*, int ); void modifyRelation( Relation* ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void slotCreateRelation( DependencyConnectorItem *pred, DependencyConnectorItem *succ ); void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on ); int selectedNodeCount() const; private Q_SLOTS: void slotItemDoubleClicked( QGraphicsItem *item ); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotSelectionChanged( const QList &lst ); void slotContextMenuRequested( QGraphicsItem *item, const QPoint& pos ); void slotEnableActions(); void slotAddTask(); void slotAddSubtask(); void slotAddMilestone(); void slotAddSubMilestone(); void slotDeleteTask(); private: void edit( const QModelIndex &index ); private: DependencyView *m_view; Node *m_currentnode; Relation *m_currentrelation; ScheduleManager *m_manager; KActionMenu *menuAddTask; KActionMenu *menuAddSubTask; QAction *actionAddTask; QAction *actionAddMilestone; QAction *actionAddSubtask; QAction *actionAddSubMilestone; QAction *actionDeleteTask; }; } //namespace KPlato #endif diff --git a/src/libs/ui/kptdocumentseditor.h b/src/libs/ui/kptdocumentseditor.h index f752d119..811f932e 100644 --- a/src/libs/ui/kptdocumentseditor.h +++ b/src/libs/ui/kptdocumentseditor.h @@ -1,125 +1,125 @@ /* This file is part of the KDE project Copyright (C) 2006 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDOCUMENTSEDITOR_H #define KPTDOCUMENTSEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include #include class QPoint; class KoDocument; namespace KPlato { -class KPLATOUI_EXPORT DocumentTreeView : public TreeViewBase +class PLANUI_EXPORT DocumentTreeView : public TreeViewBase { Q_OBJECT public: explicit DocumentTreeView(QWidget *parent); DocumentItemModel *model() const { return static_cast( TreeViewBase::model() ); } Documents *documents() const { return model()->documents(); } void setDocuments( Documents *docs ) { model()->setDocuments( docs ); } Document *currentDocument() const; QList selectedDocuments() const; QModelIndexList selectedRows() const; using QTreeView::selectionChanged; Q_SIGNALS: void selectionChanged( const QModelIndexList& ); protected Q_SLOTS: void slotSelectionChanged( const QItemSelection &selected ); }; -class KPLATOUI_EXPORT DocumentsEditor : public ViewBase +class PLANUI_EXPORT DocumentsEditor : public ViewBase { Q_OBJECT public: DocumentsEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); using ViewBase::draw; virtual void draw( Documents &docs ); virtual void draw(); DocumentItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); virtual Document *currentDocument() const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; DocumentTreeView *view() const { return m_view; } Q_SIGNALS: void addDocument(); void deleteDocumentList( const QList& ); void editDocument( Document *doc ); void viewDocument( Document *doc ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotHeaderContextMenuRequested( const QPoint &pos ); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void slotEnableActions( bool on ); void slotEditDocument(); void slotViewDocument(); void slotAddDocument(); void slotDeleteSelection(); private: DocumentTreeView *m_view; QAction *actionEditDocument; QAction *actionViewDocument; QAction *actionAddDocument; QAction *actionDeleteSelection; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptdocumentspanel.h b/src/libs/ui/kptdocumentspanel.h index 491cb1eb..35052887 100644 --- a/src/libs/ui/kptdocumentspanel.h +++ b/src/libs/ui/kptdocumentspanel.h @@ -1,83 +1,83 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTDOCUMENTSPANEL_H #define KPTDOCUMENTSPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptdocumentspanel.h" #include "kptdocuments.h" #include #include #include class QModelIndex; namespace KPlato { class Node; class DocumentItemModel; class MacroCommand; class DocumentTreeView; -class KPLATOUI_EXPORT DocumentsPanel : public QWidget +class PLANUI_EXPORT DocumentsPanel : public QWidget { Q_OBJECT public: explicit DocumentsPanel( Node &node, QWidget *parent = 0 ); ~DocumentsPanel() {} MacroCommand *buildCommand(); Ui::DocumentsPanel widget; DocumentItemModel* model() const; Document *selectedDocument() const; Q_SIGNALS: void changed(); protected Q_SLOTS: void slotAddUrl(); void slotChangeUrl(); void slotRemoveUrl(); void slotViewUrl(); void dataChanged( const QModelIndex& ); void slotSelectionChanged( const QModelIndexList& ); void currentChanged( const QModelIndex &index ); private: Node &m_node; Documents m_docs; enum State { Unmodified = 1, Modified = 2, Added = 4, Removed = 8 }; QMap m_state; QMap m_orgurl; KUndo2QStack m_cmds; DocumentTreeView *m_view; }; } #endif diff --git a/src/libs/ui/kptganttitemdelegate.h b/src/libs/ui/kptganttitemdelegate.h index af370a40..1dcc2549 100644 --- a/src/libs/ui/kptganttitemdelegate.h +++ b/src/libs/ui/kptganttitemdelegate.h @@ -1,114 +1,114 @@ /* This file is part of the KDE project Copyright (C) 2008 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTGANTTITEMDELEGATE_H #define KPTGANTTITEMDELEGATE_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include #include namespace KGantt { class StyleOptionGanttItem; class Constraint; } class QPainter; class QModelIndex; namespace KPlato { -class KPLATOUI_EXPORT GanttItemDelegate : public KGantt::ItemDelegate +class PLANUI_EXPORT GanttItemDelegate : public KGantt::ItemDelegate { Q_OBJECT public: explicit GanttItemDelegate(QObject *parent = 0); virtual QString toolTip( const QModelIndex& idx ) const; virtual KGantt::Span itemBoundingSpan( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const; virtual void paintGanttItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ); virtual void paintConstraintItem( QPainter* p, const QStyleOptionGraphicsItem& opt, const QPointF& start, const QPointF& end, const KGantt::Constraint &constraint ); QVariant data( const QModelIndex& idx, int column, int role = Qt::DisplayRole ) const; QString itemText( const QModelIndex& idx, int type ) const; QRectF itemPositiveFloatRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const; QRectF itemNegativeFloatRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const; bool hasStartConstraint( const QModelIndex& idx ) const; bool hasEndConstraint( const QModelIndex& idx ) const; QRectF itemStartConstraintRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const; QRectF itemEndConstraintRect( const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ) const; bool showResources; bool showTaskName; bool showTaskLinks; bool showProgress; bool showPositiveFloat; bool showNegativeFloat; bool showCriticalPath; bool showCriticalTasks; bool showAppointments; bool showNoInformation; bool showTimeConstraint; bool showSchedulingError; protected: void paintSpecialItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx, int typ ); protected: QBrush m_criticalBrush; QBrush m_schedulingErrorBrush; qreal m_constraintXOffset; private: Q_DISABLE_COPY(GanttItemDelegate) }; -class KPLATOUI_EXPORT ResourceGanttItemDelegate : public KGantt::ItemDelegate +class PLANUI_EXPORT ResourceGanttItemDelegate : public KGantt::ItemDelegate { Q_OBJECT public: explicit ResourceGanttItemDelegate(QObject *parent = 0); QVariant data( const QModelIndex& idx, int column, int role = Qt::DisplayRole ) const; virtual void paintGanttItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ); protected: void paintResourceItem( QPainter* painter, const KGantt::StyleOptionGanttItem& opt, const QModelIndex& idx ); private: Q_DISABLE_COPY(ResourceGanttItemDelegate) QBrush m_overloadBrush; QBrush m_underloadBrush; }; } // namespace KPlato #endif diff --git a/src/libs/ui/kptganttview.h b/src/libs/ui/kptganttview.h index d87eec0f..635377e3 100644 --- a/src/libs/ui/kptganttview.h +++ b/src/libs/ui/kptganttview.h @@ -1,477 +1,477 @@ /* This file is part of the KDE project Copyright (C) 2005 Dag Andersen Copyright (C) 2006 Raphael Langerhorst This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTGANTTVIEW_H #define KPTGANTTVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptitemviewsettup.h" #include "kptnodeitemmodel.h" #include "kptganttitemdelegate.h" #include "ui_kptganttprintingoptions.h" #include "ui_kptganttchartdisplayoptions.h" #include #include #include class KoDocument; class QPoint; class QSplitter; class KoPrintJob; namespace KGantt { class TreeViewRowController; } namespace KPlato { class Node; class MilestoneItemModel; class GanttItemModel; class ResourceAppointmentsGanttModel; class Task; class Project; class Relation; class ScheduleManager; class MyKGanttView; class GanttPrintingOptions; class GanttViewBase; class NodeGanttViewBase; class GanttPrintingOptionsWidget; //--------------------------------------- class GanttChartDisplayOptionsPanel : public QWidget, public Ui::GanttChartDisplayOptions { Q_OBJECT public: explicit GanttChartDisplayOptionsPanel( GanttItemDelegate *delegate, QWidget *parent = 0 ); void setValues( const GanttItemDelegate &del ); public Q_SLOTS: void slotOk(); void setDefault(); Q_SIGNALS: void changed(); private: GanttItemDelegate *m_delegate; }; class GanttViewSettingsDialog : public ItemViewSettupDialog { Q_OBJECT public: explicit GanttViewSettingsDialog( GanttViewBase *gantt, GanttItemDelegate *delegate, ViewBase *view, bool selectPrint = false ); protected Q_SLOTS: void slotOk(); private: GanttViewBase *m_gantt; GanttPrintingOptionsWidget *m_printingoptions; }; //-------------------- class GanttPrintingOptions { public: GanttPrintingOptions(); bool loadContext( const KoXmlElement &settings ); void saveContext( QDomElement &settings ) const; bool printRowLabels; bool singlePage; }; -class KPLATOUI_EXPORT GanttPrintingOptionsWidget : public QWidget, public Ui::GanttPrintingOptionsWidget +class PLANUI_EXPORT GanttPrintingOptionsWidget : public QWidget, public Ui::GanttPrintingOptionsWidget { Q_OBJECT public: explicit GanttPrintingOptionsWidget( QWidget *parent = 0 ); GanttPrintingOptions options() const; void setPrintRowLabels( bool value ) { ui_printRowLabels->setChecked( value ); } bool printRowLabels() const { return ui_printRowLabels->isChecked(); } void setSinglePage( bool value ) { value ? ui_singlePage->setChecked( false ) : ui_multiplePages->setChecked( true ); } bool singlePage() const { return ui_singlePage->isChecked(); } public Q_SLOTS: void setOptions(const GanttPrintingOptions &opt); }; class GanttPrintingDialog : public PrintingDialog { Q_OBJECT public: GanttPrintingDialog( ViewBase *view, GanttViewBase *gantt ); void startPrinting( RemovePolicy removePolicy ); QList createOptionWidgets() const; void printPage( int page, QPainter &painter ); int documentLastPage() const; protected Q_SLOTS: void slotPrintRowLabelsToogled( bool on ); void slotSinglePageToogled( bool on ); protected: GanttViewBase *m_gantt; QRectF m_sceneRect; int m_horPages; int m_vertPages; double m_headerHeight; GanttPrintingOptionsWidget *m_options; QImage m_image; }; -class KPLATOUI_EXPORT GanttTreeView : public TreeViewBase +class PLANUI_EXPORT GanttTreeView : public TreeViewBase { Q_OBJECT public: explicit GanttTreeView(QWidget *parent); }; class GanttZoomWidget : public QSlider { Q_OBJECT public: explicit GanttZoomWidget( QWidget *parent ); void setGrid( KGantt::DateTimeGrid *grid ); void setEnableHideOnLeave( bool hide ); protected: void leaveEvent( QEvent *event ); private Q_SLOTS: void sliderValueChanged( int value ); private: bool m_hide; KGantt::DateTimeGrid *m_grid; }; -class KPLATOUI_EXPORT GanttViewBase : public KGantt::View +class PLANUI_EXPORT GanttViewBase : public KGantt::View { Q_OBJECT public: explicit GanttViewBase(QWidget *parent); ~GanttViewBase(); GanttTreeView *treeView() const; GanttPrintingOptions printingOptions() const { return m_printOptions; } virtual bool loadContext( const KoXmlElement &settings ); virtual void saveContext( QDomElement &settings ) const; public Q_SLOTS: void setPrintingOptions( const GanttPrintingOptions &opt ) { m_printOptions = opt; } protected: bool eventFilter(QObject *obj, QEvent *event); friend class GanttPrintingDialog; GanttPrintingOptions m_printOptions; private: GanttZoomWidget *m_zoomwidget; }; class NodeGanttViewBase : public GanttViewBase { Q_OBJECT public: explicit NodeGanttViewBase(QWidget *parent); ~NodeGanttViewBase(); NodeSortFilterProxyModel *sfModel() const; void setItemModel( ItemModelBase *model ); ItemModelBase *model() const; void setProject( Project *project ); Project *project() const { return m_project; } GanttItemDelegate *delegate() const { return m_ganttdelegate; } bool loadContext( const KoXmlElement &settings ); void saveContext( QDomElement &settings ) const; protected: Project *m_project; GanttItemDelegate *m_ganttdelegate; NodeItemModel m_defaultModel; KGantt::TreeViewRowController *m_rowController; }; -class KPLATOUI_EXPORT MyKGanttView : public NodeGanttViewBase +class PLANUI_EXPORT MyKGanttView : public NodeGanttViewBase { Q_OBJECT public: explicit MyKGanttView(QWidget *parent); GanttItemModel *model() const; void setProject( Project *project ); void setScheduleManager( ScheduleManager *sm ); public Q_SLOTS: void clearDependencies(); void createDependencies(); void addDependency( Relation *rel ); void removeDependency( Relation *rel ); void slotProjectCalculated( ScheduleManager *sm ); void slotNodeInserted( Node *node ); protected: ScheduleManager *m_manager; }; -class KPLATOUI_EXPORT GanttView : public ViewBase +class PLANUI_EXPORT GanttView : public ViewBase { Q_OBJECT public: GanttView(KoPart *part, KoDocument *doc, QWidget *parent, bool readWrite = true); //~GanttView(); virtual void setZoom( double zoom ); void setupGui(); Project *project() const { return m_gantt->project(); } virtual void setProject( Project *project ); using ViewBase::draw; virtual void draw( Project &project ); virtual void drawChanges( Project &project ); Node *currentNode() const; void clear(); virtual bool loadContext( const KoXmlElement &context ); virtual void saveContext( QDomElement &context ) const; void updateReadWrite( bool on ); KoPrintJob *createPrintJob(); void setShowSpecialInfo( bool on ) { m_gantt->model()->setShowSpecial( on ); } bool showSpecialInfo() const { return m_gantt->model()->showSpecial(); } Q_SIGNALS: void modifyRelation( Relation *rel ) ; void addRelation( Node *par, Node *child ); void modifyRelation( Relation *rel, int linkType ) ; void addRelation( Node *par, Node *child, int linkType ); void itemDoubleClicked(); public Q_SLOTS: void setScheduleManager( ScheduleManager *sm ); void setShowResources( bool on ); void setShowTaskName( bool on ); void setShowTaskLinks( bool on ); void setShowProgress( bool on ); void setShowPositiveFloat( bool on ); void setShowCriticalTasks( bool on ); void setShowCriticalPath( bool on ); void setShowNoInformation( bool on ); void setShowAppointments( bool on ); protected Q_SLOTS: void slotContextMenuRequested( const QModelIndex&, const QPoint &pos ); virtual void slotOptions(); virtual void slotOptionsFinished( int result ); private: bool m_readWrite; int m_defaultFontSize; QSplitter *m_splitter; MyKGanttView *m_gantt; Project *m_project; QAction *actionShowProject; QDomDocument m_domdoc; }; class MilestoneGanttViewSettingsDialog : public ItemViewSettupDialog { Q_OBJECT public: MilestoneGanttViewSettingsDialog( GanttViewBase *gantt, ViewBase *view, bool selectPrint = false ); protected Q_SLOTS: virtual void slotOk(); private: GanttViewBase *m_gantt; GanttPrintingOptionsWidget *m_printingoptions; }; -class KPLATOUI_EXPORT MilestoneKGanttView : public NodeGanttViewBase +class PLANUI_EXPORT MilestoneKGanttView : public NodeGanttViewBase { Q_OBJECT public: explicit MilestoneKGanttView(QWidget *parent); MilestoneItemModel *model() const; void setProject( Project *project ); void setScheduleManager( ScheduleManager *sm ); public Q_SLOTS: void slotProjectCalculated( ScheduleManager *sm ); protected: ScheduleManager *m_manager; }; -class KPLATOUI_EXPORT MilestoneGanttView : public ViewBase +class PLANUI_EXPORT MilestoneGanttView : public ViewBase { Q_OBJECT public: MilestoneGanttView(KoPart *part, KoDocument *doc, QWidget *parent, bool readWrite = true); virtual void setZoom( double zoom ); void show(); virtual void setProject( Project *project ); Project *project() const { return m_gantt->project(); } using ViewBase::draw; virtual void draw( Project &project ); virtual void drawChanges( Project &project ); void setupGui(); Node *currentNode() const; void clear(); virtual bool loadContext( const KoXmlElement &context ); virtual void saveContext( QDomElement &context ) const; void updateReadWrite( bool on ); bool showNoInformation() const { return m_showNoInformation; } KoPrintJob *createPrintJob(); Q_SIGNALS: void itemDoubleClicked(); public Q_SLOTS: void setScheduleManager( ScheduleManager *sm ); void setShowTaskName( bool on ) { m_showTaskName = on; } void setShowProgress( bool on ) { m_showProgress = on; } void setShowPositiveFloat( bool on ) { m_showPositiveFloat = on; } void setShowCriticalTasks( bool on ) { m_showCriticalTasks = on; } void setShowNoInformation( bool on ) { m_showNoInformation = on; } protected Q_SLOTS: void slotContextMenuRequested( const QModelIndex&, const QPoint &pos ); virtual void slotOptions(); private: bool m_readWrite; int m_defaultFontSize; QSplitter *m_splitter; MilestoneKGanttView *m_gantt; bool m_showTaskName; bool m_showProgress; bool m_showPositiveFloat; bool m_showCriticalTasks; bool m_showNoInformation; Project *m_project; }; class ResourceAppointmentsGanttViewSettingsDialog : public ItemViewSettupDialog { Q_OBJECT public: ResourceAppointmentsGanttViewSettingsDialog(GanttViewBase *gantt, ViewBase *view, bool selectPrint = false); public Q_SLOTS: void slotOk(); private: GanttViewBase *m_gantt; GanttPrintingOptionsWidget *m_printingoptions; }; -class KPLATOUI_EXPORT ResourceAppointmentsGanttView : public ViewBase +class PLANUI_EXPORT ResourceAppointmentsGanttView : public ViewBase { Q_OBJECT public: ResourceAppointmentsGanttView(KoPart *part, KoDocument *doc, QWidget *parent, bool readWrite = true); ~ResourceAppointmentsGanttView(); virtual void setZoom( double zoom ); virtual void setProject( Project *project ); Project *project() const; void setupGui(); virtual bool loadContext( const KoXmlElement &context ); virtual void saveContext( QDomElement &context ) const; void updateReadWrite( bool on ); KoPrintJob *createPrintJob(); GanttTreeView *treeView() const { return static_cast( m_gantt->leftView() ); } Node *currentNode() const; Q_SIGNALS: void itemDoubleClicked(); public Q_SLOTS: void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: void slotContextMenuRequested( const QModelIndex&, const QPoint &pos ); virtual void slotOptions(); private: GanttViewBase *m_gantt; Project *m_project; ResourceAppointmentsGanttModel *m_model; KGantt::TreeViewRowController *m_rowController; QDomDocument m_domdoc; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kpthtmlview.h b/src/libs/ui/kpthtmlview.h index 675c074a..59058400 100644 --- a/src/libs/ui/kpthtmlview.h +++ b/src/libs/ui/kpthtmlview.h @@ -1,80 +1,80 @@ /* This file is part of the KDE project Copyright (C) 2009, 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTHTMLVIEW_H #define KPTHTMLVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "khtml_part.h" class KoDocument; class QUrl; class QPoint; namespace KPlato { -class KPLATOUI_EXPORT HtmlView : public ViewBase +class PLANUI_EXPORT HtmlView : public ViewBase { Q_OBJECT public: HtmlView(KoPart *part, KoDocument *doc, QWidget *parent); bool openHtml( const QUrl &url ); void setupGui(); virtual void updateReadWrite( bool readwrite ); KoPrintJob *createPrintJob(); KHTMLPart &htmlPart() { return *m_htmlPart; } const KHTMLPart &htmlPart() const { return *m_htmlPart; } Q_SIGNALS: void openUrlRequest( HtmlView*, const QUrl& ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void slotOpenUrlRequest(const QUrl &url, const KParts::OpenUrlArguments &arguments=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArguments=KParts::BrowserArguments()); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotEnableActions( bool on ); private: KHTMLPart *m_htmlPart; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptintervaledit.h b/src/libs/ui/kptintervaledit.h index 5c603d61..09ab9686 100644 --- a/src/libs/ui/kptintervaledit.h +++ b/src/libs/ui/kptintervaledit.h @@ -1,97 +1,97 @@ /* This file is part of the KDE project Copyright (C) 2004 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTINTERVALEDIT_H #define KPTINTERVALEDIT_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptintervaleditbase.h" #include "kptcalendar.h" #include namespace KPlato { class MacroCommand; class IntervalEditBase : public QWidget, public Ui::IntervalEditBase { public: explicit IntervalEditBase(QWidget *parent) : QWidget( parent ) { setupUi( this ); } }; class IntervalEditImpl : public IntervalEditBase { Q_OBJECT public: explicit IntervalEditImpl(QWidget *parent); QList intervals() const; void setIntervals(const QList &intervals); protected Q_SLOTS: void slotClearClicked(); void slotAddIntervalClicked(); void slotRemoveIntervalClicked(); void slotIntervalSelectionChanged(); void enableButtons(); Q_SIGNALS: void changed(); }; class IntervalEdit : public IntervalEditImpl { Q_OBJECT public: explicit IntervalEdit( CalendarDay *day, QWidget *parent=0); }; -class KPLATOUI_EXPORT IntervalEditDialog : public KoDialog +class PLANUI_EXPORT IntervalEditDialog : public KoDialog { Q_OBJECT public: explicit IntervalEditDialog( Calendar *calendar, const QList &days, QWidget *parent = 0 ); explicit IntervalEditDialog( Calendar *calendar, const QList &dates, QWidget *parent = 0 ); MacroCommand *buildCommand(); QList intervals() const { return m_panel->intervals(); } protected Q_SLOTS: void slotChanged(); void slotCalendarRemoved( const Calendar *cal ); protected: MacroCommand *buildCommand( Calendar *calendar, CalendarDay *day ); private: Calendar *m_calendar; QList m_days; QList m_dates; IntervalEdit *m_panel; }; } //KPlato namespace #endif // INTERVALEDIT_H diff --git a/src/libs/ui/kptitemviewsettup.h b/src/libs/ui/kptitemviewsettup.h index 20cf0372..18078b3e 100644 --- a/src/libs/ui/kptitemviewsettup.h +++ b/src/libs/ui/kptitemviewsettup.h @@ -1,115 +1,115 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTITEMVIEWSETTUP_H #define KPTITEMVIEWSETTUP_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptitemviewsettings.h" #include #include class KoPageLayoutWidget; namespace KPlato { class DoubleTreeViewBase; class TreeViewBase; class ViewBase; class PrintingHeaderFooter; -class KPLATOUI_EXPORT ItemViewSettup : public QWidget, public Ui::ItemViewSettings +class PLANUI_EXPORT ItemViewSettup : public QWidget, public Ui::ItemViewSettings { Q_OBJECT public: explicit ItemViewSettup( TreeViewBase *view, bool includeColumn0, QWidget *parent = 0 ); class Item : public QListWidgetItem { public: Item( int column, const QString &text ); int column() const; bool operator<( const QListWidgetItem & other ) const; private: int m_column; }; Q_SIGNALS: void enableButtonOk( bool ); public Q_SLOTS: void slotChanged(); void slotOk(); void setDefault(); private: TreeViewBase *m_view; bool m_includeColumn0; }; -class KPLATOUI_EXPORT ItemViewSettupDialog : public KPageDialog +class PLANUI_EXPORT ItemViewSettupDialog : public KPageDialog { Q_OBJECT public: explicit ItemViewSettupDialog( ViewBase *view, TreeViewBase *treeview, bool includeColumn0 = false, QWidget *parent = 0 ); KPageWidgetItem *insertWidget( int before, QWidget *widget, const QString &name, const QString &header ); void addPrintingOptions(bool setAsCurrent = false); protected Q_SLOTS: virtual void slotOk(); protected: ViewBase *m_view; TreeViewBase *m_treeview; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; QList m_pageList; ItemViewSettup *m_panel; }; -class KPLATOUI_EXPORT SplitItemViewSettupDialog : public KPageDialog +class PLANUI_EXPORT SplitItemViewSettupDialog : public KPageDialog { Q_OBJECT public: explicit SplitItemViewSettupDialog( ViewBase *view, DoubleTreeViewBase *treeview, QWidget *parent = 0 ); KPageWidgetItem *insertWidget( int before, QWidget *widget, const QString &name, const QString &header ); void addPrintingOptions(bool setAsCurrent = false); protected Q_SLOTS: virtual void slotOk(); private: ViewBase *m_view; DoubleTreeViewBase *m_treeview; QList m_pageList; ItemViewSettup *m_page1; ItemViewSettup *m_page2; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; }; } //namespace KPlato #endif diff --git a/src/libs/ui/kptlocaleconfigmoneydialog.h b/src/libs/ui/kptlocaleconfigmoneydialog.h index b56b019b..1a56c6d3 100644 --- a/src/libs/ui/kptlocaleconfigmoneydialog.h +++ b/src/libs/ui/kptlocaleconfigmoneydialog.h @@ -1,53 +1,53 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation;; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTLOCALECONFIGMONEYDIALOG_H #define KPTLOCALECONFIGMONEYDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include class KUndo2Command; namespace KPlato { class Locale; class LocaleConfigMoney; class Project; -class KPLATOUI_EXPORT LocaleConfigMoneyDialog : public KoDialog { +class PLANUI_EXPORT LocaleConfigMoneyDialog : public KoDialog { Q_OBJECT public: explicit LocaleConfigMoneyDialog( Locale *locale, QWidget *parent=0); KUndo2Command *buildCommand( Project &project ); protected Q_SLOTS: void slotChanged(); private: LocaleConfigMoney *m_panel; }; } //KPlato namespace #endif // KPLATO_LOCALECONFIGMONEYDIALOG_H diff --git a/src/libs/ui/kptmainprojectdialog.h b/src/libs/ui/kptmainprojectdialog.h index cf19eaba..14b3b58c 100644 --- a/src/libs/ui/kptmainprojectdialog.h +++ b/src/libs/ui/kptmainprojectdialog.h @@ -1,62 +1,62 @@ /* This file is part of the KDE project Copyright (C) 2003 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTMAINPROJECTDIALOG_H #define KPTMAINPROJECTDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class Project; class MainProjectPanel; class MacroCommand; -class KPLATOUI_EXPORT MainProjectDialog : public KoDialog { +class PLANUI_EXPORT MainProjectDialog : public KoDialog { Q_OBJECT public: explicit MainProjectDialog(Project &project, QWidget *parent=0, bool edit=true); MacroCommand *buildCommand(); bool loadSharedResources(); Q_SIGNALS: void dialogFinished(int); void sigLoadSharedResources(const QString &file, const QUrl &projects, bool loadProjects=false); void loadResourceAssignments(QUrl url); void clearResourceAssignments(); protected Q_SLOTS: void slotRejected(); void slotOk(); private: Project &project; MainProjectPanel *panel; }; } //KPlato namespace #endif // MAINPROJECTDIALOG_H diff --git a/src/libs/ui/kptmainprojectpanel.h b/src/libs/ui/kptmainprojectpanel.h index ff81f772..a4d103a4 100644 --- a/src/libs/ui/kptmainprojectpanel.h +++ b/src/libs/ui/kptmainprojectpanel.h @@ -1,79 +1,79 @@ /* This file is part of the KDE project Copyright (C) 2004-2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTMAINPROJECTPANEL_H #define KPTMAINPROJECTPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptmainprojectpanelbase.h" #include class QDateTime; namespace KPlato { class Project; class MacroCommand; class TaskDescriptionPanel; class MainProjectPanel : public QWidget, public Ui_MainProjectPanelBase { Q_OBJECT public: explicit MainProjectPanel(Project &project, QWidget *parent=0); virtual QDateTime startDateTime(); virtual QDateTime endDateTime(); MacroCommand *buildCommand(); bool ok(); bool loadSharedResources() const; public Q_SLOTS: virtual void slotCheckAllFieldsFilled(); virtual void slotChooseLeader(); virtual void slotStartDateClicked(); virtual void slotEndDateClicked(); virtual void enableDateTime(); private Q_SLOTS: void openResourcesFile(); void openProjectsPlace(); void loadProjects(); void clearProjects(); Q_SIGNALS: void obligatedFieldsFilled(bool); void changed(); void loadResourceAssignments(QUrl url); void clearResourceAssignments(); private: TaskDescriptionPanel *m_description; Project &project; }; } //KPlato namespace #endif // MAINPROJECTPANEL_H diff --git a/src/libs/ui/kptmilestoneprogressdialog.h b/src/libs/ui/kptmilestoneprogressdialog.h index a70e838b..c769286b 100644 --- a/src/libs/ui/kptmilestoneprogressdialog.h +++ b/src/libs/ui/kptmilestoneprogressdialog.h @@ -1,55 +1,55 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTMILESTONEPROGRESSDIALOG_H #define KPTMILESTONEPROGRESSDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class MilestoneProgressPanel; class Task; class Node; class MacroCommand; -class KPLATOUI_EXPORT MilestoneProgressDialog : public KoDialog { +class PLANUI_EXPORT MilestoneProgressDialog : public KoDialog { Q_OBJECT public: explicit MilestoneProgressDialog(Task &task, QWidget *parent=0); MacroCommand *buildCommand(); protected Q_SLOTS: void slotChanged(); void slotNodeRemoved( Node *node ); private: Node *m_node; MilestoneProgressPanel *m_panel; }; } //KPlato namespace #endif // MILESTONEPROGRESSDIALOG_H diff --git a/src/libs/ui/kptmilestoneprogresspanel.h b/src/libs/ui/kptmilestoneprogresspanel.h index ffa3040b..dd28ebbe 100644 --- a/src/libs/ui/kptmilestoneprogresspanel.h +++ b/src/libs/ui/kptmilestoneprogresspanel.h @@ -1,63 +1,63 @@ /* This file is part of the KDE project Copyright (C) 2005-2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTMILESTONEPROGRESSPANEL_H #define KPTMILESTONEPROGRESSPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptmilestoneprogresspanelbase.h" #include "kpttask.h" namespace KPlato { class MacroCommand; class MilestoneProgressPanelImpl : public QWidget, public Ui_MilestoneProgressPanelBase { Q_OBJECT public: explicit MilestoneProgressPanelImpl(QWidget *parent=0, const char *name=0); void enableWidgets(); Q_SIGNALS: void changed(); public Q_SLOTS: void slotChanged(); void slotFinishedChanged(bool state); }; class MilestoneProgressPanel : public MilestoneProgressPanelImpl { Q_OBJECT public: explicit MilestoneProgressPanel(Task &task, QWidget *parent=0, const char *name=0); MacroCommand *buildCommand(); private: Task &m_task; Completion &m_completion; }; } //KPlato namespace #endif // MILESTONEPROGRESSPANEL_H diff --git a/src/libs/ui/kptperteditor.h b/src/libs/ui/kptperteditor.h index 06ef1927..fa3a1f15 100644 --- a/src/libs/ui/kptperteditor.h +++ b/src/libs/ui/kptperteditor.h @@ -1,116 +1,116 @@ /* This file is part of the KDE project Copyright (C) 2007 Florian Piquemal Copyright (C) 2007 Alexis Ménard Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTPERTEDITOR_H #define KPTPERTEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptitemmodelbase.h" #include "kpttaskeditor.h" #include #include "kptcommand.h" #include "kptnode.h" #include class KoDocument; class QTreeWidgetItem; class QTableWidgetItem; class QModelIndex; class KUndo2Command; namespace KPlato { class View; class Project; class RelationTreeView; -class KPLATOUI_EXPORT PertEditor : public ViewBase +class PLANUI_EXPORT PertEditor : public ViewBase { Q_OBJECT public: enum Roles { NodeRole = Qt::UserRole + 1, EnabledRole }; PertEditor(KoPart *part, KoDocument *doc, QWidget *parent); virtual void updateReadWrite( bool readwrite ); void setProject( Project *project ); Project *project() const { return m_project; } void draw( Project &project ); void draw(); void drawSubTasksName( QTreeWidgetItem *parent,Node * currentNode); void clearRequiredList(); void loadRequiredTasksList(Node * taskNode); Node *itemToNode( QTreeWidgetItem *item ); QTreeWidgetItem *nodeToItem( Node *node, QTreeWidgetItem *item ); QList listNodeNotView(Node * node); void updateAvailableTasks( QTreeWidgetItem *item = 0 ); void setAvailableItemEnabled( QTreeWidgetItem *item ); void setAvailableItemEnabled( Node *node ); Q_SIGNALS: void executeCommand( KUndo2Command* ); protected: bool isInRequiredList( Node *node ); QTreeWidgetItem *findNodeItem( Node *node, QTreeWidgetItem *item ); QTableWidgetItem *findRequiredItem( Node *node ); private Q_SLOTS: void slotNodeAdded( Node* ); void slotNodeRemoved( Node* ); void slotNodeMoved( Node* ); void slotNodeChanged( Node* ); void slotRelationAdded( Relation *rel ); void slotRelationRemoved( Relation *rel ); void dispAvailableTasks(); void dispAvailableTasks( Node *parent, Node *selectedTask ); void dispAvailableTasks( Relation *rel ); void addTaskInRequiredList(QTreeWidgetItem * currentItem); void removeTaskFromRequiredList(); void slotUpdate(); void slotCurrentTaskChanged( QTreeWidgetItem *curr, QTreeWidgetItem *prev ); void slotAvailableChanged( QTreeWidgetItem *item ); void slotRequiredChanged( const QModelIndex &index ); void slotAddClicked(); void slotRemoveClicked(); private: Project * m_project; QTreeWidget *m_tasktree; QTreeWidget *m_availableList; RelationTreeView *m_requiredList; Ui::PertEditor widget; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptpertresult.h b/src/libs/ui/kptpertresult.h index 9d155df1..1c6776e0 100644 --- a/src/libs/ui/kptpertresult.h +++ b/src/libs/ui/kptpertresult.h @@ -1,153 +1,153 @@ /* This file is part of the KDE project Copyright (C) 2007 Florian Piquemal Copyright (C) 2007 Alexis Ménard Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTPERTRESULT_H #define KPTPERTRESULT_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptpertcpmmodel.h" #include "ui_kptpertresult.h" #include "ui_kptcpmwidget.h" #include class KoDocument; /// The main namespace namespace KPlato { class DateTime; class Node; class Project; class ScheduleManager; class Task; class View; -class KPLATOUI_EXPORT PertResult : public ViewBase +class PLANUI_EXPORT PertResult : public ViewBase { Q_OBJECT public: explicit PertResult(KoPart *part, KoDocument *doc, QWidget *parent = 0); void setupGui(); void setProject( Project *project ); Project *project() const { return m_project; } void draw( Project &project ); void draw(); PertResultItemModel *model() const { return static_cast( widget.treeWidgetTaskResult->model() ); } /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Node *currentNode() const; public Q_SLOTS: void slotScheduleSelectionChanged( ScheduleManager *sm ); protected Q_SLOTS: void slotProjectCalculated( ScheduleManager *sm ); void slotScheduleManagerToBeRemoved( const ScheduleManager *sm ); void slotScheduleManagerChanged( ScheduleManager *sm ); void slotHeaderContextMenuRequested( const QPoint &pos ); void slotContextMenuRequested( const QModelIndex& index, const QPoint& pos ); void slotSplitView(); virtual void slotOptions(); private: Node * m_node; Project * m_project; ScheduleManager *current_schedule; Ui::PertResult widget; private Q_SLOTS: void slotUpdate(); }; //-------------------- -class KPLATOUI_EXPORT PertCpmView : public ViewBase +class PLANUI_EXPORT PertCpmView : public ViewBase { Q_OBJECT public: explicit PertCpmView(KoPart *part, KoDocument *doc, QWidget *parent = 0); void setupGui(); void setProject( Project *project ); Project *project() const { return m_project; } void draw( Project &project ); void draw(); CriticalPathItemModel *model() const { return static_cast( widget.cpmTable->model() ); } double probability( double z ) const; double valueZ( double p ) const; /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Node *currentNode() const; public Q_SLOTS: void slotScheduleSelectionChanged( ScheduleManager *sm ); protected Q_SLOTS: void slotProjectCalculated( ScheduleManager *sm ); void slotScheduleManagerToBeRemoved( const ScheduleManager *sm ); void slotScheduleManagerChanged( ScheduleManager *sm ); void slotHeaderContextMenuRequested( const QPoint &pos ); void slotContextMenuRequested( const QModelIndex& index, const QPoint& pos ); void slotSplitView(); virtual void slotOptions(); void slotFinishTimeChanged( const QDateTime &dt ); void slotProbabilityChanged( int value ); private Q_SLOTS: void slotUpdate(); private: Project * m_project; QList m_criticalPath; ScheduleManager *current_schedule; Ui::CpmWidget widget; bool block; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptrecalculatedialog.h b/src/libs/ui/kptrecalculatedialog.h index 65ddfa91..27803331 100644 --- a/src/libs/ui/kptrecalculatedialog.h +++ b/src/libs/ui/kptrecalculatedialog.h @@ -1,54 +1,54 @@ /* This file is part of the KDE project Copyright (C) 2003 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRECALCULATEDIALOG_H #define KPTRECALCULATEDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptrecalculatedialog.h" #include namespace KPlato { class RecalculateDialogImpl : public QWidget, public Ui_RecalculateDialog { Q_OBJECT public: explicit RecalculateDialogImpl (QWidget *parent); }; -class KPLATOUI_EXPORT RecalculateDialog : public KoDialog +class PLANUI_EXPORT RecalculateDialog : public KoDialog { Q_OBJECT public: explicit RecalculateDialog(QWidget *parent = 0); QDateTime dateTime() const; private: RecalculateDialogImpl *dia; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptrelationdialog.h b/src/libs/ui/kptrelationdialog.h index a6ce8845..5d1ec619 100644 --- a/src/libs/ui/kptrelationdialog.h +++ b/src/libs/ui/kptrelationdialog.h @@ -1,95 +1,95 @@ /* This file is part of the KDE project Copyright (C) 2002 The calligra team Copyright (C) 2003 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRELATIONDIALOG_H #define KPTRELATIONDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_relationpanel.h" #include #include namespace KPlato { class RelationPanel; class Relation; class Project; class Node; class MacroCommand; class RelationPanel : public QWidget, public Ui_RelationPanel { Q_OBJECT public: explicit RelationPanel(QWidget *parent = 0); }; -class KPLATOUI_EXPORT AddRelationDialog : public KoDialog +class PLANUI_EXPORT AddRelationDialog : public KoDialog { Q_OBJECT public: AddRelationDialog(Project &project, Relation *rel, QWidget *p, const QString& caption=QString(), ButtonCodes buttons=Ok|Cancel); ~AddRelationDialog(); virtual MacroCommand *buildCommand(); int selectedRelationType() const; protected Q_SLOTS: void slotOk(); void lagChanged(); void typeClicked(int); void slotFinishStartToggled(bool); void slotFinishFinishToggled(bool); void slotStartStartToggled(bool); void slotNodeRemoved( Node *node ); protected: Project &m_project; RelationPanel *m_panel; Relation *m_relation; bool m_deleterelation; }; -class KPLATOUI_EXPORT ModifyRelationDialog : public AddRelationDialog +class PLANUI_EXPORT ModifyRelationDialog : public AddRelationDialog { Q_OBJECT public: explicit ModifyRelationDialog(Project &project, Relation *rel, QWidget *p=0); virtual MacroCommand *buildCommand(); bool relationIsDeleted() { return m_deleted; } protected Q_SLOTS: void slotUser1(); void slotRelationRemoved( Relation *relation ); private: bool m_deleted; }; } //KPlato namespace #endif // RELATIONDIALOG_H diff --git a/src/libs/ui/kptrelationeditor.h b/src/libs/ui/kptrelationeditor.h index 09b6d549..b13a877d 100644 --- a/src/libs/ui/kptrelationeditor.h +++ b/src/libs/ui/kptrelationeditor.h @@ -1,123 +1,123 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRELATIONEDITOR_H #define KPTRELATIONEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptglobal.h" #include "kptviewbase.h" #include "kptrelationmodel.h" class KoDocument; namespace KPlato { class Project; class Node; class RelationItemModel; class Relation; -class KPLATOUI_EXPORT RelationTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT RelationTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit RelationTreeView( QWidget *parent = 0 ); RelationItemModel *model() const { return static_cast( DoubleTreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } void setNode( Node *node ) { model()->setNode( node ); } Relation *currentRelation() const { return model()->relation( selectionModel()->currentIndex() ); } Q_SIGNALS: void currentColumnChanged( const QModelIndex&, const QModelIndex& ); protected Q_SLOTS: void slotCurrentChanged(const QModelIndex &curr, const QModelIndex& ); }; -class KPLATOUI_EXPORT RelationEditor : public ViewBase +class PLANUI_EXPORT RelationEditor : public ViewBase { Q_OBJECT public: /// Create a relation editor RelationEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); virtual void draw( Project &project ); virtual void draw(); virtual Relation *currentRelation() const; Relation *selectedRelation() const; virtual void updateReadWrite( bool readwrite ); RelationItemModel *model() const { return m_view->model(); } /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void openNode(); void addRelation(); void deleteRelation( Relation * ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on ); private Q_SLOTS: void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotEnableActions(); void slotAddRelation(); void slotDeleteRelation( Relation *r ); void slotSplitView(); void slotHeaderContextMenuRequested( const QPoint& ); private: void edit( const QModelIndex &index ); private: RelationTreeView *m_view; }; } //namespace KPlato #endif diff --git a/src/libs/ui/kptrequestresourcespanel.h b/src/libs/ui/kptrequestresourcespanel.h index 29bc4d60..5f2fb3b1 100644 --- a/src/libs/ui/kptrequestresourcespanel.h +++ b/src/libs/ui/kptrequestresourcespanel.h @@ -1,60 +1,60 @@ /* This file is part of the KDE project Copyright (C) 2003 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTREQUESTRESOURCESPANEL_H #define KPTREQUESTRESOURCESPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class Task; class Project; class Resource; class MacroCommand; class ResourceAllocationTreeView; class RequestResourcesPanel : public QWidget { Q_OBJECT public: RequestResourcesPanel(QWidget *parent, Project &project, Task &task, bool baseline=false); /// Builds an undocommand for the current task /// only for changes (removals and/or additions) MacroCommand *buildCommand(); /// Builds an undo command for @p task /// that clears all current requests and adds the new ones (if any) MacroCommand *buildCommand(Task *task); bool ok(); Q_SIGNALS: void changed(); private: ResourceAllocationTreeView *m_view; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptresourceallocationeditor.h b/src/libs/ui/kptresourceallocationeditor.h index 133f9ef0..e7429f10 100644 --- a/src/libs/ui/kptresourceallocationeditor.h +++ b/src/libs/ui/kptresourceallocationeditor.h @@ -1,115 +1,115 @@ /* This file is part of the KDE project Copyright (C) 2009, 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEALLOCATIONEDITOR_H #define KPTRESOURCEALLOCATIONEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptresourceallocationmodel.h" #include "kpttask.h" class KoDocument; class QPoint; namespace KPlato { class Project; class Resource; class ResourceGroup; -class KPLATOUI_EXPORT ResourceAllocationTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT ResourceAllocationTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit ResourceAllocationTreeView( QWidget *parent ); ResourceAllocationItemModel *model() const { return static_cast( DoubleTreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } Task *task() const { return model()->task(); } void setTask( Task *task ) { model()->setTask( task ); } QObject *currentObject() const; const QMap &resourceCache() const { return model()->resourceCache(); } const QMap &groupCache() const { return model()->groupCache(); } Q_SIGNALS: void dataChanged(); }; -class KPLATOUI_EXPORT ResourceAllocationEditor : public ViewBase +class PLANUI_EXPORT ResourceAllocationEditor : public ViewBase { Q_OBJECT public: ResourceAllocationEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void setProject( Project *project ) { m_view->setProject( project ); } ResourceAllocationItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); virtual Resource *currentResource() const; virtual ResourceGroup *currentResourceGroup() const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotSplitView(); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void slotEnableActions( bool on ); private: ResourceAllocationTreeView *m_view; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptresourceappointmentsview.h b/src/libs/ui/kptresourceappointmentsview.h index 5c100f73..59780e28 100644 --- a/src/libs/ui/kptresourceappointmentsview.h +++ b/src/libs/ui/kptresourceappointmentsview.h @@ -1,180 +1,180 @@ /* This file is part of the KDE project Copyright (C) 2005 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEAPPOINTMENTSVIEW_H #define KPTRESOURCEAPPOINTMENTSVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptresourceappointmentsdisplayoptions.h" #include "kptviewbase.h" #include "kptresourceappointmentsmodel.h" #include #include class KoPageLayoutWidget; class KoDocument; class QPoint; namespace KPlato { class View; class Project; class Resource; class ResourceGroup; class ScheduleManager; class ResourceAppointmentsItemModel; //------------------------------------------------- class ResourceAppointmentsDisplayOptionsPanel : public QWidget, public Ui::ResourceAppointmentsDisplayOptions { Q_OBJECT public: explicit ResourceAppointmentsDisplayOptionsPanel( ResourceAppointmentsItemModel *model, QWidget *parent = 0 ); void setValues( const ResourceAppointmentsItemModel &del ); public Q_SLOTS: void slotOk(); void setDefault(); Q_SIGNALS: void changed(); private: ResourceAppointmentsItemModel *m_model; }; class ResourceAppointmentsSettingsDialog : public KPageDialog { Q_OBJECT public: explicit ResourceAppointmentsSettingsDialog( ViewBase *view, ResourceAppointmentsItemModel *model, QWidget *parent = 0, bool selectPrint = false ); public Q_SLOTS: void slotOk(); private: ViewBase *m_view; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; }; //------------------------ -class KPLATOUI_EXPORT ResourceAppointmentsTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT ResourceAppointmentsTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit ResourceAppointmentsTreeView(QWidget *parent); ResourceAppointmentsItemModel *model() const { return static_cast( DoubleTreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } void setScheduleManager( ScheduleManager *sm ) { model()->setScheduleManager( sm ); } QModelIndex currentIndex() const; /// Load context info into this view. virtual bool loadContext( const KoXmlElement &context ); using DoubleTreeViewBase::loadContext; /// Save context info from this view. virtual void saveContext( QDomElement &context ) const; using DoubleTreeViewBase::saveContext; protected Q_SLOTS: void slotRefreshed(); private: ViewBase *m_view; }; -class KPLATOUI_EXPORT ResourceAppointmentsView : public ViewBase +class PLANUI_EXPORT ResourceAppointmentsView : public ViewBase { Q_OBJECT public: ResourceAppointmentsView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); virtual void setProject( Project *project ); Project *project() const { return m_view->project(); } virtual void draw( Project &project ); virtual void draw(); ResourceAppointmentsItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool /*readwrite*/ ) {}; virtual Node *currentNode() const; virtual Resource *currentResource() const; virtual ResourceGroup *currentResourceGroup() const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void requestPopupMenu( const QString&, const QPoint& ); void addResource( ResourceGroup* ); void deleteObjectList( const QObjectList& ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void slotEnableActions( bool on ); void slotAddResource(); void slotAddGroup(); void slotDeleteSelection(); private: ResourceAppointmentsTreeView *m_view; QAction *actionAddResource; QAction *actionAddGroup; QAction *actionDeleteSelection; QDomDocument m_domdoc; }; } //KPlato namespace #endif // KPTRESOURCEAPPOINTMENTSVIEW_H diff --git a/src/libs/ui/kptresourceassignmentview.h b/src/libs/ui/kptresourceassignmentview.h index 84f45eec..f202ce71 100644 --- a/src/libs/ui/kptresourceassignmentview.h +++ b/src/libs/ui/kptresourceassignmentview.h @@ -1,104 +1,104 @@ /* This file is part of the KDE project Copyright (C) 2006 - 2007 Frederic BECQUIER This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEASSIGNMENTVIEW_H #define KPTRESOURCEASSIGNMENTVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include #include "kpttask.h" #include "kpttaskeditor.h" #include "kptcommand.h" #include #include "ui_kptresourceassignmentview.h" class KoDocument; class QPoint; class QSplitter; class QTreeWidgetItem; namespace KPlato { class ResourcesList; -class KPLATOUI_EXPORT ResourcesList : public QTreeWidget +class PLANUI_EXPORT ResourcesList : public QTreeWidget { Q_OBJECT public: explicit ResourcesList(QWidget *parent = 0); }; -class KPLATOUI_EXPORT ResourceAssignmentView : public ViewBase +class PLANUI_EXPORT ResourceAssignmentView : public ViewBase { Q_OBJECT public: ResourceAssignmentView(KoPart *part, KoDocument *doc, QWidget *parent); using ViewBase::draw; Project *project() const { return m_project; } void draw( Project &project ); void drawResourcesName( QTreeWidgetItem *parent, ResourceGroup *group ); void drawTasksAttributedToAResource (Resource *res, QTreeWidgetItem *parent); void drawTasksAttributedToAGroup (ResourceGroup *group, QTreeWidgetItem *parent); private: QSplitter *m_splitter; ResourcesList *m_resList; Project *m_project; ResourcesList *m_taskList; QTreeWidgetItem *m_selectedItem; QTreeWidgetItem *m_tasktreeroot; KoDocument *m_part; ::Ui::ResourceAssignmentView widget; void updateTasks(); protected Q_SLOTS: void resSelectionChanged(); void resSelectionChanged( QTreeWidgetItem *item ); private Q_SLOTS: void slotRequestPopupMenu( const QPoint &p ); void slotUpdate(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptresourcedialog.h b/src/libs/ui/kptresourcedialog.h index 8e4d0650..b39435b0 100644 --- a/src/libs/ui/kptresourcedialog.h +++ b/src/libs/ui/kptresourcedialog.h @@ -1,105 +1,105 @@ /* This file is part of the KDE project Copyright (C) 2003 - 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEDIALOG_H #define KPTRESOURCEDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_resourcedialogbase.h" #include "kptresource.h" #include #include namespace KPlato { class Project; class Resource; class Calendar; class MacroCommand; class ResourceDialogImpl : public QWidget, public Ui_ResourceDialogBase { Q_OBJECT public: explicit ResourceDialogImpl( const Project &m_project, Resource &resource, bool baselined, QWidget *parent ); public Q_SLOTS: void slotChanged(); void slotTypeChanged(int); void slotCalculationNeeded(const QString&); void slotChooseResource(); void setCurrentIndexes( const QModelIndexList &lst ); Q_SIGNALS: void changed(); void calculate(); protected Q_SLOTS: void slotAvailableFromChanged(const QDateTime& dt); void slotAvailableUntilChanged(const QDateTime& dt); void slotUseRequiredChanged( int state ); void slotTeamChanged( const QModelIndex &index ); private: const Project &m_project; Resource &m_resource; QList m_currentIndexes; }; -class KPLATOUI_EXPORT ResourceDialog : public KoDialog { +class PLANUI_EXPORT ResourceDialog : public KoDialog { Q_OBJECT public: ResourceDialog(Project &project, Resource *resource, QWidget *parent=0, const char *name=0); bool calculationNeeded() { return m_calculationNeeded; } Calendar *calendar() { return m_calendars[dia->calendarList->currentIndex()]; } MacroCommand *buildCommand(); static MacroCommand *buildCommand(Resource *original, Resource &resource); protected Q_SLOTS: void enableButtonOk(); void slotCalculationNeeded(); void slotOk(); void slotCalendarChanged(int); void slotButtonClicked(int button); void slotAccountChanged( const QString &name ); void slotResourceRemoved( const Resource *resource ); private: Project &m_project; Resource *m_original; Resource m_resource; ResourceDialogImpl *dia; bool m_calculationNeeded; QMap m_calendars; QMap m_groups; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptresourceeditor.h b/src/libs/ui/kptresourceeditor.h index 45d0a3fa..fea27173 100644 --- a/src/libs/ui/kptresourceeditor.h +++ b/src/libs/ui/kptresourceeditor.h @@ -1,123 +1,123 @@ /* This file is part of the KDE project Copyright (C) 2006 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTRESOURCEEDITOR_H #define KPTRESOURCEEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include class KoDocument; class QPoint; namespace KPlato { class Project; class Resource; class ResourceGroup; -class KPLATOUI_EXPORT ResourceTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT ResourceTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit ResourceTreeView(QWidget *parent); ResourceItemModel *model() const { return static_cast( DoubleTreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } QObject *currentObject() const; QList selectedObjects() const; QList selectedGroups() const; QList selectedResources() const; protected Q_SLOTS: void slotDropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); }; -class KPLATOUI_EXPORT ResourceEditor : public ViewBase +class PLANUI_EXPORT ResourceEditor : public ViewBase { Q_OBJECT public: ResourceEditor(KoPart *part, KoDocument *dic, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void setProject( Project *project ); ResourceItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); virtual Resource *currentResource() const; virtual ResourceGroup *currentResourceGroup() const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void addResource( ResourceGroup* ); void deleteObjectList( const QObjectList& ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotSplitView(); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void slotEnableActions( bool on ); void slotAddResource(); void slotAddGroup(); void slotDeleteSelection(); private: ResourceTreeView *m_view; QAction *actionAddResource; QAction *actionAddGroup; QAction *actionDeleteSelection; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptscheduleeditor.h b/src/libs/ui/kptscheduleeditor.h index fe5ecac9..d1c46e27 100644 --- a/src/libs/ui/kptscheduleeditor.h +++ b/src/libs/ui/kptscheduleeditor.h @@ -1,290 +1,290 @@ /* This file is part of the KDE project Copyright (C) 2006-2008 Dag Andersen Copyright (C) 2006-2007 Menard Alexis This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTSCHEDULEEDITOR_H #define KPTSCHEDULEEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include "kptsplitterview.h" #include "kptschedulemodel.h" #include "ui_kptscheduleeditor.h" #include class KoDocument; class KToggleAction; class QPoint; class QSortFilterProxyModel; namespace KPlato { class Project; class ScheduleManager; class SchedulingRange; -class KPLATOUI_EXPORT ScheduleTreeView : public TreeViewBase +class PLANUI_EXPORT ScheduleTreeView : public TreeViewBase { Q_OBJECT public: explicit ScheduleTreeView(QWidget *parent); ScheduleItemModel *model() const { return static_cast( TreeViewBase::model() ); } Project *project() const { return model()->project(); } void setProject( Project *project ) { model()->setProject( project ); } ScheduleManager *manager( const QModelIndex &idx ) const; ScheduleManager *currentManager() const; ScheduleManager *selectedManager() const; QModelIndexList selectedRows() const; Q_SIGNALS: void currentChanged( const QModelIndex& ); void currentColumnChanged( const QModelIndex&, const QModelIndex& ); void selectionChanged( const QModelIndexList& ); protected Q_SLOTS: virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); }; -class KPLATOUI_EXPORT ScheduleEditor : public ViewBase +class PLANUI_EXPORT ScheduleEditor : public ViewBase { Q_OBJECT public: ScheduleEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void draw( Project &project ); virtual void draw(); ScheduleItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void calculateSchedule( Project*, ScheduleManager* ); void baselineSchedule( Project*, ScheduleManager* ); void addScheduleManager( Project* ); void deleteScheduleManager( Project*, ScheduleManager* ); void SelectionScheduleChanged(); /** * Emitted when schedule selection changes. * @param sm is the new schedule manager. If @p is 0, no schedule is selected. */ void scheduleSelectionChanged( ScheduleManager *sm ); void moveScheduleManager( ScheduleManager *sm, ScheduleManager *newparent, int index ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void updateActionsEnabled( const QModelIndex &index ); void slotEnableActions(); void slotCalculateSchedule(); void slotBaselineSchedule(); void slotAddSchedule(); void slotAddSubSchedule(); void slotDeleteSelection(); void slotMoveLeft(); private: ScheduleTreeView *m_view; SchedulingRange *m_schedulingRange; QAction *actionCalculateSchedule; QAction *actionBaselineSchedule; QAction *actionAddSchedule; QAction *actionAddSubSchedule; QAction *actionDeleteSelection; QAction *actionMoveLeft; }; //----------------------------- -class KPLATOUI_EXPORT ScheduleLogTreeView : public QTreeView +class PLANUI_EXPORT ScheduleLogTreeView : public QTreeView { Q_OBJECT public: explicit ScheduleLogTreeView(QWidget *parent); Project *project() const { return logModel()->project(); } void setProject( Project *project ) { logModel()->setProject( project ); } ScheduleLogItemModel *logModel() const { return static_cast( m_model->sourceModel() ); } ScheduleManager *scheduleManager() const { return logModel()->manager(); } void setScheduleManager( ScheduleManager *manager ) { logModel()->setManager( manager ); } void setFilterWildcard( const QString &filter ); QRegExp filterRegExp() const; Q_SIGNALS: void currentChanged( const QModelIndex& ); void currentColumnChanged( const QModelIndex&, const QModelIndex& ); void selectionChanged( const QModelIndexList& ); void contextMenuRequested( const QModelIndex&, const QPoint& ); public Q_SLOTS: void slotEditCopy(); protected Q_SLOTS: void contextMenuEvent ( QContextMenuEvent *e ); void headerContextMenuRequested( const QPoint &pos ); virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected); virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); void slotShowDebug( bool ); private: QSortFilterProxyModel *m_model; KToggleAction *actionShowDebug; }; //---------------------------------------------- -class KPLATOUI_EXPORT ScheduleLogView : public ViewBase +class PLANUI_EXPORT ScheduleLogView : public ViewBase { Q_OBJECT public: ScheduleLogView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); virtual void setProject( Project *project ); Project *project() const { return m_view->project(); } using ViewBase::draw; virtual void draw( Project &project ); ScheduleLogItemModel *baseModel() const { return m_view->logModel(); } virtual void updateReadWrite( bool readwrite ); /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. virtual void saveContext( QDomElement &/*context*/ ) const; Q_SIGNALS: void editNode( Node *node ); void editResource( Resource *resource ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void slotEditCopy(); void slotEdit(); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotScheduleSelectionChanged( ScheduleManager *sm ); void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex& ); void updateActionsEnabled( const QModelIndex &index ); void slotEnableActions( const ScheduleManager *sm ); private: ScheduleLogTreeView *m_view; }; //----------------------------- -class KPLATOUI_EXPORT ScheduleHandlerView : public SplitterView +class PLANUI_EXPORT ScheduleHandlerView : public SplitterView { Q_OBJECT public: ScheduleHandlerView(KoPart *part, KoDocument *doc, QWidget *parent); Project *project() const { return 0; } ScheduleEditor *scheduleEditor() const { return m_scheduleEditor; } /// Returns a list of actionlist names for all shown views QStringList actionListNames() const; /// Returns the list of actions associated with the action list @p name virtual QList actionList( const QString &name ) const; /// Always returns this (if we are called, we are hit) virtual ViewBase *hitView( const QPoint &glpos ); Q_SIGNALS: void currentScheduleManagerChanged( ScheduleManager* ); void editNode( Node *node ); void editResource( Resource *resource ); public Q_SLOTS: /// Activate/deactivate the gui (also of subviews) virtual void setGuiActive( bool activate ); protected Q_SLOTS: /// Noop, we handle subviews ourselves virtual void slotGuiActivated( ViewBase *v, bool active ); virtual void currentTabChanged( int i ); private: ScheduleEditor *m_scheduleEditor; }; class SchedulingRange : public QWidget, public Ui::SchedulingRange { Q_OBJECT public: SchedulingRange(KoDocument *doc, QWidget *parent = 0); public Q_SLOTS: void setProject(Project *project); void slotProjectChanged(Node*); void slotStartChanged(); void slotEndChanged(); protected: KoDocument *m_doc; Project *m_project; }; } //KPlato namespace #endif diff --git a/src/libs/ui/kptsplitterview.h b/src/libs/ui/kptsplitterview.h index 40a63d27..023ffa0c 100644 --- a/src/libs/ui/kptsplitterview.h +++ b/src/libs/ui/kptsplitterview.h @@ -1,131 +1,131 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTSPLITTERVIEW_H #define KPTSPLITTERVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include class KoDocument; class QSplitter; class QTabWidget; /// The main namespace namespace KPlato { class Project; class Node; class Resource; class ResourceGroup; class Calendar; class Relation; class Context; /** * SplitterView is a view with a vertical QSplitter that can contain * other ViewBase based views and/or QTabWidgets that can hold * ViewVase based views as well. * This splitter view is created by the main View, and subviews can then be * added with addView(). A QTabWidget is added with addTabWidget(). * * To have context info loaded, views added to this splitter must have a * unique objectName(). */ -class KPLATOUI_EXPORT SplitterView : public ViewBase +class PLANUI_EXPORT SplitterView : public ViewBase { Q_OBJECT public: /// Constructor SplitterView(KoPart *part, KoDocument *doc, QWidget *parent); /// Destructor virtual ~SplitterView() {} /// Set the project this view shall handle. virtual void setProject( Project *project ); /// Draw data from current part / project virtual void draw(); /// Draw data from project. virtual void draw( Project &project ); /// Set readWrite mode virtual void updateReadWrite( bool ); /// Return the view that has focus ViewBase *focusView() const; /// Returns the list of action lists that shall be plugged/unplugged virtual QStringList actionListNames() const; /// Returns the list of actions associated with the action list name virtual QList actionList( const QString &name ) const; /// Returns the list of context menu actions for the active view virtual QList contextActionList() const; /// Sets context info to this view. Reimplement. virtual bool setContext( const Context &/*context*/ ) { return false; } /// Gets context info from this view. Reimplement. virtual void getContext( Context &/*context*/ ) const {} /// Add a QTabWidget to the splitter QTabWidget *addTabWidget(); /// Add the @p view to the splitter void addView( ViewBase *view ); /// Add the @p view to the @p tab. Set the tabs label to @p label void addView( ViewBase *view, QTabWidget *tab, const QString &label ); /// Return the active view at @p pos ViewBase *findView( const QPoint &pos ) const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; virtual Node* currentNode() const; virtual Resource* currentResource() const; virtual ResourceGroup* currentResourceGroup() const; virtual Calendar* currentCalendar() const; virtual Relation *currentRelation() const; public Q_SLOTS: /// Activate/deactivate the gui (also of subviews) virtual void setGuiActive( bool activate ); virtual void setScheduleManager( ScheduleManager *sm ); virtual void slotEditCopy(); protected Q_SLOTS: virtual void slotGuiActivated( ViewBase *v, bool active ); virtual void currentTabChanged( int i ); protected: QSplitter *m_splitter; ViewBase *m_activeview; }; } // namespace KPlato #endif diff --git a/src/libs/ui/kptstandardworktimedialog.h b/src/libs/ui/kptstandardworktimedialog.h index 801876cf..ee9e798b 100644 --- a/src/libs/ui/kptstandardworktimedialog.h +++ b/src/libs/ui/kptstandardworktimedialog.h @@ -1,88 +1,88 @@ /* This file is part of the KDE project Copyright (C) 2004 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTSTANDARDWORKTIMEDIALOG_H #define KPTSTANDARDWORKTIMEDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_standardworktimedialogbase.h" #include "kptcalendar.h" #include namespace KPlato { class Project; class MacroCommand; class StandardWorktimeDialogImpl : public QWidget, public Ui::StandardWorktimeDialogBase { Q_OBJECT public: StandardWorktimeDialogImpl ( StandardWorktime *std, QWidget *parent); StandardWorktime *standardWorktime() { return m_std; } double inYear() const { return m_year; } double inMonth() const { return m_month; } double inWeek() const { return m_week; } double inDay() const { return m_day; } private Q_SLOTS: void slotCheckAllFieldsFilled(); void slotEnableButtonOk(bool on); void slotYearChanged(double); void slotMonthChanged(double); void slotWeekChanged(double); void slotDayChanged(double); Q_SIGNALS: void obligatedFieldsFilled(bool yes); void enableButtonOk(bool); private: StandardWorktime *m_std; double m_year; double m_month; double m_week; double m_day; }; -class KPLATOUI_EXPORT StandardWorktimeDialog : public KoDialog { +class PLANUI_EXPORT StandardWorktimeDialog : public KoDialog { Q_OBJECT public: explicit StandardWorktimeDialog(Project &project, QWidget *parent=0); MacroCommand *buildCommand(); protected Q_SLOTS: void slotOk(); private: Project &project; StandardWorktimeDialogImpl *dia; StandardWorktime *m_original; }; } //KPlato namespace #endif // STANDARDWORKTIMEDIALOG_H diff --git a/src/libs/ui/kptsummarytaskdialog.h b/src/libs/ui/kptsummarytaskdialog.h index c6c41944..ab3fbfcb 100644 --- a/src/libs/ui/kptsummarytaskdialog.h +++ b/src/libs/ui/kptsummarytaskdialog.h @@ -1,63 +1,63 @@ /* This file is part of the KDE project Copyright (C) 2002 Bo Thorsen bo@sonofthor.dk Copyright (C) 2004 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTSUMMARYTASKDIALOG_H #define KPTSUMMARYTASKDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class SummaryTaskGeneralPanel; class Task; class Node; class MacroCommand; /** * The dialog that shows and allows you to alter summary tasks. */ -class KPLATOUI_EXPORT SummaryTaskDialog : public KoDialog { +class PLANUI_EXPORT SummaryTaskDialog : public KoDialog { Q_OBJECT public: /** * The constructor for the summary task settings dialog. * @param task the task to edit * @param parent parent widget */ explicit SummaryTaskDialog(Task &task, QWidget *parent=0); MacroCommand *buildCommand(); protected Q_SLOTS: void slotButtonClicked(int button); void slotTaskRemoved( Node *node ); private: Node *m_node; SummaryTaskGeneralPanel *m_generalTab; }; } //KPlato namespace #endif // SUMMARYTASKDIALOG_H diff --git a/src/libs/ui/kptsummarytaskgeneralpanel.h b/src/libs/ui/kptsummarytaskgeneralpanel.h index 064ebc7b..48f62b90 100644 --- a/src/libs/ui/kptsummarytaskgeneralpanel.h +++ b/src/libs/ui/kptsummarytaskgeneralpanel.h @@ -1,60 +1,60 @@ /* This file is part of the KDE project Copyright (C) 2004 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTSUMMARYTASKGENERALPANEL_H #define KPTSUMMARYTASKGENERALPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptsummarytaskgeneralpanelbase.h" namespace KPlato { class SummaryTaskGeneralPanel; class TaskDescriptionPanel; class Task; class MacroCommand; class SummaryTaskGeneralPanel : public QWidget, public Ui_SummaryTaskGeneralPanelBase { Q_OBJECT public: explicit SummaryTaskGeneralPanel(Task &task, QWidget *parent=0, const char *name=0); MacroCommand *buildCommand(); bool ok(); void setStartValues(Task &task); Q_SIGNALS: void obligatedFieldsFilled(bool); public Q_SLOTS: void slotObligatedFieldsFilled(); void slotChooseResponsible(); private: Task &m_task; TaskDescriptionPanel *m_description; }; } //KPlato namespace #endif // SUMMARYTASKGENERALPANEL_H diff --git a/src/libs/ui/kpttaskcostpanel.h b/src/libs/ui/kpttaskcostpanel.h index 07d30aaa..88bfa799 100644 --- a/src/libs/ui/kpttaskcostpanel.h +++ b/src/libs/ui/kpttaskcostpanel.h @@ -1,78 +1,78 @@ /* This file is part of the KDE project Copyright (C) 2005-2007 Dag Andersen Copyright (C) 2016 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Cost Public License for more details. You should have received a copy of the GNU Library Cost Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKCOSTPANEL_H #define KPTTASKCOSTPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kpttaskcostpanelbase.h" namespace KPlato { class Locale; class TaskCostPanel; class Account; class Accounts; class Task; class MacroCommand; class TaskCostPanelImpl : public QWidget, public Ui_TaskCostPanelBase { Q_OBJECT public: explicit TaskCostPanelImpl(QWidget *parent=0, const char *name=0); Q_SIGNALS: void changed(); public Q_SLOTS: void slotChanged(); }; class TaskCostPanel : public TaskCostPanelImpl { Q_OBJECT public: TaskCostPanel(Task &task, Accounts &accounts, QWidget *parent=0, const char *name=0); ~TaskCostPanel(); MacroCommand *buildCommand(); bool ok(); void setStartValues(Task &task); protected: void setCurrentItem(QComboBox *box, const QString& name); private: Task &m_task; Accounts &m_accounts; QStringList m_accountList; Account *m_oldrunning; Account *m_oldstartup; Account *m_oldshutdown; const Locale *m_locale; bool m_localeIsOwn; }; } //KPlato namespace #endif // TASKCOSTPANEL_H diff --git a/src/libs/ui/kpttaskdescriptiondialog.h b/src/libs/ui/kpttaskdescriptiondialog.h index 7e1351e6..bf04f83f 100644 --- a/src/libs/ui/kpttaskdescriptiondialog.h +++ b/src/libs/ui/kpttaskdescriptiondialog.h @@ -1,91 +1,91 @@ /* This file is part of the KDE project Copyright (C) 2009 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTTASKDESCRIPTIONDIALOG_H #define KPTTASKDESCRIPTIONDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kpttaskdescriptionpanelbase.h" #include namespace KPlato { class TaskDescriptionPanel; class Task; class Node; class MacroCommand; class TaskDescriptionPanelImpl : public QWidget, public Ui_TaskDescriptionPanelBase { Q_OBJECT public: TaskDescriptionPanelImpl( Node &node, QWidget *parent ); public Q_SLOTS: virtual void slotChanged(); Q_SIGNALS: void textChanged( bool ); protected: Node &m_node; }; class TaskDescriptionPanel : public TaskDescriptionPanelImpl { Q_OBJECT public: explicit TaskDescriptionPanel( Node &node, QWidget *parent = 0, bool readOnly = false ); MacroCommand *buildCommand(); bool ok(); void setStartValues( Node &node ); protected: void initDescription( bool readOnly ); }; -class KPLATOUI_EXPORT TaskDescriptionDialog : public KoDialog +class PLANUI_EXPORT TaskDescriptionDialog : public KoDialog { Q_OBJECT public: /** * The constructor for the task description dialog. * @param node the node to show * @param parent parent widget */ explicit TaskDescriptionDialog( Task &task, QWidget *parent = 0, bool readOnly = false ); MacroCommand *buildCommand(); protected Q_SLOTS: void slotButtonClicked( int button ); protected: TaskDescriptionPanel *m_descriptionTab; }; } //KPlato namespace #endif // KPTTASKDESCRIPTIONDIALOG_H diff --git a/src/libs/ui/kpttaskdialog.h b/src/libs/ui/kpttaskdialog.h index 0242c42c..aabe7cba 100644 --- a/src/libs/ui/kpttaskdialog.h +++ b/src/libs/ui/kpttaskdialog.h @@ -1,109 +1,109 @@ /* This file is part of the KDE project Copyright (C) 2002 Bo Thorsen bo@sonofthor.dk Copyright (C) 2004 -2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKDIALOG_H #define KPTTASKDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class Accounts; class TaskGeneralPanel; class RequestResourcesPanel; class DocumentsPanel; class TaskCostPanel; class TaskDescriptionPanel; class Node; class Task; class Project; class MacroCommand; /** * The dialog that shows and allows you to alter any task. */ -class KPLATOUI_EXPORT TaskDialog : public KPageDialog { +class PLANUI_EXPORT TaskDialog : public KPageDialog { Q_OBJECT public: /** * The constructor for the task settings dialog. * @param task the task to show * @param accounts all defined accounts * @param parent parent widget */ TaskDialog(Project &project, Task &task, Accounts &accounts, QWidget *parent=0); virtual MacroCommand *buildCommand(); protected Q_SLOTS: void accept(); void setButtonOkEnabled(bool enabled); void slotTaskRemoved( Node *node ); void slotCurrentChanged( KPageWidgetItem*, KPageWidgetItem* ); protected: Project &m_project; Node *m_node; TaskGeneralPanel *m_generalTab; RequestResourcesPanel *m_resourcesTab; DocumentsPanel *m_documentsTab; TaskCostPanel *m_costTab; TaskDescriptionPanel *m_descriptionTab; }; -class KPLATOUI_EXPORT TaskAddDialog : public TaskDialog { +class PLANUI_EXPORT TaskAddDialog : public TaskDialog { Q_OBJECT public: TaskAddDialog(Project &project, Task &task, Node *currentNode, Accounts &accounts, QWidget *parent=0); ~TaskAddDialog(); virtual MacroCommand *buildCommand(); protected Q_SLOTS: void slotNodeRemoved( Node* ); private: Node *m_currentnode; }; -class KPLATOUI_EXPORT SubTaskAddDialog : public TaskDialog { +class PLANUI_EXPORT SubTaskAddDialog : public TaskDialog { Q_OBJECT public: SubTaskAddDialog(Project &project, Task &task, Node *currentNode, Accounts &accounts, QWidget *parent=0); ~SubTaskAddDialog(); virtual MacroCommand *buildCommand(); protected Q_SLOTS: void slotNodeRemoved( Node* ); private: Node *m_currentnode; }; } //KPlato namespace #endif // TASKDIALOG_H diff --git a/src/libs/ui/kpttaskeditor.h b/src/libs/ui/kpttaskeditor.h index c27c2266..7990620a 100644 --- a/src/libs/ui/kpttaskeditor.h +++ b/src/libs/ui/kpttaskeditor.h @@ -1,356 +1,356 @@ /* This file is part of the KDE project Copyright (C) 2006 -20010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKEDITOR_H #define KPTTASKEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptglobal.h" #include "kptnodeitemmodel.h" #include "kptviewbase.h" class KoDocument; class KActionMenu; namespace KPlato { class Project; class Node; class NodeItemModel; class MacroCommand; -class KPLATOUI_EXPORT TaskEditorItemModel : public NodeItemModel +class PLANUI_EXPORT TaskEditorItemModel : public NodeItemModel { Q_OBJECT public: explicit TaskEditorItemModel( QObject *parent = 0 ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const; virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex & index, const QVariant &value, int role = Qt::EditRole ); protected: QVariant type( const Node *node, int role ) const; virtual bool setType( Node *node, const QVariant &value, int role ); }; -class KPLATOUI_EXPORT TaskEditorTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT TaskEditorTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit TaskEditorTreeView(QWidget *parent); //void setSelectionModel( QItemSelectionModel *selectionModel ); NodeItemModel *baseModel() const; NodeSortFilterProxyModel *proxyModel() const { return qobject_cast( model() ); } Project *project() const { return baseModel()->project(); } void setProject( Project *project ) { baseModel()->setProject( project ); } Q_SIGNALS: void currentColumnChanged( const QModelIndex&, const QModelIndex& ); protected Q_SLOTS: void slotDropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); }; -class KPLATOUI_EXPORT NodeTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT NodeTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit NodeTreeView(QWidget *parent); //void setSelectionModel( QItemSelectionModel *selectionModel ); NodeItemModel *baseModel() const; NodeSortFilterProxyModel *proxyModel() const { return qobject_cast( model() ); } Project *project() const { return baseModel()->project(); } void setProject( Project *project ) { baseModel()->setProject( project ); } Q_SIGNALS: void currentColumnChanged( const QModelIndex&, const QModelIndex& ); protected Q_SLOTS: void slotDropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); }; -class KPLATOUI_EXPORT TaskEditor : public ViewBase +class PLANUI_EXPORT TaskEditor : public ViewBase { Q_OBJECT public: TaskEditor(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); void setProject( Project *project ); Project *project() const { return m_view->project(); } virtual void createDockers(); virtual Node *currentNode() const; QList selectedNodes() const ; Node *selectedNode() const; virtual void updateReadWrite( bool readwrite ); NodeItemModel *baseModel() const { return m_view->baseModel(); } NodeSortFilterProxyModel *proxyModel() const { return m_view->proxyModel(); } QAbstractItemModel *model() const { return m_view->model(); } /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; virtual KoPrintJob *createPrintJob(); Q_SIGNALS: void taskSelected( Task *task ); void openNode(); void addTask(); void addMilestone(); void addSubtask(); void addSubMilestone(); void deleteTaskList( const QList& ); void moveTaskUp(); void moveTaskDown(); void indentTask(); void unindentTask(); void loadTaskModules( const QStringList &files ); void saveTaskModule( const QUrl &url, Project *project ); void removeTaskModule( const QUrl &url ); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); void setTaskModules( const QStringList &files ); protected: void updateActionsEnabled( bool on ); int selectedRowCount() const; QModelIndexList selectedRows() const; void editTasks(const QList &tasks, const QPoint &pos); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested(const QModelIndex &index, const QPoint& pos , const QModelIndexList &rows); void slotEnableActions(); void slotAddTask(); void slotAddSubtask(); void slotAddMilestone(); void slotAddSubMilestone(); void slotDeleteTask(); void slotIndentTask(); void slotUnindentTask(); void slotMoveTaskUp(); void slotMoveTaskDown(); void slotSplitView(); void slotProjectShown( bool ); void taskModuleDoubleClicked(QModelIndex idx); private: void edit( const QModelIndex &index ); private: TaskEditorTreeView *m_view; KActionMenu *menuAddTask; KActionMenu *menuAddSubTask; QAction *actionAddTask; QAction *actionAddMilestone; QAction *actionAddSubtask; QAction *actionAddSubMilestone; QAction *actionDeleteTask; QAction *actionMoveTaskUp; QAction *actionMoveTaskDown; QAction *actionIndentTask; QAction *actionUnindentTask; QAction *actionShowProject; QDomDocument m_domdoc; }; -class KPLATOUI_EXPORT TaskView : public ViewBase +class PLANUI_EXPORT TaskView : public ViewBase { Q_OBJECT public: TaskView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const { return m_view->project(); } virtual void draw( Project &project ); virtual void draw(); NodeItemModel *baseModel() const { return m_view->baseModel(); } NodeSortFilterProxyModel *proxyModel() const { return m_view->proxyModel(); } virtual Node *currentNode() const; QList selectedNodes() const ; Node *selectedNode() const; virtual void updateReadWrite( bool readwrite ); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void openNode(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); protected: void updateActionsEnabled( bool on ); int selectedNodeCount() const; protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotEnableActions(); void slotSplitView(); private: NodeTreeView *m_view; QAction *actionShowProject; QDomDocument m_domdoc; }; //----------------------------------- class WorkPackageTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit WorkPackageTreeView(QWidget *parent); //void setSelectionModel( QItemSelectionModel *selectionModel ); NodeItemModel *baseModel() const; WorkPackageProxyModel *proxyModel() const { return m; } Project *project() const { return baseModel()->project(); } void setProject( Project *project ) { m->setProject( project ); } ScheduleManager *scheduleManager() const { return baseModel()->manager(); } Q_SIGNALS: void currentColumnChanged( const QModelIndex&, const QModelIndex& ); protected Q_SLOTS: void slotDropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); protected: WorkPackageProxyModel *m; }; -class KPLATOUI_EXPORT TaskWorkPackageView : public ViewBase +class PLANUI_EXPORT TaskWorkPackageView : public ViewBase { Q_OBJECT public: TaskWorkPackageView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); Project *project() const; void setProject( Project *project ); ScheduleManager *scheduleManager() const { return m_view->scheduleManager(); } WorkPackageProxyModel *proxyModel() const; virtual Node *currentNode() const; QList selectedNodes() const ; Node *selectedNode() const; virtual void updateReadWrite( bool readwrite ); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void mailWorkpackage( Node *n, Resource *r = 0 ); void mailWorkpackages( const QList &nodes, Resource *r ); void checkForWorkPackages(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void slotRefreshView(); void setScheduleManager( ScheduleManager *sm ); protected: void updateActionsEnabled( bool on ); int selectedNodeCount() const; protected Q_SLOTS: virtual void slotOptions(); void slotMailWorkpackage(); void slotWorkPackageSent( const QList &nodes, Resource *resource ); private Q_SLOTS: void slotSelectionChanged( const QModelIndexList& ); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotEnableActions(); void slotSplitView(); private: WorkPackageTreeView *m_view; MacroCommand *m_cmd; QAction *actionMailWorkpackage; }; } //namespace KPlato #endif diff --git a/src/libs/ui/kpttaskgeneralpanel.h b/src/libs/ui/kpttaskgeneralpanel.h index 0d873a68..9a179344 100644 --- a/src/libs/ui/kpttaskgeneralpanel.h +++ b/src/libs/ui/kpttaskgeneralpanel.h @@ -1,123 +1,123 @@ /* This file is part of the KDE project Copyright (C) 2004 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKGENERALPANEL_H #define KPTTASKGENERALPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kpttaskgeneralpanelbase.h" #include "kptduration.h" #include namespace KPlato { class TaskGeneralPanel; class Task; class MacroCommand; class Calendar; class Project; class TaskGeneralPanelImpl : public QWidget, public Ui_TaskGeneralPanelBase { Q_OBJECT public: TaskGeneralPanelImpl(QWidget *parent, const char *name); virtual int schedulingType() const; virtual int estimationType() const; virtual int optimistic() const; virtual int pessimistic(); virtual double estimationValue(); virtual QDateTime startDateTime(); virtual QDateTime endDateTime(); virtual QTime startTime() const; virtual QTime endTime(); virtual QDate startDate(); virtual QDate endDate(); virtual int risktype() const; virtual Calendar *calendar() const; public Q_SLOTS: virtual void setSchedulingType( int type ); virtual void changeLeader(); virtual void setEstimationType( int type ); virtual void setOptimistic( int value ); virtual void setPessimistic( int value ); virtual void enableDateTime( int scheduleType ); virtual void estimationTypeChanged( int type ); virtual void setEstimate( double duration ); virtual void setEstimateType( int type ); virtual void checkAllFieldsFilled(); // virtual void setEstimateScales( double day ); virtual void startDateChanged(); virtual void startTimeChanged( const QTime & time ); virtual void endDateChanged(); virtual void endTimeChanged( const QTime & time ); virtual void scheduleTypeChanged( int value ); virtual void setStartTime( const QTime & time ); virtual void setEndTime( const QTime & time ); virtual void setStartDateTime( const QDateTime & dt ); virtual void setEndDateTime( const QDateTime & dt ); virtual void setStartDate( const QDate & date ); virtual void setEndDate( const QDate & date ); virtual void setRisktype( int r ); virtual void calendarChanged( int /*index*/ ); Q_SIGNALS: void obligatedFieldsFilled( bool ); void schedulingTypeChanged( int ); void changed(); protected: bool useTime; QList m_calendars; }; class TaskGeneralPanel : public TaskGeneralPanelImpl { Q_OBJECT public: explicit TaskGeneralPanel(Project &project, Task &task, QWidget *parent=0, const char *name=0); MacroCommand *buildCommand(); bool ok(); void setStartValues(Task &task); void hideWbs() { wbsfield->hide(); wbslabel->hide(); } public Q_SLOTS: virtual void estimationTypeChanged(int type); virtual void scheduleTypeChanged(int value); private: Task &m_task; Project &m_project; Duration m_estimate; Duration m_duration; }; } //KPlato namespace #endif // TASKGENERALPANEL_H diff --git a/src/libs/ui/kpttaskprogressdialog.h b/src/libs/ui/kpttaskprogressdialog.h index f5bf9199..c8bc544e 100644 --- a/src/libs/ui/kpttaskprogressdialog.h +++ b/src/libs/ui/kpttaskprogressdialog.h @@ -1,57 +1,57 @@ /* This file is part of the KDE project Copyright (C) 2005-2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation;; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTTASKPROGRESSDIALOG_H #define KPTTASKPROGRESSDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class TaskProgressPanel; class Task; class Node; class StandardWorktime; class ScheduleManager; class MacroCommand; -class KPLATOUI_EXPORT TaskProgressDialog : public KoDialog { +class PLANUI_EXPORT TaskProgressDialog : public KoDialog { Q_OBJECT public: TaskProgressDialog(Task &task, ScheduleManager *sm, StandardWorktime *workTime, QWidget *parent=0); MacroCommand *buildCommand(); protected Q_SLOTS: void slotChanged(); void slotNodeRemoved( Node *node ); private: Node *m_node; TaskProgressPanel *m_panel; }; } //KPlato namespace #endif // TASKPROGRESSDIALOG_H diff --git a/src/libs/ui/kpttaskprogresspanel.h b/src/libs/ui/kpttaskprogresspanel.h index 7439747a..f1f15208 100644 --- a/src/libs/ui/kpttaskprogresspanel.h +++ b/src/libs/ui/kpttaskprogresspanel.h @@ -1,107 +1,107 @@ /* This file is part of the KDE project Copyright (C) 2004 - 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTTASKPROGRESSPANEL_H #define KPTTASKPROGRESSPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kpttaskprogresspanelbase.h" #include "kpttask.h" #include namespace KPlato { class StandardWorktime; class Duration; class ScheduleManager; class MacroCommand; //------------------------ class TaskProgressPanelImpl : public QWidget, public Ui_TaskProgressPanelBase { Q_OBJECT public: explicit TaskProgressPanelImpl( Task &task, QWidget *parent=0 ); void enableWidgets(); void setYear( int year ); Q_SIGNALS: void changed(); public Q_SLOTS: void slotChanged(); void slotEditmodeChanged( int idx ); void slotStartedChanged(bool state); void slotFinishedChanged(bool state); void slotPercentFinishedChanged(int value); void slotStartTimeChanged( const QDateTime &dt ); void slotFinishTimeChanged( const QDateTime &dt ); void slotEntryChanged(); void slotSelectionChanged( const QItemSelection &sel ); void slotPrevWeekBtnClicked(); void slotNextWeekBtnClicked(); protected Q_SLOTS: void slotCalculateEffort(); void slotFillWeekNumbers( int year ); protected: void setFinished(); Task &m_task; Completion &m_original; Completion m_completion; int m_dayLength; Duration scheduledEffort; int m_weekOffset; int m_year; bool m_firstIsPrevYear; bool m_lastIsNextYear; }; -class KPLATOUI_EXPORT TaskProgressPanel : public TaskProgressPanelImpl { +class PLANUI_EXPORT TaskProgressPanel : public TaskProgressPanelImpl { Q_OBJECT public: explicit TaskProgressPanel( Task &task, ScheduleManager *sm, StandardWorktime *workTime=0, QWidget *parent=0 ); MacroCommand *buildCommand(); static MacroCommand *buildCommand( const Project &project, Completion &org, Completion &curr ); protected Q_SLOTS: void slotWeekNumberChanged( int ); void slotAddResource(); void slotEntryAdded( const QDate &date); protected: void setEstimateScales( int day ); }; } //KPlato namespace #endif // TASKPROGRESSPANEL_H diff --git a/src/libs/ui/kpttaskstatusview.h b/src/libs/ui/kpttaskstatusview.h index c5d7fe4a..d1898959 100644 --- a/src/libs/ui/kpttaskstatusview.h +++ b/src/libs/ui/kpttaskstatusview.h @@ -1,501 +1,501 @@ /* This file is part of the KDE project Copyright (C) 2007 - 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef TASKSTATUSVIEW_H #define TASKSTATUSVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptitemmodelbase.h" #include "kptviewbase.h" #include "ui_kpttaskstatusviewsettingspanel.h" #include "kptitemviewsettup.h" #include "ui_kptperformancestatus.h" #include "ui_kptperformancestatusviewsettingspanel.h" #include "kptnodechartmodel.h" #include #include class QItemSelection; class KoDocument; class KoPageLayoutWidget; class PrintingHeaderFooter; namespace KChart { class CartesianCoordinatePlane; class CartesianAxis; class Legend; }; namespace KPlato { class Project; class Node; class ScheduleManager; class TaskStatusItemModel; class NodeItemModel; class PerformanceStatusBase; typedef QList NodeList; -class KPLATOUI_EXPORT TaskStatusTreeView : public DoubleTreeViewBase +class PLANUI_EXPORT TaskStatusTreeView : public DoubleTreeViewBase { Q_OBJECT public: explicit TaskStatusTreeView(QWidget *parent); //void setSelectionModel( QItemSelectionModel *selectionModel ); TaskStatusItemModel *model() const; Project *project() const; void setProject( Project *project ); int defaultWeekday() const { return Qt::Friday; } int weekday() const; void setWeekday( int day ); int defaultPeriod() const { return 7; } int period() const; void setPeriod( int days ); int defaultPeriodType() const; int periodType() const; void setPeriodType( int type ); protected: void dragMoveEvent(QDragMoveEvent *event); }; -class KPLATOUI_EXPORT TaskStatusView : public ViewBase +class PLANUI_EXPORT TaskStatusView : public ViewBase { Q_OBJECT public: TaskStatusView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); virtual void setProject( Project *project ); Project *project() const { return m_view->project(); } using ViewBase::draw; virtual void draw( Project &project ); TaskStatusItemModel *model() const { return m_view->model(); } virtual void updateReadWrite( bool readwrite ); virtual Node *currentNode() const; /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); Q_SIGNALS: void openNode(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); virtual void slotRefreshView(); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotContextMenuRequested( Node *node, const QPoint& pos ); void slotSplitView(); private: Project *m_project; int m_id; TaskStatusTreeView *m_view; QDomDocument m_domdoc; }; //-------------------------------------- class TaskStatusViewSettingsPanel : public QWidget, public Ui::TaskStatusViewSettingsPanel { Q_OBJECT public: explicit TaskStatusViewSettingsPanel( TaskStatusTreeView *view, QWidget *parent = 0 ); public Q_SLOTS: void slotOk(); void setDefault(); Q_SIGNALS: void changed(); private: TaskStatusTreeView *m_view; }; class TaskStatusViewSettingsDialog : public SplitItemViewSettupDialog { Q_OBJECT public: explicit TaskStatusViewSettingsDialog( ViewBase *view, TaskStatusTreeView *treeview, QWidget *parent = 0 ); }; struct PerformanceChartInfo { bool showBarChart; bool showLineChart; bool showTableView; bool showBaseValues; bool showIndices; bool showCost; bool showBCWSCost; bool showBCWPCost; bool showACWPCost; bool showEffort; bool showBCWSEffort; bool showBCWPEffort; bool showACWPEffort; bool showSpiCost; bool showCpiCost; bool showSpiEffort; bool showCpiEffort; bool effortShown() const { return ( showBaseValues && showEffort ) || ( showIndices && ( showSpiEffort || showCpiEffort ) ); } bool costShown() const { return ( showBaseValues && showCost ) || ( showIndices && ( showSpiCost || showCpiCost ) ); } bool bcwsCost() const { return showBaseValues && showCost && showBCWSCost; } bool bcwpCost() const { return showBaseValues && showCost && showBCWPCost; } bool acwpCost() const { return showBaseValues && showCost && showACWPCost; } bool bcwsEffort() const { return showBaseValues && showEffort && showBCWSEffort; } bool bcwpEffort() const { return showBaseValues && showEffort && showBCWPEffort; } bool acwpEffort() const { return showBaseValues && showEffort && showACWPEffort; } bool spiCost() const { return showIndices && showSpiCost; } bool cpiCost() const { return showIndices && showCpiCost; } bool spiEffort() const { return showIndices && showSpiEffort; } bool cpiEffort() const { return showIndices && showCpiEffort; } PerformanceChartInfo() { showBarChart = false; showLineChart = true; showTableView = false; showBaseValues = true; showIndices = false; showCost = showBCWSCost = showBCWPCost = showACWPCost = true; showEffort = showBCWSEffort = showBCWPEffort = showACWPEffort = true; showSpiCost = showCost = showSpiEffort = showCpiEffort = true; } bool operator!=( const PerformanceChartInfo &o ) const { return ! operator==( o ); } bool operator==( const PerformanceChartInfo &o ) const { return showBarChart == o.showBarChart && showLineChart == o.showLineChart && showBaseValues == o.showBaseValues && showIndices == o.showIndices && showCost == o.showCost && showBCWSCost == o.showBCWSCost && showBCWPCost == o.showBCWPCost && showACWPCost == o.showACWPCost && showEffort == o.showEffort && showBCWSEffort == o.showBCWSEffort && showBCWPEffort == o.showBCWPEffort && showACWPEffort == o.showACWPEffort && showSpiCost == o.showSpiCost && showCpiCost == o.showCpiCost && showSpiEffort == o.showSpiEffort && showCpiEffort == o.showCpiEffort; } }; //---------------------------------- -class KPLATOUI_EXPORT PerformanceStatusPrintingDialog : public PrintingDialog +class PLANUI_EXPORT PerformanceStatusPrintingDialog : public PrintingDialog { Q_OBJECT public: PerformanceStatusPrintingDialog( ViewBase *view, PerformanceStatusBase *chart, Project *project = 0 ); ~PerformanceStatusPrintingDialog() {} virtual int documentLastPage() const; virtual QList createOptionWidgets() const; protected: virtual void printPage( int pageNumber, QPainter &painter ); private: PerformanceStatusBase *m_chart; Project *m_project; }; class PerformanceStatusBase : public QWidget, public Ui::PerformanceStatus { Q_OBJECT public: explicit PerformanceStatusBase( QWidget *parent ); void setProject( Project *project ); void setScheduleManager( ScheduleManager *sm ); ChartItemModel *model() const { return const_cast( &m_chartmodel ); } void setupChart(); void setChartInfo( const PerformanceChartInfo &info ); PerformanceChartInfo chartInfo() const { return m_chartinfo; } /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &context ) const; /// Create a print job dialog KoPrintJob *createPrintJob( ViewBase *parent ); void setNodes( const QList &nodes ); public Q_SLOTS: void refreshChart(); protected: void contextMenuEvent( QContextMenuEvent *event ); void createBarChart(); void createLineChart(); void setEffortValuesVisible( bool visible ); void setCostValuesVisible( bool visible ); protected Q_SLOTS: void slotUpdate(); void slotLocaleChanged(); private: struct ChartContents { ~ChartContents() { delete dateaxis; delete effortaxis; delete costaxis; delete effortplane; delete costplane; delete effortdiagram; delete costdiagram; } ChartProxyModel costproxy; ChartProxyModel effortproxy; KChart::CartesianCoordinatePlane *effortplane; KChart::CartesianCoordinatePlane *costplane; KChart::AbstractDiagram *effortdiagram; KChart::AbstractDiagram *costdiagram; KChart::CartesianAxis *effortaxis; KChart::CartesianAxis *costaxis; KChart::CartesianAxis *dateaxis; ChartProxyModel piproxy; KChart::CartesianCoordinatePlane *piplane; KChart::AbstractDiagram *pidiagram; KChart::CartesianAxis *piaxis; }; void setupChart( ChartContents &cc ); private: Project *m_project; ScheduleManager *m_manager; PerformanceChartInfo m_chartinfo; ChartItemModel m_chartmodel; KChart::Legend *m_legend; KChart::BarDiagram m_legenddiagram; struct ChartContents m_barchart; struct ChartContents m_linechart; }; //---------------------------------- -class KPLATOUI_EXPORT ProjectStatusView : public ViewBase +class PLANUI_EXPORT ProjectStatusView : public ViewBase { Q_OBJECT public: ProjectStatusView(KoPart *part, KoDocument *doc, QWidget *parent ); void setupGui(); Project *project() const { return m_project; } virtual void setProject( Project *project ); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; KoPrintJob *createPrintJob(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); protected: void updateActionsEnabled( bool on ); protected Q_SLOTS: virtual void slotOptions(); private: Project *m_project; PerformanceStatusBase *m_view; }; //---------------------------------- class PerformanceStatusTreeView : public QSplitter { Q_OBJECT public: explicit PerformanceStatusTreeView( QWidget *parent ); NodeItemModel *nodeModel() const; Project *project() const; void setProject( Project *project ); void setScheduleManager( ScheduleManager *sm ); /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. virtual void saveContext( QDomElement &context ) const; TreeViewBase *treeView() const { return m_tree; } PerformanceStatusBase *chartView() const { return m_chart; } KoPrintJob *createPrintJob( ViewBase *view ); protected Q_SLOTS: void slotSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); void resizeSplitters(); private: TreeViewBase *m_tree; PerformanceStatusBase *m_chart; ScheduleManager *m_manager; QDomDocument m_domdoc; }; //---------------------------------- -class KPLATOUI_EXPORT PerformanceStatusView : public ViewBase +class PLANUI_EXPORT PerformanceStatusView : public ViewBase { Q_OBJECT public: PerformanceStatusView(KoPart *part, KoDocument *doc, QWidget *parent ); void setupGui(); Project *project() const { return m_view->project(); } virtual void setProject( Project *project ); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &context ) const; Node *currentNode() const; KoPrintJob *createPrintJob(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void setScheduleManager( ScheduleManager *sm ); protected Q_SLOTS: virtual void slotOptions(); protected: void updateActionsEnabled( bool on ); private Q_SLOTS: void slotContextMenuRequested( Node *node, const QPoint& pos ); void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); private: PerformanceStatusTreeView *m_view; }; //-------------------------------------- class PerformanceStatusViewSettingsPanel : public QWidget, public Ui::PerformanceStatusViewSettingsPanel { Q_OBJECT public: explicit PerformanceStatusViewSettingsPanel( PerformanceStatusBase *view, QWidget *parent = 0 ); public Q_SLOTS: void slotOk(); void setDefault(); Q_SIGNALS: void changed(); protected Q_SLOTS: void switchStackWidget(); private: PerformanceStatusBase *m_view; }; class PerformanceStatusViewSettingsDialog : public ItemViewSettupDialog { Q_OBJECT public: explicit PerformanceStatusViewSettingsDialog( PerformanceStatusView *view, PerformanceStatusTreeView *treeview, QWidget *parent = 0, bool selectPrint = false ); }; class ProjectStatusViewSettingsDialog : public KPageDialog { Q_OBJECT public: explicit ProjectStatusViewSettingsDialog( ViewBase *base, PerformanceStatusBase *view, QWidget *parent = 0, bool selectPrint = false ); protected Q_SLOTS: void slotOk(); private: ViewBase *m_base; KoPageLayoutWidget *m_pagelayout; PrintingHeaderFooter *m_headerfooter; }; } //namespace KPlato #endif diff --git a/src/libs/ui/kptusedefforteditor.h b/src/libs/ui/kptusedefforteditor.h index 831d5acc..6559eb4a 100644 --- a/src/libs/ui/kptusedefforteditor.h +++ b/src/libs/ui/kptusedefforteditor.h @@ -1,207 +1,207 @@ /* This file is part of the KDE project Copyright (C) 2007, 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTUSEDEFFORTEDITOR_H #define KPTUSEDEFFORTEDITOR_H -#include "kplatoui_export.h" +#include "planui_export.h" #include #include #include "kpttask.h" namespace KPlato { class Completion; class Resource; class Project; -class KPLATOUI_EXPORT UsedEffortItemModel : public QAbstractItemModel +class PLANUI_EXPORT UsedEffortItemModel : public QAbstractItemModel { Q_OBJECT public: explicit UsedEffortItemModel(QWidget *parent = 0); void setProject( Project *project ) { m_project = project; } virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex &index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; void setCompletion( Completion *completion ); const Resource *resource(const QModelIndex &index ) const; Completion::UsedEffort *usedEffort(const QModelIndex &index ) const; void setCurrentMonday( const QDate &date ); QModelIndex addRow(); QMap freeResources() const; void setReadOnly( bool ro ) { m_readonly = ro; } bool readOnly() const { return m_readonly; } Q_SIGNALS: void rowInserted( const QModelIndex& ); void changed(); public Q_SLOTS: bool submit(); void revert(); private: Project *m_project; Completion *m_completion; QList m_dates; QStringList m_headers; QList m_resourcelist; QMap m_editlist; bool m_readonly; }; -class KPLATOUI_EXPORT UsedEffortEditor : public QTableView +class PLANUI_EXPORT UsedEffortEditor : public QTableView { Q_OBJECT public: explicit UsedEffortEditor(QWidget *parent); void setProject( Project *project ); void setCompletion( Completion *completion ); void setCurrentMonday( const QDate &date ); void addResource(); bool hasFreeResources() const; UsedEffortItemModel *model() const { return static_cast( QTableView::model() ); } Q_SIGNALS: void changed(); void resourceAdded(); private: }; //-------------------------------------------- -class KPLATOUI_EXPORT CompletionEntryItemModel : public QAbstractItemModel +class PLANUI_EXPORT CompletionEntryItemModel : public QAbstractItemModel { Q_OBJECT public: enum Properties { Property_Date, /// Date of entry Property_Completion, /// % Completed Property_UsedEffort, /// Used Effort Property_RemainingEffort, /// Remaining Effort Property_PlannedEffort /// Planned Effort }; explicit CompletionEntryItemModel(QObject *parent = 0); void setTask( Task *t ); virtual Qt::ItemFlags flags( const QModelIndex & index ) const; virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; virtual bool setData( const QModelIndex &index, const QVariant & value, int role = Qt::EditRole ); virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const; virtual int rowCount( const QModelIndex & parent = QModelIndex() ) const; virtual QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const; void setCompletion( Completion *completion ); const Resource *resource(const QModelIndex &index ) const; Completion::UsedEffort *usedEffort(const QModelIndex &index ) const; void setCurrentMonday( const QDate &date ); QModelIndex addRow(); void removeRow( int row ); /// These flags are in addition to flags return from QAbstractItemModel::flags() void setFlags( int col, Qt::ItemFlags flags ) { m_flags[ col ] = flags; } long id() const { return m_manager == 0 ? -1 : m_manager->scheduleId(); } Q_SIGNALS: void rowInserted( const QDate& ); void rowRemoved( const QDate& ); void changed(); public Q_SLOTS: bool submit(); void revert(); void slotDataChanged(); void setManager( ScheduleManager *sm ); protected: QVariant date ( int row, int role = Qt::DisplayRole ) const; QVariant percentFinished ( int row, int role ) const; QVariant remainingEffort ( int row, int role ) const; virtual QVariant actualEffort ( int row, int role ) const; QVariant plannedEffort ( int row, int role ) const; void removeEntry( const QDate& date ); void addEntry( const QDate& date ); void refresh(); QList scales() const; protected: Task *m_node; Project *m_project; ScheduleManager *m_manager; Completion *m_completion; QList m_dates; QStringList m_headers; QList m_datelist; QList m_flags; }; -class KPLATOUI_EXPORT CompletionEntryEditor : public QTableView +class PLANUI_EXPORT CompletionEntryEditor : public QTableView { Q_OBJECT public: explicit CompletionEntryEditor(QWidget *parent); void setCompletion( Completion *completion ); CompletionEntryItemModel *model() const { return static_cast( QTableView::model() ); } void setCompletionModel( CompletionEntryItemModel *m ); Q_SIGNALS: void changed(); void rowInserted( const QDate& ); void rowRemoved( const QDate& ); void selectionChanged( const QItemSelection&, const QItemSelection& ); public Q_SLOTS: void addEntry(); void removeEntry(); private: }; } //KPlato namespace #endif // KPTUSEDEFFORTEDITOR_H diff --git a/src/libs/ui/kptviewbase.h b/src/libs/ui/kptviewbase.h index bbdbd95e..4cd26977 100644 --- a/src/libs/ui/kptviewbase.h +++ b/src/libs/ui/kptviewbase.h @@ -1,683 +1,683 @@ /* This file is part of the KDE project Copyright (C) 2006 -2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPTVIEWBASE_H #define KPTVIEWBASE_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptitemmodelbase.h" #include "ui_kptprintingheaderfooter.h" #include #include #include //#include #include #include #include #include #include #include class QMetaEnum; class QAbstractItemModel; class QDomElement; class QModelIndex; class KoDocument; class KoPrintJob; class KoPart; /// The main namespace namespace KPlato { class Project; class Node; class Resource; class ResourceGroup; class Relation; class Calendar; class ViewBase; class TreeViewBase; class DoubleTreeViewBase; //------------------ -class KPLATOUI_EXPORT DockWidget : public QDockWidget +class PLANUI_EXPORT DockWidget : public QDockWidget { Q_OBJECT public: DockWidget( ViewBase *v, const QString &identity, const QString &title ); void activate( KoMainWindow *mainWindow ); void deactivate( KoMainWindow *mainWindow ); bool shown() const; bool saveXml( QDomElement &context ) const; void loadXml( const KoXmlElement &context ); const ViewBase *view; /// The view this docker belongs to QString id; /// Docker identity Qt::DockWidgetArea location; /// The area the docker should go when visible bool editor; /// Editor dockers will not be shown in read only mode public Q_SLOTS: void setShown( bool show ); void setLocation( Qt::DockWidgetArea area ); private: bool m_shown; /// The dockers visibility when the view is active }; //------------------ -class KPLATOUI_EXPORT PrintingOptions +class PLANUI_EXPORT PrintingOptions { public: PrintingOptions() { headerOptions.group = true; headerOptions.project = Qt::Checked; headerOptions.date = Qt::Checked; headerOptions.manager = Qt::Checked; headerOptions.page = Qt::Checked; footerOptions.group = false; footerOptions.project = Qt::Checked; footerOptions.date = Qt::Checked; footerOptions.manager = Qt::Checked; footerOptions.page = Qt::Checked; } ~PrintingOptions() {} bool loadXml( KoXmlElement &element ); void saveXml( QDomElement &element ) const; struct Data { bool group; Qt::CheckState project; Qt::CheckState date; Qt::CheckState manager; Qt::CheckState page; }; struct Data headerOptions; struct Data footerOptions; }; //------------------ -class KPLATOUI_EXPORT PrintingHeaderFooter : public QWidget, public Ui::PrintingHeaderFooter +class PLANUI_EXPORT PrintingHeaderFooter : public QWidget, public Ui::PrintingHeaderFooter { Q_OBJECT public: explicit PrintingHeaderFooter( const PrintingOptions &opt, QWidget *parent = 0 ); ~PrintingHeaderFooter(); void setOptions( const PrintingOptions &options ); PrintingOptions options() const; Q_SIGNALS: void changed(const PrintingOptions&); protected Q_SLOTS: void slotChanged(); private: PrintingOptions m_options; }; //------------------ -class KPLATOUI_EXPORT PrintingDialog : public KoPrintingDialog +class PLANUI_EXPORT PrintingDialog : public KoPrintingDialog { Q_OBJECT public: explicit PrintingDialog(ViewBase *view); ~PrintingDialog(); virtual QList createOptionWidgets() const; // virtual QList shapesOnPage(int); QRect headerRect() const; QRect footerRect() const; void paintHeaderFooter( QPainter &p, const PrintingOptions &options, int pageNumber, const Project &project ); PrintingOptions printingOptions() const; QWidget *createPageLayoutWidget() const; QAbstractPrintDialog::PrintDialogOptions printDialogOptions() const; Q_SIGNALS: void changed( const PrintingOptions &opt ); void changed(); public Q_SLOTS: void setPrintingOptions( const PrintingOptions &opt); void setPrinterPageLayout( const KoPageLayout &pagelayout ); virtual void startPrinting(RemovePolicy removePolicy = DoNotDelete); protected: virtual void paint( QPainter &p, const PrintingOptions::Data &options, const QRect &rect, int pageNumber, const Project &project ); int headerFooterHeight( const PrintingOptions::Data &options ) const; void drawRect( QPainter &p, const QRect &r, Qt::Edges edges = Qt::LeftEdge | Qt::RightEdge | Qt::BottomEdge ); protected: ViewBase *m_view; PrintingHeaderFooter *m_widget; int m_textheight; }; -class KPLATOUI_EXPORT ViewActionLists +class PLANUI_EXPORT ViewActionLists { public: ViewActionLists() : actionOptions( 0 ) {} virtual ~ViewActionLists() {} /// Returns the list of action lists that shall be plugged/unplugged virtual QStringList actionListNames() const { return m_actionListMap.keys(); } /// Returns the list of actions associated with the action list name virtual QList actionList( const QString &name ) const { return m_actionListMap[name]; } /// Add an action to the specified action list void addAction( const QString &list, QAction *action ) { m_actionListMap[list].append( action ); } virtual QList viewlistActionList() const { return m_viewlistActionList; } void addViewlistAction( QAction *action ) { m_viewlistActionList.append( action ); } QList contextActionList() const { return m_contextActionList; } void addContextAction( QAction *action ) { m_contextActionList.append( action ); } protected: /// List of all menu/toolbar actions (used for plug/unplug) QMap > m_actionListMap; /// List of actions that will be shown in the viewlist context menu QList m_viewlistActionList; /// List of actions that will be shown in the views header context menu QList m_contextActionList; // View options context menu QAction *actionOptions; }; /** ViewBase is the baseclass of all sub-views to View. */ -class KPLATOUI_EXPORT ViewBase : public KoView, public ViewActionLists +class PLANUI_EXPORT ViewBase : public KoView, public ViewActionLists { Q_OBJECT public: enum OptionTypes { OptionExpand = 1, OptionCollapse = 2, OptionPrint = 4, OptionPrintPreview = 8, OptionPrintPdf = 16, OptionPrintConfig = 32, OptionViewConfig = 64, OptionAll = 0xffff }; /// Constructor ViewBase(KoPart *part, KoDocument *doc, QWidget *parent); /// Destructor virtual ~ViewBase(); /// Return the part (document) this view handles KoDocument *part() const; /// Return the page layout used for printing this view virtual KoPageLayout pageLayout() const; /// Return the type of view this is (class name) QString viewType() const { return metaObject()->className(); } /// Returns true if this view or any child widget has focus bool isActive() const; /// Set the project this view shall handle. virtual void setProject( Project *project ); /// Return the project virtual Project *project() const { return m_proj; } /// Return the schedule manager virtual ScheduleManager *scheduleManager() const { return m_schedulemanager; } /// Draw data from current part / project virtual void draw() {} /// Draw data from project. virtual void draw(Project &/*project*/) {} /// Draw changed data from project. virtual void drawChanges(Project &project) { draw(project); } /// Set readWrite mode virtual void updateReadWrite( bool ); bool isReadWrite() const { return m_readWrite; } /// Reimplement if your view handles nodes virtual Node* currentNode() const { return 0; } /// Reimplement if your view handles resources virtual Resource* currentResource() const { return 0; } /// Reimplement if your view handles resource groups virtual ResourceGroup* currentResourceGroup() const { return 0; } /// Reimplement if your view handles calendars virtual Calendar* currentCalendar() const { return 0; } /// Reimplement if your view handles relations virtual Relation *currentRelation() const { return 0; } /// Reimplement if your view handles zoom // virtual KoZoomController *zoomController() const { return 0; } /// Loads context info (printer settings) into this view. virtual bool loadContext( const KoXmlElement &context ); /// Save context info (printer settings) from this view. virtual void saveContext( QDomElement &context ) const; virtual KoPrintJob *createPrintJob(); PrintingOptions printingOptions() const { return m_printingOptions; } static QWidget *createPageLayoutWidget( ViewBase *view ); static PrintingHeaderFooter *createHeaderFooterWidget( ViewBase *view ); void addAction( const QString &list, QAction *action ) { ViewActionLists::addAction( list, action ); } virtual void createDockers() {} void addDocker( DockWidget *ds ); QList dockers() const; DockWidget *findDocker( const QString &id ) const; public Q_SLOTS: void setPrintingOptions( const PrintingOptions &opt ) { m_printingOptions = opt; } /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); virtual void setScheduleManager( ScheduleManager *sm ) { m_schedulemanager = sm; } void slotUpdateReadWrite( bool ); virtual void slotHeaderContextMenuRequested( const QPoint &pos ); virtual void slotEditCopy() {} virtual void slotEditCut() {} virtual void slotEditPaste() {} virtual void slotRefreshView() {} void setPageLayout( const KoPageLayout &layout ); Q_SIGNALS: /// Emitted when the gui has been activated or deactivated void guiActivated( ViewBase*, bool ); /// Request for a context menu popup void requestPopupMenu( const QString&, const QPoint & ); /// Emitted when options are modified void optionsModified(); void projectChanged( Project *project ); void readWriteChanged( bool ); void expandAll(); void collapseAll(); void openDocument(const QUrl &url); protected Q_SLOTS: virtual void slotOptions() {} virtual void slotOptionsFinished( int result ); protected: void createOptionActions(int actions); bool m_readWrite; PrintingOptions m_printingOptions; Project *m_proj; ScheduleManager *m_schedulemanager; KoPageLayout m_pagelayout; QList m_dockers; }; //------------------ -class KPLATOUI_EXPORT TreeViewPrintingDialog : public PrintingDialog +class PLANUI_EXPORT TreeViewPrintingDialog : public PrintingDialog { Q_OBJECT public: TreeViewPrintingDialog( ViewBase *view, TreeViewBase *treeview, Project *project = 0 ); ~TreeViewPrintingDialog() {} virtual int documentFirstPage() const { return 1; } virtual int documentLastPage() const; QList createOptionWidgets() const; protected: virtual void printPage( int pageNumber, QPainter &painter ); int firstRow( int page ) const; private: TreeViewBase *m_tree; Project *m_project; int m_firstRow; }; //----------------- -class KPLATOUI_EXPORT TreeViewBase : public QTreeView +class PLANUI_EXPORT TreeViewBase : public QTreeView { Q_OBJECT public: explicit TreeViewBase( QWidget *parent = 0 ); void setReadWrite( bool rw ); virtual void createItemDelegates( ItemModelBase *model ); void setArrowKeyNavigation( bool on ) { m_arrowKeyNavigation = on; } bool arrowKeyNavigation() const { return m_arrowKeyNavigation; } /// Move move to first visual QModelIndex firstColumn( int row, const QModelIndex &parent ); /// Move move to last visual QModelIndex lastColumn( int row, const QModelIndex &parent ); /// Move from @p current to next item QModelIndex nextColumn( const QModelIndex ¤t ); /// Move from @p current to next item QModelIndex previousColumn( const QModelIndex ¤t ); /// Move to first editable index in @p row with @p parent QModelIndex firstEditable( int row, const QModelIndex &parent ); /// Move to last editable index in @p row with @p parent QModelIndex lastEditable( int row, const QModelIndex &parent ); void setAcceptDropsOnView( bool mode ) { m_acceptDropsOnView = mode; } virtual void setModel( QAbstractItemModel *model ); virtual void setSelectionModel( QItemSelectionModel *model ); void setStretchLastSection( bool ); void mapToSection( int column, int section ); int section( int col ) const; void setColumnsHidden( const QList &list ); /// Loads context info into this view. Reimplement. virtual bool loadContext(const QMetaEnum &map, const KoXmlElement &element, bool expand = true); /// Save context info from this view. Reimplement. virtual void saveContext(const QMetaEnum &map, QDomElement &context , bool expand = true) const; /** Reimplemented to fix qt bug 160083: Doesn't scroll horizontally. Scroll the contents of the tree view until the given model item \a index is visible. The \a hint parameter specifies more precisely where the item should be located after the operation. If any of the parents of the model item are collapsed, they will be expanded to ensure that the model item is visible. */ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); void setDefaultColumns( const QList &lst ) { m_defaultColumns = lst; } QList defaultColumns() const { return m_defaultColumns; } KoPrintJob *createPrintJob( ViewBase *parent ); QModelIndex firstVisibleIndex( const QModelIndex &idx ) const; ItemModelBase *itemModel() const; void setContextMenuIndex(const QModelIndex &idx); void loadExpanded(const KoXmlElement &element); void saveExpanded(QDomElement &element, const QModelIndex &parent = QModelIndex()) const; void expandRecursivly(QDomElement element, const QModelIndex &parent = QModelIndex()); void doExpand(QDomDocument &doc); public Q_SLOTS: void slotExpand(); void slotCollapse(); Q_SIGNALS: /// Context menu requested from viewport at global position @p pos void contextMenuRequested( const QModelIndex&, const QPoint &pos, const QModelIndexList& ); /// Context menu requested from header at global position @p pos void headerContextMenuRequested( const QPoint &pos ); void moveAfterLastColumn( const QModelIndex & ); void moveBeforeFirstColumn( const QModelIndex & ); void editAfterLastColumn( const QModelIndex & ); void editBeforeFirstColumn( const QModelIndex & ); void dropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); protected: void keyPressEvent(QKeyEvent *event); void mousePressEvent( QMouseEvent *event ); /** Reimplemented from QTreeView to make tab/backtab in editor work reasonably well. Move the cursor in the way described by \a cursorAction, *not* using the information provided by the button \a modifiers. */ QModelIndex moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers ); /// Move cursor from @p index in direction @p cursorAction. @p modifiers is not used. QModelIndex moveCursor( const QModelIndex &index, CursorAction cursorAction, Qt::KeyboardModifiers = Qt::NoModifier ); /// Move from @p index to next editable item, in direction @p cursorAction. QModelIndex moveToEditable( const QModelIndex &index, CursorAction cursorAction ); void contextMenuEvent ( QContextMenuEvent * event ); void dragMoveEvent(QDragMoveEvent *event); void dropEvent( QDropEvent *e ); void updateSelection( const QModelIndex &oldidx, const QModelIndex &newidx, QKeyEvent *event ); void expandRecursive(const QModelIndex &parent, bool xpand); protected Q_SLOTS: /// Close the @p editor, using sender()->endEditHint(). /// Use @p hint if sender is not of type ItemDelegate. virtual void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint); virtual void slotCurrentChanged ( const QModelIndex & current, const QModelIndex & previous ); void slotHeaderContextMenuRequested( const QPoint& ); //Copied from QAbstractItemView inline QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const { switch (selectionBehavior()) { case QAbstractItemView::SelectRows: return QItemSelectionModel::Rows; case QAbstractItemView::SelectColumns: return QItemSelectionModel::Columns; case QAbstractItemView::SelectItems: default: return QItemSelectionModel::NoUpdate; } } void doContextExpanded(); void doExpanded(); protected: virtual void focusInEvent(QFocusEvent *event); bool m_arrowKeyNavigation; bool m_acceptDropsOnView; QList m_hideList; bool m_readWrite; QList m_defaultColumns; QPersistentModelIndex m_contextMenuIndex; QDomDocument m_loadContextDoc; QDomDocument m_expandDoc; }; //------------------ -class KPLATOUI_EXPORT DoubleTreeViewPrintingDialog : public PrintingDialog +class PLANUI_EXPORT DoubleTreeViewPrintingDialog : public PrintingDialog { Q_OBJECT public: DoubleTreeViewPrintingDialog( ViewBase *view, DoubleTreeViewBase *treeview, Project *project ); ~DoubleTreeViewPrintingDialog() {} virtual int documentFirstPage() const { return 1; } virtual int documentLastPage() const; QList createOptionWidgets() const; protected: virtual void printPage( int pageNumber, QPainter &painter ); int firstRow( int page ) const; private: DoubleTreeViewBase *m_tree; Project *m_project; int m_firstRow; }; -class KPLATOUI_EXPORT DoubleTreeViewBase : public QSplitter +class PLANUI_EXPORT DoubleTreeViewBase : public QSplitter { Q_OBJECT public: explicit DoubleTreeViewBase( QWidget *parent ); DoubleTreeViewBase( bool mode, QWidget *parent ); ~DoubleTreeViewBase(); void setReadWrite( bool rw ); void closePersistentEditor( const QModelIndex &index ); void setModel( QAbstractItemModel *model ); QAbstractItemModel *model() const; void setArrowKeyNavigation( bool on ) { m_arrowKeyNavigation = on; } bool arrowKeyNavigation() const { return m_arrowKeyNavigation; } QItemSelectionModel *selectionModel() const { return m_selectionmodel; } void setSelectionModel( QItemSelectionModel *model ); void setSelectionMode( QAbstractItemView::SelectionMode mode ); void setSelectionBehavior( QAbstractItemView::SelectionBehavior mode ); virtual void createItemDelegates( ItemModelBase *model ); void setItemDelegateForColumn( int col, QAbstractItemDelegate * delegate ); void setEditTriggers ( QAbstractItemView::EditTriggers ); QAbstractItemView::EditTriggers editTriggers() const; void setAcceptDrops( bool ); void setAcceptDropsOnView( bool ); void setDropIndicatorShown( bool ); void setDragDropMode( QAbstractItemView::DragDropMode mode ); void setDragDropOverwriteMode( bool mode ); void setDragEnabled ( bool mode ); void setDefaultDropAction( Qt::DropAction action ); void setStretchLastSection( bool ); /// Hide columns in the @p hideList, show all other columns. /// If the hideList.last() == -1, the rest of the columns are hidden. void hideColumns( TreeViewBase *view, const QList &hideList ); void hideColumns( const QList &masterList, const QList &slaveList = QList() ); void hideColumn( int col ) { m_leftview->hideColumn( col ); if ( m_rightview ) m_rightview->hideColumn( col ); } void showColumn( int col ) { if ( col == 0 || m_rightview == 0 ) m_leftview->showColumn( col ); else m_rightview->showColumn( col ); } bool isColumnHidden( int col ) const { return m_rightview ? m_rightview->isColumnHidden( col ) : m_leftview->isColumnHidden( col ); } TreeViewBase *masterView() const { return m_leftview; } TreeViewBase *slaveView() const { return m_rightview; } /// Loads context info into this view. Reimplement. virtual bool loadContext( const QMetaEnum &map, const KoXmlElement &element ); /// Save context info from this view. Reimplement. virtual void saveContext( const QMetaEnum &map, QDomElement &context ) const; void setViewSplitMode( bool split ); bool isViewSplit() const { return m_mode; } QAction *actionSplitView() const { return m_actionSplitView; } void setRootIsDecorated ( bool show ); KoPrintJob *createPrintJob( ViewBase *parent ); void setStretchFactors(); QModelIndex indexAt( const QPoint &pos ) const; void setParentsExpanded( const QModelIndex &idx, bool expanded ); void setSortingEnabled( bool on ) { m_leftview->setSortingEnabled( on ); m_rightview->setSortingEnabled( on ); } void sortByColumn( int col, Qt::SortOrder order = Qt::AscendingOrder ) { if ( ! m_leftview->isColumnHidden( col ) || ! m_rightview->isVisible() || m_rightview->isColumnHidden( col ) ) { m_leftview->sortByColumn( col, order ); } else { m_rightview->sortByColumn( col, order ); } } void setContextMenuIndex(const QModelIndex &idx); Q_SIGNALS: /// Context menu requested from the viewport, pointer over @p index at global position @p pos void contextMenuRequested( const QModelIndex &index, const QPoint& pos, const QModelIndexList& ); /// Context menu requested from master- or slave header at global position @p pos void headerContextMenuRequested( const QPoint &pos ); /// Context menu requested from master header at global position @p pos void masterHeaderContextMenuRequested( const QPoint &pos ); /// Context menu requested from slave header at global position @p pos void slaveHeaderContextMenuRequested( const QPoint &pos ); void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); void selectionChanged( const QModelIndexList& ); void dropAllowed( const QModelIndex &index, int dropIndicatorPosition, QDragMoveEvent *event ); public Q_SLOTS: void edit( const QModelIndex &index ); void slotExpand(); void slotCollapse(); protected Q_SLOTS: void slotSelectionChanged( const QItemSelection &sel, const QItemSelection & ); void slotToRightView( const QModelIndex &index ); void slotToLeftView( const QModelIndex &index ); void slotEditToRightView( const QModelIndex &index ); void slotEditToLeftView( const QModelIndex &index ); void slotRightHeaderContextMenuRequested( const QPoint &pos ); void slotLeftHeaderContextMenuRequested( const QPoint &pos ); void slotLeftSortIndicatorChanged( int logicalIndex, Qt::SortOrder order ); void slotRightSortIndicatorChanged( int logicalIndex, Qt::SortOrder order ); protected: void init(); QList expandColumnList( const QList &lst ) const; protected: TreeViewBase *m_leftview; TreeViewBase *m_rightview; QItemSelectionModel *m_selectionmodel; bool m_arrowKeyNavigation; bool m_readWrite; bool m_mode; QAction *m_actionSplitView; }; } // namespace KPlato #endif diff --git a/src/libs/ui/kptwbsdefinitiondialog.h b/src/libs/ui/kptwbsdefinitiondialog.h index 75d974e8..9a2b272a 100644 --- a/src/libs/ui/kptwbsdefinitiondialog.h +++ b/src/libs/ui/kptwbsdefinitiondialog.h @@ -1,52 +1,52 @@ /* This file is part of the KDE project Copyright (C) 2005 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTWBSDEFINITIONDIALOG_H #define KPTWBSDEFINITIONDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include class KUndo2Command; namespace KPlato { class WBSDefinitionPanel; class WBSDefinition; class Project; -class KPLATOUI_EXPORT WBSDefinitionDialog : public KoDialog { +class PLANUI_EXPORT WBSDefinitionDialog : public KoDialog { Q_OBJECT public: explicit WBSDefinitionDialog(Project &project, WBSDefinition &def, QWidget *parent=0); KUndo2Command *buildCommand(); protected Q_SLOTS: void slotOk(); private: WBSDefinitionPanel *m_panel; }; } //KPlato namespace #endif // WBSDEFINITIONDIALOG_H diff --git a/src/libs/ui/kptwbsdefinitionpanel.h b/src/libs/ui/kptwbsdefinitionpanel.h index d9a883a5..7bc98e86 100644 --- a/src/libs/ui/kptwbsdefinitionpanel.h +++ b/src/libs/ui/kptwbsdefinitionpanel.h @@ -1,86 +1,86 @@ /* This file is part of the KDE project Copyright (C) 2005-2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTWBSDEFINITIONPANEL_H #define KPTWBSDEFINITIONPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptwbsdefinitionpanelbase.h" #include #include class KUndo2Command; namespace KPlato { class WBSDefinition; class Project; class ComboBoxDelegate : public QStyledItemDelegate { Q_OBJECT public: explicit ComboBoxDelegate(QStringList &list, QObject *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; void setEditorData(QWidget *editor, const QModelIndex &index) const; void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const; void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const; private: QStringList m_list; }; //--------------- class WBSDefinitionPanel : public QWidget, public Ui_WBSDefinitionPanelBase { Q_OBJECT public: explicit WBSDefinitionPanel( Project &project, WBSDefinition &def, QWidget *parent=0, const char *name=0); KUndo2Command *buildCommand(); bool ok(); void setStartValues(); Q_SIGNALS: void changed(bool enable); protected Q_SLOTS: void slotChanged(); void slotSelectionChanged(); void slotRemoveBtnClicked(); void slotAddBtnClicked(); void slotLevelChanged(int); void slotLevelsGroupToggled(bool on); private: Project &m_project; WBSDefinition &m_def; int selectedRow; }; } //KPlato namespace #endif // WBSDEFINITIONPANEL_H diff --git a/src/libs/ui/kptworkpackagemergedialog.h b/src/libs/ui/kptworkpackagemergedialog.h index 24494f46..8851f998 100644 --- a/src/libs/ui/kptworkpackagemergedialog.h +++ b/src/libs/ui/kptworkpackagemergedialog.h @@ -1,88 +1,88 @@ /* This file is part of the KDE project Copyright (C) 2011 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef WORKPACKAGEMERGEDIALOG_H #define WORKPACKAGEMERGEDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptworkpackagemergepanel.h" #include #include #include #include class KExtendableItemDelegate; class QStandardItemModel; namespace KPlato { class Package; class PackageInfoWidget : public QFrame { Q_OBJECT public: explicit PackageInfoWidget( Package *package, QWidget *parent = 0 ); protected Q_SLOTS: void slotUsedEffortChanged( int state ); void slotProgressChanged( int state ); void slotDocumentsChanged( int state ); protected: Package *m_package; }; class WorkPackageMergePanel : public QWidget, public Ui::WorkPackageMergePanel { Q_OBJECT public: explicit WorkPackageMergePanel(QWidget *parent = 0); }; -class KPLATOUI_EXPORT WorkPackageMergeDialog : public KoDialog +class PLANUI_EXPORT WorkPackageMergeDialog : public KoDialog { Q_OBJECT public: enum Columns { CheckColumn = 0, TaskNameColumn, OwnerNameColumn, DateTimeColumn }; WorkPackageMergeDialog( const QString &text, const QMap &list, QWidget *parent = 0 ); ~WorkPackageMergeDialog(); QList checkedList() const; protected Q_SLOTS: void slotActivated( const QModelIndex &idx ); void slotChanged(); private: WorkPackageMergePanel panel; KExtendableItemDelegate *m_delegate; QList m_packages; QStandardItemModel *m_model; }; } // namespace KPlato #endif diff --git a/src/libs/ui/kptworkpackagesenddialog.h b/src/libs/ui/kptworkpackagesenddialog.h index 0437ea9e..a93b00ae 100644 --- a/src/libs/ui/kptworkpackagesenddialog.h +++ b/src/libs/ui/kptworkpackagesenddialog.h @@ -1,49 +1,49 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTWORKPACKAGESENDDIALOG_H #define KPTWORKPACKAGESENDDIALOG_H -#include "kplatoui_export.h" +#include "planui_export.h" #include namespace KPlato { class WorkPackageSendPanel; class Node; class ScheduleManager; -class KPLATOUI_EXPORT WorkPackageSendDialog : public KoDialog +class PLANUI_EXPORT WorkPackageSendDialog : public KoDialog { Q_OBJECT public: explicit WorkPackageSendDialog( const QList &tasks, ScheduleManager *sm, QWidget *parent=0); WorkPackageSendPanel *panel() const { return m_wp; } private: WorkPackageSendPanel *m_wp; }; } //KPlato namespace #endif // KPTWORKPACKAGESENDDIALOG_H diff --git a/src/libs/ui/kptworkpackagesendpanel.h b/src/libs/ui/kptworkpackagesendpanel.h index 9919875b..47ceaaee 100644 --- a/src/libs/ui/kptworkpackagesendpanel.h +++ b/src/libs/ui/kptworkpackagesendpanel.h @@ -1,58 +1,58 @@ /* This file is part of the KDE project Copyright (C) 2007 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPTWORKPACKAGESENDPANEL_H #define KPTWORKPACKAGESENDPANEL_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_kptworkpackagesendpanel.h" #include #include class QPushButton; namespace KPlato { class Resource; class Node; class ScheduleManager; -class KPLATOUI_EXPORT WorkPackageSendPanel : public QWidget, public Ui_WorkPackageSendPanel +class PLANUI_EXPORT WorkPackageSendPanel : public QWidget, public Ui_WorkPackageSendPanel { Q_OBJECT public: explicit WorkPackageSendPanel( const QList &tasks, ScheduleManager *sm, QWidget *parent=0 ); Q_SIGNALS: void sendWorkpackages( const QList&, Resource* ); protected Q_SLOTS: void slotSendClicked(); protected: QMap > m_resMap; QMap m_pbMap; }; } //KPlato namespace #endif // KPTWORKPACKAGESENDPANEL_H diff --git a/src/libs/ui/locale/localemon.h b/src/libs/ui/locale/localemon.h index a4428cbc..a390687e 100644 --- a/src/libs/ui/locale/localemon.h +++ b/src/libs/ui/locale/localemon.h @@ -1,81 +1,81 @@ /* * localemon.h * * Copyright (c) 1999-2003 Hans Petter Bieker * Copyright (c) 2007 Dag Andersen * Copyright (C) 2016 Dag Andersen * * Requires the Qt widget libraries, available at no cost at * http://www.troll.no/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPLATO_LOCALEMON_H #define KPLATO_LOCALEMON_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_localemon.h" namespace KPlato { class MacroCommand; class Locale; -class KPLATOUI_EXPORT LocaleConfigMoney : public QWidget, Ui::LocaleConfigMoney +class PLANUI_EXPORT LocaleConfigMoney : public QWidget, Ui::LocaleConfigMoney { Q_OBJECT public: LocaleConfigMoney(Locale *locale, QWidget *parent); virtual ~LocaleConfigMoney(); /// Save all changes MacroCommand *buildCommand(); public Q_SLOTS: /** * Loads all settings from the current locale into the current widget. */ void slotLocaleChanged(); /** * Retranslate all objects owned by this object using the current locale. */ void slotTranslate(); Q_SIGNALS: void localeChanged(); private Q_SLOTS: // Money void slotMonCurSymChanged(const QString &t); /* void slotMonDecSymChanged(const QString &t); void slotMonThoSepChanged(const QString &t);*/ void slotMonFraDigChanged(int value); void slotMonPosPreCurSymChanged(); void slotMonNegPreCurSymChanged(); void slotMonPosMonSignPosChanged(int i); void slotMonNegMonSignPosChanged(int i); // void slotMonDigSetChanged(int i); private: Locale *m_locale; }; } // namespace KPlato #endif // LOCALEMON_H diff --git a/src/libs/ui/projectsettings/ProjectSettingsView.h b/src/libs/ui/projectsettings/ProjectSettingsView.h index 67b66b90..90fd5684 100644 --- a/src/libs/ui/projectsettings/ProjectSettingsView.h +++ b/src/libs/ui/projectsettings/ProjectSettingsView.h @@ -1,78 +1,78 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PROJECTSETTINGSVIEW_H #define PROJECTSETTINGSVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_ProjectSettingsView.h" #include "kptviewbase.h" class KoDocument; class QUrl; class QPoint; namespace KPlato { -class KPLATOUI_EXPORT ProjectSettingsView : public ViewBase +class PLANUI_EXPORT ProjectSettingsView : public ViewBase { Q_OBJECT public: ProjectSettingsView(KoPart *part, KoDocument *doc, QWidget *parent); bool openHtml( const QUrl &url ); void setupGui(); virtual void updateReadWrite( bool readwrite ); KoPrintJob *createPrintJob(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); Q_SIGNALS: void connectResources(const QString &file); protected: void updateActionsEnabled( bool on = true ); private Q_SLOTS: void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos ); void slotEnableActions( bool on ); void slotOpenResourcesFile(); void slotResourcesConnect(); private: Ui::ProjectSettingsView widget; }; } //KPlato namespace #endif diff --git a/src/libs/ui/projectview/ProjectView.h b/src/libs/ui/projectview/ProjectView.h index 4f8850ab..cdafa17a 100644 --- a/src/libs/ui/projectview/ProjectView.h +++ b/src/libs/ui/projectview/ProjectView.h @@ -1,84 +1,84 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef PROJECTVIEW_H #define PROJECTVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptglobal.h" #include "kptviewbase.h" class KoDocument; class KActionMenu; class QWidget; class QTableView; namespace KPlato { -class KPLATOUI_EXPORT ProjectView : public ViewBase +class PLANUI_EXPORT ProjectView : public ViewBase { Q_OBJECT public: ProjectView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); protected: void updateActionsEnabled( bool on ); int selectedRowCount() const; QModelIndexList selectedRows() const; bool createConnection(); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotSelectionChanged(); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested(const QPoint &pos); void slotEnableActions(); private: QTableView *m_view; }; } //namespace KPlato #endif diff --git a/src/libs/ui/reports/reportdata.cpp b/src/libs/ui/reports/reportdata.cpp index 084f589b..6e093b45 100644 --- a/src/libs/ui/reports/reportdata.cpp +++ b/src/libs/ui/reports/reportdata.cpp @@ -1,1061 +1,1061 @@ /* * KPlato Report Plugin * Copyright (C) 2007-2009 by Adam Pigg (adam@piggz.co.uk) * Copyright (C) 2010 by Dag Andersen * Copyright (C) 2016 by Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "reportdata.h" #include "kptproject.h" #include "kptschedule.h" #include "kptnodeitemmodel.h" #include "kptflatproxymodel.h" #include "kpttaskstatusmodel.h" #include "kptnodechartmodel.h" #include "kptaccountsmodel.h" #include "kptresourcemodel.h" #include "kptresourceallocationmodel.h" #include "kptresourceappointmentsmodel.h" #include #include #include #include extern int planDbg(); namespace KPlato { -KPLATOUI_EXPORT QList Report::createBaseReportDataModels( QObject *parent ) +PLANUI_EXPORT QList Report::createBaseReportDataModels( QObject *parent ) { QList lst; ReportData *data = new TaskReportData( parent ); lst << data; data = new TaskStatusReportData( parent ); lst << data; data = new ResourceAssignmentReportData( parent ); lst << data; data = new ResourceReportData( parent ); lst << data; data = new CostPerformanceReportData( parent ); lst << data; data = new EffortPerformanceReportData( parent ); lst << data; data = new CostBreakdownReportData( parent ); lst << data; data = new ProjectReportData( parent ); lst << data; foreach ( ReportData *r, lst ) { QList sub; foreach ( ReportData *d, lst ) { if ( d->isSubDataSource() ) { sub << d; } } r->setSubDataSources( sub ); } return lst; } -KPLATOUI_EXPORT ReportData *Report::findReportData( const QList &lst, const QString &type ) +PLANUI_EXPORT ReportData *Report::findReportData( const QList &lst, const QString &type ) { foreach( ReportData *r, lst ) { if ( r->objectName() == type ) { return r; } } return 0; } //------------------ ReportData::ReportData( QObject *parent ) : QObject( parent ), m_row( 0 ), m_project( 0 ), m_schedulemanager( 0 ), m_maindatasource( false ), m_subdatasource( false ) { } ReportData::ReportData( const ReportData &other ) : QObject(), m_project( 0 ), m_schedulemanager( 0 ) { setObjectName( other.objectName() ); m_name = other.m_name; m_columnroles = other.m_columnroles; m_sortlist = other.m_sortlist; m_maindatasource = other.m_maindatasource; m_subdatasource = other.m_subdatasource; m_subdatasources = other.m_subdatasources; } ReportData::~ReportData() { } void ReportData::setColumnRole( int column, int role ) { m_columnroles[ column ] = role; } bool ReportData::open() { close(); ItemModelBase *basemodel = itemModel(); if ( basemodel ) { basemodel->setProject( m_project ); basemodel->setScheduleManager( m_schedulemanager ); } else errorPlan<<"No item model"; if ( ! m_sortlist.isEmpty() ) { QAbstractItemModel *sourcemodel = m_model.sourceModel(); foreach ( const SortedField &sort, m_sortlist ) { int col = fieldNumber( sort.field ); QSortFilterProxyModel *sf = new QSortFilterProxyModel( &m_model ); sf->setSourceModel( sourcemodel ); if ( basemodel ) { sf->setSortRole( basemodel->sortRole( col ) ); } sf->sort( col, sort.order ); sourcemodel = sf; m_sortmodels << sf; } m_model.setSourceModel( sourcemodel ); } return true; } bool ReportData::close() { while ( ! m_sortmodels.isEmpty() ) { QAbstractProxyModel *m = qobject_cast( m_sortmodels.takeLast() ); for ( QAbstractProxyModel *p = &m_model; p != 0; p = qobject_cast( p->sourceModel() ) ) { if ( p->sourceModel() == m ) { p->setSourceModel( m->sourceModel() ); delete m; break; } } } ItemModelBase *basemodel = itemModel(); if ( basemodel ) { basemodel->setScheduleManager( 0 ); basemodel->setProject( 0 ); } return true; } QString ReportData::sourceName() const { return m_name; } int ReportData::fieldNumber ( const QString &fld ) const { QStringList names = fieldKeys(); int idx = names.indexOf( fld ); return idx; } QStringList ReportData::fieldNames() const { QStringList names; int count = m_model.columnCount(); for ( int i = 0; i < count; ++i ) { names << m_model.headerData( i, Qt::Horizontal ).toString(); } return names; } QStringList ReportData::fieldKeys() const { QStringList keys; int count = m_model.columnCount(); for ( int i = 0; i < count; ++i ) { keys << m_model.headerData( i, Qt::Horizontal, Role::ColumnTag ).toString(); } return keys; } QVariant ReportData::value ( unsigned int i ) const { debugPlan<value(fld); } if ( m_model.rowCount() == 0 ) { return QVariant(); } int i = fieldNumber ( fld ); return value( i ); } bool ReportData::moveNext() { if ( m_model.rowCount() <= m_row + 1 ) { return false; } ++m_row; return true; } bool ReportData::movePrevious() { if ( m_row <= 0 ) { return false; } --m_row; return true; } bool ReportData::moveFirst() { if ( m_model.rowCount() == 0 ) { return false; } m_row = 0; return true; } bool ReportData::moveLast() { if ( m_model.rowCount() == 0 ) { return false; } m_row = m_model.rowCount() - 1; return true; } qint64 ReportData::at() const { return m_row; } qint64 ReportData::recordCount() const { return m_model.rowCount(); } QStringList ReportData::dataSources() const { QStringList lst; foreach ( ReportData *r, m_subdatasources ) { if ( r->isSubDataSource() ) { lst << r->objectName(); } } return lst; } QStringList ReportData::dataSourceNames() const { QStringList lst; foreach ( ReportData *r, m_subdatasources ) { if ( r->isSubDataSource() ) { lst << r->sourceName(); } } return lst; } void ReportData::setSorting(const QList& lst ) { m_sortlist = lst; } KReportData* ReportData::data(const QString &source) { ReportData *r = Report::findReportData( m_subdatasources, source ); if ( r ) { r = r->clone(); r->setParent( this ); r->setProject( m_project ); r->setScheduleManager( m_schedulemanager ); } debugPlan<( &m_model ); } ItemModelBase *ReportData::itemModel() const { QAbstractItemModel *m = m_model.sourceModel(); QAbstractProxyModel *p = 0; do { p = qobject_cast( m ); if ( p ) { m = p->sourceModel(); } } while ( p ); return qobject_cast( m ); } void ReportData::setProject( Project *project ) { m_project = project; } void ReportData::setScheduleManager( ScheduleManager *sm ) { m_schedulemanager = sm; } ReportData *ReportData::getReportData(const QString &tag) const { if (tag == "project") { if (!m_datasources.contains(tag)) { ReportData *r = new ProjectReportData(); r->setParent( const_cast(this) ); r->setProject( m_project ); r->setScheduleManager( m_schedulemanager ); m_datasources[tag] = r; } debugPlan<setFilterKeyColumn( NodeModel::NodeType ); sf->setFilterRole( Qt::EditRole ); sf->setFilterRegExp( rex ); sf->setDynamicSortFilter( true ); FlatProxyModel *fm = new FlatProxyModel( sf ); sf->setSourceModel( fm ); NodeItemModel *m = new NodeItemModel( fm ); fm->setSourceModel( m ); } //--------------------------- TaskStatusReportData::TaskStatusReportData( QObject *parent ) : ReportData( parent ) { m_maindatasource = true; m_subdatasource = false; setObjectName( "taskstatus" ); m_name = i18n( "Task status" ); setColumnRole( NodeModel::NodeDescription, Qt::EditRole ); createModels(); } TaskStatusReportData::TaskStatusReportData( const TaskStatusReportData &other ) : ReportData( other ) { createModels(); } bool TaskStatusReportData::loadXml( const KoXmlElement &element ) { Q_UNUSED(element); return true; } void TaskStatusReportData::saveXml( QDomElement &element ) const { Q_UNUSED(element); } ReportData *TaskStatusReportData::clone() const { return new TaskStatusReportData( *this ); } void TaskStatusReportData::createModels() { QRegExp rex( QString( "^(%1|%2)$" ).arg( (int)Node::Type_Task ).arg( (int)Node::Type_Milestone ) ); QSortFilterProxyModel *sf = new QSortFilterProxyModel( &m_model ); m_model.setSourceModel( sf ); sf->setFilterKeyColumn( NodeModel::NodeType ); sf->setFilterRole( Qt::EditRole ); sf->setFilterRegExp( rex ); sf->setDynamicSortFilter( true ); FlatProxyModel *fm = new FlatProxyModel( sf ); sf->setSourceModel( fm ); TaskStatusItemModel *m = new TaskStatusItemModel( fm ); fm->setSourceModel( m ); } //--------------------------- ResourceReportData::ResourceReportData( QObject *parent ) : ReportData( parent ) { m_maindatasource = true; m_subdatasource = false; setObjectName( "resources" ); m_name = i18n( "Resources" ); createModels(); } ResourceReportData::ResourceReportData( const ResourceReportData &other ) : ReportData( other ) { createModels(); } bool ResourceReportData::loadXml( const KoXmlElement &element ) { Q_UNUSED(element); return true; } void ResourceReportData::saveXml( QDomElement &element ) const { Q_UNUSED(element); } ReportData *ResourceReportData::clone() const { return new ResourceReportData( *this ); } void ResourceReportData::createModels() { ItemModelBase *m = 0; QRegExp rex( QString( "^(%1)$" ).arg( (int)OT_Resource ) ); QSortFilterProxyModel *sf = new QSortFilterProxyModel( &m_model ); m_model.setSourceModel( sf ); sf->setFilterKeyColumn( 0 ); sf->setFilterRole( Role::ObjectType ); sf->setFilterRegExp( rex ); sf->setDynamicSortFilter( true ); FlatProxyModel *fm = new FlatProxyModel( sf ); sf->setSourceModel( fm ); m = new ResourceItemModel( fm ); fm->setSourceModel( m ); } //--------------------------- ResourceAssignmentReportData::ResourceAssignmentReportData( QObject *parent ) : ReportData( parent ) { m_maindatasource = true; m_subdatasource = false; setObjectName( "resourceassignments" ); m_name = i18n( "Resource assignments" ); createModels(); } ResourceAssignmentReportData::ResourceAssignmentReportData( const ResourceAssignmentReportData &other ) : ReportData( other ) { createModels(); } bool ResourceAssignmentReportData::loadXml( const KoXmlElement &element ) { Q_UNUSED(element); return true; } void ResourceAssignmentReportData::saveXml( QDomElement &element ) const { Q_UNUSED(element); } ReportData *ResourceAssignmentReportData::clone() const { return new ResourceAssignmentReportData( *this ); } void ResourceAssignmentReportData::createModels() { QSortFilterProxyModel *sf = 0; ItemModelBase *m = 0; QRegExp rex( QString( "^(%1)$" ).arg( (int)OT_Appointment ) ); sf = new QSortFilterProxyModel( &m_model ); sf->setFilterKeyColumn( 0 ); sf->setFilterRole( Role::ObjectType ); sf->setFilterRegExp( rex ); sf->setDynamicSortFilter( true ); FlatProxyModel *fm = new FlatProxyModel( sf ); sf->setSourceModel( fm ); m = new ResourceAppointmentsRowModel( fm ); fm->setSourceModel( m ); m_model.setSourceModel( sf ); } //--------------------------- ChartReportData::ChartReportData( QObject *parent ) : ReportData( parent ), cbs( false ), m_firstrow( 0 ), m_lastrow( -1 ) { // these controls the amount of data (days) to include in a chart m_keywords << "start" << "end" << "first" << "days"; } ChartReportData::ChartReportData( const ChartReportData &other ) : ReportData( other ), m_fakedata( true ) { } bool ChartReportData::open() { return ReportData::open(); } int ChartReportData::firstRow() { if ( m_fakedata ) { return 0; } int row = 0; QDate s; if ( m_expressions.contains( "start" ) ) { s = m_expressions[ "start" ].toDate(); } else if ( m_expressions.contains( "first" ) ) { s = QDate::currentDate().addDays( m_expressions[ "first" ].toInt() ); } if ( s.isValid() ) { if ( m_startdate.isValid() && s > m_startdate ) { row = m_startdate.daysTo( s ); m_startdate = s; } debugPlan< m_firstrow ? row : m_firstrow; } bool ChartReportData::moveNext() { if ( m_row >= recordCount() - 1 ) { return false; } ++m_row; return true; } bool ChartReportData::movePrevious() { if ( m_row <= 0 ) { return false; } --m_row; return true; } bool ChartReportData::moveFirst() { m_row = 0; return true; } bool ChartReportData::moveLast() { m_row = recordCount() - 1; return true; } qint64 ChartReportData::recordCount() const { return m_lastrow < 0 ? 0 : m_lastrow - m_firstrow + 1; } QVariant ChartReportData::value ( unsigned int i ) const { if ( m_fakedata ) { debugPlan< m_keys; QMap m_names; }; } //namespace KPlato #endif diff --git a/src/libs/ui/reports/reportview.h b/src/libs/ui/reports/reportview.h index ef52f066..9b25e8e8 100644 --- a/src/libs/ui/reports/reportview.h +++ b/src/libs/ui/reports/reportview.h @@ -1,308 +1,308 @@ /* * KPlato Report Plugin * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) * Copyright (C) 2010, 2011 by Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KPLATOREPORTVIEW_H #define KPLATOREPORTVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "kptsplitterview.h" #include "kptcommand.h" #include "ui_reportnavigator.h" #include #include #include class KoDocument; class KoShape; struct KoPageLayout; class KReportPage; class KReportPreRenderer; class ORODocument; class KReportDesigner; class KReportRendererBase; class KPropertyEditorView; class KPropertySet; class QGraphicsView; class QGraphicsScene; class QDomElement; class QStackedWidget; class QDomElement; class QScrollArea; class QStandardItemModel; class KUndo2Command; namespace KPlato { class Project; class ReportView; class ReportWidget; class ReportDesigner; class ReportData; class ReportSourceEditor; class ReportNavigator; class GroupSectionEditor; class ReportPrintingDialog : public KoPrintingDialog { Q_OBJECT public: ReportPrintingDialog( ViewBase *view, ORODocument *reportDocument ); ~ReportPrintingDialog(); void printPage( int page, QPainter &painter ); int documentLastPage() const; virtual QList createOptionWidgets() const { return QList(); } virtual QList shapesOnPage(int) { return QList(); } virtual QAbstractPrintDialog::PrintDialogOptions printDialogOptions() const; public Q_SLOTS: virtual void startPrinting(RemovePolicy removePolicy = DoNotDelete); protected: ORODocument *m_reportDocument; KReportRendererContext m_context; KReportRendererBase *m_renderer; }; //------------------- -class KPLATOUI_EXPORT ReportView : public ViewBase +class PLANUI_EXPORT ReportView : public ViewBase { Q_OBJECT public: ReportView(KoPart *part, KoDocument *doc, QWidget *parent); void setProject( Project *project ); KoPrintJob *createPrintJob(); /// Load the design document @p doc bool loadXML( const QDomDocument &doc ); /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. virtual void saveContext( QDomElement &context ) const; ReportWidget *reportWidget() const; ReportDesigner *reportDesigner() const; QDomDocument document() const; QList reportDataModels() const; public Q_SLOTS: void setGuiActive( bool active ); void setScheduleManager( ScheduleManager *sm ); virtual void slotRefreshView(); // refresh display private Q_SLOTS: void slotEditReport(); void slotViewReport(); Q_SIGNALS: void editReportDesign( ReportWidget* ); private: QStackedWidget *m_stack; }; //------------------- -class KPLATOUI_EXPORT ReportWidget : public ViewBase +class PLANUI_EXPORT ReportWidget : public ViewBase { Q_OBJECT public: ReportWidget(KoPart *part, KoDocument *doc, QWidget *parent); public Q_SLOTS: void setGuiActive( bool active ); void renderPage( int page ); /// Return true if document is null bool documentIsNull() const; /// Load the design document @p doc bool loadXML( const QDomDocument &doc ); /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. virtual void saveContext( QDomElement &context ) const; KoPrintJob *createPrintJob(); /// Return the page layout used for printing this view KoPageLayout pageLayout() const; void setReportDataModels( const QList &models ); QList reportDataModels() const { return m_reportdatamodels; } Q_SIGNALS: void editReportDesign(); public Q_SLOTS: /// refresh display virtual void slotRefreshView(); protected: void setupGui(); private Q_SLOTS: void nextPage(); void prevPage(); void firstPage(); void lastPage(); void exportAsTextDocument(); void exportAsSpreadsheet(); void exportAsWebPage(); private: ReportData *createReportData( const QDomElement &connection ); ReportData *createReportData( const QString &type ); QUrl getExportFileName(const QString &mimetype); private: KReportPreRenderer *m_preRenderer; KReportRendererFactory m_factory; ORODocument *m_reportDocument; QGraphicsView *m_reportView; QGraphicsScene *m_reportScene; KReportPage *m_reportPage; ReportNavigator *m_pageSelector; int m_currentPage; int m_pageCount; QList m_reportdatamodels; QDomDocument m_design; }; //----------------- -class KPLATOUI_EXPORT ReportNavigator : public QWidget, public Ui::ReportNavigator +class PLANUI_EXPORT ReportNavigator : public QWidget, public Ui::ReportNavigator { Q_OBJECT public: explicit ReportNavigator(QWidget *parent = 0); void setCurrentPage( int page ); public Q_SLOTS: void setMaximum( int ); protected Q_SLOTS: void slotMaxChanged( int ); void setButtonsEnabled(); }; //------------------- -class KPLATOUI_EXPORT ModifyReportDefinitionCmd : public NamedCommand +class PLANUI_EXPORT ModifyReportDefinitionCmd : public NamedCommand { public: ModifyReportDefinitionCmd( ReportView *view, const QDomDocument &value, const KUndo2MagicString &name = KUndo2MagicString() ); void execute(); void unexecute(); private: ReportView *m_view; QDomDocument m_newvalue; QDomDocument m_oldvalue; }; //------------------------- -class KPLATOUI_EXPORT ReportDesigner : public ViewBase +class PLANUI_EXPORT ReportDesigner : public ViewBase { Q_OBJECT public: ReportDesigner(KoPart *part, KoDocument *doc, QWidget *parent = 0); bool isModified() const; void setModified( bool on ); QDomDocument document() const; void setData( const QDomDocument &doc ); /// Loads context info into this view. virtual bool loadContext( const KoXmlElement &context ); /// Save context info from this view. virtual void saveContext( QDomElement &context ) const; public Q_SLOTS: void setReportData( const QString &tag ); void slotSaveReportDefinition(); Q_SIGNALS: void viewReport(); void resetButtonState( bool ); void raiseClicked(); void lowerClicked(); void cutActivated(); void copyActivated(); void pasteActivated(); void deleteActivated(); void reportheaderShown(bool); void reportfooterShown(bool); void headerFirstpageShown(bool); void headerLastpageShown(bool); void headerOddpagesShown(bool); void headerEvenpagesShown(bool); void headerAllpagesShown(bool); void footerFirstpageShown(bool); void footerLastpageShown(bool); void footerOddpagesShown(bool); void footerEvenpagesShown(bool); void footerAllpagesShown(bool); protected: void setupGui(); void createDockers(); QStandardItemModel *createSourceModel( QObject *parent ) const; void setData(); protected Q_SLOTS: void slotPropertySetChanged(); void slotInsertAction(); void slotItemInserted( const QString & ); void slotSectionToggled( bool ); void undoAllChanges(); void slotModified(); private: QScrollArea *m_scrollarea; KReportDesigner *m_designer; ReportSourceEditor *m_sourceeditor; KPropertyEditorView *m_propertyeditor; QList m_reportdatamodels; GroupSectionEditor *m_groupsectioneditor; QDomDocument m_original; QAction *m_undoaction; }; } // namespace KPlato #endif diff --git a/src/libs/ui/reports/reportview_p.h b/src/libs/ui/reports/reportview_p.h index e7ec017e..641870f5 100644 --- a/src/libs/ui/reports/reportview_p.h +++ b/src/libs/ui/reports/reportview_p.h @@ -1,121 +1,121 @@ /* This file is part of the KDE project Copyright (C) 2010 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KPLATOREPORTVIEW_P_H #define KPLATOREPORTVIEW_P_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "ui_reportgroupsectionswidget.h" #include #include #include #include #include class KReportDesignerSectionDetailGroup; class KReportDesigner; class KToolBar; class QDomElement; class QActionGroup; namespace KPlato { class ReportData; class GroupSectionEditor : public QObject { Q_OBJECT public: explicit GroupSectionEditor(QObject *parent); void setupUi( QWidget *widget ); void clear(); void setData( KReportDesigner *designer, ReportData *rd ); protected Q_SLOTS: void slotSelectionChanged(const QItemSelection &sel ); void slotAddRow(); void slotRemoveRows(); void slotMoveRowUp(); void slotMoveRowDown(); private: Ui::ReportGroupSectionsWidget gsw; KReportDesigner *designer; ReportData *reportdata; QStandardItemModel model; class Item : public QStandardItem { public: explicit Item(KReportDesignerSectionDetailGroup *g) : QStandardItem(), group( g ) {} KReportDesignerSectionDetailGroup *group; QStringList names; QStringList keys; }; class ColumnItem : public Item { public: explicit ColumnItem(KReportDesignerSectionDetailGroup *g); QVariant data( int role = Qt::DisplayRole ) const; void setData( const QVariant &value, int role = Qt::EditRole ); }; class SortItem : public Item { public: explicit SortItem(KReportDesignerSectionDetailGroup *g); QVariant data( int role = Qt::DisplayRole ) const; void setData( const QVariant &value, int role = Qt::EditRole ); }; class HeaderItem : public Item { public: explicit HeaderItem(KReportDesignerSectionDetailGroup *g); QVariant data( int role = Qt::DisplayRole ) const; void setData( const QVariant &value, int role = Qt::EditRole ); }; class FooterItem : public Item { public: explicit FooterItem(KReportDesignerSectionDetailGroup *g); QVariant data( int role = Qt::DisplayRole ) const; void setData( const QVariant &value, int role = Qt::EditRole ); }; class PageBreakItem : public Item { public: explicit PageBreakItem(KReportDesignerSectionDetailGroup *g); QVariant data( int role = Qt::DisplayRole ) const; void setData( const QVariant &value, int role = Qt::EditRole ); }; }; } // namespace KPlato #endif diff --git a/src/libs/ui/reportsgenerator/ReportsGeneratorView.h b/src/libs/ui/reportsgenerator/ReportsGeneratorView.h index 8597ac77..4926c0bf 100644 --- a/src/libs/ui/reportsgenerator/ReportsGeneratorView.h +++ b/src/libs/ui/reportsgenerator/ReportsGeneratorView.h @@ -1,92 +1,92 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef REPORTSGENERATORVIEW_H #define REPORTSGENERATORVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptglobal.h" #include "kptviewbase.h" class KoDocument; class KActionMenu; class QWidget; class QTreeView; namespace KPlato { -class KPLATOUI_EXPORT ReportsGeneratorView : public ViewBase +class PLANUI_EXPORT ReportsGeneratorView : public ViewBase { Q_OBJECT public: ReportsGeneratorView(KoPart *part, KoDocument *doc, QWidget *parent); void setupGui(); /// Loads context info into this view. Reimplement. virtual bool loadContext( const KoXmlElement &/*context*/ ); /// Save context info from this view. Reimplement. virtual void saveContext( QDomElement &/*context*/ ) const; static QStringList addOptions(); static QStringList addTags(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive( bool activate ); void slotAddReport(); void slotRemoveReport(); void slotGenerateReport(); protected: void updateActionsEnabled( bool on ); int selectedRowCount() const; QModelIndexList selectedRows() const; bool generateReport(const QString &templateFile, const QString &file); protected Q_SLOTS: virtual void slotOptions(); private Q_SLOTS: void slotSelectionChanged(); void slotCurrentChanged( const QModelIndex&, const QModelIndex& ); void slotContextMenuRequested(const QPoint &pos); void slotEnableActions(); private: QTreeView *m_view; QAction *actionAddReport; QAction *actionRemoveReport; QAction *actionGenerateReport; }; } //namespace KPlato #endif diff --git a/src/libs/ui/welcome/WelcomeView.h b/src/libs/ui/welcome/WelcomeView.h index e8ee14c2..5841f6b4 100644 --- a/src/libs/ui/welcome/WelcomeView.h +++ b/src/libs/ui/welcome/WelcomeView.h @@ -1,102 +1,102 @@ /* This file is part of the KDE project Copyright (C) 2017 Dag Andersen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef WELCOMEVIEW_H #define WELCOMEVIEW_H -#include "kplatoui_export.h" +#include "planui_export.h" #include "kptviewbase.h" #include "ui_WelcomeView.h" #include "kptmainprojectdialog.h" #include class KoDocument; class QUrl; class QItemSelecteion; namespace KPlato { class RecentFilesModel; -class KPLATOUI_EXPORT WelcomeView : public ViewBase +class PLANUI_EXPORT WelcomeView : public ViewBase { Q_OBJECT public: WelcomeView(KoPart *part, KoDocument *doc, QWidget *parent); ~WelcomeView(); void setRecentFiles(const QStringList &files); void setupGui(); virtual void updateReadWrite(bool readwrite); KoPrintJob *createPrintJob(); public Q_SLOTS: /// Activate/deactivate the gui virtual void setGuiActive(bool activate); Q_SIGNALS: void newProject(); void openProject(); void recentProject(const QUrl &file); void showIntroduction(); void selectDefaultView(); void loadSharedResources(const QUrl &url, const QUrl &projects); void openExistingFile(const QUrl &url); void projectCreated(); void finished(); void openTemplate(QUrl); protected: void updateActionsEnabled( bool on = true); private Q_SLOTS: void slotContextMenuRequested(const QModelIndex &index, const QPoint& pos); void slotRecentFileSelected(const QItemSelection &selected); void slotEnableActions(bool on); void slotNewProject(); void slotOpenProject(); void slotLoadSharedResources(const QString &file, const QUrl &projects, bool loadProjectsAtStartup); void slotProjectEditFinished(int result); void slotOpenFileFinished(int result); void slotCreateResourceFile(); private: Ui::WelcomeView widget; RecentFilesModel *m_model; QPointer m_projectdialog; QPointer m_filedialog; }; } //KPlato namespace #endif diff --git a/src/plugins/filters/icalendar/export/CMakeLists.txt b/src/plugins/filters/icalendar/export/CMakeLists.txt index e6533bf4..cdae3ed3 100644 --- a/src/plugins/filters/icalendar/export/CMakeLists.txt +++ b/src/plugins/filters/icalendar/export/CMakeLists.txt @@ -1,26 +1,26 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${PLAN_SOURCE_DIR} ${PLANKERNEL_INCLUDES} ${PLANMAIN_INCLUDES} ) set(icalendarexport_PART_SRCS icalendarexport.cpp ) add_library(planicalexport MODULE ${icalendarexport_PART_SRCS}) #calligraplan_filter_desktop_to_json(planicalexport plan_icalendar_export.desktop) if(${KF5_VERSION} VERSION_LESS "5.16.0") kcoreaddons_desktop_to_json(planicalexport plan_icalendar_export.desktop) else() kcoreaddons_desktop_to_json(planicalexport plan_icalendar_export.desktop SERVICE_TYPES ${PLAN_SOURCE_DIR}/servicetypes/calligraplan_filter.desktop ) endif() -target_link_libraries(planicalexport planprivate kplatokernel planmain KF5::CalendarCore) +target_link_libraries(planicalexport planprivate plankernel planmain KF5::CalendarCore) install(TARGETS planicalexport DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/formatfilters) diff --git a/src/plugins/filters/kplato/import/CMakeLists.txt b/src/plugins/filters/kplato/import/CMakeLists.txt index 7acba2ca..2507ce8e 100644 --- a/src/plugins/filters/kplato/import/CMakeLists.txt +++ b/src/plugins/filters/kplato/import/CMakeLists.txt @@ -1,25 +1,25 @@ include_directories( ${PLAN_SOURCE_DIR} ${PLAN_SOURCE_DIR} ${PLANMAIN_INCLUDES} ) set(kplatoimport_PART_SRCS kplatoimport.cpp ) add_library(plankplatoimport MODULE ${kplatoimport_PART_SRCS}) # calligraplan_filter_desktop_to_json(plankplatoimport plan_kplato_import.desktop) if(${KF5_VERSION} VERSION_LESS "5.16.0") kcoreaddons_desktop_to_json(plankplatoimport plan_kplato_import.desktop) else() kcoreaddons_desktop_to_json(plankplatoimport plan_kplato_import.desktop SERVICE_TYPES ${PLAN_SOURCE_DIR}/servicetypes/calligraplan_filter.desktop ) endif() -target_link_libraries(plankplatoimport planprivate kplatokernel planmain) +target_link_libraries(plankplatoimport planprivate plankernel planmain) install(TARGETS plankplatoimport DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/formatfilters) diff --git a/src/plugins/schedulers/rcps/CMakeLists.txt b/src/plugins/schedulers/rcps/CMakeLists.txt index 66d17307..2236a902 100644 --- a/src/plugins/schedulers/rcps/CMakeLists.txt +++ b/src/plugins/schedulers/rcps/CMakeLists.txt @@ -1,33 +1,33 @@ add_definitions(-DTRANSLATION_DOMAIN=\"calligraplan_scheduler_rcps\") set(LIBRCPS_INCLUDE_DIR 3rdparty/LibRCPS/src) include_directories( ${LIBRCPS_INCLUDE_DIR} ${PLANODF_INCLUDES} ${PLAN_SOURCE_DIR}/libs/kernel ) add_subdirectory( 3rdparty ) if(BUILD_TESTING) add_subdirectory( tests ) endif() set ( RCPSScheduler_SRCS KPlatoRCPSPlugin.cpp KPlatoRCPSScheduler.cpp ) -add_library(kplatorcpsscheduler MODULE ${RCPSScheduler_SRCS} ) -#calligraplan_scheduler_desktop_to_json(kplatorcpsscheduler planrcpsscheduler.desktop) +add_library(plancpsscheduler MODULE ${RCPSScheduler_SRCS} ) +#calligraplan_scheduler_desktop_to_json(plancpsscheduler planrcpsscheduler.desktop) if(${KF5_VERSION} VERSION_LESS "5.16.0") - kcoreaddons_desktop_to_json(kplatorcpsscheduler planrcpsscheduler.desktop) + kcoreaddons_desktop_to_json(plancpsscheduler planrcpsscheduler.desktop) else() - kcoreaddons_desktop_to_json(kplatorcpsscheduler planrcpsscheduler.desktop + kcoreaddons_desktop_to_json(plancpsscheduler planrcpsscheduler.desktop SERVICE_TYPES ${PLAN_SOURCE_DIR}/libs/kernel/plan_schedulerplugin.desktop ) endif() target_link_libraries( - kplatorcpsscheduler - kplatokernel + plancpsscheduler + plankernel rcps_plan # ${LIBRCPS_LIBRARIES} ) -install( TARGETS kplatorcpsscheduler DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/schedulers ) +install( TARGETS plancpsscheduler DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/schedulers ) diff --git a/src/plugins/schedulers/rcps/KPlatoRCPSScheduler.cpp b/src/plugins/schedulers/rcps/KPlatoRCPSScheduler.cpp index eea765cc..e3ae9733 100644 --- a/src/plugins/schedulers/rcps/KPlatoRCPSScheduler.cpp +++ b/src/plugins/schedulers/rcps/KPlatoRCPSScheduler.cpp @@ -1,1376 +1,1376 @@ /* This file is part of the KDE project * Copyright (C) 2009, 2010, 2012 Dag Andersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "KPlatoRCPSScheduler.h" #include "kptproject.h" #include "kptschedule.h" #include "kptresource.h" #include "kpttask.h" #include "kptrelation.h" #include "kptdebug.h" #include #include #include #include #include #include #include #include #define GENERATION_MIN_LIMIT 5000 #define PROGRESS_CALLBACK_FREQUENCY 100 #define PROGRESS_MAX_VALUE 120000 #define PROGRESS_INIT_VALUE 12000 #define PROGRESS_INIT_STEP 2000 /* low weight == late, high weight == early */ #define WEIGHT_ASAP 50 #define WEIGHT_ALAP 1 #define WEIGHT_CONSTRAINT 1000 #define WEIGHT_FINISH 1000 #define GROUP_TARGETTIME 1 #define GROUP_CONSTRAINT 2 class ProgressInfo { public: explicit ProgressInfo() : init( true ), base( 0 ), progress( 0 ) { fitness.group = 0; fitness.weight = 0; } bool init; int base; int progress; struct rcps_fitness fitness; }; KPlatoRCPSScheduler::KPlatoRCPSScheduler( Project *project, ScheduleManager *sm, ulong granularity, QObject *parent ) : SchedulerThread( project, sm, parent ), result( -1 ), m_schedule( 0 ), m_recalculate( false ), m_usePert( false ), m_backward( false ), m_problem( 0 ), m_timeunit( granularity / 1000 ), m_offsetFromTime_t( 0 ), m_progressinfo( new ProgressInfo() ) { connect(this, SIGNAL(sigCalculationStarted(Project*,ScheduleManager*)), project, SIGNAL(sigCalculationStarted(Project*,ScheduleManager*))); emit sigCalculationStarted( project, sm ); connect( this, SIGNAL(sigCalculationFinished(Project*,ScheduleManager*)), project, SIGNAL(sigCalculationFinished(Project*,ScheduleManager*)) ); } KPlatoRCPSScheduler::~KPlatoRCPSScheduler() { delete m_progressinfo; qDeleteAll( m_duration_info_list ); qDeleteAll( m_weight_info_list ); rcps_problem_free( m_problem ); } int KPlatoRCPSScheduler::progress_callback( int generations, struct rcps_fitness fitness, void *arg ) { if ( arg == 0 ) { return -1; } KPlatoRCPSScheduler *self = static_cast( arg ); //debugPlan<<"KPlatoRCPSScheduler::progress_callback"<progress( generations, fitness ); } int KPlatoRCPSScheduler::progress( int generations, struct rcps_fitness fitness ) { if ( m_haltScheduling ) { debugPlan<<"KPlatoRCPSScheduler::progress:"<<"halt"; return -1; } if ( m_stopScheduling ) { m_schedule->logWarning( i18n( "Scheduling halted after %1 generations", generations ), 1 ); debugPlan<<"KPlatoRCPSScheduler::progress:"<<"stop"; return -1; } // std::cout << "Progress after: " << generations << " generations\n"; if ( m_progressinfo->init ) { if ( generations == 0 ) { m_progressinfo->progress += PROGRESS_INIT_STEP; } else { m_progressinfo->progress = PROGRESS_INIT_VALUE; m_progressinfo->init = false; // std::cout << "Population generated: "<< generations << "\n"; } } else { m_progressinfo->progress = PROGRESS_INIT_VALUE + generations; } // detect change in fitness if ( rcps_fitness_cmp( &m_progressinfo->fitness, &fitness ) != 0 ) { // std::cout << "Fitness changed in generation: " << generations << " group=["<fitness.group<<"->"<fitness.weight<<"->"<fitness = fitness; m_progressinfo->base = generations; } m_manager->setProgress( m_progressinfo->progress ); setProgress( m_progressinfo->progress ); // stop if fitness does not change in GENERATION_MIN_LIMIT generations /* int result = ( generations >= m_progressinfo->base + GENERATION_MIN_LIMIT ? 1 : 0 ); if ( result ) { //debugPlan<<"KPlatoRCPSScheduler::progress, stop after"<progress; m_schedule->logDebug( QString( "Acceptable solution found after %1 generations" ).arg( generations ), 1 ); std::cout << "Acceptable solution found after " << generations << " generations\n"; }*/ return 0; } int KPlatoRCPSScheduler::duration_callback( int direction, int time, int nominal_duration, void *arg ) { - //debugPlan<<"kplato_duration:"<( arg ); return info->self->duration( direction, time, nominal_duration, info ); } int KPlatoRCPSScheduler::duration( int direction, int time, int nominal_duration, KPlatoRCPSScheduler::duration_info *info ) { if ( m_haltScheduling || m_manager == 0 ) { return nominal_duration; } ++(info->calls); if ( info->cache.contains( QPair( time, direction ) ) ) { return info->cache[ QPair( time, direction ) ]; } if ( m_manager->recalculate() && info->task->completion().isFinished() ) { return 0; } int dur = 0; if ( info->task->constraint() == Node::FixedInterval ) { // duration may depend on daylight saving so we need to calculate // NOTE: dur may not be correct if time != info->task->constraintStartTime, let's see what happens... dur = ( info->task->constraintEndTime() - info->task->constraintStartTime() ).seconds() / m_timeunit; info->task->schedule()->logDebug( QString( "Fixed interval: Time=%1, duration=%2 ( %3, %4 )" ).arg( time ).arg( dur ).arg( fromRcpsTime( time ).toString() ).arg( Duration( (qint64)(dur) * m_timeunit * 1000 ).toDouble( Duration::Unit_h ) ) ); } else if ( info->estimatetype == Estimate::Type_Effort ) { if ( info->requests.isEmpty() ) { dur = info->estimate.seconds() / m_timeunit; } else { dur = info->task->requests().duration( info->requests, fromRcpsTime( time ), info->estimate, 0, /*no schedule*/ m_backward ? ! direction : direction ).seconds() / m_timeunit; //debugPlan<task->name()<< QString( "duration_callback effort: backward=%5, direction=%6 (direction=%7); Time=%1, duration=%2 ( %3, %4 )" ).arg( time ).arg( dur ).arg( fromRcpsTime( time ).toString() ).arg( Duration( (qint64)(dur) * m_timeunit * 1000 ).toDouble( Duration::Unit_h ) ).arg( m_backward ).arg( direction ).arg( m_backward ? !direction : direction ); } } else { dur = info->task->length( fromRcpsTime( time ), info->estimate, 0, /*no schedule*/ m_backward ? ! direction : direction ).seconds() / m_timeunit; } info->cache[ QPair( time, direction ) ] = dur; info->task->schedule()->logDebug( QString( "duration_callback: Time=%1, duration=%2 ( %3, %4 )" ).arg( time ).arg( dur ).arg( fromRcpsTime( time ).toString() ).arg( Duration( (qint64)(dur) * m_timeunit * 1000 ).toDouble( Duration::Unit_h ) ) ); return dur; } int KPlatoRCPSScheduler::weight_callback( int time, int duration, struct rcps_fitness *nominal_weight, void* weight_arg, void* fitness_arg ) { - //debugPlan<<"kplato_weight:"<weight *= time; return 0; } KPlatoRCPSScheduler::weight_info *winfo = static_cast( weight_arg ); KPlatoRCPSScheduler::fitness_info *finfo = static_cast( fitness_arg ); return winfo->self->weight( time, duration, nominal_weight, winfo, finfo ); } void *KPlatoRCPSScheduler::fitness_callback_init( void *arg ) { Q_ASSERT( arg ); KPlatoRCPSScheduler::fitness_info *info = static_cast( arg ); Q_ASSERT( info ); fitness_info *finfo = new fitness_info; finfo->self = info->self; // debugPlan<self; return finfo; } int KPlatoRCPSScheduler::fitness_callback_result( struct rcps_fitness *fit, void *arg ) { KPlatoRCPSScheduler::fitness_info *info = static_cast( arg ); info->self->fitness( fit, info ); delete info; return 0; } int KPlatoRCPSScheduler::fitness( struct rcps_fitness *fit, KPlatoRCPSScheduler::fitness_info *info ) { /* std::cout << ">-------------------------------------------\n"; std::cout << "Sequence: "; foreach ( Task *t, info->jobs ) { std::cout << (t ? t->name().toLocal8Bit().data() : "End") << ", "; } std::cout << "\n"; debugPlan<map;*/ QMultiMap >::const_iterator it = info->map.constFind( GROUP_CONSTRAINT ); if ( it != info->map.constEnd() ) { // constraint fit->group = GROUP_CONSTRAINT; for ( ; it.key() == GROUP_CONSTRAINT && it != info->map.constEnd(); ++it ) { fit->weight += it.value().first; QString s = it.value().second ? it.value().second->name() : "End node"; // std::cout << s.toLocal8Bit().data() << ": group=" << it.key() << " weight=" << it.value().first << "\n"; // m_schedule->logDebug( QString( "%3: %1 %2" ).arg( it.key() ).arg( it.value().first ).arg( it.value().second->name() ) ); } // std::cout << "Result: group= " << fit->group << " weight=" << fit->weight << "\n--------------------------\n"; return 0; } it = info->map.constFind( GROUP_TARGETTIME ); if ( it != info->map.constEnd() ) { // missed target time fit->group = GROUP_TARGETTIME; for ( ; it.key() == GROUP_TARGETTIME && it != info->map.constEnd(); ++it ) { fit->weight += it.value().first; QString s = it.value().second ? it.value().second->name() : "End node"; // std::cout << s.toLocal8Bit().data() << ": group=" << it.key() << " weight=" << it.value().first << "\n"; // m_schedule->logDebug( QString( "%3: %1 %2" ).arg( it.key() ).arg( it.value().first ).arg( it.value().second->name() ) ); } // std::cout << "Result: group= " << fit->group << " weight=" << fit->weight << "\n--------------------------\n"; return 0; } fit->group = 0; for ( it = info->map.constBegin(); it != info->map.constEnd(); ++it ) { fit->weight += it.value().first; QString s = it.value().second ? it.value().second->name() : "End node"; // std::cout << s.toLocal8Bit().data() << ": group=" << it.key() << " weight=" << it.value().first << "\n"; // m_schedule->logDebug( QString( "%3: %1 %2" ).arg( it.key() ).arg( it.value().first ).arg( it.value().second->name() ) ); } // std::cout << "Result: group= " << fit->group << " weight=" << fit->weight << "\n--------------------------\n"; return 0; } int KPlatoRCPSScheduler::weight( int time, int duration, struct rcps_fitness *nominal_weight, KPlatoRCPSScheduler::weight_info* info, KPlatoRCPSScheduler::fitness_info* finfo ) { if ( m_haltScheduling || m_manager == 0 ) { return 0; } if ( m_manager->recalculate() && info->task->completion().isFinished() ) { return 0; } struct rcps_fitness &f = *nominal_weight; f.group = 0; f.weight = time; if ( info->isEndJob ) { if ( info->finish == 0 ) { info->finish = time; /* const char *s = QString( "First : %1 %2 %3 End job" ).arg( time, 10 ).arg( duration, 10 ).arg( w, 10 ).toLatin1(); std::cout<finish / ( time > 0 ? time : 1 ); if ( time > info->targettime ) { w = w + ( WEIGHT_CONSTRAINT * ( time - info->targettime ) ); }*/ if ( time > info->targettime ) { f.group = GROUP_TARGETTIME; f.weight = time - info->targettime; } /* const char *s = QString( "End job: %1 %2 %3 End job target: %4" ).arg( time, 10 ).arg( duration, 10 ).arg( w, 10 ).arg( info->targettime ).toLatin1(); std::cout<task->constraint() ) { case Node::FinishNotLater: if ( info->targettime > time ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * ( info->targettime - time ); } break; case Node::MustFinishOn: if ( info->targettime != time ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * abs( info->targettime - time ); } break; case Node::StartNotEarlier: if ( info->targettime < time ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * ( time - info->targettime ); } break; case Node::MustStartOn: case Node::FixedInterval: if ( info->targettime != time ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * abs( info->targettime - time ); } break; default: break; } /* const char *s = QString( "Backward: %1 %2 %3 %4 (target: %5)" ).arg( time, 10 ).arg( duration, 10 ).arg( w, 10 ).arg( info->task->name() ).arg( info->targettime ).toLatin1(); std::cout<task->constraint() ) { case Node::StartNotEarlier: if ( time < info->targettime ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * ( info->targettime - time ); } break; case Node::MustStartOn: case Node::FixedInterval: if ( info->targettime != time ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * ( abs( info->targettime - time ) ); } break; case Node::FinishNotLater: // std::cout << "FNL " << info->task->name().toLocal8Bit().data() << ": end="< info->targettime ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * ( time - info->targettime ); } // std::cout << info->task->name().toLocal8Bit().data() << ": group=" << f.group << " weight=" << f.weight << "\n"; break; case Node::MustFinishOn: // std::cout << "MSO " << info->task->name().toLocal8Bit().data() << ": end="<targettime != time + duration ) { f.group = GROUP_CONSTRAINT; f.weight = WEIGHT_CONSTRAINT * abs( info->targettime - time ); } // std::cout << info->task->name().toLocal8Bit().data() << ": group=" << f.group << " weight=" << f.weight << "\n"; break; default: break; } /* const char *s = QString( "Forward: %1 %2 %3 %4 (target: %5)" ).arg( time, 10 ).arg( duration, 10 ).arg( w, 10 ).arg( info->task->name() ).arg( info->targettime ).toLatin1(); std::cout<task ? info->task->name() : "End node"; if ( finfo ) { finfo->map.insert( f.group, QPair( f.weight, info->task ) ); finfo->jobs << info->task; // debugPlan<map; }// else debugPlan< m_projectMutex.lock(); m_managerMutex.lock(); m_project = new Project(); loadProject( m_project, m_pdoc ); m_project->setName( "Schedule: " + m_project->name() ); //Debug m_project->stopcalculation = false; m_manager = m_project->scheduleManager( m_mainmanagerId ); Q_CHECK_PTR( m_manager ); Q_ASSERT( m_manager->expected() ); Q_ASSERT( m_manager != m_mainmanager ); Q_ASSERT( m_manager->scheduleId() == m_mainmanager->scheduleId() ); Q_ASSERT( m_manager->expected() != m_mainmanager->expected() ); m_manager->setName( "Schedule: " + m_manager->name() ); //Debug m_schedule = m_manager->expected(); connect(m_manager, SIGNAL(sigLogAdded(Schedule::Log)), this, SLOT(slotAddLog(Schedule::Log))); m_project->initiateCalculation( *m_schedule ); m_project->initiateCalculationLists( *m_schedule ); m_problem = rcps_problem_new(); rcps_problem_setfitness_mode( m_problem, FITNESS_WEIGHT ); m_usePert = m_manager->usePert(); m_recalculate = m_manager->recalculate(); if ( m_recalculate ) { m_starttime = m_manager->recalculateFrom(); m_backward = false; } else { m_backward = m_manager->schedulingDirection(); m_starttime = m_backward ? m_project->constraintEndTime() : m_project->constraintStartTime(); } m_targettime = m_backward ? m_project->constraintStartTime() : m_project->constraintEndTime(); m_project->setCurrentSchedule( m_manager->expected()->id() ); m_schedule->setPhaseName( 0, i18n( "Init" ) ); QLocale locale; if ( ! m_backward ) { m_schedule->logDebug( QString( "Schedule project using RCPS Scheduler, starting at %1, granularity %2 sec" ).arg( locale.toString(QDateTime::currentDateTime(), QLocale::ShortFormat) ).arg( m_timeunit ), 0 ); if ( m_recalculate ) { m_schedule->logInfo( i18n( "Re-calculate project from start time: %1", locale.toString(m_starttime, QLocale::ShortFormat) ), 0 ); } else { m_schedule->logInfo( i18n( "Schedule project from start time: %1", locale.toString(m_starttime, QLocale::ShortFormat) ), 0 ); } } else { m_schedule->logDebug( QString( "Schedule project backward using RCPS Scheduler, starting at %1, granularity %2 sec" ).arg( locale.toString( QDateTime::currentDateTime(), QLocale::ShortFormat) ).arg( m_timeunit ), 0 ); m_schedule->logInfo( i18n( "Schedule project from end time: %1", locale.toString(m_starttime, QLocale::ShortFormat) ), 0 ); } m_managerMutex.unlock(); m_projectMutex.unlock(); } // <--- mutex m_progressinfo->progress += PROGRESS_INIT_STEP / 5; setProgress( m_progressinfo->progress ); result = kplatoToRCPS(); if ( result != 0 ) { m_schedule->logError( i18n( "Failed to build a valid RCPS project" ) ); setProgress( PROGRESS_MAX_VALUE ); return; } m_schedule->setPhaseName( 1, i18n( "Schedule" ) ); setMaxProgress( PROGRESS_MAX_VALUE ); solve(); if ( m_haltScheduling ) { deleteLater(); return; } if ( result != 0 ) { m_schedule->logError( i18n( "Invalid scheduling solution. Result: %1", result ), 1 ); } kplatoFromRCPS(); setProgress( PROGRESS_MAX_VALUE ); } int KPlatoRCPSScheduler::check() { return rcps_check( m_problem ); } void KPlatoRCPSScheduler::solve() { debugPlan<<"KPlatoRCPSScheduler::solve()"; struct rcps_solver *s = rcps_solver_new(); rcps_solver_set_progress_callback(s, PROGRESS_CALLBACK_FREQUENCY, this, &KPlatoRCPSScheduler::progress_callback); rcps_solver_set_duration_callback(s, &KPlatoRCPSScheduler::duration_callback ); rcps_problem_set_weight_callback( m_problem, &KPlatoRCPSScheduler::weight_callback ); fitness_init_arg.self = this; rcps_problem_set_fitness_callback( m_problem, &KPlatoRCPSScheduler::fitness_callback_init, &fitness_init_arg, &KPlatoRCPSScheduler::fitness_callback_result ); Q_ASSERT( check() == 0 ); rcps_solver_setparam( s, SOLVER_PARAM_POPSIZE, 1000 ); rcps_solver_solve( s, m_problem ); result = rcps_solver_getwarnings( s ); rcps_solver_free( s ); } int KPlatoRCPSScheduler::kplatoToRCPS() { addResources(); addTasks(); addDependencies(); addRequests(); setWeights(); setConstraints(); int r = check(); return r; } void KPlatoRCPSScheduler::taskFromRCPSForward( struct rcps_job *job, Task *task, QMap > &resourcemap ) { if ( m_haltScheduling || m_manager == 0 ) { return; } QLocale locale; Schedule *cs = task->currentSchedule(); Q_ASSERT( cs ); struct rcps_mode *mode = rcps_mode_get(job, rcps_job_getmode_res(job)); /* get the duration of this mode */ KPlatoRCPSScheduler::duration_info *info = static_cast( rcps_mode_get_cbarg(mode) ); qint64 dur = 0; qint64 st = rcps_job_getstart_res(job); if ( info == 0 ) { dur = rcps_mode_getduration(mode); } else { cs->logDebug( QString( "Task '%1' estimate: %2" ).arg( task->name() ).arg( task->estimate()->value( Estimate::Use_Expected, false ).toString() ), 1 ); cs->logDebug( QString( "Task '%1' duration called %2 times, cached values: %3" ).arg( rcps_job_getname(job) ).arg( info->calls ).arg( info->cache.count() ) ); dur = duration_callback( 0, st, rcps_mode_getduration(mode), info ); for ( QMap, int>::ConstIterator it = info->cache.constBegin(); it != info->cache.constEnd(); ++it ) { cs->logDebug( QString( "Task '%1' start: %2, duration: %3 (%4, %5 hours)" ).arg( rcps_job_getname(job) ).arg( it.key().first ).arg( it.value() ).arg( fromRcpsTime( it.key().first ).toString() ).arg( (double)(it.value())/60.0 ), 1 ); } } DateTime start = m_starttime.addSecs(st * m_timeunit); DateTime end = start + Duration( dur * m_timeunit * 1000 ); cs->logDebug( QString( "Task '%1' start=%2, duration=%3: %4 - %5" ).arg( rcps_job_getname(job) ).arg( st ).arg( dur ).arg( locale.toString(start, QLocale::ShortFormat) ).arg( locale.toString(end, QLocale::ShortFormat ) ), 1 ); task->setStartTime( start ); task->setEndTime( end ); for ( int reqs = 0; reqs < rcps_request_count(mode); ++reqs ) { struct rcps_request *req = rcps_request_get(mode, reqs); struct rcps_alternative *alt = rcps_alternative_get(req, rcps_request_getalternative_res(req)); int amount = rcps_alternative_getamount(alt); struct rcps_resource *res = rcps_alternative_getresource(alt); cs->logDebug( QString( "Job %1: resource %2 is %3 available" ).arg( rcps_job_getname(job) ).arg( rcps_resource_getname(res) ).arg( amount ), 1 ); // do actual appointments etc ResourceRequest *r = m_requestmap.value( req ); if ( r == 0 ) { cs->logWarning( i18n( "No resource request is registered" ), 1 ); continue; } resourcemap[ task ] << r; cs->logDebug( QString( "Make appointments to resource %1" ).arg( r->resource()->name() ), 1 ); r->makeAppointment( cs, amount ); } if ( m_recalculate ) { if ( task->completion().isFinished() ) { task->copySchedule(); if ( m_manager ) { cs->logDebug( QString( "Task is completed, copied schedule: %2 to %3" ).arg( task->name() ).arg( locale.toString(task->startTime(), QLocale::ShortFormat) ).arg( locale.toString(task->endTime(), QLocale::ShortFormat) ), 1 ); } } else if ( task->completion().isStarted() ) { task->copyAppointments( DateTime(), start ); if ( m_manager ) { cs->logDebug( QString( "Task is %4% completed, copied appointments from %2 to %3" ).arg( task->name() ).arg( locale.toString(task->startTime(), QLocale::ShortFormat) ).arg( locale.toString(start, QLocale::ShortFormat) ).arg( task->completion().percentFinished() ), 1 ); } } } cs->setScheduled( true ); if ( task->estimate()->type() == Estimate::Type_Effort ) { if ( task->appointmentStartTime().isValid() ) { task->setStartTime( task->appointmentStartTime() ); } if ( task->appointmentEndTime().isValid() ) { task->setEndTime( task->appointmentEndTime() ); } if ( info && info->requests.isEmpty() ) { cs->setResourceError( true ); cs->logError( i18n( "No resource has been allocated" ), 1 ); } } else if ( task->estimate()->calendar() ) { DateTime t = task->estimate()->calendar()->firstAvailableAfter( task->startTime(), task->endTime() ); if ( t.isValid() ) { task->setStartTime( t ); } t = task->estimate()->calendar()->firstAvailableBefore( task->endTime(), task->startTime() ); if ( t.isValid() ) { task->setEndTime( t ); } } //else Fixed duration task->setDuration( task->endTime() - task->startTime() ); cs->logInfo( i18n( "Scheduled task to start at %1 and finish at %2", locale.toString(task->startTime(), QLocale::ShortFormat), locale.toString(task->endTime(), QLocale::ShortFormat ) ), 1 ); } void KPlatoRCPSScheduler::kplatoFromRCPS() { if ( m_backward ) { kplatoFromRCPSBackward(); } else { kplatoFromRCPSForward(); } } void KPlatoRCPSScheduler::kplatoFromRCPSForward() { //debugPlan<<"KPlatoRCPSScheduler::kplatoFromRCPSForward:"; MainSchedule *cs = static_cast( m_project->currentSchedule() ); QMap > resourcemap; int count = rcps_job_count(m_problem); int step = ( PROGRESS_MAX_VALUE - m_progressinfo->progress ) / count; DateTime projectstart = m_starttime.addSecs( rcps_job_getstart_res(m_jobstart) * m_timeunit ); for ( int i = 0; i < count; ++i ) { m_progressinfo->progress += step; m_manager->setProgress( m_progressinfo->progress ); setProgress( m_progressinfo->progress ); struct rcps_job *job = rcps_job_get( m_problem, i ); Task *task = m_taskmap.value( job ); if ( task == 0 ) { continue; //might be dummy task for lag, ... } taskFromRCPSForward( job, task, resourcemap ); if ( projectstart > task->startTime() ) { projectstart = task->startTime(); } } qint64 st = rcps_job_getstart_res(m_jobstart) * m_timeunit; DateTime start = m_starttime.addSecs( st ); qint64 et = rcps_job_getstart_res(m_jobend) * m_timeunit; DateTime end = m_starttime.addSecs( et ); m_project->setStartTime( projectstart ); m_project->setEndTime( end ); adjustSummaryTasks( m_schedule->summaryTasks() ); calculatePertValues( resourcemap ); QLocale locale; cs->logInfo( i18n( "Project scheduled to start at %1 and finish at %2", locale.toString(projectstart, QLocale::ShortFormat), locale.toString(end, QLocale::ShortFormat) ), 1 ); if ( m_manager ) { cs->logDebug( QString( "Project scheduling finished at %1" ).arg( QDateTime::currentDateTime().toString() ), 1 ); m_project->finishCalculation( *m_manager ); m_manager->scheduleChanged( cs ); } } void KPlatoRCPSScheduler::taskFromRCPSBackward( struct rcps_job *job, Task *task, QMap > &resourcemap ) { if ( m_haltScheduling || m_manager == 0 ) { return; } QLocale locale; Schedule *cs = task->currentSchedule(); Q_ASSERT( cs ); struct rcps_mode *mode = rcps_mode_get( job, rcps_job_getmode_res( job ) ); /* get the duration of this mode */ KPlatoRCPSScheduler::duration_info *info = static_cast( rcps_mode_get_cbarg( mode ) ); qint64 dur = 0; qint64 st = rcps_job_getstart_res( job ); if ( info == 0 ) { dur = rcps_mode_getduration( mode ); } else { cs->logDebug( QString( "Task '%1' estimate: %2" ).arg( task->name() ).arg( task->estimate()->value( Estimate::Use_Expected, false ).toString() ), 1 ); cs->logDebug( QString( "Task '%1' duration called %2 times, cached values: %3" ).arg( rcps_job_getname( job ) ).arg( info->calls ).arg( info->cache.count() ) ); dur = duration_callback( 0, st, rcps_mode_getduration( mode ), info ); for ( QMap, int>::ConstIterator it = info->cache.constBegin(); it != info->cache.constEnd(); ++it ) { cs->logDebug( QString( "Task '%1' start: %2, duration: %3 (%4, %5 hours)" ).arg( rcps_job_getname(job) ).arg( it.key().first ).arg( it.value() ).arg( fromRcpsTime( it.key().first ).toString() ).arg( (double)(it.value())/60.0 ), 1 ); } } DateTime end = fromRcpsTime( st ); DateTime start = fromRcpsTime( st + dur ); cs->logDebug( QString( "Task '%1' start=%2, duration=%3: %4 - %5" ).arg( rcps_job_getname(job) ).arg( st ).arg( dur ).arg( locale.toString(start, QLocale::ShortFormat) ).arg( locale.toString(end, QLocale::ShortFormat) ), 1 ); task->setStartTime( start ); task->setEndTime( end ); for ( int reqs = 0; reqs < rcps_request_count( mode ); ++reqs ) { struct rcps_request *req = rcps_request_get( mode, reqs ); struct rcps_alternative *alt = rcps_alternative_get( req, rcps_request_getalternative_res( req ) ); int amount = rcps_alternative_getamount( alt ); struct rcps_resource *res = rcps_alternative_getresource( alt ); cs->logDebug( QString( "Job %1: resource %2 is %3 available" ).arg( rcps_job_getname( job ) ).arg( rcps_resource_getname( res ) ).arg( amount ), 1 ); // do actual appointments etc ResourceRequest *r = m_requestmap.value( req ); if ( r == 0 ) { cs->logWarning( i18n( "No resource request is registered" ), 1 ); continue; } resourcemap[ task ] << r; cs->logDebug( QString( "Make appointments to resource %1" ).arg( r->resource()->name() ), 1 ); r->makeAppointment( cs, amount ); } if ( m_recalculate ) { if ( task->completion().isFinished() ) { task->copySchedule(); if ( m_manager ) { cs->logDebug( QString( "Task is completed, copied schedule: %2 to %3" ).arg( task->name() ).arg( locale.toString(task->startTime(), QLocale::ShortFormat) ).arg( locale.toString(task->endTime(), QLocale::ShortFormat) ), 1 ); } } else if ( task->completion().isStarted() ) { task->copyAppointments( DateTime(), start ); if ( m_manager ) { cs->logDebug( QString( "Task is %4% completed, copied appointments from %2 to %3" ).arg( task->name() ).arg( locale.toString(task->startTime(), QLocale::ShortFormat) ).arg( locale.toString(start, QLocale::ShortFormat) ).arg( task->completion().percentFinished() ), 1 ); } } } cs->setScheduled( true ); if ( task->estimate()->type() == Estimate::Type_Effort ) { if ( task->appointmentStartTime().isValid() ) { task->setStartTime( task->appointmentStartTime() ); } if ( task->appointmentEndTime().isValid() ) { task->setEndTime( task->appointmentEndTime() ); } if ( info && info->requests.isEmpty() ) { cs->setResourceError( true ); cs->logError( i18n( "No resource has been allocated" ), 1 ); } } else if ( task->estimate()->calendar() ) { DateTime t = task->estimate()->calendar()->firstAvailableAfter( task->startTime(), task->endTime() ); if ( t.isValid() ) { task->setStartTime( t ); } t = task->estimate()->calendar()->firstAvailableBefore( task->endTime(), task->startTime() ); if ( t.isValid() ) { task->setEndTime( t ); } } //else Fixed duration task->setDuration( task->endTime() - task->startTime() ); cs->logInfo( i18n( "Scheduled task to start at %1 and finish at %2", locale.toString(task->startTime(), QLocale::ShortFormat), locale.toString(task->endTime(), QLocale::ShortFormat) ), 1 ); } void KPlatoRCPSScheduler::kplatoFromRCPSBackward() { QLocale locale; //debugPlan<<"KPlatoRCPSScheduler::kplatoFromRCPSBackward:"; MainSchedule *cs = static_cast( m_project->currentSchedule() ); QMap > resourcemap; int count = rcps_job_count( m_problem ); int step = ( PROGRESS_MAX_VALUE - m_progressinfo->progress ) / count; DateTime projectstart = fromRcpsTime( rcps_job_getstart_res( m_jobend ) ); for ( int i = 0; i < count; ++i ) { m_progressinfo->progress += step; m_manager->setProgress( m_progressinfo->progress ); setProgress( m_progressinfo->progress ); struct rcps_job *job = rcps_job_get( m_problem, i ); Task *task = m_taskmap.value( job ); if ( task == 0 ) { continue; //might be dummy task for lag, ... } taskFromRCPSBackward( job, task, resourcemap ); if ( projectstart > task->startTime() ) { projectstart = task->startTime(); } } DateTime end = fromRcpsTime( rcps_job_getstart_res( m_jobstart ) ); m_project->setStartTime( projectstart ); m_project->setEndTime( end ); cs->logInfo( i18n( "Project scheduled to start at %1 and finish at %2", locale.toString(projectstart, QLocale::ShortFormat), locale.toString(end, QLocale::ShortFormat) ), 1 ); if ( projectstart < m_project->constraintStartTime() ) { cs->setConstraintError( true ); cs->logError( i18n( "Must start project early in order to finish in time: %1", locale.toString(m_project->constraintStartTime(), QLocale::ShortFormat) ), 1 ); } adjustSummaryTasks( m_schedule->summaryTasks() ); calculatePertValues( resourcemap ); if ( m_manager ) { cs->logDebug( QString( "Project scheduling finished at %1" ).arg( QDateTime::currentDateTime().toString() ), 1 ); m_project->finishCalculation( *m_manager ); m_manager->scheduleChanged( cs ); } } void KPlatoRCPSScheduler::adjustSummaryTasks( const QList &nodes ) { foreach ( Node *n, nodes ) { adjustSummaryTasks( n->childNodeIterator() ); if ( n->parentNode()->type() == Node::Type_Summarytask ) { DateTime pt = n->parentNode()->startTime(); DateTime nt = n->startTime(); if ( ! pt.isValid() || pt > nt ) { n->parentNode()->setStartTime( nt ); } pt = n->parentNode()->endTime(); nt = n->endTime(); if ( ! pt.isValid() || pt < nt ) { n->parentNode()->setEndTime( nt ); } } } } void KPlatoRCPSScheduler::calculatePertValues( const QMap > &map ) { if ( m_manager ) { m_schedule->setPhaseName( 2, i18nc( "Project Evaluation and Review Technique", "PERT" ) ); } foreach ( Node *n, m_project->allNodes() ) { if ( n->type() != Node::Type_Task && n->type() != Node::Type_Milestone ) { continue; } Task *t = static_cast( n ); if ( n->isStartNode() ) { (void)calculateLateStuff( map, static_cast( n ) ); } if ( n->isEndNode() ) { (void)calculateEarlyStuff( map, static_cast( n ) ); } switch ( n->constraint() ) { case Node::StartNotEarlier: n->schedule()->setNegativeFloat( n->startTime() < n->constraintStartTime() ? n->startTime() - n->constraintStartTime() : Duration::zeroDuration ); break; case Node::MustStartOn: case Node::FixedInterval: n->schedule()->setNegativeFloat( n->startTime() > n->constraintStartTime() ? n->startTime() - n->constraintStartTime() : n->constraintStartTime() - n->startTime() ); break; case Node::FinishNotLater: n->schedule()->setNegativeFloat( n->endTime() > n->constraintEndTime() ? n->endTime() - n->constraintEndTime() : Duration::zeroDuration ); break; case Node::MustFinishOn: n->schedule()->setNegativeFloat( n->endTime() > n->constraintEndTime() ? n->endTime() - n->constraintEndTime() : n->constraintEndTime() - n->endTime() ); break; default: break; } if ( t->negativeFloat() != 0 ) { n->schedule()->setConstraintError( true ); n->schedule()->logError( i18nc( "1=type of constraint", "%1: Failed to meet constraint. Negative float=%2", n->constraintToString( true ), KFormat().formatDuration( t->negativeFloat().milliseconds() ) ) ); } } } Duration KPlatoRCPSScheduler::calculateLateStuff( const QMap > &map, Task *task ) { Schedule *cs = task->currentSchedule(); Duration pf = m_project->endTime() - m_project->startTime(); QList lst = task->dependChildNodes() + task->childProxyRelations(); if ( lst.isEmpty() ) { // end node DateTime end = task->endTime(); if ( task->estimate()->type() == Estimate::Type_Effort ) { foreach ( ResourceRequest *r, map.value( static_cast( task ) ) ) { DateTime x = r->resource()->availableBefore( m_project->endTime(), task->endTime(), 0 ); cs->logDebug( QString( "Resource '%1' available before %2: %3" ).arg( r->resource()->name() ).arg( m_project->endTime().toString() ).arg( x.toString() ), 2 ); if ( x.isValid() && x > end ) { end = x; } } } else if ( task->estimate()->calendar() ) { end = task->estimate()->calendar()->firstAvailableBefore( m_project->endTime(), task->endTime() ); cs->logDebug( QString( "Calendar work time before %1: %2" ).arg( m_project->endTime().toString() ).arg( end.toString() ), 2 ); } // TODO must calculate backwards to get late *start* of task pf = end.isValid() ? end - task->endTime() : m_project->endTime() - task->endTime(); task->setFreeFloat( pf ); } else { Duration prev = pf; Duration x = pf; foreach ( Relation *r, lst ) { prev = qMin( prev, calculateLateStuff( map, static_cast( r->child() ) ) ); DateTime end = task->endTime(); if ( task->estimate()->type() == Estimate::Type_Effort ) { foreach ( ResourceRequest *req, map.value( static_cast( task ) ) ) { DateTime y = req->resource()->availableBefore( r->child()->startTime(), task->endTime(), 0 ); cs->logDebug( QString( "Resource '%1' available before %2: %3" ).arg( req->resource()->name() ).arg( r->child()->startTime().toString() ).arg( y.toString() ), 2 ); if ( y.isValid() && y > end ) { end = y; } } } else if ( task->estimate()->calendar() ) { end = task->estimate()->calendar()->firstAvailableBefore( r->child()->startTime(), task->endTime() ); cs->logDebug( QString( "Calendar work time before %1: %2" ).arg( r->child()->startTime().toString() ).arg( end.toString() ), 2 ); } x = qMin( x, end.isValid() ? end - task->endTime() : r->child()->startTime() - task->endTime() ); } task->setFreeFloat( x ); // TODO must calculate backwards to get late *start* of task pf = prev + x; } task->setPositiveFloat( pf ); task->setLateFinish( task->endTime() + pf ); task->setLateStart( task->lateFinish() - ( task->endTime() - task->startTime() ) ); QLocale locale; cs->logDebug( QString( "Late start %1, late finish %2, positive float %3" ).arg( locale.toString(task->lateStart(), QLocale::ShortFormat ) ).arg( locale.toString(task->lateFinish(), QLocale::ShortFormat) ).arg( pf.toString() ), 2 ); return pf; } Duration KPlatoRCPSScheduler::calculateEarlyStuff( const QMap > &map, Task *task ) { Schedule *cs = task->currentSchedule(); Duration tot = m_project->endTime() - m_project->startTime(); QList lst = task->dependParentNodes() + task->parentProxyRelations(); if ( lst.isEmpty() ) { // start node DateTime earlystart = task->startTime(); if ( task->estimate()->type() == Estimate::Type_Effort ) { foreach ( ResourceRequest *r, map.value( static_cast( task ) ) ) { DateTime x = r->resource()->availableAfter( m_project->startTime(), task->startTime(), 0 ); cs->logDebug( QString( "Resource '%1' available after %2 (%4): %3" ).arg( r->resource()->name() ).arg( m_project->startTime().toString() ).arg( x.toString() ).arg( task->startTime().toString() ), 2 ); if ( x.isValid() && x < earlystart ) { earlystart = x; } } } else if ( task->estimate()->calendar() ) { earlystart = task->estimate()->calendar()->firstAvailableAfter( m_project->startTime(), task->startTime() ); cs->logDebug( QString( "Calendar work time after %1: %2" ).arg( m_project->startTime().toString() ).arg( earlystart.toString() ), 2 ); } // TODO must calculate forward to get early *????* of task tot = earlystart.isValid() ? task->startTime() - earlystart : task->startTime() - m_project->startTime(); } else { Duration prev = tot; Duration x = tot; foreach ( Relation *r, lst ) { prev = qMin( prev, calculateEarlyStuff( map, static_cast( r->parent() ) ) ); DateTime earlystart = task->startTime(); if ( task->estimate()->type() == Estimate::Type_Effort ) { foreach ( ResourceRequest *req, map.value( static_cast( task ) ) ) { DateTime y = req->resource()->availableAfter( r->parent()->endTime(), task->startTime(), 0 ); cs->logDebug( QString( "Resource '%1' available after %2: %3" ).arg( req->resource()->name() ).arg( r->parent()->endTime().toString() ).arg( y.toString() ), 2 ); if ( y.isValid() && y < earlystart ) { earlystart = y; } } } else if ( task->estimate()->calendar() ) { earlystart = task->estimate()->calendar()->firstAvailableAfter( r->parent()->endTime(), task->startTime() ); cs->logDebug( QString( "Calendar work time after %1: %2" ).arg( r->parent()->endTime().toString() ).arg( earlystart.toString() ), 2 ); } x = qMin( x, earlystart.isValid() ? task->startTime() - earlystart : task->startTime() - r->parent()->startTime() ); } // TODO must calculate backwards to get late *start* of task tot = prev + x; } task->setEarlyStart( task->startTime() - tot ); task->setEarlyFinish( task->earlyStart() + ( task->endTime() - task->startTime() ) ); QLocale locale; cs->logDebug( QString( "Early start %1, early finish %2" ).arg( locale.toString(task->earlyStart(), QLocale::ShortFormat) ).arg( locale.toString(task->earlyFinish(), QLocale::ShortFormat) ), 2 ); return tot; } struct rcps_resource *KPlatoRCPSScheduler::addResource( KPlato::Resource *r) { if ( m_resourcemap.values().contains( r ) ) { warnPlan<name()<<"already exist"; return 0; } struct rcps_resource *res = rcps_resource_new(); rcps_resource_setname( res, r->name().toLocal8Bit().data() ); rcps_resource_setavail( res, r->units() ); rcps_resource_add( m_problem, res ); m_resourcemap[res] = r; return res; } void KPlatoRCPSScheduler::addResources() { debugPlan; QList list = m_project->resourceList(); for (int i = 0; i < list.count(); ++i) { addResource( list.at(i) ); } } int KPlatoRCPSScheduler::toRcpsTime( const DateTime &time ) const { return ( m_backward ? time.secsTo( m_starttime ) : m_starttime.secsTo( time ) ) / m_timeunit; } DateTime KPlatoRCPSScheduler::fromRcpsTime( int time ) const { return m_starttime.addSecs( ( m_backward ? -time : time ) * m_timeunit ); } struct rcps_job *KPlatoRCPSScheduler::addTask( KPlato::Task *task ) { struct rcps_job *job = rcps_job_new(); rcps_job_setname( job, task->name().toLocal8Bit().data() ); rcps_job_add( m_problem, job ); m_taskmap[job] = task; return job; } void KPlatoRCPSScheduler::addTasks() { debugPlan; // Add a start job m_jobstart = rcps_job_new(); rcps_job_setname( m_jobstart, "RCPS start job" ); rcps_job_add( m_problem, m_jobstart ); struct rcps_mode *mode = rcps_mode_new(); rcps_mode_add( m_jobstart, mode ); QList list = m_project->allNodes(); for (int i = 0; i < list.count(); ++i) { Node *n = list.at(i); switch ( n->type() ) { case Node::Type_Summarytask: m_schedule->insertSummaryTask( n ); break; case Node::Type_Task: case Node::Type_Milestone: addTask( static_cast( n ) ); break; default: break; } } // Add an end job m_jobend = rcps_job_new(); rcps_job_setname( m_jobend, "RCPS end job" ); rcps_job_add( m_problem, m_jobend ); mode = rcps_mode_new(); rcps_mode_add( m_jobend, mode ); // add a weight callback argument struct KPlatoRCPSScheduler::weight_info *info = new KPlatoRCPSScheduler::weight_info; info->self = this; info->task = 0; info->targettime = toRcpsTime( m_targettime ); info->isEndJob = true; info->finish = 0; rcps_mode_set_weight_cbarg( mode, info ); m_weight_info_list[ m_jobend ] = info; for( int i = 0; i < rcps_job_count( m_problem ); ++i ) { debugPlan<<"Task:"<dependParentNodes().isEmpty() && task->parentProxyRelations().isEmpty() ) { rcps_job_successor_add( m_jobstart, job, SUCCESSOR_FINISH_START ); } if ( task->dependChildNodes().isEmpty() && task->childProxyRelations().isEmpty() ) { rcps_job_successor_add( job, m_jobend, SUCCESSOR_FINISH_START ); } foreach ( Relation *r, task->dependChildNodes() ) { Node *n = r->child(); if ( n == 0 || n->type() == Node::Type_Summarytask ) { continue; } int type = SUCCESSOR_FINISH_START; switch ( r->type() ) { case Relation::FinishStart: type = SUCCESSOR_FINISH_START; break; case Relation::FinishFinish: type = SUCCESSOR_FINISH_FINISH; break; case Relation::StartStart: type = SUCCESSOR_START_START; break; } if ( r->lag() == Duration::zeroDuration ) { rcps_job_successor_add( job, m_taskmap.key( static_cast( n ) ), type ); } else { // Add a dummy job to represent the lag struct rcps_job *dummy = addJob( r->lag().toString(), r->lag().seconds() / m_timeunit ); rcps_job_successor_add( job, dummy, type ); int t = type == SUCCESSOR_FINISH_FINISH ? type : SUCCESSOR_FINISH_START; rcps_job_successor_add( dummy, m_taskmap.key( static_cast( n ) ), t ); } } foreach ( Relation *r, task->childProxyRelations() ) { Node *n = r->child(); if ( n == 0 || n->type() == Node::Type_Summarytask ) { continue; } int type = SUCCESSOR_FINISH_START; switch ( r->type() ) { case Relation::FinishStart: type = SUCCESSOR_FINISH_START; break; case Relation::FinishFinish: type = SUCCESSOR_FINISH_FINISH; break; case Relation::StartStart: type = SUCCESSOR_START_START; break; } if ( r->lag() == Duration::zeroDuration ) { rcps_job_successor_add( job, m_taskmap.key( static_cast( n ) ), type ); } else { // Add a dummy job to represent the lag struct rcps_job *dummy = addJob( r->lag().toString(), r->lag().seconds() / m_timeunit ); rcps_job_successor_add( job, dummy, type ); int t = type == SUCCESSOR_FINISH_FINISH ? type : SUCCESSOR_FINISH_START; rcps_job_successor_add( dummy, m_taskmap.key( static_cast( n ) ), t ); } } } void KPlatoRCPSScheduler::addDependenciesBackward( struct rcps_job *job, KPlato::Task *task ) { if ( task->dependParentNodes().isEmpty() && task->parentProxyRelations().isEmpty() ) { rcps_job_successor_add( job, m_jobend, SUCCESSOR_FINISH_START ); //debugPlan<"<dependChildNodes().isEmpty() && task->childProxyRelations().isEmpty() ) { rcps_job_successor_add( m_jobstart, job, SUCCESSOR_FINISH_START ); //debugPlan<"<dependParentNodes() ) { Node *n = r->parent(); if ( n == 0 || n->type() == Node::Type_Summarytask ) { continue; } int type = SUCCESSOR_FINISH_START; switch ( r->type() ) { case Relation::FinishStart: type = SUCCESSOR_FINISH_START; break; case Relation::FinishFinish: type = SUCCESSOR_FINISH_FINISH; break; case Relation::StartStart: type = SUCCESSOR_START_START; break; } if ( r->lag() == Duration::zeroDuration ) { rcps_job_successor_add( job, m_taskmap.key( static_cast( n ) ), type ); //debugPlan<"<( n ) ) )<lag().toString(), r->lag().seconds() / m_timeunit ); rcps_job_successor_add( job, dummy, type ); debugPlan<"<<"dummy lag"<( n ) ), t ); //debugPlan<<"dummy lag"<<"->"<( n ) ) )<parentProxyRelations() ) { Node *n = r->parent(); if ( n == 0 || n->type() == Node::Type_Summarytask ) { continue; } int type = SUCCESSOR_FINISH_START; switch ( r->type() ) { case Relation::FinishStart: type = SUCCESSOR_FINISH_START; break; case Relation::FinishFinish: type = SUCCESSOR_FINISH_FINISH; break; case Relation::StartStart: type = SUCCESSOR_START_START; break; } if ( r->lag() == Duration::zeroDuration ) { rcps_job_successor_add( job, m_taskmap.key( static_cast( n ) ), type ); //debugPlan<"<( n ) ) )<lag().toString(), r->lag().seconds() / m_timeunit ); rcps_job_successor_add( job, dummy, type ); debugPlan<"<<"dummy lag"<( n ) ), t ); //debugPlan<<"dummy lag"<<"->"<( n ) ) )< ::const_iterator it = m_taskmap.constBegin(); for ( ; it != m_taskmap.constEnd(); ++it ) { if ( m_backward ) { addDependenciesBackward( it.key(), it.value() ); } else { addDependenciesForward( it.key(), it.value() ); } } } void KPlatoRCPSScheduler::addRequests() { debugPlan; QMap ::const_iterator it = m_taskmap.constBegin(); for ( ; it != m_taskmap.constEnd(); ++it ) { addRequest( it.key(), it.value() ); } } void KPlatoRCPSScheduler::addRequest( rcps_job *job, Task *task ) { debugPlan; struct rcps_mode *mode = rcps_mode_new(); rcps_mode_add( job, mode ); // add a weight callback argument struct KPlatoRCPSScheduler::weight_info *wi = new KPlatoRCPSScheduler::weight_info; wi->self = this; wi->task = task; wi->targettime = 0; wi->isEndJob = false; wi->finish = 0; rcps_mode_set_weight_cbarg( mode, wi ); m_weight_info_list[ job ] = wi; if ( task->constraint() != Node::FixedInterval ) { if ( task->type() == Node::Type_Milestone || task->estimate() == 0 || ( m_recalculate && task->completion().isFinished() ) ) { rcps_mode_setduration(mode, 0); return; } if ( task->estimate()->type() == Estimate::Type_Duration && task->estimate()->calendar() == 0 ) { // Fixed duration, no duration callback needed rcps_mode_setduration(mode, task->estimate()->value( Estimate::Use_Expected, m_usePert ).seconds() / m_timeunit ); return; } } /* set the argument for the duration callback */ struct KPlatoRCPSScheduler::duration_info *info = new KPlatoRCPSScheduler::duration_info; info->self = this; info->calls = 0; info->task = task; if ( m_recalculate && task->completion().isStarted() ) { info->estimate = task->completion().remainingEffort(); } else { info->estimate = task->estimate()->value( Estimate::Use_Expected, m_usePert ); } info->requests = task->requests().resourceRequests(); // returns team members (not team resource itself) info->estimatetype = task->estimate()->type(); rcps_mode_set_cbarg( mode, info ); m_duration_info_list[ job ] = info; foreach ( ResourceRequest *rr, info->requests ) { Resource *r = rr->resource(); if ( r->type() == Resource::Type_Team ) { warnPlan<<"There should not be any request to a team resource:"<name(); continue; } struct rcps_request *req = rcps_request_new(); rcps_request_add( mode, req ); m_requestmap[ req ] = rr; struct rcps_alternative *alt = rcps_alternative_new(); rcps_alternative_setresource( alt, m_resourcemap.key( r ) ); rcps_alternative_setamount( alt, (double)rr->units() * 100 / r->units() ); rcps_alternative_add( req, alt ); } } void KPlatoRCPSScheduler::setConstraints() { for ( QMap::ConstIterator it = m_taskmap.constBegin(); it != m_taskmap.constEnd(); ++it ) { Task *task = it.value(); struct rcps_job *job = it.key(); struct weight_info *wi = m_weight_info_list.value( job ); struct duration_info *di = m_duration_info_list.value( job ); switch ( task->constraint() ) { case Node::MustStartOn: case Node::StartNotEarlier: wi->targettime = toRcpsTime( task->constraintStartTime() ); if ( m_backward ) { int d = 0; if ( di ) { // as m_backward == true, DURATION_BACKWARD in rcps means forward in plan d = duration( DURATION_BACKWARD, wi->targettime, 0, di ); } wi->targettime -= d; } rcps_job_setearliest_start( job, wi->targettime ); task->currentSchedule()->logDebug( QString( "%2 %3 %4: %5 (rcps=%6)") .arg( task->constraintToString() ) .arg( m_backward?"backward":"forward") .arg( task->constraintStartTime().toString() ) .arg( fromRcpsTime( wi->targettime ).toString() ) .arg( wi->targettime ) ); break; case Node::MustFinishOn: wi->targettime = toRcpsTime( task->constraintEndTime() ); if ( ! m_backward ) { int d = 0; if ( di ) { d = duration( DURATION_BACKWARD, wi->targettime, 0, di ); } rcps_job_setearliest_start( job, wi->targettime - d ); } break; case Node::FinishNotLater: wi->targettime = toRcpsTime( task->constraintEndTime() ); if ( m_backward ) { rcps_job_setearliest_start( job, wi->targettime ); } break; case Node::FixedInterval: wi->targettime = m_backward ? toRcpsTime( task->constraintEndTime() ) : toRcpsTime( task->constraintStartTime() ); rcps_job_setearliest_start( job, wi->targettime ); break; default: break; } } } void KPlatoRCPSScheduler::setWeights() { for ( QMap::ConstIterator it = m_taskmap.constBegin(); it != m_taskmap.constEnd(); ++it ) { Task *task = it.value(); struct rcps_job *job = it.key(); if ( m_backward ) { switch ( task->constraint() ) { case Node::ASAP: rcps_job_setweight( job, WEIGHT_ALAP ); break; case Node::ALAP: rcps_job_setweight( job, WEIGHT_ASAP ); break; case Node::StartNotEarlier: rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::MustStartOn: rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::FinishNotLater: rcps_job_setearliest_start( job, toRcpsTime( task->constraintEndTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::MustFinishOn: rcps_job_setearliest_start( job, toRcpsTime( task->constraintEndTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::FixedInterval: rcps_job_setearliest_start( job, toRcpsTime( task->constraintEndTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; default: rcps_job_setweight( job, WEIGHT_ASAP ); break; } } else { switch ( task->constraint() ) { case Node::ASAP: rcps_job_setweight( job, WEIGHT_ASAP ); break; case Node::ALAP: rcps_job_setweight( job, WEIGHT_ALAP ); break; case Node::StartNotEarlier: rcps_job_setearliest_start( job, toRcpsTime( task->constraintStartTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::MustStartOn: rcps_job_setearliest_start( job, toRcpsTime( task->constraintStartTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::FinishNotLater: rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::MustFinishOn: rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; case Node::FixedInterval: rcps_job_setearliest_start( job, toRcpsTime( task->constraintStartTime() ) ); rcps_job_setweight( job, WEIGHT_CONSTRAINT ); break; default: rcps_job_setweight( job, WEIGHT_ASAP ); break; } } } } diff --git a/src/plugins/schedulers/rcps/tests/CMakeLists.txt b/src/plugins/schedulers/rcps/tests/CMakeLists.txt index 08cbee26..d0cab67e 100644 --- a/src/plugins/schedulers/rcps/tests/CMakeLists.txt +++ b/src/plugins/schedulers/rcps/tests/CMakeLists.txt @@ -1,15 +1,15 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( .. ${KPLATO_INCLUDES} ${KOSTORE_INCLUDES}) +include_directories( .. ${PLAN_INCLUDES} ${KOSTORE_INCLUDES}) ########### next target ############### set(ProjectTester_SRCS ProjectTester.cpp ../KPlatoRCPSScheduler.cpp ../KPlatoRCPSPlugin.cpp) add_definitions(-DPLAN_NOPLUGIN) ecm_add_test( ${ProjectTester_SRCS} TEST_NAME "RCPSTester" NAME_PREFIX "plan-schedulers-rcps-" - LINK_LIBRARIES rcps_plan planprivate kplatokernel Qt5::Test + LINK_LIBRARIES rcps_plan planprivate plankernel Qt5::Test ) diff --git a/src/plugins/schedulers/tj/CMakeLists.txt b/src/plugins/schedulers/tj/CMakeLists.txt index 8f29a2f6..3d1101b7 100644 --- a/src/plugins/schedulers/tj/CMakeLists.txt +++ b/src/plugins/schedulers/tj/CMakeLists.txt @@ -1,61 +1,61 @@ add_definitions(-DTRANSLATION_DOMAIN=\"calligraplan_scheduler_tj\") set(LIBTJ_INCLUDE_DIR taskjuggler) include_directories(${LIBTJ_INCLUDE_DIR} ${PLANODF_INCLUDES} ${PLANKERNEL_INCLUDES}) #add_subdirectory( taskjuggler ) if(BUILD_TESTING) add_subdirectory( tests ) endif() set ( TJScheduler_SRCS PlanTJPlugin.cpp PlanTJScheduler.cpp taskjuggler/Allocation.cpp taskjuggler/CoreAttributes.cpp taskjuggler/CoreAttributesList.cpp taskjuggler/Project.cpp taskjuggler/Task.cpp taskjuggler/TaskDependency.cpp taskjuggler/TaskList.cpp taskjuggler/TaskScenario.cpp taskjuggler/Resource.cpp taskjuggler/ResourceList.cpp taskjuggler/Scenario.cpp taskjuggler/ScenarioList.cpp taskjuggler/Shift.cpp taskjuggler/ShiftList.cpp taskjuggler/ShiftSelection.cpp taskjuggler/ShiftSelectionList.cpp taskjuggler/VacationList.cpp taskjuggler/TjMessageHandler.cpp taskjuggler/Utility.cpp # taskjuggler/XMLFile.cpp # taskjuggler/ParserElement.cpp # taskjuggler/ParserNode.cpp # taskjuggler/ParserTreeContext.cpp taskjuggler/Interval.cpp ) # TODO: plugin should not be SHARED, but MODULE. Needs to be SHARED because tests link to it -> fix with util lib/objects add_library(plantjscheduler SHARED ${TJScheduler_SRCS} ) # calligraplan_scheduler_desktop_to_json(plantjscheduler plantjscheduler.desktop) if(${KF5_VERSION} VERSION_LESS "5.16.0") kcoreaddons_desktop_to_json(plantjscheduler plantjscheduler.desktop) else() kcoreaddons_desktop_to_json(plantjscheduler plantjscheduler.desktop SERVICE_TYPES ${PLAN_SOURCE_DIR}/libs/kernel/plan_schedulerplugin.desktop ) endif() # TODO: only export symbols for tests, not release generate_export_header(plantjscheduler BASE_NAME kplatotj) add_definitions(-Dplantjscheduler_EXPORTS) target_link_libraries( plantjscheduler - kplatokernel + plankernel ) -set_target_properties( plantjscheduler PROPERTIES DEFINE_SYMBOL MAKE_KPLATOTJ_LIB ) +set_target_properties( plantjscheduler PROPERTIES DEFINE_SYMBOL MAKE_PLANTJ_LIB ) install( TARGETS plantjscheduler DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/schedulers ) diff --git a/src/plugins/schedulers/tj/tests/CMakeLists.txt b/src/plugins/schedulers/tj/tests/CMakeLists.txt index 3842328f..2352bca2 100644 --- a/src/plugins/schedulers/tj/tests/CMakeLists.txt +++ b/src/plugins/schedulers/tj/tests/CMakeLists.txt @@ -1,24 +1,24 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( .. ../taskjuggler ${KPLATO_INCLUDES} ${KOSTORE_INCLUDES}) +include_directories( .. ../taskjuggler ${PLAN_INCLUDES} ${KOSTORE_INCLUDES}) # call: planschedulers_tj_add_unit_test( LINK_LIBRARIES [ [...]] [GUI]) macro(PLANSCHEDULERS_TJ_ADD_UNIT_TEST _TEST_NAME) ecm_add_test( ${ARGN} TEST_NAME "${_TEST_NAME}" NAME_PREFIX "plan-schedulers-tj-" ) endmacro() ########### next target ############### planschedulers_tj_add_unit_test(TJTester TaskJuggler.cpp - LINK_LIBRARIES plantjscheduler planprivate kplatokernel Qt5::Test + LINK_LIBRARIES plantjscheduler planprivate plankernel Qt5::Test ) ########### next target ############### planschedulers_tj_add_unit_test(SchedulerTester SchedulerTester.cpp - LINK_LIBRARIES plantjscheduler planprivate kplatokernel planodf Qt5::Test + LINK_LIBRARIES plantjscheduler planprivate plankernel planodf Qt5::Test ) diff --git a/src/plugins/scripting/CMakeLists.txt b/src/plugins/scripting/CMakeLists.txt index 0be92d6b..1415f94b 100644 --- a/src/plugins/scripting/CMakeLists.txt +++ b/src/plugins/scripting/CMakeLists.txt @@ -1,49 +1,49 @@ add_definitions(-DTRANSLATION_DOMAIN=\"krossmoduleplan\") include_directories( ${PLAN_SOURCE_DIR} - ${KPLATO_INCLUDES} + ${PLAN_INCLUDES} ${PLANKROSS_INCLUDES} ) add_subdirectory( scripts ) if(BUILD_TESTING) add_subdirectory( tests ) endif() set(krossmoduleplan_PART_SRCS Account.cpp Calendar.cpp Node.cpp Resource.cpp ResourceGroup.cpp Schedule.cpp Project.cpp Module.cpp ScriptingPart.cpp ScriptingWidgets.cpp ScriptingDebug.cpp ) ki18n_wrap_ui(krossmoduleplan_PART_SRCS ScriptingDataQueryView.ui ) # TODO: plugin should not be SHARED, but MODULE. Needs to be SHARED because tests link to it -> fix with util lib/objects add_library(krossmoduleplan SHARED ${krossmoduleplan_PART_SRCS}) generate_export_header(krossmoduleplan - BASE_NAME kplatoscripting - EXPORT_FILE_NAME kplatoscripting_generated_export.h + BASE_NAME planscripting + EXPORT_FILE_NAME planscripting_generated_export.h ) calligraplan_viewplugin_desktop_to_json(krossmoduleplan planscripting.desktop) target_link_libraries(krossmoduleplan planprivate - kplatokernel - kplatomodels + plankernel + planmodels planmain plankross ) install(TARGETS krossmoduleplan DESTINATION ${PLUGIN_INSTALL_DIR}/calligraplan/extensions) install(FILES scripting.rc DESTINATION ${DATA_INSTALL_DIR}/calligraplan/viewplugins) diff --git a/src/plugins/scripting/tests/CMakeLists.txt b/src/plugins/scripting/tests/CMakeLists.txt index 4d27e6f1..2de0ad17 100644 --- a/src/plugins/scripting/tests/CMakeLists.txt +++ b/src/plugins/scripting/tests/CMakeLists.txt @@ -1,20 +1,20 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( .. ${KPLATO_INCLUDES} ${KOKROSS_INCLUDES} ${KOSTORE_INCLUDES}) +include_directories( .. ${PLAN_INCLUDES} ${KOKROSS_INCLUDES} ${KOSTORE_INCLUDES}) add_definitions(-DFILES_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}") ########### next target ############### set (ScriptingTester_SRCS ScriptingTester.cpp TestResult.cpp) ecm_add_test( ${ScriptingTester_SRCS} TEST_NAME ScriptingTester NAME_PREFIX "plan-" LINK_LIBRARIES krossmoduleplan planprivate - kplatokernel + plankernel plankross Qt5::Test ) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 20eaf666..9360d66f 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,35 +1,35 @@ set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) -include_directories( .. ${KPLATO_INCLUDES}) +include_directories( .. ${PALN_INCLUDES}) # call: plan_add_unit_test( LINK_LIBRARIES [ [...]] [GUI]) macro(PLAN_ADD_UNIT_TEST _TEST_NAME) ecm_add_test( ${ARGN} TEST_NAME "${_TEST_NAME}" NAME_PREFIX "plan-" ) endmacro() ########### test files ############### set(test_files version-0-6.kplato project_stats1.kplato pert1.kplato) foreach(it ${test_files}) add_custom_target(${it} ALL COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${it} ${CMAKE_CURRENT_BINARY_DIR}/${it} COMMENT "Copy test file ${it}" VERBATIM ) endforeach(it) ########### next target ############### # NOTE: .kplato files is no longer native, so need some magic to run this test # plan_add_unit_test(InsertFileTester # InsertFileTester.cpp -# LINK_LIBRARIES planprivate kplatokernel komain Qt5::Test +# LINK_LIBRARIES planprivate plankernel komain Qt5::Test # ) ########## next target ############### plan_add_unit_test(InsertProjectTester InsertProjectTester.cpp - LINK_LIBRARIES planprivate kplatokernel planmain Qt5::Test + LINK_LIBRARIES planprivate plankernel planmain Qt5::Test ) diff --git a/src/workpackage/CMakeLists.txt b/src/workpackage/CMakeLists.txt index eed68c3b..09ca86b7 100644 --- a/src/workpackage/CMakeLists.txt +++ b/src/workpackage/CMakeLists.txt @@ -1,121 +1,121 @@ #project(planwork) add_definitions(-DTRANSLATION_DOMAIN=\"calligraplanwork\") add_subdirectory( templates ) add_subdirectory( pics ) #add_subdirectory( toolbar ) #add_subdirectory( tests ) -include_directories(${KPLATO_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/) +include_directories(${PLAN_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/) -########### KPlatoWork private library ############### +########### PlanWork private library ############### set(planworkfactory_LIB_SRCS factory.cpp mainwindow.cpp part.cpp view.cpp workpackage.cpp taskworkpackagemodel.cpp taskworkpackageview.cpp packagesettings.cpp taskcompletiondialog.cpp debugarea.cpp ../KPlatoXmlLoader.cpp #NB ) ki18n_wrap_ui(planworkfactory_LIB_SRCS packagesettings.ui taskcompletionpanel.ui ) kconfig_add_kcfg_files(planworksettings_SRCS calligraplanworksettings.kcfgc) add_library(planworkfactory SHARED ${planworkfactory_LIB_SRCS} ${planworksettings_SRCS}) -generate_export_header(planworkfactory BASE_NAME kplatowork) +generate_export_header(planworkfactory BASE_NAME planwork) target_link_libraries(planworkfactory PUBLIC - kplatokernel - kplatomodels - kplatoui + plankernel + planmodels + planui planprivate planmain KGantt KF5::Parts PRIVATE KF5::IconThemes ) set_target_properties(planworkfactory PROPERTIES VERSION ${GENERIC_PLAN_LIB_VERSION} SOVERSION ${GENERIC_PLAN_LIB_SOVERSION} ) install(TARGETS planworkfactory ${INSTALL_TARGETS_DEFAULT_ARGS}) install(FILES calligraplanworksettings.kcfg DESTINATION ${KCFG_INSTALL_DIR}) -########### KPlatoWork part ############### +########### PlanWork part ############### set(planworkpart_PART_SRCS factoryinit.cpp ) add_library(calligraplanworkpart MODULE ${planworkpart_PART_SRCS}) if(NOT ${KF5_VERSION} VERSION_LESS "5.16.0") set(calligraplanworkpart_SERVICE_TYPES_ARGS SERVICE_TYPES kpart.desktop) endif() kcoreaddons_desktop_to_json(calligraplanworkpart planworkpart.desktop ${calligraplanworkpart_SERVICE_TYPES_ARGS} ) target_link_libraries(calligraplanworkpart Qt5::Core KF5::Parts planworkfactory) install(TARGETS calligraplanworkpart DESTINATION ${PLUGIN_INSTALL_DIR}) ########### Calligra PlanWork executable ############### set(calligraplanwork_KDEINIT_SRCS main.cpp commandlineparser.cpp) file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/pics/*-apps-calligraplanwork.png") ecm_add_app_icon(kdeinit_app_ICONS_SRCS ICONS ${ICONS_SRCS}) if(WIN32) set(_resourcefile "${CMAKE_CURRENT_BINARY_DIR}/kdeinit_app_ICONS_SRCS.rc") endif() kf5_add_kdeinit_executable(calligraplanwork ${calligraplanwork_KDEINIT_SRCS}) if (APPLE) set_target_properties(calligraplanwork PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.template) set_target_properties(calligraplanwork PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.calligra.plan.work") set_target_properties(calligraplanwork PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Plan Work") endif () target_link_libraries( kdeinit_calligraplanwork planworkfactory - kplatokernel + plankernel planmain KF5::Parts KF5::IconThemes KF5::WindowSystem KF5::DBusAddons ) install(TARGETS kdeinit_calligraplanwork ${INSTALL_TARGETS_DEFAULT_ARGS}) target_link_libraries( calligraplanwork kdeinit_calligraplanwork ) install(TARGETS calligraplanwork ${INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### install( FILES calligraplanwork.rc calligraplanwork_readonly.rc calligraplanworkui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/calligraplanwork) install( FILES calligraplanworkrc DESTINATION ${CONFIG_INSTALL_DIR}) install( PROGRAMS org.kde.calligraplanwork.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})