diff --git a/src/DirectoryInfo.h b/src/DirectoryInfo.h
index e84cb4c..18a06e4 100644
--- a/src/DirectoryInfo.h
+++ b/src/DirectoryInfo.h
@@ -1,51 +1,51 @@
/**
- * Copyright (C) 2018 Michael Reeves
+ * 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 .
*/
#ifndef DIRECTORYINFO_H
#define DIRECTORYINFO_H
#include "fileaccess.h"
class DirectoryInfo
{
public:
DirectoryInfo(FileAccess& dirA, FileAccess& dirB, FileAccess& dirC, FileAccess& dirDest)
{
m_dirA = dirA;
m_dirB = dirB;
m_dirC = dirC;
m_dirDest = dirDest;
}
inline FileAccess dirA() const { return m_dirA; }
inline FileAccess dirB() const { return m_dirB; }
inline FileAccess dirC() const { return m_dirC; }
inline FileAccess destDir() const
{
if(m_dirDest.isValid())
return m_dirDest;
else
return m_dirC.isValid() ? m_dirC : m_dirB;
}
private:
FileAccess m_dirA, m_dirB, m_dirC;
FileAccess m_dirDest;
};
#endif
diff --git a/src/ProgressProxyExtender.cpp b/src/ProgressProxyExtender.cpp
index 5f0651f..f58857b 100644
--- a/src/ProgressProxyExtender.cpp
+++ b/src/ProgressProxyExtender.cpp
@@ -1,37 +1,37 @@
/**
* Copyright (C) 2003-2007 by Joachim Eibl
* joachim.eibl at gmx.de
- * Copyright (C) 2018 Michael Reeves
+ * 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 .
*
*/
#include "ProgressProxyExtender.h"
#include
void ProgressProxyExtender::slotListDirInfoMessage(KJob*, const QString& msg)
{
setInformation(msg, 0);
}
void ProgressProxyExtender::slotPercent(KJob*, qint64 percent)
{
setCurrent(percent);
}
diff --git a/src/ProgressProxyExtender.h b/src/ProgressProxyExtender.h
index f96847e..ed098b7 100644
--- a/src/ProgressProxyExtender.h
+++ b/src/ProgressProxyExtender.h
@@ -1,40 +1,40 @@
/**
* Copyright (C) 2003-2007 by Joachim Eibl
* joachim.eibl at gmx.de
- * Copyright (C) 2018 Michael Reeves
+ * 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 .
*
*/
#ifndef PROGREESPROXYEXTENDER_H
#define PROGREESPROXYEXTENDER_H
#include "progress.h"
#include
class KJob;
class ProgressProxyExtender: public ProgressProxy
{
Q_OBJECT
public:
ProgressProxyExtender() { setMaxNofSteps(100); }
public Q_SLOTS:
void slotListDirInfoMessage( KJob*, const QString& msg );
void slotPercent( KJob*, qint64 percent );
};
#endif
diff --git a/src/Utils.cpp b/src/Utils.cpp
index e6670f0..067fd63 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -1,125 +1,125 @@
/**
* Copyright (C) 2003-2007 by Joachim Eibl
- * Copyright (C) 2018 Michael Reeves
+ * 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 .
*
*/
#include "Utils.h"
#include
#include
#include
#include
#include
/* Split the command line into arguments.
* Normally split at white space separators except when quoting with " or '.
* Backslash is treated as meta character within single quotes ' only.
* Detect parsing errors like unclosed quotes.
* The first item in the list will be the command itself.
* Returns the error reasor as string or an empty string on success.
* Eg. >"1" "2"< => >1<, >2<
* Eg. >'\'\\'< => >'\< backslash is a meta character between single quotes
* Eg. > "\\" < => >\\< but not between double quotes
* Eg. >"c:\sed" 's/a/\' /g'< => >c:\sed<, >s/a/' /g<
*/
QString Utils::getArguments(QString cmd, QString& program, QStringList& args)
{
program = QString();
args.clear();
for(int i = 0; i < cmd.length(); ++i)
{
while(i < cmd.length() && cmd[i].isSpace())
{
++i;
}
if(cmd[i] == '"' || cmd[i] == '\'') // argument beginning with a quote
{
QChar quoteChar = cmd[i];
++i;
int argStart = i;
bool bSkip = false;
while(i < cmd.length() && (cmd[i] != quoteChar || bSkip))
{
if(bSkip)
{
bSkip = false;
//Don't emulate bash here we are not talking to it.
//For us all quotes are the same.
if(cmd[i] == '\\' || cmd[i] == '\'' || cmd[i] == '"')
{
cmd.remove(i - 1, 1); // remove the backslash '\'
continue;
}
}
else if(cmd[i] == '\\')
bSkip = true;
++i;
}
if(i < cmd.length())
{
args << cmd.mid(argStart, i - argStart);
if(i + 1 < cmd.length() && !cmd[i + 1].isSpace())
return i18n("Expecting space after closing quote.");
}
else
return i18n("Unmatched quote.");
continue;
}
else
{
int argStart = i;
while(i < cmd.length() && (!cmd[i].isSpace() /*|| bSkip*/))
{
if(cmd[i] == '"' || cmd[i] == '\'')
return i18n("Unexpected quote character within argument.");
++i;
}
args << cmd.mid(argStart, i - argStart);
}
}
if(args.isEmpty())
return i18n("No program specified.");
else
{
program = args[0];
args.pop_front();
}
return QString();
}
bool Utils::wildcardMultiMatch(const QString& wildcard, const QString& testString, bool bCaseSensitive)
{
static QHash s_patternMap;
QStringList sl = wildcard.split(QChar(';'));
for(QStringList::Iterator it = sl.begin(); it != sl.end(); ++it)
{
QHash::iterator patIt = s_patternMap.find(*it);
if(patIt == s_patternMap.end())
{
QRegExp pattern(*it, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive, QRegExp::Wildcard);
patIt = s_patternMap.insert(*it, pattern);
}
if(patIt.value().exactMatch(testString))
return true;
}
return false;
}
diff --git a/src/Utils.h b/src/Utils.h
index c1a4772..bb94c21 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -1,33 +1,33 @@
/**
- * Copyright (C) 2018 Michael Reeves
+ * 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 .
*
*/
#ifndef UTILS_H
#define UTILS_H
#include
#include
class Utils{
public:
static bool wildcardMultiMatch(const QString& wildcard, const QString& testString, bool bCaseSensitive);
static QString getArguments(QString cmd, QString& program, QStringList& args);
};
#endif
diff --git a/src/common.h b/src/common.h
index 18ca778..9dd8d00 100644
--- a/src/common.h
+++ b/src/common.h
@@ -1,116 +1,116 @@
/***************************************************************************
common.h - Things that are needed often
-------------------
begin : Mon Mar 18 2002
copyright : (C) 2002-2007 by Joachim Eibl
email : 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. *
* *
***************************************************************************/
-#ifndef _COMMON_H
-#define _COMMON_H
+#ifndef COMMON_H
+#define COMMON_H
#include
#include
#include