diff --git a/CalligraProducts.cmake b/CalligraProducts.cmake index 4abddc24e32..c76eadfda74 100644 --- a/CalligraProducts.cmake +++ b/CalligraProducts.cmake @@ -1,718 +1,718 @@ ### DEFINITION OF PRODUCTS, FEATURES AND PRODUCTSETS #################################################### # When building Calligra a lot of different things are created and installed. To # describe them and their internal dependencies the concepts of "product", # "feature" and "product set" are used. # A "product" is the smallest functional unit which can be created in the build # and which is useful on its own when installed. Examples are e.g. libraries, # plugins or executables. Products have external and internal required # dependencies at build-time. Internal dependencies are noted in terms of other # products or features (see below) and could be e.g. other libraries to link # against or build tools needed to generate source files. # A product gets defined by setting an identifier, a descriptive fullname and # the needed internal build-time requirements. Any other product or feature # listed as requirement must have been defined before. # A "feature" is not a standalone product, but adds abilities to one or multiple # given products. One examples is e.g. scriptability. Features have external and # internal required dependencies at build-time. Internal dependencies are noted # in terms of other products or features and could be e.g. other libraries to # link against or build tools needed to generate source files. # A feature gets defined by setting an identifier, a descriptive fullname and # the needed internal build-time requirements. Any other product or feature # listed as requirement must have been defined before. # A "productset" is a selection of products and features which should be build # together. The products and features can be either essential or optional to the # set. If essential (REQUIRES), the whole productset will not be build if a # product or feature is missing another internal or external dependency. If # optional (OPTIONAL), the rest of the set will still be build in that case. # The products and features to include in a set can be listed directly or # indirectly: they can be named explicitely, but also by including other # productsets in a set, whose products and features will then be part of the # first set as well. # Products, features and productsets can be listed as dependencies in multiple # product sets. As with dependencies for products or features, they must have # been defined before. # Products, features and product sets are in the same namespace, so a given # identifier can be only used either for a product or for a feature or for a # product set. # The ids of products and features (but not sets) are used to generate cmake # variables SHOULD_BUILD_${ID}, which then are used to control what is build and # how. ############################################# #### Product definitions #### ############################################# # For defining new products see end of this file, "How to add another product?" # IDEA: also add headers/sdk for all the libs ("_DEVEL"?) # IDEA: note external deps for products, so they are only checked if needed # There can be required or optional external deps, required will also result # in automatic disabling of product building # TODO: some products have multiple optional requirements, but need at least one. # See APP_CONVERTER, FILEMANAGER_* # building tools calligra_define_product(BUILDTOOL_RNG2CPP "rng2cpp") # Calligra-independent utility libs calligra_define_product(LIB_KOVECTORIMAGE "libkovectorimage") # calligra libs calligra_define_product(LIB_CALLIGRA "Calligra core libs" REQUIRES BUILDTOOL_RNG2CPP) calligra_define_product(LIB_KOMAIN "Lib for one-file-per-window apps" REQUIRES LIB_CALLIGRA) calligra_define_product(LIB_KOPAGEAPP "Lib for paged documents" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(LIB_KOODF2 "libkoodf2" REQUIRES LIB_CALLIGRA) calligra_define_product(LIB_KOODFREADER "libkoodfreader" REQUIRES LIB_KOODF2 LIB_CALLIGRA) calligra_define_product(LIB_MSO "libmso" REQUIRES LIB_CALLIGRA) calligra_define_product(LIB_KOMSOOXML "libkomsooxml" REQUIRES LIB_CALLIGRA LIB_KOODF2 LIB_KOMAIN) # features calligra_define_feature(FEATURE_SCRIPTING "Scripting feature" UNPORTED) # TODO calligra_define_feature(FEATURE_RDF "RDF feature") # plugins calligra_define_product(PLUGIN_TEXTSHAPE "Text shape plugin" REQUIRES LIB_CALLIGRA) # parts calligra_define_product(PART_WORDS "Words engine" REQUIRES LIB_CALLIGRA LIB_KOMAIN PLUGIN_TEXTSHAPE) calligra_define_product(PART_STAGE "Stage engine" REQUIRES LIB_CALLIGRA LIB_KOMAIN LIB_KOPAGEAPP) calligra_define_product(PART_SHEETS "Sheets engine" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(PART_QTQUICK "QtQuick Plugin that provides Calligra components" REQUIRES PART_WORDS PART_STAGE)# SHEETS_PART) # apps calligra_define_product(APP_WORDS "Words app (for Desktop)" REQUIRES PART_WORDS) calligra_define_product(APP_STAGE "Stage app (for Desktop)" REQUIRES PART_STAGE) calligra_define_product(APP_SHEETS "Sheets app (for Desktop)" REQUIRES PART_SHEETS) calligra_define_product(APP_AUTHOR "Author app (for Desktop)" REQUIRES PART_WORDS) calligra_define_product(APP_KARBON "Karbon app (for Desktop)" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(APP_KRITA "Krita app (for Desktop)" REQUIRES LIB_CALLIGRA) calligra_define_product(APP_KEXI "Kexi app (for Desktop)" REQUIRES LIB_CALLIGRA) calligra_define_product(APP_FLOW "Flow app (for Desktop)" UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN LIB_KOPAGEAPP) calligra_define_product(APP_PLAN "Plan app (for Desktop)" REQUIRES LIB_CALLIGRA LIB_KOMAIN) -calligra_define_product(APP_BRAINDUMP "Braindump app (for Desktop)" UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN) +calligra_define_product(APP_BRAINDUMP "Braindump app (for Desktop)" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(APP_GEMINI "The Calligra Gemini application" REQUIRES PART_QTQUICK) # TODO: this needs to be split up by app products calligra_define_product(DOC "Calligra Documentations" UNPORTED) # extras calligra_define_product(APP_CONVERTER "Format converter for commandline" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(FILEMANAGER_PROPERTIES "Plugin for the KDE file properties dialog" REQUIRES LIB_CALLIGRA) calligra_define_product(FILEMANAGER_THUMBNAIL "Plugins for KDE filesystem thumbnailing" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(FILEMANAGER_QUICKPRINT "Plugin for the filemanager adding a \"Print\" action") calligra_define_product(FILEMANAGER_TEMPLATES "File templates for filemanager") calligra_define_product(OKULAR_GENERATOR_ODP "Plugin for Okular adding support for ODP" REQUIRES PART_STAGE) calligra_define_product(OKULAR_GENERATOR_ODT "Plugin for Okular adding support for ODT" REQUIRES PART_WORDS) # more plugins calligra_define_product(PLUGIN_COLORENGINES "Colorengine plugins" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_MUSICSHAPE "Music shape plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_SPACENAVIGATOR "SpaceNavigator input plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_ARTISTICTEXTSHAPE "Artistic shape plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_DOCKERS "Default dockers plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_TEXTEDITING "Textediting plugins" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_KEXI_SPREADSHEETMIGRATION "Import from ODS plugin for Kexi" UNPORTED REQUIRES APP_KEXI PART_SHEETS) calligra_define_product(PLUGIN_DEFAULTTOOLS "Default Flake tools plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_PATHSHAPES "Path shape plugins" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_VARIABLES "Text variables plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_CHARTSHAPE "Chart shape plugin" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(PLUGIN_PICTURESHAPE "Picture shape plugin" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_PLUGINSHAPE "Plugin shape plugin" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(PLUGIN_FORMULASHAPE "Formula shape plugin" REQUIRES LIB_CALLIGRA LIB_KOMAIN) calligra_define_product(PLUGIN_VIDEOSHAPE "Plugin for handling videos in Calligra" REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_VECTORSHAPE "Vectorgraphic shape plugin" REQUIRES LIB_CALLIGRA LIB_KOVECTORIMAGE) calligra_define_product(PLUGIN_SEMANTICITEMS "Semantic items plugins" REQUIRES FEATURE_RDF LIB_CALLIGRA) calligra_define_product(PLUGIN_CALLIGRAGEMINI_GIT "Git support plugin for Calligra Gemini" UNPORTED) # staging plugins calligra_define_product(PLUGIN_THREEDSHAPE "3D shape plugin" STAGING REQUIRES LIB_CALLIGRA) # Sheets filters calligra_define_product(FILTER_XLSX_TO_ODS "XLSX to ODS filter" REQUIRES LIB_KOMSOOXML PART_SHEETS) calligra_define_product(FILTER_XLS_TO_SHEETS "Sheets XLS import filter" REQUIRES LIB_MSO LIB_KOMSOOXML PART_SHEETS) calligra_define_product(FILTER_SHEETS_TO_XLS "Sheets XLS export filter" REQUIRES LIB_MSO LIB_KOMSOOXML PART_SHEETS) calligra_define_product(FILTER_CSV_TO_SHEETS "Sheets CSV import filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_SHEETS_TO_CSV "Sheets CSV export filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_APPLIXSPREAD_TO_KSPREAD "Applix Spreadsheet to KSpread filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_DBASE_TO_KSPREAD "dBASE to KSpread filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_GNUMERIC_TO_SHEETS "Sheets GNUMERIC import filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_SHEETS_TO_GNUMERIC "Sheets GNUMERIC import filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_OPENCALC_TO_SHEETS "Sheets OpenOffice.org Calc import filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_SHEETS_TO_OPENCALC "Sheets OpenOffice.org Calc export filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_QUATTROPRO_TO_SHEETS "Sheets Quattro Pro import filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_HTML_TO_ODS "HTML to ODS filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_SHEETS_TO_HTML "Sheets HTML export filter" REQUIRES PART_SHEETS) calligra_define_product(FILTER_KSPREAD_TO_LATEX "KSpread to LaTeX filter" REQUIRES LIB_KOMAIN) # Flow filters calligra_define_product(FILTER_VISIO_TO_ODG "Visio to ODG filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_WPG_TO_ODG "WPG to ODG filter" REQUIRES LIB_KOMAIN) # Stage filters calligra_define_product(FILTER_KEY_TO_ODP "Apple Keynote to ODP filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_KPR_TO_ODP "KPresenter to ODP filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_PPT_TO_ODP "PPT to OPD filter" REQUIRES LIB_MSO LIB_KOMAIN) calligra_define_product(FILTER_PPTX_TO_ODP "PPTX to ODP filter" REQUIRES LIB_KOMSOOXML LIB_KOODF2 LIB_KOMAIN) # Words filters calligra_define_product(FILTER_DOC_TO_ODT "DOC to ODT filter" REQUIRES LIB_MSO LIB_KOMSOOXML LIB_KOMAIN) calligra_define_product(FILTER_DOCX_TO_ODT "DOCX to ODT filter" REQUIRES LIB_KOMSOOXML LIB_KOODF2 LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_DOCX "ODT to DOCX filter" REQUIRES LIB_KOODFREADER LIB_KOODF2 LIB_KOMAIN) calligra_define_product(FILTER_WORDPERFECT_TO_ODT "Word Perfect to ODT filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_WORKS_TO_ODT "MS Works to ODT filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_APPLIXWORD_TO_ODT "Applixword to ODT filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_ASCII_TO_WORDS "Words ASCII import filter" REQUIRES PART_WORDS LIB_KOODF2 LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_ASCII "ODT to ASCII filter" REQUIRES LIB_KOODFREADER LIB_KOMAIN) calligra_define_product(FILTER_RTF_TO_ODT "RTF to ODT filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_MOBI "Mobi export filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_EPUB2 "ODT Epub2 export filter" REQUIRES LIB_KOVECTORIMAGE LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_HTML "ODT HTML export filter" REQUIRES LIB_KOVECTORIMAGE LIB_KOMAIN) calligra_define_product(FILTER_ODT_TO_WIKI "ODT Wiki export filter" REQUIRES LIB_KOODFREADER LIB_KOODF2 LIB_KOMAIN) # Plan filters calligra_define_product(FILTER_MPXJ_IMPORT "MS Project import filter" UNPORTED REQUIRES APP_PLAN) # Karbon filters calligra_define_product(FILTER_EPS_TO_SVG_AI "EPS to SVG/AI filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_XFIG_TO_ODG "XFig to ODG filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_PDF_TO_SVG "PDF to SVG filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_WPG_TO_SVG "WPG to SVG filter" REQUIRES LIB_KOMAIN) calligra_define_product(FILTER_KARBON_TO_IMAGE "Karbon image export filter" REQUIRES APP_KARBON) calligra_define_product(FILTER_KARBON_TO_SVG "Karbon SVG export filter" REQUIRES APP_KARBON) calligra_define_product(FILTER_SVG_TO_KARBON "Karbon SVG import filter" REQUIRES APP_KARBON) calligra_define_product(FILTER_KARBON_TO_WMF "Karbon WMF export filter" REQUIRES APP_KARBON) calligra_define_product(FILTER_WMF_TO_SVG "WMF to SVG filter" REQUIRES LIB_KOVECTORIMAGE LIB_KOMAIN) calligra_define_product(FILTER_KARBON1X_TO_KARBON "Karbon 1.x import filter" REQUIRES APP_KARBON) # meta apps calligra_define_product(APP_ACTIVE "Calligra Active app" UNPORTED REQUIRES PART_SHEETS PART_STAGE PART_WORDS) calligra_define_product(APP_CALLIGRA "General Calligra app starter" REQUIRES LIB_CALLIGRA LIB_KOMAIN) # more extras calligra_define_product(OKULAR_GENERATOR_PPT "Plugin for Okular extended with support for PPT" REQUIRES OKULAR_GENERATOR_ODP FILTER_PPT_TO_ODP) calligra_define_product(OKULAR_GENERATOR_PPTX "Plugin for Okular extended with support for PPTX" REQUIRES OKULAR_GENERATOR_ODP FILTER_PPTX_TO_ODP) calligra_define_product(OKULAR_GENERATOR_DOC "Plugin for Okular extended with support for DOC" REQUIRES OKULAR_GENERATOR_ODT FILTER_DOC_TO_ODT) calligra_define_product(OKULAR_GENERATOR_DOCX "Plugin for Okular extended with support for DOCX" REQUIRES OKULAR_GENERATOR_ODT FILTER_DOCX_TO_ODT) calligra_define_product(OKULAR_GENERATOR_WORDPERFECT "Plugin for Okular extended with support for WORDPERFECT" REQUIRES OKULAR_GENERATOR_ODT FILTER_WORDPERFECT_TO_ODT) # developer utils calligra_define_product(APP_DEVTOOLS "Tools for developers") calligra_define_product(APP_CSTESTER "cstester" REQUIRES PART_SHEETS PART_STAGE PART_WORDS) ############################################# #### Product set definitions #### ############################################# # For defining new productsets see end of this file, # "How to add another productset?" # filter sets calligra_define_productset(FILTERS_SHEETS_IMPORT "All Sheets import filters" OPTIONAL FILTER_XLSX_TO_ODS FILTER_XLS_TO_SHEETS FILTER_CSV_TO_SHEETS FILTER_APPLIXSPREAD_TO_KSPREAD FILTER_DBASE_TO_KSPREAD FILTER_GNUMERIC_TO_SHEETS FILTER_OPENCALC_TO_SHEETS FILTER_QUATTROPRO_TO_SHEETS FILTER_HTML_TO_ODS ) calligra_define_productset(FILTERS_SHEETS_EXPORT "All Sheets export filters" OPTIONAL FILTER_SHEETS_TO_XLS FILTER_SHEETS_TO_CSV FILTER_SHEETS_TO_GNUMERIC FILTER_SHEETS_TO_OPENCALC FILTER_SHEETS_TO_HTML FILTER_KSPREAD_TO_LATEX ) calligra_define_productset(FILTERS_SHEETS "All Sheets filters" OPTIONAL FILTERS_SHEETS_IMPORT FILTERS_SHEETS_EXPORT ) calligra_define_productset(FILTERS_FLOW_IMPORT "All Flow import filters" OPTIONAL FILTER_VISIO_TO_ODG FILTER_WPG_TO_ODG ) #calligra_define_productset(FILTERS_FLOW_EXPORT "All Flow export filters" OPTIONAL ) noone currently calligra_define_productset(FILTERS_FLOW "All Flow filters" OPTIONAL FILTERS_FLOW_IMPORT # FILTERS_FLOW_EXPORT ) calligra_define_productset(FILTERS_STAGE_IMPORT "All Stage import filters" OPTIONAL FILTER_KEY_TO_ODP FILTER_KPR_TO_ODP FILTER_PPT_TO_ODP FILTER_PPTX_TO_ODP ) #calligra_define_productset(FILTERS_STAGE_EXPORT "All Stage export filters" OPTIONAL ) noone currently calligra_define_productset(FILTERS_STAGE "All Stage filters" OPTIONAL FILTERS_STAGE_IMPORT # FILTERS_STAGE_EXPORT ) calligra_define_productset(FILTERS_WORDS_IMPORT "All Words import filters" OPTIONAL FILTER_DOC_TO_ODT FILTER_DOCX_TO_ODT FILTER_WORDPERFECT_TO_ODT FILTER_WORKS_TO_ODT FILTER_APPLIXWORD_TO_ODT FILTER_ASCII_TO_WORDS FILTER_RTF_TO_ODT ) calligra_define_productset(FILTERS_WORDS_EXPORT "All Words export filters" OPTIONAL FILTER_ODT_TO_ASCII FILTER_ODT_TO_MOBI FILTER_ODT_TO_EPUB2 FILTER_ODT_TO_HTML FILTER_ODT_TO_DOCX FILTER_ODT_TO_WIKI ) calligra_define_productset(FILTERS_WORDS "All Words filters" OPTIONAL FILTERS_WORDS_IMPORT FILTERS_WORDS_EXPORT ) calligra_define_productset(FILTERS_PLAN "All Plan filters" OPTIONAL FILTER_MPXJ_IMPORT ) calligra_define_productset(FILTERS_KARBON_IMPORT "All Karbon import filters" OPTIONAL FILTER_EPS_TO_SVG_AI FILTER_XFIG_TO_ODG FILTER_PDF_TO_SVG FILTER_WPG_TO_SVG FILTER_SVG_TO_KARBON FILTER_WMF_TO_SVG FILTER_KARBON1X_TO_KARBON ) calligra_define_productset(FILTERS_KARBON_EXPORT "All Karbon export filters" OPTIONAL FILTER_KARBON_TO_IMAGE FILTER_KARBON_TO_SVG FILTER_KARBON_TO_WMF ) calligra_define_productset(FILTERS_KARBON "All Karbon filters" OPTIONAL FILTERS_KARBON_IMPORT FILTERS_KARBON_EXPORT ) # filemanager calligra_define_productset(FILEMANAGER "Extensions for the filemanager" OPTIONAL FILEMANAGER_PROPERTIES FILEMANAGER_QUICKPRINT FILEMANAGER_TEMPLATES FILEMANAGER_THUMBNAIL ) # apps calligra_define_productset(ACTIVE "Full Calligra Active" REQUIRES APP_ACTIVE OPTIONAL # extras FILEMANAGER_PROPERTIES FILEMANAGER_THUMBNAIL # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE PLUGIN_VIDEOSHAPE # filters FILTERS_SHEETS_IMPORT FILTERS_STAGE_IMPORT FILTERS_WORDS_IMPORT ) calligra_define_productset(AUTHOR "Full Author (for Desktop)" REQUIRES APP_AUTHOR OPTIONAL # extras FILEMANAGER # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_SEMANTICITEMS PLUGIN_VARIABLES PLUGIN_VECTORSHAPE # filters FILTERS_WORDS ) calligra_define_productset(BRAINDUMP "Full Braindump (for Desktop)" REQUIRES APP_BRAINDUMP OPTIONAL # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_MUSICSHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_THREEDSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE PLUGIN_VIDEOSHAPE ) calligra_define_productset(FLOW "Full Flow (for Desktop)" REQUIRES APP_FLOW OPTIONAL # extras FILEMANAGER # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE # filters FILTERS_FLOW ) calligra_define_productset(KARBON "Full Karbon (for Desktop)" REQUIRES APP_KARBON OPTIONAL # extras FILEMANAGER # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE # filters FILTERS_KARBON ) calligra_define_productset(KEXI "Full Kexi (for Desktop)" REQUIRES APP_KEXI OPTIONAL FEATURE_SCRIPTING PLUGIN_KEXI_SPREADSHEETMIGRATION ) calligra_define_productset(KRITA "Full Krita" REQUIRES APP_KRITA OPTIONAL # extras FILEMANAGER_PROPERTIES FILEMANAGER_QUICKPRINT # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_COLORENGINES PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_SPACENAVIGATOR PLUGIN_VECTORSHAPE ) calligra_define_productset(PLAN "Full Plan (for Desktop)" REQUIRES APP_PLAN OPTIONAL FEATURE_SCRIPTING FILTERS_PLAN ) calligra_define_productset(SHEETS "Full Sheets (for Desktop)" REQUIRES APP_SHEETS OPTIONAL # extras FILEMANAGER # feature FEATURE_SCRIPTING # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE # filters FILTERS_SHEETS ) calligra_define_productset(STAGE "Full Stage (for Desktop)" REQUIRES APP_STAGE OPTIONAL # extras FILEMANAGER # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE PLUGIN_VIDEOSHAPE # filters FILTERS_STAGE ) calligra_define_productset(WORDS "Full Words (for Desktop)" REQUIRES APP_WORDS OPTIONAL # extras FILEMANAGER # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_SEMANTICITEMS PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE # filters FILTERS_WORDS ) calligra_define_productset(GEMINI "Calligra for 2:1 devices" REQUIRES APP_GEMINI OPTIONAL # plugins PLUGIN_ARTISTICTEXTSHAPE PLUGIN_CALLIGRAGEMINI_GIT PLUGIN_CHARTSHAPE PLUGIN_DEFAULTTOOLS PLUGIN_DOCKERS PLUGIN_FORMULASHAPE PLUGIN_PATHSHAPES PLUGIN_PICTURESHAPE PLUGIN_PLUGINSHAPE PLUGIN_TEXTEDITING PLUGIN_TEXTSHAPE PLUGIN_VARIABLES PLUGIN_VECTORSHAPE PLUGIN_VIDEOSHAPE # filters FILTERS_WORDS FILTERS_STAGE ) # okular support calligra_define_productset(OKULAR "Okular generators" OPTIONAL OKULAR_GENERATOR_ODP OKULAR_GENERATOR_PPT OKULAR_GENERATOR_PPTX OKULAR_GENERATOR_ODT OKULAR_GENERATOR_DOC OKULAR_GENERATOR_DOCX OKULAR_GENERATOR_WORDPERFECT ) # How to add another product? # =========================== # # 1. Define the product by a call of calligra_define_product, # e.g. # # calligra_define_product(MYPRODUCT "title of product") # # For the product id use a proper prefix (LIB_, PLUGIN_, FILTER_, APP_, PART_, # ...), whatever is appropriate. # # 2. Extend that call with a REQUIRES argument section, if the product has # hard internal build-time dependencies on other products or features. # Products/features that are listed as dependencies have to be defined before # (see also the API doc in cmake/modules/CalligraProductSetMacros.cmake) # E.g. # # calligra_define_product(MYPRODUCT "title of product" REQUIRES P1 P2) # # 3. Add a rule when to not build the product, in the section "Detect which # products/features can be compiled" of the toplevel CMakeLists.txt. Each # product should have their own boolean expression when to set the build flag # to FALSE, e.g. # # if (PLATFORMX OR NOT EXTERNAL_DEP_X_FOUND) # set(SHOULD_BUILD_MYPRODUCT FALSE) # endif () # # 4. Wrap everything belonging to the product with the build flag of the product. # Ideally this is done around subdirectory inclusions, results in easier code. # e.g. # # if (SHOULD_BUILD_MYPRODUCT) # add_subdirectory(myproduct) # endif () # # 5. Tag the product as STAGING, if it is not yet ready for release, but already # integrated in the master branch, e.g. # # calligra_define_product(MYPRODUCT "title of product" STAGING REQUIRES P1) # # 6. Add the product to all products, features and product sets which have this # product as REQUIRED or OPTIONAL dependency. # # # How to add another feature? # =========================== # # 1. Define the feature by a call of calligra_define_feature, # e.g. # # calligra_define_feature(MYFEATURE "title of feature") # # For the feature id use a proper prefix (FEATURE_, ...), whatever is # appropriate. # # 2. Extend that call with a REQUIRES argument section, if the feature has # hard internal build-time dependencies on other products or features. # Products or features that are listed as dependencies have to be defined # before # (see also the API doc in cmake/modules/CalligraProductSetMacros.cmake) # E.g. # # calligra_define_feature(MYFEATURE "title of feature" REQUIRES P1 F1) # # 3. Add a rule when to not build the feature, in the section "Detect which # products/features can be compiled" of the toplevel CMakeLists.txt. Each # feature should have their own boolean expression when to set the build flag # to FALSE, e.g. # # if (PLATFORMX OR NOT EXTERNAL_DEP_X_FOUND) # set(SHOULD_BUILD_MYFEATURE FALSE) # endif () # # 4. Wrap everything belonging to the feature with the build flag of the feature. # Ideally this is done around subdirectory inclusions, results in easier code. # e.g. # # if (SHOULD_BUILD_MYFEATURE) # add_subdirectory(myproduct) # endif () # # 5. Tag the feature as STAGING, if it is not yet ready for release, but already # integrated in the master branch, e.g. # # calligra_define_product(MYFEATURE "title of feature" STAGING REQUIRES P1 F1) # # 6. Add the feature to all products, features and product sets which have this # product as REQUIRED or OPTIONAL dependency. # # # How to add another productset? # ============================== # # There are two possible places to put a productset definition. The first is to # add it to this file, which should be done for more generic sets that are # useful for many people. The second is a file of its own, in the directory # "cmake/productsets", which should be done for more special ones or for those # which should not be added to the repository. # The file must be named with the name of the productset in lowercase and have # the extension ".cmake". # # 1. Define the productset by a call of calligra_define_productset, # e.g. # # calligra_define_productset(MYPRODUCTSET "title of productset") # # 2. Extend that call with REQUIRES or OPTIONAL argument sections, if the productset # has hard or soft internal dependencies on other products, features or # productsets. # Products, features or productsets that are listed as dependencies have to # be defined before # (see also the API doc in cmake/modules/CalligraProductSetMacros.cmake) # E.g. # # calligra_define_productset(MYPRODUCT "title of product" # REQUIRES P1 P2 F1 PS1 # OPTIONAL P3 F2 PS2) # # 3. Add the productset to all product sets which have this product set as # REQUIRED or OPTIONAL dependency. # # Example for a file-based productset definition: # You want a productset "MYWORDS". For that you add a file named # "mywords.cmake" into the directory "cmake/productsets", with the content: # --- 8< --- # calligra_define_productset(MYWORDS "My Words" # REQUIRES # APP_WORDS # PLUGIN_DEFAULTTOOLS # PLUGIN_DOCKERS # PLUGIN_PATHSHAPES # PLUGIN_VARIABLES # PLUGIN_TEXTSHAPE # PLUGIN_PLUGINSHAPE # PLUGIN_FORMULASHAPE # ) # --- 8< --- diff --git a/braindump/braindumpcore/CMakeLists.txt b/braindump/braindumpcore/CMakeLists.txt index 24f38544335..4cd55bd1351 100644 --- a/braindump/braindumpcore/CMakeLists.txt +++ b/braindump/braindumpcore/CMakeLists.txt @@ -1,14 +1,14 @@ set(braindumpcore_LIB_SRCS State.cpp StateCategory.cpp StatesRegistry.cpp ) add_library(braindumpcore SHARED ${braindumpcore_LIB_SRCS}) -target_link_libraries(braindumpcore Qt5::Core Qt5::Xml Qt5::Svg ) +target_link_libraries(braindumpcore Qt5::Core Qt5::Xml Qt5::Svg komain) target_link_libraries(braindumpcore LINK_INTERFACE_LIBRARIES Qt5::Core) set_target_properties(braindumpcore PROPERTIES VERSION ${GENERIC_CALLIGRA_LIB_VERSION} SOVERSION ${GENERIC_CALLIGRA_LIB_SOVERSION}) install(TARGETS braindumpcore ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP ) diff --git a/braindump/braindumpcore/State.h b/braindump/braindumpcore/State.h index 59702803766..e9d67fc9365 100644 --- a/braindump/braindumpcore/State.h +++ b/braindump/braindumpcore/State.h @@ -1,47 +1,46 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _STATE_H_ #define _STATE_H_ #include +#include #include "braindumpcore_export.h" -class QSvgRenderer; - class StateCategory; class BRAINDUMPCORE_EXPORT State { friend class StatesRegistry; State(const QString& _id, const QString& _name, StateCategory* _category, const QString& _fileName, int _priority); ~State(); public: const QString& name() const; const QString& id() const; const StateCategory* category() const; QSvgRenderer* renderer() const; int priority() const; private: struct Private; Private* const d; }; #endif diff --git a/braindump/braindumpcore/StatesRegistry.cpp b/braindump/braindumpcore/StatesRegistry.cpp index 037df923fb1..266d7568a77 100644 --- a/braindump/braindumpcore/StatesRegistry.cpp +++ b/braindump/braindumpcore/StatesRegistry.cpp @@ -1,178 +1,178 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "StatesRegistry.h" #include #include #include #include #include #include #include #include #include #include "State.h" #include "StateCategory.h" #include "StateCategory_p.h" struct Q_DECL_HIDDEN StatesRegistry::Private { static StatesRegistry* s_instance; QMap categories; void parseStatesRC(const QString& _filename); }; StatesRegistry* StatesRegistry::Private::s_instance = 0; void StatesRegistry::Private::parseStatesRC(const QString& _filename) { QDomDocument doc; QFile file(_filename); if(!file.open(QIODevice::ReadOnly)) { kError() << "Can't open " << _filename; return; } QString errMsg; int line, column; if(!doc.setContent(&file, &errMsg, &line, &column)) { kError() << "At (" << line << ", " << column << ") " << errMsg; file.close(); return; } file.close(); QDir directory = QFileInfo(_filename).absoluteDir(); QDomElement docElem = doc.documentElement(); if(docElem.nodeName() != "states") { kError() << "Invalid state file"; return; } QDomNode nCat = docElem.firstChild(); while(!nCat.isNull()) { QDomElement eCat = nCat.toElement(); // try to convert the node to an element. if(!eCat.isNull() && eCat.tagName() == "category") { QString catId = eCat.attribute("id"); QString catName = eCat.attribute("name"); int catPriority = eCat.attribute("priority", "1000").toInt(); StateCategory* category = 0; if(catId.isEmpty()) { kError() << "Missing category id"; } else { if(categories.contains(catId)) { category = categories[catId]; } else if(!catName.isEmpty()) { category = new StateCategory(catId, i18n(catName.toUtf8()), catPriority); categories[catId] = category; } if(category) { // Parse the states QDomNode nState = eCat.firstChild(); while(!nState.isNull()) { QDomElement eState = nState.toElement(); if(!eState.isNull() && eState.tagName() == "state") { QString stateId = eState.attribute("id"); QString stateName = eState.attribute("name"); QString stateFilename = eState.attribute("filename"); int statePriority = eState.attribute("priority", "1000").toInt(); if(stateId.isEmpty() || stateName.isEmpty() || stateFilename.isEmpty()) { kError() << "Missing attribute: id = " << stateId << " name = " << stateName << " filename = " << stateFilename; } else { QString file = directory.absoluteFilePath(stateFilename); if(QFileInfo(file).exists()) { if(category->d->states.contains(stateId)) { delete category->d->states[stateId]; } kDebug() << "Adding state id = " << stateId << " name = " << stateName << " filename = " << stateFilename; category->d->states[stateId] = new State(stateId, stateName, category, file, statePriority); } else { kError() << "Missing file " << file; } } } else { kError() << "Invalid node in category " << catId; } nState = nState.nextSibling(); } } else { kError() << "Couldn't make a category for " << catId; } } } else { kError() << "Invalid XML node."; } nCat = nCat.nextSibling(); } } StatesRegistry::StatesRegistry() : d(new Private) { - KGlobal::mainComponent().dirs()->addResourceType("stateshape_states", "data", "stateshape/states/"); - QStringList statesFilenames = KGlobal::mainComponent().dirs()->findAllResources("stateshape_states", "*.xml", KStandardDirs::Recursive); + KGlobal::dirs()->addResourceType("stateshape_states", "data", "stateshape/states/"); + QStringList statesFilenames = KGlobal::dirs()->findAllResources("stateshape_states", "*.xml", KStandardDirs::Recursive); foreach(const QString & filename, statesFilenames) { kDebug() << "Load state: " << filename; d->parseStatesRC(filename); } } StatesRegistry::~StatesRegistry() { delete d; } const StatesRegistry* StatesRegistry::instance() { if(!Private::s_instance) { Private::s_instance = new StatesRegistry; } return Private::s_instance; } QList StatesRegistry::categorieIds() const { return d->categories.keys(); } QList StatesRegistry::stateIds(const QString& _id) const { Q_ASSERT(d->categories.contains(_id)); return d->categories[_id]->stateIds(); } const State* StatesRegistry::state(const QString& _category, const QString& _state) const { if(d->categories.contains(_category)) return d->categories[_category]->state(_state); kWarning() << "No category " << _category << " found among " << d->categories.keys(); return 0; } const State* StatesRegistry::nextState(const State* _state) const { if(_state) { QList states = _state->category()->d->states.values(); int idx = states.indexOf(_state); idx += 1; if(idx >= states.count()) idx = 0; return states[idx]; } return 0; } diff --git a/braindump/plugins/stateshape/CMakeLists.txt b/braindump/plugins/stateshape/CMakeLists.txt index 38c9c5eb556..a09c11b176a 100644 --- a/braindump/plugins/stateshape/CMakeLists.txt +++ b/braindump/plugins/stateshape/CMakeLists.txt @@ -1,34 +1,35 @@ include_directories (${FLAKE_INCLUDES} ) ########### Flake Plugin library ############### set (stateshape_LIB_SRCS CategorizedItemDelegate.cpp StatesModel.cpp StateShape.cpp StateShapeChangeStateCommand.cpp StateShapeFactory.cpp StateShapePlugin.cpp StateTool.cpp StateToolFactory.cpp StateToolWidget.cpp ) ki18n_wrap_ui( stateshape_LIB_SRCS StateShapeConfigWidget.ui ) add_library(braindump_shape_state MODULE ${stateshape_LIB_SRCS}) target_link_libraries( braindump_shape_state flake Qt5::Core + Qt5::Svg braindumpcore ) install(TARGETS braindump_shape_state DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR}) ########### install files ############### install( FILES braindump_shape_state.desktop DESTINATION ${SERVICES_INSTALL_DIR}/calligra) ecm_install_icons( ${DATA_INSTALL_DIR}/calligra/icons ) diff --git a/braindump/plugins/stateshape/CategorizedItemDelegate.cpp b/braindump/plugins/stateshape/CategorizedItemDelegate.cpp index 4e7a80209a2..cfe89659266 100644 --- a/braindump/plugins/stateshape/CategorizedItemDelegate.cpp +++ b/braindump/plugins/stateshape/CategorizedItemDelegate.cpp @@ -1,133 +1,134 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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 program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "CategorizedItemDelegate.h" #include #include #include struct CategorizedItemDelegate::Private { QAbstractItemDelegate* fallback; KCategoryDrawer* categoryDrawer; bool isFirstOfCategory(const QModelIndex& index); }; bool CategorizedItemDelegate::Private::isFirstOfCategory(const QModelIndex& index) { if(index.row() == 0) return true; QModelIndex idx = index.model()->index(index.row() - 1, index.column(), index.parent()); const QString category1 = index.model()->data(index, KCategorizedSortFilterProxyModel::CategorySortRole).toString(); const QString category2 = index.model()->data(idx, KCategorizedSortFilterProxyModel::CategorySortRole).toString(); return category1 != category2; } CategorizedItemDelegate::CategorizedItemDelegate(QAbstractItemDelegate* _fallback, QObject* parent) : QAbstractItemDelegate(parent), d(new Private) { _fallback->setParent(this); d->fallback = _fallback; - d->categoryDrawer = new KCategoryDrawer; + // QT5TODO: Pass correct param to KCategoryDrawer + d->categoryDrawer = new KCategoryDrawer(0); } CategorizedItemDelegate::~CategorizedItemDelegate() { delete d; } QWidget * CategorizedItemDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const { return d->fallback->createEditor(parent, option, index); } bool CategorizedItemDelegate::editorEvent(QEvent * event, QAbstractItemModel * model, const QStyleOptionViewItem & option, const QModelIndex & index) { return d->fallback->editorEvent(event, model, option, index); } void CategorizedItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem & _option, const QModelIndex & index) const { // We will need to edit the option to make sure the header isn't drawned as selected QStyleOptionViewItem* option = 0; if(const QStyleOptionViewItemV4 *v4 = qstyleoption_cast(&_option)) { option = new QStyleOptionViewItemV4(*v4); } else if(const QStyleOptionViewItemV3 *v3 = qstyleoption_cast(&_option)) { option = new QStyleOptionViewItemV3(*v3); } else if(const QStyleOptionViewItemV2 *v2 = qstyleoption_cast(&_option)) { option = new QStyleOptionViewItemV2(*v2); } else { option = new QStyleOptionViewItem(_option); } Q_ASSERT(option); // If it's a first category then we need to draw it if(d->isFirstOfCategory(index)) { // Prepare the rectangle for drawing the category int h = d->categoryDrawer->categoryHeight(index, *option); QRect rect = option->rect; // Make sure the categroy isn't drawned as selected option->state &= (~QStyle::State_Selected); Q_ASSERT(!(option->state & QStyle::State_Selected)); option->state &= (~QStyle::State_HasFocus); Q_ASSERT(!(option->state & QStyle::State_HasFocus)); option->state &= (~QStyle::State_MouseOver); Q_ASSERT(!(option->state & QStyle::State_MouseOver)); option->rect.setHeight(h); // draw the cateogry d->categoryDrawer->drawCategory(index, 0, *option, painter); // Prepare the rectangle for the item option->rect = rect; option->rect.setY(rect.y() + h); option->rect.setHeight(rect.height() - h); option->state = _option.state; } d->fallback->paint(painter, *option, index); delete option; } void CategorizedItemDelegate::setEditorData(QWidget * editor, const QModelIndex & index) const { d->fallback->setEditorData(editor, index); } void CategorizedItemDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const { d->fallback->setModelData(editor, model, index); } QSize CategorizedItemDelegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const { QSize size = d->fallback->sizeHint(option, index); // If is first of a category, then add the space needed to paint the category if(d->isFirstOfCategory(index)) { size.setHeight(d->categoryDrawer->categoryHeight(index, option) + size.height()); } return size; } void CategorizedItemDelegate::updateEditorGeometry(QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index) const { d->fallback->updateEditorGeometry(editor, option, index); // If it's the first category, then the editor need to be moved if(d->isFirstOfCategory(index)) { int h = d->categoryDrawer->categoryHeight(index, option); editor->move(editor->x(), editor->y() + h); editor->resize(editor->width(), editor->height() - h); } } diff --git a/braindump/plugins/webshape/CMakeLists.txt b/braindump/plugins/webshape/CMakeLists.txt index 07b25ba9199..20854770abc 100644 --- a/braindump/plugins/webshape/CMakeLists.txt +++ b/braindump/plugins/webshape/CMakeLists.txt @@ -1,32 +1,33 @@ include_directories (${FLAKE_INCLUDES} ) ########### Flake Plugin library ############### set (webshape_LIB_SRCS WebShape.cpp WebShapeFactory.cpp WebShapePlugin.cpp WebTool.cpp WebToolWidget.cpp WebToolFactory.cpp ) ki18n_wrap_ui( webshape_LIB_SRCS WebShapeConfigWidget.ui ) add_library(braindump_shape_web MODULE ${webshape_LIB_SRCS}) target_link_libraries( braindump_shape_web flake Qt5::Core Qt5::WebKitWidgets + Qt5::Svg ) install(TARGETS braindump_shape_web DESTINATION ${CALLIGRA_PLUGIN_INSTALL_DIR}) ########### install files ############### install( FILES braindump_shape_web.desktop DESTINATION ${SERVICES_INSTALL_DIR}/calligra) ecm_install_icons( ${DATA_INSTALL_DIR}/calligra/icons ) diff --git a/braindump/plugins/webshape/WebShapePlugin.cpp b/braindump/plugins/webshape/WebShapePlugin.cpp index 631342940bd..fac8d02de54 100644 --- a/braindump/plugins/webshape/WebShapePlugin.cpp +++ b/braindump/plugins/webshape/WebShapePlugin.cpp @@ -1,43 +1,44 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "WebShapePlugin.h" #include #include #include #include +#include #include "WebShapeFactory.h" #include "WebToolFactory.h" K_PLUGIN_FACTORY(WebShapePluginFactory, registerPlugin();) K_EXPORT_PLUGIN(WebShapePluginFactory("WebShapePlugin")) WebShapePlugin::WebShapePlugin(QObject *parent, const QVariantList&) : QObject(parent) { // register the shape's factory KoShapeRegistry::instance()->add( new WebShapeFactory()); // we could register more things here in this same plugin. KoToolRegistry::instance()->add(new WebToolFactory()); } #include "WebShapePlugin.moc" diff --git a/braindump/src/AboutData.h b/braindump/src/AboutData.h index d3dadc4229e..2130a9101e6 100644 --- a/braindump/src/AboutData.h +++ b/braindump/src/AboutData.h @@ -1,40 +1,40 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef BRAINDUMPABOUTDATA_H #define BRAINDUMPABOUTDATA_H -#include +#include #include static const char BRAINDUMP_DESCRIPTION[] = I18N_NOOP("Braindump: directly from your brain to the computer."); static const char BRAINDUMP_VERSION[] = "0.10.9"; -inline KAboutData* newBrainDumpAboutData() +inline K4AboutData* newBrainDumpAboutData() { - KAboutData* aboutData = new KAboutData("braindump", 0, ki18n("Braindump"), - BRAINDUMP_VERSION, ki18n(BRAINDUMP_DESCRIPTION), KAboutData::License_LGPL, + K4AboutData* aboutData = new K4AboutData("braindump", 0, ki18n("Braindump"), + BRAINDUMP_VERSION, ki18n(BRAINDUMP_DESCRIPTION), K4AboutData::License_LGPL, ki18n("(c) 2009, 2010, 2011, 2012, 2013 Cyrille Berger"), KLocalizedString(), ""); aboutData->addAuthor(ki18n("Cyrille Berger"), ki18n("Maintainer"), "cberger@cberger.net"); return aboutData; } #endif diff --git a/braindump/src/CMakeLists.txt b/braindump/src/CMakeLists.txt index d79564d6d2f..495fc14618a 100644 --- a/braindump/src/CMakeLists.txt +++ b/braindump/src/CMakeLists.txt @@ -1,51 +1,51 @@ include_directories ( ${CMAKE_CURRENT_BINARY_DIR} ${KOTEXT_INCLUDES} ${KOMAIN_INCLUDES} ) ### braindump ### set(braindump_SRCS main.cpp Canvas.cpp DocumentModel.cpp Layout.cpp LayoutFactory.cpp LayoutFactoryRegistry.cpp MainWindow.cpp RootSection.cpp SectionsBoxDock.cpp Section.cpp SectionContainer.cpp SectionGroup.cpp SectionPropertiesDock.cpp SectionShapeContainerModel.cpp SectionsIO.cpp TreeSortFilter.cpp Utils.cpp View.cpp ViewManager.cpp # Layouts layouts/ColumnLayout.cpp layouts/FreeLayout.cpp # Commands commands/ChangeLayoutCommand.cpp commands/MoveSectionCommand.cpp commands/InsertSectionCommand.cpp commands/RememberPositionCommand.cpp commands/RemoveSectionCommand.cpp commands/RenameSectionCommand.cpp # Imported file import/DockerManager.cpp import/ToolDocker.cpp ) ki18n_wrap_ui(braindump_SRCS forms/wdgsectionsbox.ui forms/wdgsectionproperties.ui ) -ecm_add_app_icon( braindump_SRCS "../data/icons/hi*-app-braindump.png" ICONS ) +ecm_add_app_icon( braindump_SRCS ICONS "../data/icons/hi*-app-braindump.png") add_executable(braindump ${braindump_SRCS}) target_link_libraries(braindump ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} flake kotext kowidgets braindumpcore komain) install(TARGETS braindump ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/braindump/src/MainWindow.cpp b/braindump/src/MainWindow.cpp index 4118ca87783..04d037d874c 100644 --- a/braindump/src/MainWindow.cpp +++ b/braindump/src/MainWindow.cpp @@ -1,254 +1,255 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "MainWindow.h" #include #include #include #include #include #include #include #include #include #include #include #include +#include #include #include #include "RootSection.h" #include "View.h" #include "Canvas.h" #include "import/DockerManager.h" #include #include #include "StatusBarItem.h" MainWindow::MainWindow(RootSection* document, const KComponentData &componentData) : m_doc(document), m_activeView(0), m_dockerManager(0) { Q_ASSERT(componentData.isValid()); KGlobal::setActiveComponent(componentData); // then, setup our actions setupActions(); // Create the docker manager after setting up the action m_dockerManager = new DockerManager(this); // Setup the view view = new View(m_doc, this); setCentralWidget(view); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the // mainwindow to automatically save settings if changed: window size, // toolbar position, icon size, etc. setupGUI(); activateView(view); // Position and show toolbars according to user's preference setAutoSaveSettings(componentData.componentName()); const int scnum = QApplication::desktop()->screenNumber(parentWidget()); QRect desk = QApplication::desktop()->screenGeometry(scnum); // if the desktop is virtual then use virtual screen size if(QApplication::desktop()->isVirtualDesktop()) desk = QApplication::desktop()->screenGeometry(QApplication::desktop()->screen()); KConfigGroup config(KGlobal::config(), componentData.componentName()); const QSize size(config.readEntry(QString::fromLatin1("Width %1").arg(desk.width()), 0), config.readEntry(QString::fromLatin1("Height %1").arg(desk.height()), 0)); resize(size); foreach(QDockWidget * wdg, m_dockWidgets) { if((wdg->features() & QDockWidget::DockWidgetClosable) == 0) { wdg->setVisible(true); } } forceDockTabFonts(); } MainWindow::~MainWindow() { // The view need to be deleted before the dockermanager delete view; } void MainWindow::setupActions() { KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection()); m_doc->createActions(actionCollection()); m_dockWidgetMenu = new KActionMenu(i18n("Dockers"), this); actionCollection()->addAction("settings_dockers_menu", m_dockWidgetMenu); m_dockWidgetMenu->setVisible(false); } QDockWidget* MainWindow::createDockWidget(KoDockFactoryBase* factory) { QDockWidget* dockWidget = 0; if(!m_dockWidgetMap.contains(factory->id())) { dockWidget = factory->createDockWidget(); // It is quite possible that a dock factory cannot create the dock; don't // do anything in that case. if(!dockWidget) return 0; m_dockWidgets.push_back(dockWidget); dockWidget->setObjectName(factory->id()); dockWidget->setParent(this); if(dockWidget->widget() && dockWidget->widget()->layout()) dockWidget->widget()->layout()->setContentsMargins(1, 1, 1, 1); Qt::DockWidgetArea side = Qt::RightDockWidgetArea; bool visible = true; switch(factory->defaultDockPosition()) { case KoDockFactoryBase::DockTornOff: dockWidget->setFloating(true); // position nicely? break; case KoDockFactoryBase::DockTop: side = Qt::TopDockWidgetArea; break; case KoDockFactoryBase::DockLeft: side = Qt::LeftDockWidgetArea; break; case KoDockFactoryBase::DockBottom: side = Qt::BottomDockWidgetArea; break; case KoDockFactoryBase::DockRight: side = Qt::RightDockWidgetArea; break; case KoDockFactoryBase::DockMinimized: visible = false; break; default:; } addDockWidget(side, dockWidget); if(dockWidget->features() & QDockWidget::DockWidgetClosable) { m_dockWidgetMenu->addAction(dockWidget->toggleViewAction()); if(!visible) dockWidget->hide(); } m_dockWidgetMap.insert(factory->id(), dockWidget); } else { dockWidget = m_dockWidgetMap[ factory->id()]; } KConfigGroup group(KGlobal::config(), "GUI"); QFont dockWidgetFont = KGlobalSettings::generalFont(); qreal pointSize = group.readEntry("palettefontsize", dockWidgetFont.pointSize() * 0.75); pointSize = qMax(pointSize, KGlobalSettings::smallestReadableFont().pointSizeF()); dockWidgetFont.setPointSizeF(pointSize); #ifdef Q_WS_MAC dockWidget->setAttribute(Qt::WA_MacSmallSize, true); #endif dockWidget->setFont(dockWidgetFont); connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(forceDockTabFonts())); return dockWidget; } void MainWindow::forceDockTabFonts() { QObjectList chis = children(); for(int i = 0; i < chis.size(); ++i) { if(chis.at(i)->inherits("QTabBar")) { QFont dockWidgetFont = KGlobalSettings::generalFont(); qreal pointSize = KGlobalSettings::smallestReadableFont().pointSizeF(); dockWidgetFont.setPointSizeF(pointSize); ((QTabBar *)chis.at(i))->setFont(dockWidgetFont); } } } DockerManager* MainWindow::dockerManager() { return m_dockerManager; } void MainWindow::activateView(View* view) { Q_ASSERT(factory()); // Desactivate previous view if(m_activeView) { factory()->removeClient(m_activeView); foreach(StatusBarItem * item, m_statusBarItems[m_activeView]) { item->ensureItemHidden(statusBar()); } } // Set the new view m_activeView = view; if(m_activeView) { factory()->addClient(view); // Show the status widget for the current view foreach(StatusBarItem * item, m_statusBarItems[m_activeView]) { item->ensureItemShown(statusBar()); } } } void MainWindow::addStatusBarItem(QWidget* _widget, int _stretch, View* _view) { Q_ASSERT(_widget); Q_ASSERT(_view); QList& list = m_statusBarItems[_view]; StatusBarItem* item = new StatusBarItem(_widget, _stretch, _view); if(_view == m_activeView) { item->ensureItemShown(statusBar()); } list.append(item); } void MainWindow::removeStatusBarItem(QWidget* _widget) { foreach(View * key, m_statusBarItems.keys()) { QList& list = m_statusBarItems[key]; foreach(StatusBarItem * item, list) { if(item->m_widget == _widget) { list.removeAll(item); item->ensureItemHidden(statusBar()); delete item; return; } } } kWarning() << "Widget " << _widget << " not found in the status bar"; } QList MainWindow::canvasObservers() const { QList observers; foreach(QDockWidget * docker, m_dockWidgets) { KoCanvasObserverBase *observer = dynamic_cast(docker); if(observer) { observers << observer; } } return observers; } diff --git a/braindump/src/MainWindow.h b/braindump/src/MainWindow.h index 83662adb589..f6a693f8fae 100644 --- a/braindump/src/MainWindow.h +++ b/braindump/src/MainWindow.h @@ -1,63 +1,63 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _MAINWINDOW_H_ #define _MAINWINDOW_H_ #include #include +#include class DockerManager; class RootSection; -class KComponentData; class KoDockFactoryBase; class View; class KActionMenu; class MainWindow : public KXmlGuiWindow, public KoCanvasSupervisor { Q_OBJECT public: MainWindow(RootSection* document, const KComponentData &componentData); ~MainWindow(); public: QDockWidget* createDockWidget(KoDockFactoryBase* factory); DockerManager* dockerManager(); void addStatusBarItem(QWidget* _widget, int _stretch, View* _view); void removeStatusBarItem(QWidget*); private: void setupActions(); public: void activateView(View* view); QList canvasObservers() const; public Q_SLOTS: void forceDockTabFonts(); private: RootSection* m_doc; View* view; View* m_activeView; QMap m_dockWidgetMap; QList m_dockWidgets; KActionMenu* m_dockWidgetMenu; DockerManager* m_dockerManager; struct StatusBarItem; QMap > m_statusBarItems; }; #endif diff --git a/braindump/src/SectionsIO.cpp b/braindump/src/SectionsIO.cpp index b2d07b7153e..7eedb6207b8 100644 --- a/braindump/src/SectionsIO.cpp +++ b/braindump/src/SectionsIO.cpp @@ -1,367 +1,361 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "SectionsIO.h" #include #include #include #include -#include -#include -#include "RootSection.h" -#include "SectionGroup.h" -#include "Section.h" #include #include -#include -#include #include #include #include #include #include #include #include #include #include + +#include "RootSection.h" +#include "SectionGroup.h" +#include "Section.h" #include "SectionContainer.h" #include "Layout.h" #include "LayoutFactoryRegistry.h" #include "Xml.h" SectionsIO::SectionsIO(RootSection* rootSection) : m_rootSection(rootSection), m_timer(new QTimer(this)), m_nextNumber(0) { m_timer->start(60 * 1000); // Every minute connect(m_timer, SIGNAL(timeout()), SLOT(save())); - m_directory = KGlobal::dirs()->localkdedir() + "share/apps/braindump/sections/"; - KStandardDirs::makeDir(m_directory); + m_directory = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/sections/"; + QDir().mkdir(m_directory); // Finally load load(); } SectionsIO::~SectionsIO() { } void SectionsIO::push(Section* _section, PushMode _pushMode) { if(!m_sectionsToSave.contains(_section)) { m_sectionsToSave.push_back(_section); } if(_pushMode == RecursivePush) { foreach(Section * sec, _section->sections()) { push(sec, RecursivePush); } } } struct SectionsIO::SaveContext { enum Version { VERSION_1 }; Section* section; QString filename; bool saveSection(SectionsIO* sectionsIO); bool loadSection(SectionsIO* sectionsIO, Version version); }; bool SectionsIO::SaveContext::saveSection(SectionsIO* sectionsIO) { struct Finally { Finally(KoStore *s) : store(s) { } ~Finally() { delete store; } KoStore *store; }; QString fullFileName = sectionsIO->m_directory + filename; QString fullFileNameTmpNew = fullFileName + ".tmp_new/"; QString fullFileNameTmpOld = fullFileName + ".tmp_old"; - KIO::NetAccess::del(fullFileNameTmpNew, 0); + QDir().remove(fullFileNameTmpNew); const char* mimeType = KoOdf::mimeType(KoOdf::Text); QDir().mkdir(fullFileNameTmpNew); KoStore* store = KoStore::createStore(fullFileNameTmpNew, KoStore::Write, mimeType, KoStore::Directory); Finally finaly(store); KoOdfWriteStore odfStore(store); KoEmbeddedDocumentSaver embeddedSaver; KoXmlWriter* manifestWriter = odfStore.manifestWriter(mimeType); KoXmlWriter* contentWriter = odfStore.contentWriter(); KoXmlWriter* bodyWriter = odfStore.bodyWriter(); if(!manifestWriter || !contentWriter || !bodyWriter) { return false; } KoGenStyles mainStyles; KoShapeSavingContext * context = new KoShapeSavingContext(*bodyWriter, mainStyles, embeddedSaver); context->addOption(KoShapeSavingContext::DrawId); bodyWriter->startElement("office:body"); Xml::writeBraindumpNS(*bodyWriter); bodyWriter->startElement(KoOdf::bodyContentElement(KoOdf::Text, true)); section->sectionContainer()->saveOdf(*context); bodyWriter->startElement("braindump:layout"); bodyWriter->addAttribute("braindump:type", section->layout()->id()); bodyWriter->endElement(); // braindump:layout bodyWriter->endElement(); // office:element bodyWriter->endElement(); // office:body mainStyles.saveOdfStyles(KoGenStyles::DocumentAutomaticStyles, contentWriter); odfStore.closeContentWriter(); //add manifest line for content.xml manifestWriter->addManifestEntry("content.xml", "text/xml"); if(!mainStyles.saveOdfStylesDotXml(store, manifestWriter)) { return false; } if(!context->saveDataCenter(store, manifestWriter)) { kDebug() << "save data centers failed"; return false; } // Save embedded objects KoDocumentBase::SavingContext documentContext(odfStore, embeddedSaver); if(!embeddedSaver.saveEmbeddedDocuments(documentContext)) { kDebug() << "save embedded documents failed"; return false; } // Write out manifest file if(!odfStore.closeManifestWriter()) { return false; } delete store; finaly.store = 0; delete context; - KIO::NetAccess::del(fullFileNameTmpOld, 0); - KIO::CopyJob *mv = KIO::move(fullFileName, fullFileNameTmpOld); - KIO::NetAccess::synchronousRun(mv, 0); - mv = KIO::move(fullFileNameTmpNew, fullFileName); - KIO::NetAccess::synchronousRun(mv, 0); - KIO::NetAccess::del(fullFileNameTmpOld, 0); + QDir().remove(fullFileNameTmpOld); + QDir().rename(fullFileName, fullFileNameTmpOld); + QDir().rename(fullFileNameTmpNew, fullFileName); + QDir().remove(fullFileNameTmpOld); + return true; } bool SectionsIO::SaveContext::loadSection(SectionsIO* sectionsIO, SectionsIO::SaveContext::Version version) { Q_UNUSED(version); // In case saving problem occurred, try to recover a directory either new or old QString fullFileName = sectionsIO->m_directory + filename; QString fullFileNameTmpNew = fullFileName + ".tmp_new/"; QString fullFileNameTmpOld = fullFileName + ".tmp_old"; if(!QFileInfo(fullFileName).exists()) { if(QFileInfo(fullFileNameTmpNew).exists()) { - KIO::CopyJob *mv = KIO::move(fullFileNameTmpNew, fullFileName); - KIO::NetAccess::synchronousRun(mv, 0); + QDir().rename(fullFileNameTmpNew, fullFileName); } else if(QFileInfo(fullFileNameTmpOld).exists()) { - KIO::CopyJob *mv = KIO::move(fullFileNameTmpOld, fullFileName); - KIO::NetAccess::synchronousRun(mv, 0); + QDir().rename(fullFileNameTmpOld, fullFileName); } else { return false; } } kDebug() << "Loading from " << fullFileName; const char* mimeType = KoOdf::mimeType(KoOdf::Text); KoStore* store = KoStore::createStore(fullFileName + '/', KoStore::Read, mimeType, KoStore::Directory); KoOdfReadStore odfStore(store); QString errorMessage; if(! odfStore.loadAndParse(errorMessage)) { kError() << "loading and parsing failed:" << errorMessage << endl; return false; } KoXmlElement content = odfStore.contentDoc().documentElement(); KoXmlElement realBody(KoXml::namedItemNS(content, KoXmlNS::office, "body")); KoXmlElement body = KoXml::namedItemNS(realBody, KoXmlNS::office, KoOdf::bodyContentElement(KoOdf::Text, false)); KoOdfLoadingContext loadingContext(odfStore.styles(), odfStore.store()); KoShapeLoadingContext context(loadingContext, section->sectionContainer()->resourceManager()); KoXmlElement element; QList shapes; forEachElement(element, body) { kDebug() << "loading shape" << element.nodeName(); if(element.nodeName() == "braindump:section") { section->sectionContainer()->loadOdf(element, context, shapes); } else if(element.nodeName() == "braindump:layout") { QString type = element.attribute("type"); Layout* layout = LayoutFactoryRegistry::instance()->createLayout(type); if(layout) { section->setLayout(layout); } } } section->layout()->addShapes(shapes); return true; } void SectionsIO::saveTheStructure(QDomDocument& doc, QDomElement& elt, SectionGroup* root, QList& contextToRemove) { foreach(Section * section, root->sections()) { SaveContext* context = m_contextes[section]; if(context) { contextToRemove.removeAll(context); } else { context = new SaveContext; m_contextes[section] = context; context->section = section; context->filename = generateFileName(); } Q_ASSERT(context); QDomElement celt = doc.createElement("Section"); elt.appendChild(celt); celt.setAttribute("filename", context->filename); celt.setAttribute("name", section->name()); saveTheStructure(doc, celt, section, contextToRemove); } } void SectionsIO::save() { kDebug() << "Start saving"; if(m_sectionsToSave.isEmpty()) { kDebug() << "No section to save"; return; } QList contextToRemove = m_contextes.values(); // First: save the structure QDomDocument doc; QDomElement root = doc.createElement("RootElement"); doc.appendChild(root); saveTheStructure(doc, root, m_rootSection, contextToRemove); QFile file(structureFileName()); file.open(QIODevice::WriteOnly); file.write(doc.toString().toUtf8()); file.close(); // Second: save each section foreach(SaveContext * saveContext, m_contextes) { if(m_sectionsToSave.contains(saveContext->section)) { if(saveContext->saveSection(this)) { kDebug() << "Successfully loaded: " << saveContext->section->name(); } else { kDebug() << "Saving failed"; // TODO: Report it } } } m_sectionsToSave.clear(); // Last remove unused sections foreach(SaveContext * saveContext, contextToRemove) { - KIO::NetAccess::del(KUrl(m_directory + saveContext->filename), 0); + QDir().remove(m_directory + saveContext->filename); m_contextes.remove(saveContext->section); delete saveContext; } } void SectionsIO::loadTheStructure(QDomElement& elt, SectionGroup* parent, RootSection* _rootSection) { QDomNode n = elt.firstChild(); while(!n.isNull()) { QDomElement e = n.toElement(); // try to convert the node to an element. if(!e.isNull() && e.nodeName() == "Section") { Section* section = new Section(_rootSection); QString name = e.attribute("name", ""); if(name.isEmpty()) { name = SectionGroup::nextName(); } section->setName(name); parent->insertSection(section); SaveContext* context = new SaveContext; context->filename = e.attribute("filename", ""); context->section = section; m_contextes[section] = context; loadTheStructure(e, section, _rootSection); } n = n.nextSibling(); } } void SectionsIO::load() { QDomDocument doc; QFile file(structureFileName()); if(!file.open(QIODevice::ReadOnly)) return; if(!doc.setContent(&file)) { file.close(); return; } file.close(); QDomElement docElem = doc.documentElement(); if(docElem.nodeName() != "RootElement") return; loadTheStructure(docElem, m_rootSection, m_rootSection); // Second: load each section foreach(SaveContext * saveContext, m_contextes) { if(!saveContext->loadSection(this, SaveContext::VERSION_1)) { kDebug() << "Loading failed"; // TODO: Report it } } } QString SectionsIO::generateFileName() { for(; true; ++m_nextNumber) { QString filename = "section" + QString::number(m_nextNumber); if(!QFileInfo(m_directory + filename).exists() && !usedFileName(filename)) { return filename; } } } bool SectionsIO::usedFileName(const QString& filename) { foreach(SaveContext * context, m_contextes.values()) { if(context->filename == filename) return true; } return false; } QString SectionsIO::structureFileName() { return m_directory + "structure.xml"; } #include "SectionsIO.moc" diff --git a/braindump/src/StatusBarItem.h b/braindump/src/StatusBarItem.h index 9afba374e0e..0ca6f99709f 100644 --- a/braindump/src/StatusBarItem.h +++ b/braindump/src/StatusBarItem.h @@ -1,59 +1,59 @@ /* * Copyright (c) 1998, 1999 Torben Weis * Copyright (c) 2007 Thomas Zander * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _STATUSBARITEM_H_ #define _STATUSBARITEM_H_ #include "MainWindow.h" -#include "kstatusbar.h" +#include struct MainWindow::StatusBarItem { StatusBarItem(QWidget* _widget, int _strech, bool _permanent) : m_widget(_widget), m_stretch(_strech), m_permanent(_permanent), m_visible(false) { } - void ensureItemShown(KStatusBar * sb) { + void ensureItemShown(QStatusBar * sb) { Q_ASSERT(m_widget); Q_ASSERT(sb); if(!m_visible) { if(m_permanent) { sb->addPermanentWidget(m_widget, m_stretch); } else { sb->addWidget(m_widget, m_stretch); } m_visible = true; m_widget->show(); } } - void ensureItemHidden(KStatusBar * sb) { + void ensureItemHidden(QStatusBar * sb) { Q_ASSERT(sb); if(m_visible) { sb->removeWidget(m_widget); m_visible = false; m_widget->hide(); } } QWidget* m_widget; int m_stretch; bool m_permanent; bool m_visible; }; #endif diff --git a/braindump/src/View.cpp b/braindump/src/View.cpp index 6e39da350d4..af74bd3b8ee 100644 --- a/braindump/src/View.cpp +++ b/braindump/src/View.cpp @@ -1,419 +1,421 @@ /* * Copyright (c) 2009,2010 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include "View.h" #include #include #include #include #include #include #include #include #include +#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "KoZoomController.h" #include #include "Canvas.h" #include "RootSection.h" #include "Section.h" #include "ViewManager.h" #include "import/DockerManager.h" #include "KoToolBoxFactory.h" #include #include #include +#include #include #include #include #include #include "KoOdf.h" #include "KoShapeGroup.h" #include "KoShapeDeleteCommand.h" #include "KoShapeCreateCommand.h" #include "KoShapeGroupCommand.h" #include "KoShapeUngroupCommand.h" #include "MainWindow.h" #include "SectionContainer.h" #include "SectionsBoxDock.h" #include "Layout.h" #include "SectionPropertiesDock.h" #include "commands/RememberPositionCommand.h" View::View(RootSection *document, MainWindow* parent) : QWidget(parent) , m_doc(document) , m_canvas(0) , m_activeSection(0) , m_mainWindow(parent) , m_cutController(0) , m_copyController(0) { setXMLFile("braindumpview.rc"); m_doc->viewManager()->addView(this); m_editPaste = actionCollection()->addAction(KStandardAction::Paste, "edit_paste", this, SLOT(editPaste())); m_editCut = actionCollection()->addAction(KStandardAction::Cut, "edit_cut", 0, 0); m_editCopy = actionCollection()->addAction(KStandardAction::Copy, "edit_copy", 0, 0); initGUI(); initActions(); loadExtensions(); if(m_doc->sections().count() > 0) { setActiveSection(m_doc->sections()[0]); } else { setActiveSection(0); } m_doc->viewManager()->viewHasFocus(this); } View::~View() { m_doc->viewManager()->removeView(this); KoToolManager::instance()->removeCanvasController(m_canvasController); delete m_zoomController; } Section* View::activeSection() const { return m_activeSection; } void View::initGUI() { // add all plugins. foreach(const QString & docker, KoDockRegistry::instance()->keys()) { kDebug() << "Creating docker: " << docker; KoDockFactoryBase *factory = KoDockRegistry::instance()->value(docker); m_mainWindow->createDockWidget(factory); } // Init the widgets QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setMargin(0); gridLayout->setSpacing(0); setLayout(gridLayout); m_canvasController = new KoCanvasControllerWidget(actionCollection(), this); m_canvasController->setCanvasMode(KoCanvasController::Infinite); createCanvas(0); KoToolManager::instance()->addController(m_canvasController); KoToolManager::instance()->registerTools(actionCollection(), m_canvasController); m_zoomController = new KoZoomController(m_canvasController, &m_zoomHandler, actionCollection()); connect(m_zoomController, SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)), this, SLOT(slotZoomChanged(KoZoomMode::Mode,qreal))); m_zoomAction = m_zoomController->zoomAction(); m_mainWindow->addStatusBarItem(m_zoomAction->createWidget(m_mainWindow->statusBar()), 0, this); m_zoomController->setZoomMode(KoZoomMode::ZOOM_WIDTH); gridLayout->addWidget(m_canvasController, 1, 1); connect(m_canvasController->proxyObject, SIGNAL(canvasMousePositionChanged(QPoint)), this, SLOT(updateMousePosition(QPoint))); KoToolBoxFactory toolBoxFactory; m_mainWindow->createDockWidget(&toolBoxFactory); connect(m_canvasController, SIGNAL(toolOptionWidgetsChanged(QList >)), m_mainWindow->dockerManager(), SLOT(newOptionWidgets(QList >))); SectionsBoxDockFactory structureDockerFactory; m_sectionsBoxDock = qobject_cast(m_mainWindow->createDockWidget(&structureDockerFactory)); Q_ASSERT(m_sectionsBoxDock); m_sectionsBoxDock->setup(m_doc, this); SectionPropertiesDockFactory sectionPropertiesDockerFactory; m_sectionPropertiesDock = qobject_cast(m_mainWindow->createDockWidget(§ionPropertiesDockerFactory)); Q_ASSERT(m_sectionPropertiesDock); m_sectionPropertiesDock->setRootSection(m_doc); KoToolManager::instance()->requestToolActivation(m_canvasController); show(); } void View::initActions() { connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); clipboardDataChanged(); actionCollection()->addAction(KStandardAction::SelectAll, "edit_select_all", this, SLOT(editSelectAll())); actionCollection()->addAction(KStandardAction::Deselect, "edit_deselect_all", this, SLOT(editDeselectAll())); m_deleteSelectionAction = new KAction(koIcon("edit-delete"), i18n("D&elete"), this); actionCollection()->addAction("edit_delete", m_deleteSelectionAction); - m_deleteSelectionAction->setShortcut(QKeySequence("Del")); + actionCollection()->setDefaultShortcut(m_deleteSelectionAction, QKeySequence("Del")); connect(m_deleteSelectionAction, SIGNAL(triggered()), this, SLOT(editDeleteSelection())); // Shapes menu // TODO: get an icon "edit-duplicate" KAction *actionDuplicate = new KAction(i18nc("Duplicate selection", "&Duplicate"), this); actionCollection()->addAction("shapes_duplicate", actionDuplicate); - actionDuplicate->setShortcut(QKeySequence("Ctrl+D")); + actionCollection()->setDefaultShortcut(actionDuplicate, QKeySequence("Ctrl+D")); connect(actionDuplicate, SIGNAL(triggered()), this, SLOT(selectionDuplicate())); m_groupShapes = new KAction(koIcon("object-group"), i18n("Group Shapes"), this); actionCollection()->addAction("shapes_group", m_groupShapes); - m_groupShapes->setShortcut(QKeySequence("Ctrl+G")); + actionCollection()->setDefaultShortcut(m_groupShapes, QKeySequence("Ctrl+G")); connect(m_groupShapes, SIGNAL(triggered()), this, SLOT(groupSelection())); m_ungroupShapes = new KAction(koIcon("object-ungroup"), i18n("Ungroup Shapes"), this); actionCollection()->addAction("shapes_ungroup", m_ungroupShapes); - m_ungroupShapes->setShortcut(QKeySequence("Ctrl+Shift+G")); + actionCollection()->setDefaultShortcut(m_ungroupShapes, QKeySequence("Ctrl+Shift+G")); connect(m_ungroupShapes, SIGNAL(triggered()), this, SLOT(ungroupSelection())); } void View::loadExtensions() { const QList offers = KoJsonTrader::self()->query("Braindump/Extensions", QString()); foreach(QPluginLoader *pluginLoader, offers) { KPluginFactory *factory = qobject_cast(pluginLoader->instance()); KXMLGUIClient *plugin = dynamic_cast(factory->create(this, QVariantList())); if (plugin) { insertChildClient(plugin); } } } void View::editPaste() { m_canvas->toolProxy()->paste(); } void View::editDeleteSelection() { m_canvas->toolProxy()->deleteSelection(); } void View::editSelectAll() { KoSelection* selection = canvas()->shapeManager()->selection(); if(!selection) return; KoShapeLayer *layer = activeSection()->sectionContainer()->layer(); QList layerShapes(layer->shapes()); foreach(KoShape * layerShape, layerShapes) { selection->select(layerShape); layerShape->update(); } } void View::editDeselectAll() { KoSelection* selection = canvas()->shapeManager()->selection(); if(selection) selection->deselectAll(); canvas()->update(); } void View::slotZoomChanged(KoZoomMode::Mode mode, qreal zoom) { Q_UNUSED(mode); Q_UNUSED(zoom); canvas()->updateOriginAndSize(); canvas()->update(); } void View::createCanvas(Section* _currentSection) { Canvas* canvas = new Canvas(this, m_doc, _currentSection); m_canvasController->setCanvas(canvas); // No need to delete the current canvas, it will be deleted in Viewport::setCanvas (flake/KoCanvasController_p.cpp) m_canvas = canvas; delete m_cutController; m_cutController = new KoCutController(m_canvas, m_editCut); delete m_copyController; m_copyController = new KoCopyController(m_canvas, m_editCopy); connect(m_canvas, SIGNAL(canvasReceivedFocus()), SLOT(canvasReceivedFocus())); connect(m_canvas, SIGNAL(documentRect(QRectF)), SLOT(documentRectChanged(QRectF))); connect(m_canvasController->proxyObject, SIGNAL(moveDocumentOffset(QPoint)), m_canvas, SLOT(setDocumentOffset(QPoint))); connect(m_canvas->toolProxy(), SIGNAL(toolChanged(QString)), this, SLOT(clipboardDataChanged())); m_canvas->updateOriginAndSize(); setEnabled(_currentSection); } void View::setActiveSection(Section* page) { m_activeSection = page; m_doc->setCurrentSection(page); createCanvas(m_activeSection); if(m_activeSection) { documentRectChanged(m_activeSection->layout()->boundingBox()); } m_sectionsBoxDock->updateGUI(); m_sectionPropertiesDock->setSection(m_activeSection); } void View::updateMousePosition(const QPoint& /*position*/) { QPoint canvasOffset(m_canvasController->canvasOffsetX(), m_canvasController->canvasOffsetY()); // the offset is positive it the canvas is shown fully visible canvasOffset.setX(canvasOffset.x() < 0 ? canvasOffset.x() : 0); canvasOffset.setY(canvasOffset.y() < 0 ? canvasOffset.y() : 0); } void View::clipboardDataChanged() { const QMimeData* data = QApplication::clipboard()->mimeData(); bool paste = false; if(data) { // TODO see if we can use the KoPasteController instead of having to add this feature in each calligra app. QStringList mimeTypes = m_canvas->toolProxy()->supportedPasteMimeTypes(); mimeTypes << KoOdf::mimeType(KoOdf::Graphics); mimeTypes << KoOdf::mimeType(KoOdf::Presentation); foreach(const QString & mimeType, mimeTypes) { if(data->hasFormat(mimeType)) { paste = true; break; } } } m_editPaste->setEnabled(paste); } void View::focusInEvent(QFocusEvent * event) { QWidget::focusInEvent(event); m_doc->viewManager()->viewHasFocus(this); } void View::canvasReceivedFocus() { m_doc->viewManager()->viewHasFocus(this); } void View::documentRectChanged(const QRectF& bb) { QSizeF pageSize(400, 400); // Make sure we never use an empty size if(!bb.isNull() && !bb.isEmpty()) { pageSize = bb.size(); } m_zoomController->setPageSize(pageSize); m_zoomController->setDocumentSize(pageSize); } void View::selectionDuplicate() { m_canvas->toolProxy()->copy(); m_canvas->toolProxy()->paste(); } void View::groupSelection() { KoSelection* selection = m_canvas->shapeManager()->selection(); if(! selection) return; QList selectedShapes = selection->selectedShapes(KoFlake::TopLevelSelection); QList groupedShapes; // only group shapes with an unselected parent foreach(KoShape * shape, selectedShapes) { if(selectedShapes.contains(shape->parent())) continue; groupedShapes << shape; } KoShapeGroup *group = new KoShapeGroup(); if(selection->activeLayer()) selection->activeLayer()->addShape(group); KUndo2Command *cmd = new KUndo2Command(kundo2_i18n("Group shapes")); new KoShapeCreateCommand(m_activeSection->sectionContainer(), group, cmd); new KoShapeGroupCommand(group, groupedShapes, cmd); m_canvas->addCommand(cmd); } void View::ungroupSelection() { KoSelection* selection = m_canvas->shapeManager()->selection(); if(! selection) return; QList selectedShapes = selection->selectedShapes(KoFlake::TopLevelSelection); QList containerSet; // only ungroup shape containers with an unselected parent foreach(KoShape * shape, selectedShapes) { if(selectedShapes.contains(shape->parent())) continue; containerSet << shape; } KUndo2Command *cmd = new KUndo2Command(kundo2_i18n("Ungroup shapes")); // add a ungroup command for each found shape container to the macro command foreach(KoShape * shape, containerSet) { KoShapeContainer *container = dynamic_cast(shape); if(container) { new KoShapeUngroupCommand(container, container->shapes(), QList(), cmd); new KoShapeDeleteCommand(m_activeSection->sectionContainer(), container, cmd); new RememberPositionCommand(container->shapes(), cmd); } } m_canvas->addCommand(cmd); } #include "View.moc" diff --git a/braindump/src/View.h b/braindump/src/View.h index c3f2cf7eb08..30cbb0b3af2 100644 --- a/braindump/src/View.h +++ b/braindump/src/View.h @@ -1,134 +1,134 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef VIEW_H #define VIEW_H #include +#include #include #include class KoCanvasControllerWidget; class Canvas; class MainWindow; -class KAction; class KoZoomAction; class KoZoomController; class RootSection; class Section; class SectionsBoxDock; class SectionPropertiesDock; class KoCutController; class KoCopyController; class View : public QWidget, public KXMLGUIClient { Q_OBJECT public: /** * Constructor * @param document the document of this view * @param parent the parent widget */ explicit View(RootSection* document, MainWindow* parent); virtual ~View(); KoZoomHandler* zoomHandler() { return &m_zoomHandler; } KoZoomController *zoomController() { return m_zoomController; } Canvas* canvas() { return m_canvas; } Canvas* canvas() const { return m_canvas; } RootSection* rootSection() { return m_doc; } /// @return Page that is shown in the canvas Section* activeSection() const; /// Set page shown in the canvas to @p page void setActiveSection(Section * page); private: /// creates the widgets (called from the constructor) void initGUI(); /// creates the actions (called from the constructor) void initActions(); void loadExtensions(); protected Q_SLOTS: void slotZoomChanged(KoZoomMode::Mode mode, qreal zoom); void editPaste(); void editDeleteSelection(); void editSelectAll(); void editDeselectAll(); /// Called when the mouse position changes on the canvas virtual void updateMousePosition(const QPoint& position); /// Called when the clipboard changed virtual void clipboardDataChanged(); private Q_SLOTS: void canvasReceivedFocus(); void documentRectChanged(const QRectF& rect); void selectionDuplicate(); void groupSelection(); void ungroupSelection(); protected: virtual void focusInEvent(QFocusEvent * event); private: void createCanvas(Section* _currentSection); private: RootSection* m_doc; Canvas* m_canvas; Section* m_activeSection; MainWindow* m_mainWindow; SectionsBoxDock* m_sectionsBoxDock; SectionPropertiesDock* m_sectionPropertiesDock; KoCanvasControllerWidget * m_canvasController; KoZoomController * m_zoomController; KoZoomHandler m_zoomHandler; KoCutController* m_cutController; KoCopyController* m_copyController; - KAction* m_editCopy; - KAction* m_editCut; + QAction* m_editCopy; + QAction* m_editCut; - KAction *m_editPaste; - KAction *m_deleteSelectionAction; - KAction* m_groupShapes; - KAction* m_ungroupShapes; + QAction *m_editPaste; + QAction *m_deleteSelectionAction; + QAction* m_groupShapes; + QAction* m_ungroupShapes; KoZoomAction *m_zoomAction; }; #endif /* KOPAVIEW_H */ diff --git a/braindump/src/import/DockerManager.cpp b/braindump/src/import/DockerManager.cpp index 3521ed5ebbf..5a7da060a6d 100644 --- a/braindump/src/import/DockerManager.cpp +++ b/braindump/src/import/DockerManager.cpp @@ -1,73 +1,73 @@ /* This file is part of the KDE project * * Copyright (c) 2008,2010 C. Boemann * Copyright (c) 2009 Cyrille Berger * * 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 "DockerManager.h" #include "DockerManager_p.h" #include "KoDockFactoryBase.h" #include #include #include "ToolDocker.h" #include "MainWindow.h" #include #include DockerManager::DockerManager(MainWindow *mainWindow) : QObject(mainWindow), d(new Private(mainWindow)) { ToolDockerFactory toolDockerFactory; ToolBarsDockerFactory toolBarsDockerFactory; d->toolOptionsDocker = qobject_cast(mainWindow->createDockWidget(&toolDockerFactory)); Q_ASSERT(d->toolOptionsDocker); d->toolOptionsDocker->setVisible(false); d->toolBarsDocker = mainWindow->createDockWidget(&toolBarsDockerFactory); Q_ASSERT(d->toolBarsDocker); QWidget *dockedToolBarsWidget = new QWidget(); d->dockedToolBarsLayout = new QGridLayout(); d->dockedToolBarsLayout->setHorizontalSpacing(2); d->dockedToolBarsLayout->setVerticalSpacing(0); dockedToolBarsWidget->setLayout(d->dockedToolBarsLayout); d->toolBarsDocker->setAllowedAreas(Qt::TopDockWidgetArea); d->toolBarsDocker->setFeatures(QDockWidget::DockWidgetClosable); d->toolBarsDocker->setWidget(dockedToolBarsWidget); d->toolBarsDocker->setTitleBarWidget(new QWidget()); d->toolBarsDocker->setVisible(false); connect(d->toolBarsDocker, SIGNAL(visibilityChanged(bool)), this, SLOT(moveToolBars())); } DockerManager::~DockerManager() { delete d; } void DockerManager::newOptionWidgets(const QList > &optionWidgetMap) { d->toolOptionsDocker->setOptionWidgets(optionWidgetMap); } -#include +#include diff --git a/braindump/src/import/ToolDocker.cpp b/braindump/src/import/ToolDocker.cpp index 090f0bc6d39..28fd4ea3984 100644 --- a/braindump/src/import/ToolDocker.cpp +++ b/braindump/src/import/ToolDocker.cpp @@ -1,127 +1,127 @@ /* This file is part of the KDE project * * Copyright (c) 2010-2011 C. Boemann * Copyright (c) 2005-2006 Boudewijn Rempt * Copyright (c) 2006 Thomas Zander * * 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 "ToolDocker.h" #include "ToolDocker_p.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ToolDocker::ToolDocker(QWidget *parent) : QDockWidget(i18n("Tool Options"), parent), d(new Private(this)) { setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::TopDockWidgetArea); KConfigGroup cfg = KGlobal::config()->group("DockWidget sharedtooldocker"); d->tabbed = cfg.readEntry("TabbedMode", false); d->hasTitle = cfg.readEntry("Locked", true); toggleViewAction()->setVisible(false); //should always be visible, so hide option in menu setFeatures(DockWidgetMovable | DockWidgetFloatable); if(d->hasTitle) { setTitleBarWidget(new KoDockWidgetTitleBar(this)); } else { setTitleBarWidget(new QWidget()); } connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(locationChanged(Qt::DockWidgetArea))); d->housekeeperWidget = new QWidget(); d->housekeeperLayout = new QGridLayout(); d->housekeeperWidget->setLayout(d->housekeeperLayout); d->housekeeperLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); d->hiderWidget = new QWidget(d->housekeeperWidget); d->hiderWidget->setVisible(false); d->scrollArea = new QScrollArea(); d->scrollArea->setWidget(d->housekeeperWidget); d->scrollArea->setFrameShape(QFrame::NoFrame); d->scrollArea->setWidgetResizable(true); setWidget(d->scrollArea); d->lockButton = new QToolButton(this); if(d->hasTitle) { d->lockButton->setIcon(d->unlockIcon); } else { d->lockButton->setIcon(d->lockIcon); } d->lockButton->setToolTip(i18n("Toggles showing a title bar")); d->lockButton->setAutoRaise(true); connect(d->lockButton, SIGNAL(clicked()), SLOT(toggleLock())); d->lockButton->setVisible(true); d->lockButton->resize(d->lockButton->sizeHint()); d->tabButton = new QToolButton(this); // parent hack in toggleLock to keep it clickable d->tabButton->setIcon(d->tabIcon); d->tabButton->setToolTip(i18n("Toggles organising the options in tabs or not")); d->tabButton->setAutoRaise(true); connect(d->tabButton, SIGNAL(clicked()), SLOT(toggleTab())); d->tabButton->resize(d->tabButton->sizeHint()); d->tabButton->setVisible(d->hasTitle); } ToolDocker::~ToolDocker() { KConfigGroup cfg = KGlobal::config()->group("DockWidget sharedtooldocker"); cfg.writeEntry("TabbedMode", d->tabbed); cfg.writeEntry("Locked", d->hasTitle); cfg.sync(); delete d; } bool ToolDocker::hasOptionWidget() { return !d->currentWidgetList.isEmpty(); } void ToolDocker::setOptionWidgets(const QList > &optionWidgetList) { d->recreateLayout(optionWidgetList); } void ToolDocker::resizeEvent(QResizeEvent*) { int fw = isFloating() ? style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, this) : 0; d->lockButton->move(width() - d->lockButton->width() - d->scrollArea->verticalScrollBar()->sizeHint().width(), fw); d->tabButton->move(d->lockButton->x() - d->tabButton->width() - 2, d->lockButton->y()); } -#include +#include diff --git a/braindump/src/main.cpp b/braindump/src/main.cpp index c6c0c381c87..d62c83f5fef 100644 --- a/braindump/src/main.cpp +++ b/braindump/src/main.cpp @@ -1,56 +1,56 @@ /* * Copyright (c) 2009 Cyrille Berger * * 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, or (at your option) any later version 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #include #include #include #include #include "AboutData.h" #include "MainWindow.h" #include "KoGlobal.h" #include "RootSection.h" #include "SectionsIO.h" int main(int argc, char **argv) { - KAboutData* about = newBrainDumpAboutData(); + K4AboutData* about = newBrainDumpAboutData(); KCmdLineArgs::init(argc, argv, about); KUniqueApplication app; KIconLoader::global()->addAppDir("calligra"); KoGlobal::initialize(); KComponentData* m_documentData = new KComponentData(about); RootSection* doc = new RootSection; MainWindow* window = new MainWindow(doc, *m_documentData); window->setVisible(true); app.exec(); // Ensure the root section is saved doc->sectionsIO()->save(); delete doc; app.exit(0); }