...
 
Commits (508)
{
"phabricator.uri" : "https://phabricator.kde.org/"
}
root = true
[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
image: reporter123/cmake:bionic
build:
stage: build
before_script:
- apt-get update && apt-get install -y extra-cmake-modules gettext qtbase5-dev extra-cmake-modules libkf5i18n-dev libkf5coreaddons-dev libkf5iconthemes-dev libkf5parts-dev libkf5doctools-dev libkf5crash-dev
script:
- cmake .
- make
- make install
#artifacts:
# paths:
# - mybinary
# depending on your build setup it's most likely a good idea to cache outputs to reduce the build time
# cache:
# paths:
# - "*.o"
# run tests using the binary built before
#test:
# stage: test
# script:
# - ./runmytests.sh
# Free-bsd and windows are currently unsupport at invent.kde.org. Disabling so build will pass
include:
- https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-before.yml
- https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-extragear-linux.yml
# - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-extragear-freebsd.yml
# - https://invent.kde.org/sysadmin/ci-tooling/raw/master/invent/ci-extragear-windows.yml
stages:
- build
- test
build_ubuntu_18_04-boost(1.66):
stage: build
image: reporter123/kdiff3env:bionic
#before_script:
# - apt-get update
# - apt-get install -y libqt5test5 gettext qtbase5-dev extra-cmake-modules libkf5i18n-dev libkf5coreaddons-dev libkf5iconthemes-dev libkf5parts-dev libkf5doctools-dev libkf5crash-dev libboost-dev
script:
- cmake -DBUILD_TESTING=YES .
- make
artifacts:
untracked: true
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
ubuntu_18_04_test:
stage: test
needs: ["build_ubuntu_18_04-boost(1.66)"]
image: reporter123/kdiff3env:bionic
before_script:
- apt-get update
- apt-get install -y libqt5test5
script:
- make ARGS="-V -E appstreamtest" test #exclude appstreamtest this does not run properly in my image
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
# SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
# SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
# SPDX-License-Identifier: GPL-2.0-or-later
#cmake < 3.1 has no sane way of checking C++11 features and needed flags
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
#need at least 3.8 for cxx_std_11.
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(kdiff3)
set(CMAKE_CXX_EXTENSIONS OFF ) #don't use non-standard extensions
set(CMAKE_CXX_EXTENSIONS ON ) #disable trigraphs in clang/gcc -- officially removed in c++17
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ECM_MIN_VERSION "5.10.0")
set(QT_MIN_VERSION "5.6.0")
set(KF5_MIN_VERSION "5.23.0")
set(QT_MIN_VERSION "5.8.0")
#KF5 5.27 fixes a crash bug triggered on exit.
set(KF5_MIN_VERSION "5.37.0")
find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED)
set(
......@@ -24,8 +30,16 @@ include(FeatureSummary)
include(ECMInstallIcons)
include(ECMAddAppIcon)
include(ECMSetupVersion)
include(ECMAddTests)
ecm_setup_version(1.8.70 VARIABLE_PREFIX KDIFF3 VERSION_HEADER ${CMAKE_BINARY_DIR}/src/version.h)
ecm_setup_version(1.8.0 VARIABLE_PREFIX KDIFF3 VERSION_HEADER ${CMAKE_BINARY_DIR}/src/version.h)
# Some older versions on boost contain a bug that prevents compiling gcc offers a built-in workaround
# but that isn't enough to ship as clang has no such workaround. 1.65 is known to be affected.
find_package(Boost 1.66 REQUIRED)
#needed on craft and possiablely other custom setups.
include_directories(${Boost_INCLUDE_DIRS})
find_package(
Qt5 ${QT_MIN_VERSION}
......@@ -45,30 +59,37 @@ find_package(
I18n
CoreAddons
Crash
DocTools
IconThemes
OPTIONAL_COMPONENTS
DocTools
)
set_package_properties(KF5DocTools PROPERTIES PURPOSE "Allows generating and installing docs.")
option(ENABLE_AUTO "Enable kdiff3's '--auto' flag" ON)
option(ENABLE_CLANG_TIDY "Run clang-tidy if available and cmake version >=3.6" OFF)
set(KDiff3_LIBRARIES ${Qt5PrintSupport_LIBRARIES} KF5::I18n KF5::CoreAddons KF5::Crash KF5::IconThemes )
set(KDiff3_LIBRARIES ${Qt5PrintSupport_LIBRARIES} KF5::I18n KF5::CoreAddons KF5::IconThemes )
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
#Adjust clang specific warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wshadow")
set(CLANG_WARNING_FLAGS "-Wno-invalid-pp-token -Wno-comment -Wshorten-64-to-32 -Wstring-conversion -Wc++11-narrowing -fstack-protector-all")
set(CLANG_WARNING_FLAGS "-Wno-trigraphs -Wno-invalid-pp-token -Wno-comment -Wshorten-64-to-32 -Wstring-conversion -Wc++11-narrowing -fstack-protector-all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_WARNING_FLAGS}")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options("/EHs")
add_definitions(-DNOMINMAX) #Suppress MSVCs min/max macros
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-check")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wduplicated-cond -Wduplicated-branches -Wshadow")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-trigraphs -Wduplicated-cond -Wduplicated-branches -Wshadow")
endif()
endif()
#new in cmake 3.6+ integrate clang-tidy
if(ENABLE_CLANG_TIDY AND NOT ${CMAKE_VERSION} VERSION_LESS "3.6.0")
if(ENABLE_CLANG_TIDY)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" "clang-tidy-7" "clang-tidy-6.0" "clang-tidy-6" DOC "Path to clang-tidy executable")
if(NOT CLANG_TIDY_EXE)
message(STATUS "clang-tidy not found disabling integration.")
......@@ -82,26 +103,38 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}")
set(
needed_features
cxx_nullptr
cxx_override
cxx_nonstatic_member_init
cxx_inheriting_constructors
cxx_static_assert
cxx_std_11
)
if(ENABLE_AUTO)
add_definitions(
-DENABLE_AUTO
)
endif()
add_definitions(
-DQT_DEPRECATED_WARNINGS #Get warnings from QT about deprecated functions.
-DQT_NO_URL_CAST_FROM_STRING # casting from string to url does not always behave as you might think
-DQT_RESTRICTED_CAST_FROM_ASCII #casting from char*/QByteArray to QString can produce unexpected results for non-latin characters.
-DQT_NO_KEYWORDS
-DQT_NO_CAST_TO_ASCII
-DQT_DISABLE_DEPRECATED_BEFORE=0x050800#disable depriated api for Qt<5.8.
#KF5 5.64+ flags
#Don't warn for API depreciated after 5.36.0 (below as hex.hex.hex number)
-DKF_DEPRECATED_WARNINGS_SINCE=0x052400
-DKIOCORE_DEPRECATED_WARNINGS_SINCE=0x052400
)
add_subdirectory(src)
add_subdirectory(doc)
add_subdirectory(kdiff3fileitemactionplugin)
if(KF5DocTools_FOUND)
add_subdirectory(doc)
kdoctools_install(po)
else()
message(WARNING "DocTools not found.")
endif()
ki18n_install(po)
kdoctools_install(po)
add_subdirectory(kdiff3fileitemactionplugin)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
Version 1.8.3 - 2020-06-24
===========================
Bug 423001 fixed reload on Windows.
15f1cc4e - Fixed error handling during directory compare.
065a3997, 2d56cd94, 42b3b5e4 - Only give one error message per directory compare opperation.
Bug 419722 - Fix crash when clipboard is available. Mainly affects some network setups.
f2d89bbc - Rework intial window display and full screen toggling.
BUG:421048 - Treat /dev/null as non-existant as git expects.
Version 1.8.2 - 2020-03-29
===========================
Bug 411472 Allow editing of blank lines and don't mark newly intserted lines as a confilict
2ba20222 - Remove broken attempt to optimize drawing on horizonal scroll.
Bug 418813 - Fix line numbers not shown. Use QString::number directly not through a format string.
11e93232 - Correcly support "Print Current Page"
64804a64 - Don't attempt to free nullptr in SourceData::FileData::reset()
f4c66ace - Make Preferance dialog panes scrollable if too large to fit on screen.
de06e561 - Fix dialog filter on windows.
e8d06774 - Switch to QElapsedTime for timing avoids explictly undefined behavior inside qt if time is changed.
05e2d6fb - Fix sync mode.
f9bd88a1 - Make matching in CvsIngnoreList always honor bCaseSensitive setting.
418ea78c - Don't use temporary with QLatin1String constructor strange things will happen.
b058c060 - ignore over size cvsignore files
Bug 410962 - Fix '-L' parameter handling
b4b2c970 - Restore acciedently deleted --auto option
Bug 411602 - Fixing missing menu items also resolves a potiential crash in MergeResultWindow::slotUpdateAvailabilities (Bug 407745).
d4239b92 - Prevent intermient crash during reload/refresh
Bug 410008 - Show diff for empty/missing files.
3bb755c5 - Don't give false error when comparing empty folders
Bug 408991 - 4ad69790,0737cc3e,0402f84a - Close files when not in use - Fixes "Too many open files" bug.
Bug 407829 - Avoid crash when recieving mouse or key events during earily startup.
cc6d76e3 - Don't try to manually build url if parent is not set.
85052379 - Fix crash when canceling by using only one event loop in ProgressDialog.
d151f151 - Don't append to already complete url.
d3cb2def - Fix manual url building in FileAccess::setFromUdsEntry - scheme should not change now.
Bug 405918 - Fix craft install instructions for windows
Bug 411586 - Fix crash in OptionDialog::slotApply()
Bug 407745 - Fix crash in MergeResultWindow::slotUpdateAvailabilities
Bug 407894,399070 - Fixed redraw for horizonal scrolling.
Version 1.8 - 2019-03-22
===========================
-Don't enable "Choose C for Everthing" on two way merge.
......@@ -26,7 +66,7 @@ Version 0.9.98 - 2014-07-04
- Improved handling of texts with both right to left and left to right languages (mixed Arabic and western texts).
- Improved handling of Chinese and Japanese.
- Whitespace characters are now shown as dots for spaces and arrows for tabs, and not only in differences.
- Fixed symlink comparison (Qt4 symLinkTarget returns absolute paths)
- Fixed symlink comparison (Qt4 symLinkTarget returns absolute paths)
- Text analysis for rendering with QTextLayout is interruptable and multithreaded. (See progressbar and abort-button in statusbar)
- Fix for saving to relative path in KDE-environments. (Patch from Harald Sitter)
- Fixed bug in 0.9.97: Directory compare was always case sensitive.
......@@ -50,7 +90,7 @@ Version 0.9.97 - 2012-08-10
- Fixed mouse wheel problem. (Patch by David Hay)
- Change an encoding in diff text window via click on encoding label. (Patch by Alexey Kostromin)
- Fix for tab-key moving focus instead of adding a tab character in MergeResultWindow.
- Workaround for git on Cygwin that allows KDiff3 to find files in a Cygwin "/tmp" directory
- Workaround for git on Cygwin that allows KDiff3 to find files in a Cygwin "/tmp" directory
when environment variable "CYGWIN_BIN" is set. (Patch by Nigel Stewart)
- Removed iostream dependency (Patch by Nigel Stewart)
- Regression test framework (by Maurice van der Pot)
......@@ -76,7 +116,7 @@ Version 0.9.96 - 2011-09-02
- String corrections (Frederik Schwarzer)
- Fixed writing to KIO.
- OS2-Port (Patch by Silvan Scherrer)
- Fixed problem where destination directory would be renamed or deleted during copy operation.
- Fixed problem where destination directory would be renamed or deleted during copy operation.
Now if the destination directory exists only the files inside will be copied.
- In merge: Separate lines where the automatic choice would be the same but for different reasons.
- Fixed some problems with huge files in directory comparison mode (>2GB) (but direct comparison is still not possible)
......@@ -86,7 +126,7 @@ Version 0.9.96 - 2011-09-02
- Exclude printing code if Qt was compiled without printing support.
- For Windows: Fixed handling of unicode characters in command line parameters.
- Improved "old mac" lineendstyle handling: Break lines.
- Detect encoding specified in xml header or html "meta" tag.
- Detect encoding specified in xml header or html "meta" tag.
Version 0.9.95 - 2009/03/03
===========================
......@@ -180,7 +220,7 @@ New features:
- Filename-edit above DiffInputWindows
- Windows-Context Menu in A/B/C-columns for dir-comparison (Windows only)
- Edit Menu: Select All (Ctrl-A)
- New commandline options:
- New commandline options:
--config filename: Select an individual config file. (Now also available for Windows and Qt-only version.)
--cs config: Change one specific setting via the command line. (For settings that were previously adjustable via GUI only.)
--confighelp: Show available config items and their current values.
......@@ -233,7 +273,7 @@ Bugfixes:
- Fix for MergeResultWindow-contextmenu: All items were disabled always. (new in 0.9.84)
- Fix for problem when opening files specified relative to current directory. (new in 0.9.84, qt-only-version)
- Fix for compilation with older gcc (2.9x)
- Several Word-wrap problems fixed:
- Several Word-wrap problems fixed:
- Find string with word wrap active didn't work if found text was not in first wrap-line.
- overview-position was not updated when toggling word wrap
- horizontal scrollbar was not updated when toggling word wrap
......@@ -253,15 +293,15 @@ Version 0.9.84 - 2004/05/29
============================
New Features:
- Word Wrap for DiffTextWindow
- Directory-Comparison: Option "Full Analysis" allows you to show the number of solved vs. unsolved
- Directory-Comparison: Option "Full Analysis" allows you to show the number of solved vs. unsolved
conflicts or deltas vs. whitespace-changes in the directory tree.
- Diff-Menu for Diff-view specific entries
- Docs now contain a new chapter for uses of preprocessor and line-matching-preprocessor.
- Docs now contain a new chapter for uses of preprocessor and line-matching-preprocessor.
- Added several credits which now are also visible in the Qt-only version.
- The Qt-only version now also shows all command-line options. Under windows a dialog shows them.
- Command line options -u and -L for Subversion-support.
- Command line options --L1/2/3 for specifying alias names.
- In the Qt-only-version the user-interface-language can be set via the regional-settings
- In the Qt-only-version the user-interface-language can be set via the regional-settings
(only effective after a restart).
- ProgressDialog redesign for recursive use.
- Overview now allows you to show the delta between two other files in triplediff-mode.
......@@ -305,7 +345,7 @@ Version 0.9.82 - 2004/02/02
(To avoid accidental overwrites.)
- Icon for "Highlight white space differences."
- Editor-Option: Line End Style for saving: Dos/Windows "\r\n" vs. Unix "\n"
- Merge output editor: Corrected wrong encoding for output-filename and
- Merge output editor: Corrected wrong encoding for output-filename and
user-typed characters.
- Speedup for reading directories under Windows.
- Enhanced progress dialog responsiveness during local file copy.
......@@ -317,7 +357,7 @@ Version 0.9.81 - 2004/01/08
- Bugfix for 3 file-compare (and A or B don't exist, crashed)
- Bugfix for crash when second directory is merged
- Some keyboard-shortcuts for selection of merge-operation didn't work correctly.
- Shortcuts Ctrl-1/2/3 are possible in textmergewindow and in dirmergewindow,
- Shortcuts Ctrl-1/2/3 are possible in textmergewindow and in dirmergewindow,
depending on the focus.
- First steps towards internationalisation
- Manpage doc/en/kdiff3.1 by Eike Sauer (for Debian)
......
Building KDiff3 requires the fallowing minimium versions:
1)Qt 5.6 or later
2)KF5 5.14+
2)KF5 5.27+
3)CMake 3.1
4)ECM 1.8
Support compilers:
......@@ -33,14 +33,30 @@ Run the fallowing.
1)Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
2)iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/KDE/craft/master/setup/install_craft.ps1'))
You may also have exempt your craft directory from virus scans as these can interefer with the build process.
You may also have to exempt your craft directory from virus scans as these can interefer with the build process.
1)cd to your craft root
Run:
2)C:\CraftRoot\craft\craftenv.ps1
3)craft --package kdiff3
3)craft png2ico
4)craft kdiff3
If you what to build 1.8x than use:
4) craft --target 1.8 kdiff3
This will be a time consuming process on first run as craft will have download all dependencies.
KDiff3 does not require special configuration for craft.
Otherwise craft will use master which is the developement branch and therefor more likely to experiance breakage.
At this point you can run kdiff3 itself via the following:
cb kdiff3
bin/kdiff3
If you want to create an install package you would run:
5)craft nsis
6)craft --package kdiff3 or craft --target 1.8 --package kdiff3
This will be a time consuming process on first run as craft will have to download all dependencies.
KDiff3 does not require special configuration for craft.
There should be an installer package generated in CraftRoot/tmp
Please contact kde-windows@kde.org before filing a bug report regarding this process.
\ No newline at end of file
Copyright (c) <year> <owner>. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This diff is collapsed.
MIT License Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
......@@ -3,18 +3,25 @@ KDiff3-Readme
Author: Joachim Eibl (joachim.eibl at gmx.de)
Port to KF5/Qt5 by Michael Reeves (reeves.87@gmail.com)
KDiff3-Version: 1.8
Now requires Qt 5.6 or later and KF5 5.14+. Legacy 0.9.98 and earlier builds are not supported.
MacOSX build is untested since port. The Konqueror specific plugin is not ported and no longer maintained.
This plugin would only apply to KDE before 4.6. Support as been removed from main CMakeLists.txt.
As of 1/13/17 cmake 3.1+ is the targeted cmake version.
KDiff3-Version: 1.8.70
Now requires Qt 5.6 or later and KF5 5.27+. Legacy 0.9.98 and earlier builds are not supported.
MacOSX build is 64-bit only unfortantually I cann't test build locally. The Konqueror specific plugin
is not ported and no longer maintained. This plugin would only apply to KDE before 4.6. As of 1/13/17
cmake 3.1+ is the targeted cmake version.
cmake is now the only build system supported. KF5/Qt5 was big jump. A lot changed besides just the API.
I am not against a Qt5-only build variant but see no reason to maintain two separate build systems.
At present KF5 is my focus.
Known Issues:
*Binary comparison has been temporarily disabled due to stability issues.
*Network comparison operation via non file urls may hang or crash. This is under investegation.
The current reprository is at https://invent.kde.org/kde/kdiff3
Bugs can be reported at https://bugs.kde.org
The original pre KF5/Qt5 Readme follows old build instructions have been removed to avoid confusion:
......
#! /usr/bin/env bash
$EXTRACTRC *.rc >> rc.cpp
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/diff_ext.pot
$XGETTEXT *.cpp -o $podir/diff_ext.pot
/*
* Copyright (c) 2003, Sergey Zorin. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
SPDX-FileCopyrightText: 2003-2006, Sergey Zorin. All rights reserved.
SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
SPDX-License-Identifier: BSD-2-Clause
*/
#include "class_factory.h"
#include "diff_ext.h"
#include "server.h"
......
/*
* Copyright (c) 2003, Sergey Zorin. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
SPDX-FileCopyrightText: 2003-2006, Sergey Zorin. All rights reserved.
SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
SPDX-License-Identifier: BSD-2-Clause
*/
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef class_factory_h
#define class_factory_h
#ifndef __class_factory_h__
#define __class_factory_h__
#include <shlobj.h>
#include <shlguid.h>
......@@ -43,9 +23,9 @@ class CLASS_FACTORY : public IClassFactory {
//ICLASS_FACTORY members
STDMETHODIMP CreateInstance(IUnknown*, REFIID, void**);
STDMETHODIMP LockServer(BOOL);
private:
ULONG _ref_count;
};
#endif //__class_factory_h__
#endif //class_factory_h
This diff is collapsed.
/*
* Copyright (c) 2003-2004, Sergey Zorin. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
SPDX-FileCopyrightText: 2003-2006, Sergey Zorin. All rights reserved.
SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
SPDX-License-Identifier: BSD-2-Clause
*/
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __diff_ext_h__
#define __diff_ext_h__
#ifndef diff_ext_h
#define diff_ext_h
#include <windows.h>
#include <windowsx.h>
......@@ -58,7 +38,6 @@ class DIFF_EXT : public IContextMenu, IShellExtInit {
void diff( const tstring& arguments );
void diff_with(unsigned int num, bool bMerge);
tstring cut_to_length(const tstring&, size_t length = 64);
void initialize_language();
private:
UINT m_nrOfSelectedFiles;
......
/*
* Copyright (c) 2003, Sergey Zorin. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __string_h__
#define __string_h__
#include <windows.h>
#include <tchar.h>
#include <string.h>
#include <stdlib.h>
class STRING;
inline STRING operator+( const STRING& s1, const STRING& s2);
class STRING {
public:
static const int begin = 0;
static const int end = -1;
public:
STRING(const STRING& s) {
_str = new TCHAR[s.length()+1];
lstrcpy(_str, s);
}
STRING(const TCHAR* str = TEXT("")) {
_str = new TCHAR[lstrlen(str)+1];
lstrcpy(_str, str);
}
~STRING() {
delete[] _str;
}
void resize( size_t newLength )
{
size_t oldLength = length();
if ( newLength < oldLength ) {
_str[newLength] = 0; // Just truncate the string
} else if( newLength>oldLength) {
TCHAR* p = new TCHAR[ newLength + 1 ];
lstrcpy(p, _str);
for( size_t i=oldLength; i<newLength; ++i)
p[i]=TEXT(' ');
p[newLength]=0;
}
}
STRING& operator=(const STRING& s) {
delete[] _str;
_str = new TCHAR[s.length()+1];
lstrcpy(_str, s);
return *this;
}
operator TCHAR*() {
return _str;
}
operator const TCHAR*() const {
return _str;
}
const TCHAR* c_str() const {
return _str;
}
size_t length() const {
return _tcslen(_str);
}
// Also returns the length. Behaviour like std::basic_string::size.
// See also sizeInBytes() below.
size_t size() const {
return length();
}
// String length in bytes. May differ from length() for Unicode or MBCS
size_t sizeInBytes() const {
return length()*sizeof(TCHAR);
}
bool empty() const
{
return length()==0;
}
STRING substr(size_t from, size_t len=size_t(-1)) const {
STRING tmp;
size_t to = len==size_t(-1) ? length() : from + len;
if(from < to && (to <= length())) {
size_t new_len = to - from + 1;
TCHAR* new_str = new TCHAR[new_len+1];
lstrcpyn(new_str, &_str[from], int(new_len) );
new_str[new_len] = 0;
tmp = new_str;
delete[] new_str;
}
return tmp;
}
STRING& replace( size_t pos, size_t num, const STRING& s )
{
*this = substr( 0, pos ) + s + substr( pos+num );
return *this;
}
bool operator ==(const STRING& s) const {
return (lstrcmp(_str, s) == 0);
}
size_t find(const STRING& s) const
{
const TCHAR* p = _tcsstr( _str, s._str );
if (p)
return p - _str;
else
return size_t(-1);
}
STRING& operator +=(const STRING& s) {
TCHAR* str = new TCHAR[lstrlen(_str)+s.length()+1];
lstrcpy(str, _str);
lstrcat(str, s);
delete[] _str;
_str = str;
return *this;
}
private:
TCHAR* _str;
};
inline STRING operator+( const STRING& s1, const STRING& s2) {
STRING tmp(s1);
tmp+=s2;
return tmp;
}
#endif // __string_h__
This diff is collapsed.
/*
* Copyright (c) 2003-2005, Sergey Zorin. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __server_h__
#define __server_h__
SPDX-FileCopyrightText: 2003-2006, Sergey Zorin. All rights reserved.
SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
SPDX-License-Identifier: BSD-2-Clause
*/
#ifndef server_h
#define server_h
#include <list> // std::list
//#include <log/file_sink.h>
#include <windows.h>
#include <string> // std::wstring
#ifdef UNICODE
typedef std::wstring tstring;
#define toQString(s) QString::fromStdWString(s)
#define fromQString(s) (s).toStdWString()
#else
typedef std::string tstring;
#define toQString(s) { QString::fromStdString(s);}
#define fromQString(s) { (s).toStdString();}
#endif
#define MESSAGELOG( msg ) SERVER::logMessage( __FUNCTION__, __FILE__, __LINE__, msg )
......@@ -53,34 +42,34 @@ class SERVER {
public:
static SERVER* instance();
void initLogging();
public:
virtual ~SERVER();
tstring getRegistryKeyString( const tstring& subKey, const tstring& value );
HINSTANCE handle() const;
HRESULT do_register();
HRESULT do_unregister();
void lock();
void release();
ULONG reference_count() const {
return _reference_count;
}
std::list< tstring >& recent_files();
void save_history() const;
static void logMessage( const char* function, const char* file, int line, const tstring& msg );
private:
SERVER();
SERVER(const SERVER&) {}
private:
LONG _reference_count;
std::list<tstring>* m_pRecentFiles;
......
# SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
# SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
# SPDX-License-Identifier: GPL-2.0-or-later
add_subdirectory(en)
# SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
# SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
# SPDX-License-Identifier: GPL-2.0-or-later
kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kdiff3)
kdoctools_create_manpage (man-kdiff3.1.docbook 1 INSTALL_DESTINATION ${KDE_INSTALL_MANDIR})
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,7 +21,7 @@
<refnamediv>
<refname><command>kdiff3</command></refname>
<refpurpose>Tool for Comparison and Merge of Files and Directories</refpurpose>
<refpurpose>Tool for Comparison and Merge of Files and Folders</refpurpose>
</refnamediv>
<refsynopsisdiv>
......@@ -35,6 +35,7 @@
<arg choice="opt"><option>-b, --base</option> <replaceable>file</replaceable></arg>
<arg choice="opt"><option>-o, --output</option> <replaceable>file</replaceable></arg>
<arg choice="opt"><option>--out</option> <replaceable>file</replaceable></arg>
<arg choice="opt"><option>--noauto</option></arg>
<arg choice="opt"><option>--auto</option></arg>
<arg choice="opt"><option>--qall</option></arg>
<arg choice="opt"><option>-L1</option> <replaceable>alias1</replaceable></arg>
......@@ -52,7 +53,7 @@
<refsect1>
<title>Description</title>
<para>Compares two or three input files or directories.</para>
<para>Compares two or three input files or folders.</para>
</refsect1>
......
#! /usr/bin/env bash
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/kdiff3fileitemactionplugin.pot
$XGETTEXT *.cpp -o $podir/kdiff3fileitemactionplugin.pot
/* This file is part of the KDiff3 project
Copyright (C) 2008 Joachim Eibl <joachim dot eibl at gmx dot de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
/*
* KDiff3 - Text Diff And Merge Tool
*
* SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
* SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kdiff3fileitemaction.h"
......@@ -94,14 +82,8 @@ QList<QAction*> KDiff3FileItemAction::actions( const KFileItemListProperties& fi
pMenuAction->setMenu( pActionMenu );
// remember currently selected files (copy to a QStringList)
QList<QUrl> itemList = fileItemInfos.urlList();
foreach(const QUrl& item, itemList)
{
//m_urlList.append( item.url() );
m_list.append( item );
}
// remember currently selected files
m_list = fileItemInfos.urlList();
/* Menu structure:
KDiff3 -> (1 File selected): Save 'selection' for later comparison (push onto history stack)
......@@ -151,11 +133,12 @@ QList<QAction*> KDiff3FileItemAction::actions( const KFileItemListProperties& fi
pHistoryMenuAction->setMenu( pHistoryMenu );
pHistoryMenu->setEnabled( m_list.count()>0 && historyCount>0 );
pActionMenu->addAction(pHistoryMenuAction);
foreach (const QString &file, *s_pHistory) {
pAction = new QAction(file, this);
pAction->setData(file);
connect(pAction, &QAction::triggered, this, &KDiff3FileItemAction::slotCompareWithHistoryItem);
pHistoryMenu->addAction(pAction);
for(const QString& file : qAsConst(*s_pHistory))
{
pAction = new QAction(file, this);
pAction->setData(file);
connect(pAction, &QAction::triggered, this, &KDiff3FileItemAction::slotCompareWithHistoryItem);
pHistoryMenu->addAction(pAction);
}
pAction = new QAction(i18n("Clear list"), this);
......@@ -254,8 +237,8 @@ void KDiff3FileItemAction::slotMergeThreeWay()
if ( m_list.count() > 0 && s_pHistory && s_pHistory->count()>=2 )
{
QStringList args;
args << (*s_pHistory).at(1);
args << (*s_pHistory).at(0);
args << s_pHistory->at(1);
args << s_pHistory->at(0);
args << m_list.first().toDisplayString(QUrl::PreferLocalFile);
args << ("-o" + m_list.first().toDisplayString(QUrl::PreferLocalFile));
KProcess::startDetached ("kdiff3", args);
......@@ -292,7 +275,7 @@ void KDiff3FileItemAction::slotAbout()
"Then use \"Compare With\" on the second file.\n"
"For a 3-way merge first \"Save\" the base file, then the branch to merge and "
"choose \"3-way merge with base\" on the other branch which will be used as destination.\n"
"Same also applies to directory comparison and merge.");
"Same also applies to folder comparison and merge.");
KMessageBox::information(m_pParentWidget, s, i18n("About KDiff3 File Item Action Plugin") );
}
/* This file is part of the KDiff3 project
Copyright (C) 2008 Joachim Eibl <Joachim dot Eibl at gmx dot de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
/*
* KDiff3 - Text Diff And Merge Tool
*
* SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
* SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KDIFF3FILEITEMACTIONPLUGIN_H
......@@ -23,9 +11,6 @@
#include <KAbstractFileItemActionPlugin>
#include <KFileItemListProperties>
#include <QStringList>
class QStringList;
class KDiff3FileItemAction : public KAbstractFileItemActionPlugin
{
......@@ -49,7 +34,7 @@ private Q_SLOTS:
private:
QList<QUrl> m_list;
QWidget* m_pParentWidget;
QWidget* m_pParentWidget = nullptr;
//KFileItemListProperties m_fileItemInfos;
};
#endif
......@@ -4,26 +4,29 @@
"application/octet-stream",
"inode/directory"
],
"Name": "Compare/Merge Files/Directories with KDiff3",
"Name[ca@valencia]": "Compara/fusiona fitxers/directoris amb el KDiff3",
"Name[ca]": "Compara/fusiona fitxers/directoris amb el KDiff3",
"Name[cs]": "Porovnávejte/slučujte soubory/adresáře pomocí KDiff3",
"Name": "Compare/Merge Files/Folders with KDiff3",
"Name[ca@valencia]": "Compara/fusiona fitxers/carpetes amb el KDiff3",
"Name[ca]": "Compara/fusiona fitxers/carpetes amb el KDiff3",
"Name[cs]": "Porovnávejte/slučujte soubory/složky pomocí KDiff3",
"Name[de]": "Dateien und Ordner vergleichen und zusammenführen mit KDiff3",
"Name[en_GB]": "Compare/Merge Files/Directories with KDiff3",
"Name[es]": "Comparar o fusionar archivos o directorios con KDiff3",
"Name[en_GB]": "Compare/Merge Files/Folders with KDiff3",
"Name[es]": "Comparar o fusionar archivos o carpetas con KDiff3",
"Name[et]": "Failide/kataloogide võrdlemine/ühendamine KDiff3 abil",
"Name[eu]": "Alderatu/bateratu fitxategiak/direktorioak KDiff3 erabiliz",
"Name[fi]": "Vertaa ja yhdistä tiedostoja ja kansioita KDiff3:lla",
"Name[fr]": "Comparaison et fusion de fichiers ou de dossiers à l'aide de « KDiff3 »",
"Name[gl]": "Comparar ou mesturar ficheiros ou directorios con KDiff3",
"Name[ia]": "Compara/Fusiona Files/Dossieres con KDiff3",
"Name[it]": "Confronta e fonde i file o le cartelle con KDiff3",
"Name[ko]": "KDiff3으로 파일과 폴더를 비교하거나 병합",
"Name[nl]": "Vergelijk/Voeg samen bestanden/mappen met KDiff3",
"Name[pl]": "Porównuj/Scalaj pliki/katalogi z KDiff3",
"Name[nn]": "Samanlikna/flett filer/mapper med KDiff3",
"Name[pt]": "Comparar/Reunir os Ficheiros/Pastas com o KDiff3",
"Name[pt_BR]": "Comparar/Mesclar arquivos/pastas com o KDiff3",
"Name[sk]": "Porovnať/zlúčiť súbory/adresáre s KDiff3",
"Name[sv]": "Jämför/Sammanfoga filer/kataloger med KDiff3",
"Name[uk]": "Порівняння та об'єднання файлів та каталогів за допомогою KDiff3",
"Name[x-test]": "xxCompare/Merge Files/Directories with KDiff3xx",
"Name[zh_TW]": "使用 KDiff3 比較/合併檔案或資料夾",
"Name[pt_BR]": "Comparar/mesclar arquivos/pastas com o KDiff3",
"Name[ru]": "Сравнение и слияние файлов и папок с использованием приложения KDiff3",
"Name[sl]": "Primerjaj/Zlij datoteke/Mape s KDiff3",
"Name[sv]": "Jämför/Sammanfoga filer/kataloger med Kdiff3",
"Name[uk]": "Порівняння та об'єднання файлів та тек за допомогою KDiff3",
"Name[x-test]": "xxCompare/Merge Files/Folders with KDiff3xx",
"ServiceTypes": [
"KFileItemAction/Plugin"
]
......
logo.png

2.88 KB

# SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
# SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
# SPDX-License-Identifier: GPL-2.0-or-later
########### kdiff3 KPart ###############
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Parts WidgetsAddons)
......@@ -29,7 +31,15 @@ set(kdiff3part_PART_SRCS
SourceData.cpp
Overview.cpp
Logging.cpp
FileNameLineEdit.cpp )
FileNameLineEdit.cpp
MergeEditLine.cpp
Options.cpp
CommentParser.cpp )
ki18n_wrap_ui(kdiff3part_PART_SRCS
scroller.ui
opendialog.ui
)
add_library(kdiff3part MODULE ${kdiff3part_PART_SRCS})
......@@ -49,12 +59,36 @@ set(kdiff3_SRCS
${kdiff3part_PART_SRCS}
)
if(BUILD_TESTING)
add_subdirectory( autotests )
endif()
#cann't use add_subdirectory because it changes the scope.
include(icons/CMakeLists.txt)
add_executable(kdiff3 ${kdiff3_SRCS})
target_link_libraries(kdiff3 KF5::ConfigCore KF5::ConfigGui KF5::Parts KF5::Crash ${KDiff3_LIBRARIES} )
target_compile_features(kdiff3 PRIVATE ${needed_features})
install(TARGETS kdiff3 ${INSTALL_TARGETS_DEFAULT_ARGS})
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
if(APPLE)
set_property(
TARGET kdiff3
PROPERTY MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in
)
# These are substituted by CMake into plist.in.
set(MACOSX_BUNDLE_DISPLAY_NAME "KDiff3")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.KDiff3")
set(MACOSX_BUNDLE_BUNDLE_NAME "KDiff3")
set(MACOSX_BUNDLE_DISPLAY_NAME "KDiff3")
set(MACOSX_BUNDLE_INFO_STRING "KDiff3 - Diff/Patch Frontend")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "KDiff3 ${KDIFF3_VERSION}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${KDIFF3_VERSION_MAJOR}.${KDIFF3_VERSION_MINOR}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${KDIFF3_VERSION}")
set(MACOSX_BUNDLE_COPYRIGHT "2003-2020 The KDiff3 Authors")
endif()
install(TARGETS kdiff3 ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
########### install files ###############
......@@ -66,4 +100,3 @@ install( FILES kdiff3_shell.rc DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kdiff3 )
install( PROGRAMS org.kde.kdiff3.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES org.kde.kdiff3.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
add_subdirectory(icons)
/*
* KDiff3 - Text Diff And Merge Tool
*
* SPDX-FileCopyrightText: 2019-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "CommentParser.h"
#include <QChar>
#include <QRegularExpression>
#include <QSharedPointer>
#include <QString>
void DefaultCommentParser::processChar(const QString &line, const QChar &inChar)
{
if(!bIsEscaped)
{
switch(inChar.unicode())
{
case '\\':
if(bInString)
bIsEscaped = true;
break;
case '\'':
case '"':
if(!inComment())
{
if(!bInString)
{
bInString = true;
mStartChar = inChar;
}
else if(mStartChar == inChar)
{
bInString = false;
}
}
break;
case '/':
if(bInString)
break;
if(!inComment() && mLastChar == '/')
{
mCommentType = singleLine;
mIsPureComment = line.startsWith(QLatin1String("//"));
lastComment.startOffset = offset - 1;
}
else if(mLastChar == '*' && mCommentType == multiLine)
{
//ending multi-line comment
mCommentType = none;
lastComment.endOffset = offset + 1; //include last char in offset
comments.push_back(lastComment);
if(!isFirstLine)
mIsPureComment = line.endsWith(QLatin1String("*/")) ? true : mIsPureComment;
}
break;
case '*':
if(bInString)
break;
if(mLastChar == '/' && !inComment())
{
mCommentType = multiLine;
mIsPureComment = line.startsWith(QLatin1String("/*")) ? true : mIsPureComment;
isFirstLine = true;
lastComment.startOffset = offset - 1;
}
break;
case '\n':
if(mCommentType == singleLine)
{
mCommentType = none;
lastComment.endOffset = offset;
comments.push_back(lastComment);
}
if(mCommentType == multiLine && !isFirstLine)
{
mIsPureComment = true;
}
if(lastComment.startOffset > 0 && lastComment.endOffset == 0)
{
lastComment.endOffset = offset;
comments.push_back(lastComment);
}
isFirstLine = false;
break;
default:
if(inComment())
{
break;
}
mIsPureComment = false;
break;
}
mLastChar = inChar;
}
else
{
bIsEscaped = false;
mLastChar = QChar();
}
++offset;
};
/*
Find comments if any and set is pure comment flag it it has nothing but whitespace and comments.
*/
void DefaultCommentParser::processLine(const QString &line)
{
offset = line.indexOf(QRegularExpression("[\\S]", QRegularExpression::UseUnicodePropertiesOption));
lastComment.startOffset = lastComment.endOffset = 0; //reset these for each line
comments.clear();
//remove trailing and ending spaces.
const QString trimmedLine = line.trimmed();
for(const QChar &c : trimmedLine)
{
processChar(trimmedLine, c);
}
processChar(trimmedLine, '\n');
}
/*
Modifies the input data, and replaces comments with whitespace when the line contains other data too.
*/
void DefaultCommentParser::removeComment(QString &line)
{
if(isPureComment() || lastComment.startOffset == lastComment.endOffset) return;
for(const CommentRange &range : comments)
{
/*
Q_ASSERT isn't useful during auto testing as it causes the QTest not to show the actual line that
the test failed on.
*/
#ifndef AUTOTEST
Q_ASSERT(range.endOffset <= line.length() && range.startOffset <= line.length());
Q_ASSERT(range.endOffset >= range.startOffset);
#endif
qint32 size = range.endOffset - range.startOffset;
line.replace(range.startOffset, size, QString(" ").repeated(size));
}
}
/*
* KDiff3 - Text Diff And Merge Tool
*
* SPDX-FileCopyrightText: 2019-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef COMMENTPARSER_H
#define COMMENTPARSER_H
#include <vector>
#include <QChar>
#include <QString>
class CommentParser
{
public:
virtual void processChar(const QString &line, const QChar &inChar) = 0;
virtual void processLine(const QString &line) = 0;
virtual void removeComment(QString &line) = 0;
virtual bool inComment() const = 0;
virtual bool isPureComment() const = 0;
virtual ~CommentParser(){};
};
class DefaultCommentParser : public CommentParser
{
private:
typedef enum {none, singleLine, multiLine}CommentType;
public:
void processLine(const QString &line) override;
inline bool inComment() const override { return mCommentType != none; };
inline bool isPureComment() const override { return mIsPureComment; };
void removeComment(QString &line) override;
protected:
friend class CommentParserTest;
void processChar(const QString &line, const QChar &inChar) override;
//For tests only.
inline bool isEscaped() const{ return bIsEscaped; }
inline bool inString() const{ return bInString; }
private:
QChar mLastChar, mStartChar;
struct CommentRange
{
qint32 startOffset = 0;
qint32 endOffset = 0;
};
qint32 offset = -1;
CommentRange lastComment;
std::vector<CommentRange> comments;
bool isFirstLine = false;
bool mIsPureComment = false;
bool bInString = false;
bool bIsEscaped = false;
CommentType mCommentType = none;
};
#endif // !COMMENTPASER_H
/**
* Copyright (C) 2019 Michael Reeves <reeves.87@gmail.com>
* Copyright (C) 2002-2009 Joachim Eibl, joachim.eibl at gmx.de
/*
* This file is part of KDiff3.
*
* This file is part of KDiff3.
*
* KDiff3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* KDiff3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with KDiff3. If not, see <http://www.gnu.org/licenses/>.
*/
* SPDX-FileCopyrightText: 2002-2011 Joachim Eibl, joachim.eibl at gmx.de
* SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef CONFIGVALUEMAP_H
#define CONFIGVALUEMAP_H
......
/**
* Copyright (C) 2018 Michael Reeves reeves.87@gmail.com
*
* This file is part of KDiff3.
*
* KDiff3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* KDiff3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with KDiff3. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* KDiff3 - Text Diff And Merge Tool
*
* SPDX-FileCopyrightText: 2018-2020 Michael Reeves reeves.87@gmail.com
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef DIRECTORYINFO_H
#define DIRECTORYINFO_H
......@@ -49,6 +37,8 @@ class DirectoryInfo
return m_dirC.isValid() ? m_dirC : m_dirB;
}
inline bool allowSyncMode() { return !m_dirC.isValid() && !m_dirDest.isValid(); }