Commit 4abec9ed authored by Joachim Eibl's avatar Joachim Eibl

KDiff3-0.9.91 (Qt3 based src)

git-svn-id: https://kdiff3.svn.sourceforge.net/svnroot/kdiff3/trunk@80 c8aa9fed-2811-0410-8543-893ada326672
parent cf77f4c3
# set the include path for X, qt and KDE
INCLUDES = $(all_includes)
# these are the headers for your project
noinst_HEADERS = kdiff3_part.h kdiff3_shell.h kdiff3.h common.h diff.h \
directorymergewindow.h merger.h optiondialog.h fileaccess.h version.h \
smalldialogs.h difftextwindow.h mergeresultwindow.h
# let automoc handle all of the meta source files (moc)
METASOURCES = AUTO
messages: rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/kdiff3.pot
KDE_ICON = kdiff3
# this Makefile creates both a KPart application and a KPart
#########################################################################
# APPLICATION SECTION
#########################################################################
# this is the program that gets installed. it's name is used for all
# of the other Makefile.am variables
bin_PROGRAMS = kdiff3
# the application source, library search path, and link libraries
kdiff3_SOURCES = main.cpp kdiff3_shell.cpp
kdiff3_LDFLAGS = $(KDE_RPATH) $(all_libraries)
kdiff3_LDADD = $(LIB_KPARTS)
# this is where the desktop file will go
shelldesktopdir = $(kde_appsdir)/Development
shelldesktop_DATA = kdiff3.desktop
# this is where the shell's XML-GUI resource file goes
shellrcdir = $(kde_datadir)/kdiff3
shellrc_DATA = kdiff3_shell.rc
#########################################################################
# KPART SECTION
#########################################################################
kde_module_LTLIBRARIES = libkdiff3part.la
# the Part's source, library search path, and link libraries
libkdiff3part_la_SOURCES = kdiff3_part.cpp kdiff3.cpp directorymergewindow.cpp \
merger.cpp pdiff.cpp difftextwindow.cpp diff.cpp optiondialog.cpp \
mergeresultwindow.cpp fileaccess.cpp gnudiff_analyze.cpp gnudiff_io.cpp gnudiff_xmalloc.cpp \
common.cpp smalldialogs.cpp
libkdiff3part_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
libkdiff3part_la_LIBADD = $(LIB_KDEPRINT) $(LIB_KPARTS) $(LIB_KFILE)
# this is where the desktop file will go
partdesktopdir = $(kde_servicesdir)
partdesktop_DATA = kdiff3part.desktop
# this is where the part's XML-GUI resource file goes
partrcdir = $(kde_datadir)/kdiff3part
partrc_DATA = kdiff3_part.rc
#############################################################################
# Makefile for building: kdiff3
# Generated by qmake (1.07a) (Qt 3.3.5) on: Sat Apr 8 20:11:51 2006
# Project: kdiff3.pro
# Template: app
# Command: $(QMAKE) -o Makefile kdiff3.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
LEX = flex
YACC = yacc
CFLAGS = -pipe -O2 -Wall -W -fPIC -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -D__USE_STD_IOSTREAM
CXXFLAGS = -pipe -O2 -Wall -W -fPIC -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -D__USE_STD_IOSTREAM
LEXFLAGS =
YACCFLAGS= -d
INCPATH = -I$(QTDIR)/mkspecs/default -I. -Ikreplacements -I/usr/include -I$(QTDIR)/include
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib/ -L$(QTDIR)/lib/ -L/usr/X11R6/lib/ -lqt-mt -lXext -lX11 -lm -lpthread
AR = ar cqs
RANLIB =
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
QMAKE = qmake
TAR = tar -cf
GZIP = gzip -9f
COPY = cp -f
COPY_FILE= $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE= $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
HEADERS = version.h \
diff.h \
difftextwindow.h \
mergeresultwindow.h \
kdiff3.h \
merger.h \
optiondialog.h \
kreplacements/kreplacements.h \
directorymergewindow.h \
fileaccess.h \
kdiff3_shell.h \
kdiff3_part.h \
smalldialogs.h
SOURCES = main.cpp \
diff.cpp \
difftextwindow.cpp \
kdiff3.cpp \
merger.cpp \
mergeresultwindow.cpp \
optiondialog.cpp \
pdiff.cpp \
directorymergewindow.cpp \
fileaccess.cpp \
smalldialogs.cpp \
kdiff3_shell.cpp \
kdiff3_part.cpp \
gnudiff_analyze.cpp \
gnudiff_io.cpp \
gnudiff_xmalloc.cpp \
common.cpp \
kreplacements/kreplacements.cpp \
kreplacements/ShellContextMenu.cpp
OBJECTS = main.o \
diff.o \
difftextwindow.o \
kdiff3.o \
merger.o \
mergeresultwindow.o \
optiondialog.o \
pdiff.o \
directorymergewindow.o \
fileaccess.o \
smalldialogs.o \
kdiff3_shell.o \
kdiff3_part.o \
gnudiff_analyze.o \
gnudiff_io.o \
gnudiff_xmalloc.o \
common.o \
kreplacements.o \
ShellContextMenu.o
FORMS =
UICDECLS =
UICIMPLS =
SRCMOC = moc_difftextwindow.cpp \
moc_mergeresultwindow.cpp \
moc_kdiff3.cpp \
moc_optiondialog.cpp \
kreplacements/moc_kreplacements.cpp \
moc_directorymergewindow.cpp \
moc_fileaccess.cpp \
moc_kdiff3_shell.cpp \
moc_kdiff3_part.cpp \
moc_smalldialogs.cpp
OBJMOC = moc_difftextwindow.o \
moc_mergeresultwindow.o \
moc_kdiff3.o \
moc_optiondialog.o \
moc_kreplacements.o \
moc_directorymergewindow.o \
moc_fileaccess.o \
moc_kdiff3_shell.o \
moc_kdiff3_part.o \
moc_smalldialogs.o
DIST = kdiff3.pro
QMAKE_TARGET = kdiff3
DESTDIR =
TARGET = kdiff3
first: all
####### Implicit rules
.SUFFIXES: .c .o .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
all: $(TARGET)
$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)
mocables: $(SRCMOC)
uicables: $(UICDECLS) $(UICIMPLS)
$(MOC):
( cd $(QTDIR)/src/moc && $(MAKE) )
dist:
@mkdir -p .tmp/kdiff3 && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) .tmp/kdiff3/ && ( cd `dirname .tmp/kdiff3` && $(TAR) kdiff3.tar kdiff3 && $(GZIP) kdiff3.tar ) && $(MOVE) `dirname .tmp/kdiff3`/kdiff3.tar.gz . && $(DEL_FILE) -r .tmp/kdiff3
mocclean:
-$(DEL_FILE) $(OBJMOC)
-$(DEL_FILE) $(SRCMOC)
uiclean:
yaccclean:
lexclean:
clean: mocclean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET) $(TARGET)
FORCE:
####### Compile
main.o: main.cpp kdiff3_shell.h \
version.h \
optiondialog.h \
common.h
diff.o: diff.cpp diff.h \
fileaccess.h \
optiondialog.h \
common.h
difftextwindow.o: difftextwindow.cpp difftextwindow.h \
merger.h \
optiondialog.h \
diff.h \
common.h \
fileaccess.h
kdiff3.o: kdiff3.cpp difftextwindow.h \
mergeresultwindow.h \
kdiff3.h \
optiondialog.h \
fileaccess.h \
kdiff3_part.h \
directorymergewindow.h \
smalldialogs.h \
xpm/downend.xpm \
xpm/currentpos.xpm \
xpm/down1arrow.xpm \
xpm/down2arrow.xpm \
xpm/upend.xpm \
xpm/up1arrow.xpm \
xpm/up2arrow.xpm \
xpm/prevunsolved.xpm \
xpm/nextunsolved.xpm \
xpm/iconA.xpm \
xpm/iconB.xpm \
xpm/iconC.xpm \
xpm/autoadvance.xpm \
xpm/showwhitespace.xpm \
xpm/showwhitespacechars.xpm \
xpm/showlinenumbers.xpm \
diff.h \
common.h
merger.o: merger.cpp merger.h \
diff.h \
common.h \
fileaccess.h \
optiondialog.h
mergeresultwindow.o: mergeresultwindow.cpp mergeresultwindow.h \
optiondialog.h \
diff.h \
common.h \
fileaccess.h
optiondialog.o: optiondialog.cpp optiondialog.h \
diff.h \
smalldialogs.h \
common.h \
fileaccess.h
pdiff.o: pdiff.cpp difftextwindow.h \
mergeresultwindow.h \
directorymergewindow.h \
smalldialogs.h \
kdiff3.h \
optiondialog.h \
fileaccess.h \
gnudiff_diff.h \
diff.h \
common.h \
gnudiff_system.h
directorymergewindow.o: directorymergewindow.cpp directorymergewindow.h \
optiondialog.h \
xpm/link_arrow.xpm \
xpm/file.xpm \
xpm/folder.xpm \
xpm/startmerge.xpm \
xpm/showequalfiles.xpm \
xpm/showfilesonlyina.xpm \
xpm/showfilesonlyinb.xpm \
xpm/showfilesonlyinc.xpm \
common.h \
fileaccess.h \
diff.h
fileaccess.o: fileaccess.cpp fileaccess.h \
optiondialog.h \
common.h
smalldialogs.o: smalldialogs.cpp smalldialogs.h \
optiondialog.h \
diff.h \
common.h \
fileaccess.h
kdiff3_shell.o: kdiff3_shell.cpp kdiff3_shell.h \
kdiff3.h \
diff.h \
common.h \
fileaccess.h \
optiondialog.h
kdiff3_part.o: kdiff3_part.cpp kdiff3_part.h \
kdiff3.h \
fileaccess.h \
version.h \
diff.h \
common.h \
optiondialog.h
gnudiff_analyze.o: gnudiff_analyze.cpp gnudiff_diff.h \
gnudiff_system.h
gnudiff_io.o: gnudiff_io.cpp gnudiff_diff.h \
gnudiff_system.h
gnudiff_xmalloc.o: gnudiff_xmalloc.cpp gnudiff_diff.h \
gnudiff_system.h
common.o: common.cpp common.h
kreplacements.o: kreplacements/kreplacements.cpp kreplacements/kreplacements.h \
common.h \
xpm/fileopen.xpm \
xpm/filesave.xpm \
xpm/fileprint.xpm \
kreplacements/kreplacements.moc
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o kreplacements.o kreplacements/kreplacements.cpp
ShellContextMenu.o: kreplacements/ShellContextMenu.cpp kreplacements/ShellContextMenu.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o ShellContextMenu.o kreplacements/ShellContextMenu.cpp
moc_difftextwindow.o: moc_difftextwindow.cpp difftextwindow.h diff.h \
common.h \
fileaccess.h \
optiondialog.h
moc_mergeresultwindow.o: moc_mergeresultwindow.cpp mergeresultwindow.h diff.h \
common.h \
fileaccess.h \
optiondialog.h
moc_kdiff3.o: moc_kdiff3.cpp kdiff3.h diff.h \
common.h \
fileaccess.h \
optiondialog.h
moc_optiondialog.o: moc_optiondialog.cpp optiondialog.h
moc_kreplacements.o: kreplacements/moc_kreplacements.cpp kreplacements/kreplacements.h common.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_kreplacements.o kreplacements/moc_kreplacements.cpp
moc_directorymergewindow.o: moc_directorymergewindow.cpp directorymergewindow.h common.h \
fileaccess.h \
diff.h \
optiondialog.h
moc_fileaccess.o: moc_fileaccess.cpp fileaccess.h
moc_kdiff3_shell.o: moc_kdiff3_shell.cpp kdiff3_shell.h
moc_kdiff3_part.o: moc_kdiff3_part.cpp kdiff3_part.h
moc_smalldialogs.o: moc_smalldialogs.cpp smalldialogs.h diff.h \
common.h \
fileaccess.h \
optiondialog.h
moc_difftextwindow.cpp: $(MOC) difftextwindow.h
$(MOC) difftextwindow.h -o moc_difftextwindow.cpp
moc_mergeresultwindow.cpp: $(MOC) mergeresultwindow.h
$(MOC) mergeresultwindow.h -o moc_mergeresultwindow.cpp
moc_kdiff3.cpp: $(MOC) kdiff3.h
$(MOC) kdiff3.h -o moc_kdiff3.cpp
moc_optiondialog.cpp: $(MOC) optiondialog.h
$(MOC) optiondialog.h -o moc_optiondialog.cpp
kreplacements/moc_kreplacements.cpp: $(MOC) kreplacements/kreplacements.h
$(MOC) kreplacements/kreplacements.h -o kreplacements/moc_kreplacements.cpp
moc_directorymergewindow.cpp: $(MOC) directorymergewindow.h
$(MOC) directorymergewindow.h -o moc_directorymergewindow.cpp
moc_fileaccess.cpp: $(MOC) fileaccess.h
$(MOC) fileaccess.h -o moc_fileaccess.cpp
moc_kdiff3_shell.cpp: $(MOC) kdiff3_shell.h
$(MOC) kdiff3_shell.h -o moc_kdiff3_shell.cpp
moc_kdiff3_part.cpp: $(MOC) kdiff3_part.h
$(MOC) kdiff3_part.h -o moc_kdiff3_part.cpp
moc_smalldialogs.cpp: $(MOC) smalldialogs.h
$(MOC) smalldialogs.h -o moc_smalldialogs.cpp
####### Install
install_documentation: all
@$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/" || $(MKDIR) "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/da" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/de" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/en" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/et" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/fr" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/it" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/pt" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
-$(INSTALL_DIR) "../doc/sv" "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
uninstall_documentation:
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/da"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/de"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/en"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/et"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/fr"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/it"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/pt"
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/sv"
-$(DEL_DIR) "$(INSTALL_ROOT)/usr/local/share/doc/kdiff3/"
install_target: all
@$(CHK_DIR_EXISTS) "$(INSTALL_ROOT)/usr/local/bin/" || $(MKDIR) "$(INSTALL_ROOT)/usr/local/bin/"
-$(INSTALL_FILE) "$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)"
uninstall_target:
-$(DEL_FILE) "$(INSTALL_ROOT)/usr/local/bin/$(QMAKE_TARGET)"
-$(DEL_DIR) "$(INSTALL_ROOT)/usr/local/bin/"
install: install_documentation install_target
uninstall: uninstall_documentation uninstall_target
/***************************************************************************
* Copyright (C) 2004-2006 by Joachim Eibl *
* joachim.eibl at gmx.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; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "common.h"
#include <map>
#include <qfont.h>
#include <qcolor.h>
#include <qsize.h>
#include <qpoint.h>
#include <qstringlist.h>
#include <qtextstream.h>
ValueMap::ValueMap()
{
}
ValueMap::~ValueMap()
{
}
void ValueMap::save( QTextStream& ts )
{
std::map<QString,QString>::iterator i;
for( i=m_map.begin(); i!=m_map.end(); ++i)
{
QString key = i->first;
QString val = i->second;
ts << key << "=" << val << "\n";
}
}
QString ValueMap::getAsString()
{
QString result;
std::map<QString,QString>::iterator i;
for( i=m_map.begin(); i!=m_map.end(); ++i)
{
QString key = i->first;
QString val = i->second;
result += key + "=" + val + "\n";
}
return result;
}
void ValueMap::load( QTextStream& ts )
{
while ( !ts.eof() )
{ // until end of file...
QString s = ts.readLine(); // line of text excluding '\n'
int pos = s.find('=');
if( pos > 0 ) // seems not to have a tag
{
QString key = s.left(pos);
QString val = s.mid(pos+1);
m_map[key] = val;
}
}
}
/*
void ValueMap::load( const QString& s )
{
int pos=0;
while ( pos<(int)s.length() )
{ // until end of file...
int pos2 = s.find('=', pos);
int pos3 = s.find('\n', pos2 );
if (pos3<0)
pos3=s.length();
if( pos2 > 0 ) // seems not to have a tag
{
QString key = s.mid(pos, pos2-pos);
QString val = s.mid(pos2+1, pos3-pos2-1);
m_map[key] = val;
}
pos = pos3;
}
}
*/
// safeStringJoin and safeStringSplit allow to convert a stringlist into a string and back
// safely, even if the individual strings in the list contain the separator character.
QString safeStringJoin(const QStringList& sl, char sepChar, char metaChar )
{
// Join the strings in the list, using the separator ','
// If a string contains the separator character, it will be replaced with "\,".
// Any occurances of "\" (one backslash) will be replaced with "\\" (2 backslashes)
assert(sepChar!=metaChar);
QString sep;
sep += sepChar;
QString meta;
meta += metaChar;
QString safeString;
QStringList::const_iterator i;
for (i=sl.begin(); i!=sl.end(); ++i)
{
QString s = *i;
s.replace(meta, meta+meta); // "\" -> "\\"
s.replace(sep, meta+sep); // "," -> "\,"
if ( i==sl.begin() )
safeString = s;
else
safeString += sep + s;
}
return safeString;
}