diff --git a/src/DirectoryInfo.h b/src/DirectoryInfo.h
index fbc0495..0d979dd 100644
--- a/src/DirectoryInfo.h
+++ b/src/DirectoryInfo.h
@@ -1,55 +1,55 @@
/**
* Copyright (C) 2018 Michael Reeves
*
* 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(void) const { return m_dirA; }
- inline FileAccess dirB(void) const { return m_dirB; }
- inline FileAccess dirC(void) const { return m_dirC; }
- inline FileAccess destDir(void) const
+ 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
\ No newline at end of file
diff --git a/src/MergeFileInfos.cpp b/src/MergeFileInfos.cpp
index 12889b1..bec8ee2 100644
--- a/src/MergeFileInfos.cpp
+++ b/src/MergeFileInfos.cpp
@@ -1,131 +1,131 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Joachim Eibl *
* Copyright (C) 2018 Michael Reeves reeves.87@gmail.com *
* *
* *
* 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. *
* *
***************************************************************************/
#include "MergeFileInfos.h"
#include "DirectoryInfo.h"
#include "fileaccess.h"
#include
MergeFileInfos::MergeFileInfos()
{
m_bEqualAB = false;
m_bEqualAC = false;
m_bEqualBC = false;
m_pParent = nullptr;
m_bOperationComplete = false;
m_bSimOpComplete = false;
m_eMergeOperation = eNoOperation;
m_eOpStatus = eOpStatusNone;
m_ageA = eNotThere;
m_ageB = eNotThere;
m_ageC = eNotThere;
m_bConflictingAges = false;
m_pFileInfoA = nullptr;
m_pFileInfoB = nullptr;
m_pFileInfoC = nullptr;
m_dirInfo.clear();
}
MergeFileInfos::~MergeFileInfos()
{
m_children.clear();
}
//bool operator>( const MergeFileInfos& );
-QString MergeFileInfos::subPath(void) const
+QString MergeFileInfos::subPath() const
{
if(m_pFileInfoA && m_pFileInfoA->exists())
return m_pFileInfoA->fileRelPath();
else if(m_pFileInfoB && m_pFileInfoB->exists())
return m_pFileInfoB->fileRelPath();
else if(m_pFileInfoC && m_pFileInfoC->exists())
return m_pFileInfoC->fileRelPath();
return QString("");
}
-QString MergeFileInfos::fileName(void) const
+QString MergeFileInfos::fileName() const
{
if(m_pFileInfoA && m_pFileInfoA->exists())
return m_pFileInfoA->fileName();
else if(m_pFileInfoB && m_pFileInfoB->exists())
return m_pFileInfoB->fileName();
else if(m_pFileInfoC && m_pFileInfoC->exists())
return m_pFileInfoC->fileName();
return QString("");
}
-bool MergeFileInfos::conflictingFileTypes(void)
+bool MergeFileInfos::conflictingFileTypes()
{
// Now check if file/dir-types fit.
if(isLinkA() || isLinkB() || isLinkC())
{
if((existsInA() && !isLinkA()) ||
(existsInB() && !isLinkB()) ||
(existsInC() && !isLinkC()))
{
return true;
}
}
if(dirA() || dirB() || dirC())
{
if((existsInA() && !dirA()) ||
(existsInB() && !dirB()) ||
(existsInC() && !dirC()))
{
return true;
}
}
return false;
}
-QString MergeFileInfos::fullNameA(void) const
+QString MergeFileInfos::fullNameA() const
{
if(existsInA())
return getFileInfoA()->absoluteFilePath();
return m_dirInfo->dirA().absoluteFilePath() + "/" + subPath();
}
-QString MergeFileInfos::fullNameB(void) const
+QString MergeFileInfos::fullNameB() const
{
if(existsInB())
return getFileInfoB()->absoluteFilePath();
return m_dirInfo->dirB().absoluteFilePath() + "/" + subPath();
}
-QString MergeFileInfos::fullNameC(void) const
+QString MergeFileInfos::fullNameC() const
{
if(existsInC())
return getFileInfoC()->absoluteFilePath();
return m_dirInfo->dirC().absoluteFilePath() + "/" + subPath();
}
void MergeFileInfos::sort(Qt::SortOrder order)
{
std::sort(m_children.begin(), m_children.end(), MfiCompare(order));
for(int i = 0; i < m_children.count(); ++i)
m_children[i]->sort(order);
}
-QString MergeFileInfos::fullNameDest(void) const
+QString MergeFileInfos::fullNameDest() const
{
if(m_dirInfo->destDir().prettyAbsPath() == m_dirInfo->dirC().prettyAbsPath())
return fullNameC();
else if(m_dirInfo->destDir().prettyAbsPath() == m_dirInfo->dirB().prettyAbsPath())
return fullNameB();
else
return m_dirInfo->destDir().absoluteFilePath() + "/" + subPath();
}
diff --git a/src/MergeFileInfos.h b/src/MergeFileInfos.h
index d36c4c3..958a689 100644
--- a/src/MergeFileInfos.h
+++ b/src/MergeFileInfos.h
@@ -1,156 +1,156 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Joachim Eibl *
* Copyright (C) 2018 Michael Reeves reeves.87@gmail.com *
* *
* *
* 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 MERGEFILEINFO_H
#define MERGEFILEINFO_H
#include "fileaccess.h"
#include "diff.h"
#include "DirectoryInfo.h"
#include
//class DirectoryInfo;
enum e_MergeOperation
{
eTitleId,
eNoOperation,
// Operations in sync mode (with only two directories):
eCopyAToB, eCopyBToA, eDeleteA, eDeleteB, eDeleteAB, eMergeToA, eMergeToB, eMergeToAB,
// Operations in merge mode (with two or three directories)
eCopyAToDest, eCopyBToDest, eCopyCToDest, eDeleteFromDest, eMergeABCToDest,
eMergeABToDest,
eConflictingFileTypes, // Error
eChangedAndDeleted, // Error
eConflictingAges // Equal age but files are not!
};
enum e_Age { eNew, eMiddle, eOld, eNotThere, eAgeEnd };
enum e_OperationStatus
{
eOpStatusNone,
eOpStatusDone,
eOpStatusError,
eOpStatusSkipped,
eOpStatusNotSaved,
eOpStatusInProgress,
eOpStatusToDo
};
class MergeFileInfos
{
public:
MergeFileInfos();
~MergeFileInfos();
//bool operator>( const MergeFileInfos& );
- QString subPath(void) const;
- QString fileName(void) const;
+ QString subPath() const;
+ QString fileName() const;
bool dirA() const { return m_pFileInfoA ? m_pFileInfoA->isDir() : false; }
bool dirB() const { return m_pFileInfoB ? m_pFileInfoB->isDir() : false; }
bool dirC() const { return m_pFileInfoC ? m_pFileInfoC->isDir() : false; }
bool isLinkA() const { return m_pFileInfoA ? m_pFileInfoA->isSymLink() : false; }
bool isLinkB() const { return m_pFileInfoB ? m_pFileInfoB->isSymLink() : false; }
bool isLinkC() const { return m_pFileInfoC ? m_pFileInfoC->isSymLink() : false; }
bool existsInA() const { return m_pFileInfoA != nullptr; }
bool existsInB() const { return m_pFileInfoB != nullptr; }
bool existsInC() const { return m_pFileInfoC != nullptr; }
- bool conflictingFileTypes(void);
+ bool conflictingFileTypes();
void sort(Qt::SortOrder order);
- inline MergeFileInfos* parent(void) const { return m_pParent; }
+ inline MergeFileInfos* parent() const { return m_pParent; }
inline void setParent(MergeFileInfos* inParent) { m_pParent = inParent; }
- inline const QList& children(void) const { return m_children; }
+ inline const QList& children() const { return m_children; }
inline void addChild(MergeFileInfos* child) { m_children.push_back(child); }
- inline void clear(void) { m_children.clear(); }
+ inline void clear() { m_children.clear(); }
- FileAccess* getFileInfoA(void) const { return m_pFileInfoA; }
- FileAccess* getFileInfoB(void) const { return m_pFileInfoB; }
- FileAccess* getFileInfoC(void) const { return m_pFileInfoC; }
+ FileAccess* getFileInfoA() const { return m_pFileInfoA; }
+ FileAccess* getFileInfoB() const { return m_pFileInfoB; }
+ FileAccess* getFileInfoC() const { return m_pFileInfoC; }
void setFileInfoA(FileAccess* newInfo) { m_pFileInfoA = newInfo; }
void setFileInfoB(FileAccess* newInfo) { m_pFileInfoB = newInfo; }
void setFileInfoC(FileAccess* newInfo) { m_pFileInfoC = newInfo; }
- QString fullNameA(void) const;
- QString fullNameB(void) const;
- QString fullNameC(void) const;
- QString fullNameDest(void) const;
+ QString fullNameA() const;
+ QString fullNameB() const;
+ QString fullNameC() const;
+ QString fullNameDest() const;
- inline QSharedPointer getDirectoryInfo(void) const { return m_dirInfo; }
+ inline QSharedPointer getDirectoryInfo() const { return m_dirInfo; }
void setDirectoryInfo(const QSharedPointer &dirInfo) { m_dirInfo = dirInfo; }
inline QString getDirNameA() const { return getDirectoryInfo()->dirA().prettyAbsPath(); }
inline QString getDirNameB() const { return getDirectoryInfo()->dirB().prettyAbsPath(); }
inline QString getDirNameC() const { return getDirectoryInfo()->dirC().prettyAbsPath(); }
inline QString getDirNameDest() const { return getDirectoryInfo()->destDir().prettyAbsPath(); }
private:
MergeFileInfos* m_pParent;
FileAccess* m_pFileInfoA;
FileAccess* m_pFileInfoB;
FileAccess* m_pFileInfoC;
QSharedPointer m_dirInfo;
public:
TotalDiffStatus m_totalDiffStatus;
QList m_children;
e_MergeOperation m_eMergeOperation;
e_OperationStatus m_eOpStatus;
e_Age m_ageA;
e_Age m_ageB;
e_Age m_ageC;
bool m_bOperationComplete;
bool m_bSimOpComplete;
bool m_bEqualAB;
bool m_bEqualAC;
bool m_bEqualBC;
bool m_bConflictingAges; // Equal age but files are not!
};
class MfiCompare
{
Qt::SortOrder mOrder;
public:
explicit MfiCompare(Qt::SortOrder order)
{
mOrder = order;
}
bool operator()(MergeFileInfos* pMFI1, MergeFileInfos* pMFI2)
{
bool bDir1 = pMFI1->dirA() || pMFI1->dirB() || pMFI1->dirC();
bool bDir2 = pMFI2->dirA() || pMFI2->dirB() || pMFI2->dirC();
if(bDir1 == bDir2) {
if(mOrder == Qt::AscendingOrder)
{
return pMFI1->fileName().compare(pMFI2->fileName(), Qt::CaseInsensitive) < 0;
}
else
{
return pMFI1->fileName().compare(pMFI2->fileName(), Qt::CaseInsensitive) > 0;
}
}
else
return bDir1;
}
};
#endif // !MERGEFILEINFO_H
\ No newline at end of file
diff --git a/src/directorymergewindow.cpp b/src/directorymergewindow.cpp
index 766a2be..3c777a1 100644
--- a/src/directorymergewindow.cpp
+++ b/src/directorymergewindow.cpp
@@ -1,3521 +1,3521 @@
/***************************************************************************
* Copyright (C) 2003-2007 by Joachim Eibl *
* Copyright (C) 2018 Michael Reeves reeves.87@gmail.com *
* *
* *
* 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. *
* *
***************************************************************************/
#include
#include "MergeFileInfos.h"
#include "DirectoryInfo.h"
#include "directorymergewindow.h"
#include "guiutils.h"
#include "options.h"
#include "progress.h"
#include "Utils.h"
#include
#include