comparison kdiff3/src/directorymergewindow.h @ 66:efe33e938730

0.9.86
author joachim99
date Thu, 16 Sep 2004 02:40:08 +0000
parents 8af4bb9d9a5a
children 8febbfb1148c
comparison
equal deleted inserted replaced
65:8ea11c8efeb5 66:efe33e938730
24 #include <qdir.h> 24 #include <qdir.h>
25 #include <list> 25 #include <list>
26 #include <map> 26 #include <map>
27 #include "common.h" 27 #include "common.h"
28 #include "fileaccess.h" 28 #include "fileaccess.h"
29 #include "diff.h" //TotalDiffStatus
29 30
30 class OptionDialog; 31 class OptionDialog;
31 class KIconLoader; 32 class KIconLoader;
32 class StatusMessageBox; 33 class StatusMessageBox;
33 class StatusInfo; 34 class StatusInfo;
35 class OneDirectoryInfo; 36 class OneDirectoryInfo;
36 class QLabel; 37 class QLabel;
37 class KAction; 38 class KAction;
38 class KToggleAction; 39 class KToggleAction;
39 class KActionCollection; 40 class KActionCollection;
41 class TotalDiffStatus;
40 42
41 enum e_MergeOperation 43 enum e_MergeOperation
42 { 44 {
43 eTitleId, 45 eTitleId,
44 eNoOperation, 46 eNoOperation,
95 bool m_bConflictingAges; // Equal age but files are not! 97 bool m_bConflictingAges; // Equal age but files are not!
96 98
97 FileAccess m_fileInfoA; 99 FileAccess m_fileInfoA;
98 FileAccess m_fileInfoB; 100 FileAccess m_fileInfoB;
99 FileAccess m_fileInfoC; 101 FileAccess m_fileInfoC;
102
103 TotalDiffStatus m_totalDiffStatus;
100 }; 104 };
101 105
102 class DirMergeItem : public QListViewItem 106 class DirMergeItem : public QListViewItem
103 { 107 {
104 public: 108 public:
105 DirMergeItem( QListView* pParent, const QString&, MergeFileInfos*); 109 DirMergeItem( QListView* pParent, const QString&, MergeFileInfos*);
106 DirMergeItem( DirMergeItem* pParent, const QString&, MergeFileInfos*); 110 DirMergeItem( DirMergeItem* pParent, const QString&, MergeFileInfos*);
107 ~DirMergeItem(); 111 ~DirMergeItem();
108 MergeFileInfos* m_pMFI; 112 MergeFileInfos* m_pMFI;
109 #if QT_VERSION!=230 113 #if QT_VERSION!=230
110 virtual int compare(QListViewItem *i, int col, bool ascending) const 114 virtual int compare(QListViewItem *i, int col, bool ascending) const;
111 {
112 DirMergeItem* pDMI = static_cast<DirMergeItem*>(i);
113 bool bDir1 = m_pMFI->m_bDirA || m_pMFI->m_bDirB || m_pMFI->m_bDirC;
114 bool bDir2 = pDMI->m_pMFI->m_bDirA || pDMI->m_pMFI->m_bDirB || pDMI->m_pMFI->m_bDirC;
115 if ( m_pMFI==0 || pDMI->m_pMFI==0 || bDir1 == bDir2 )
116 return QListViewItem::compare( i, col, ascending );
117 else
118 return bDir1 ? -1 : 1;
119 }
120 #endif 115 #endif
116 void init(MergeFileInfos* pMFI);
121 }; 117 };
122 118
123 class DirectoryMergeWindow : public QListView 119 class DirectoryMergeWindow : public QListView
124 { 120 {
125 Q_OBJECT 121 Q_OBJECT
137 bool isFileSelected(); 133 bool isFileSelected();
138 void allowResizeEvents(bool bAllowResizeEvents); 134 void allowResizeEvents(bool bAllowResizeEvents);
139 bool isDirectoryMergeInProgress() { return m_bRealMergeStarted; } 135 bool isDirectoryMergeInProgress() { return m_bRealMergeStarted; }
140 int totalColumnWidth(); 136 int totalColumnWidth();
141 bool isSyncMode() { return m_bSyncMode; } 137 bool isSyncMode() { return m_bSyncMode; }
138 bool isScanning() { return m_bScanning; }
142 void initDirectoryMergeActions( QObject* pKDiff3App, KActionCollection* ac ); 139 void initDirectoryMergeActions( QObject* pKDiff3App, KActionCollection* ac );
143 void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible, 140 void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible,
144 KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC ); 141 KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC );
145 142
146 virtual void keyPressEvent( QKeyEvent* e ); 143 virtual void keyPressEvent( QKeyEvent* e );
181 protected: 178 protected:
182 void mergeContinue( bool bStart, bool bVerbose ); 179 void mergeContinue( bool bStart, bool bVerbose );
183 void resizeEvent(QResizeEvent* e); 180 void resizeEvent(QResizeEvent* e);
184 bool m_bAllowResizeEvents; 181 bool m_bAllowResizeEvents;
185 182
186 void prepareListView(); 183 void prepareListView(ProgressProxy& pp);
187 void calcSuggestedOperation( MergeFileInfos& mfi, e_MergeOperation eDefaultOperation ); 184 void calcSuggestedOperation( MergeFileInfos& mfi, e_MergeOperation eDefaultOperation );
188 void setAllMergeOperations( e_MergeOperation eDefaultOperation ); 185 void setAllMergeOperations( e_MergeOperation eDefaultOperation );
189 friend class MergeFileInfos; 186 friend class MergeFileInfos;
190 187
191 bool canContinue(); 188 bool canContinue();
227 bool m_bSimulatedMergeStarted; 224 bool m_bSimulatedMergeStarted;
228 bool m_bRealMergeStarted; 225 bool m_bRealMergeStarted;
229 bool m_bError; 226 bool m_bError;
230 bool m_bSyncMode; 227 bool m_bSyncMode;
231 bool m_bDirectoryMerge; // if true, then merge is the default operation, otherwise it's diff. 228 bool m_bDirectoryMerge; // if true, then merge is the default operation, otherwise it's diff.
229
230 bool m_bScanning; // true while in init()
232 231
233 OptionDialog* m_pOptions; 232 OptionDialog* m_pOptions;
234 KIconLoader* m_pIconLoader; 233 KIconLoader* m_pIconLoader;
235 StatusMessageBox* m_pStatusMessageBox; 234 StatusMessageBox* m_pStatusMessageBox;
236 DirectoryMergeInfo* m_pDirectoryMergeInfo; 235 DirectoryMergeInfo* m_pDirectoryMergeInfo;
268 KAction* dirCurrentSyncDeleteAAndB; 267 KAction* dirCurrentSyncDeleteAAndB;
269 KAction* dirCurrentSyncMergeToA; 268 KAction* dirCurrentSyncMergeToA;
270 KAction* dirCurrentSyncMergeToB; 269 KAction* dirCurrentSyncMergeToB;
271 KAction* dirCurrentSyncMergeToAAndB; 270 KAction* dirCurrentSyncMergeToAAndB;
272 signals: 271 signals:
273 void startDiffMerge(QString fn1,QString fn2, QString fn3, QString ofn, QString,QString,QString); 272 void startDiffMerge(QString fn1,QString fn2, QString fn3, QString ofn, QString,QString,QString,TotalDiffStatus*);
274 void checkIfCanContinue( bool* pbContinue ); 273 void checkIfCanContinue( bool* pbContinue );
275 void updateAvailabilities(); 274 void updateAvailabilities();
275 void statusBarMessage( const QString& msg );
276 protected slots: 276 protected slots:
277 void onDoubleClick( QListViewItem* lvi ); 277 void onDoubleClick( QListViewItem* lvi );
278 void onClick( QListViewItem* lvi, const QPoint&, int c ); 278 void onClick( QListViewItem* lvi, const QPoint&, int c );
279 void onSelectionChanged(QListViewItem* lvi); 279 void onSelectionChanged(QListViewItem* lvi);
280 }; 280 };
289 const FileAccess& BPath, 289 const FileAccess& BPath,
290 const FileAccess& CPath, 290 const FileAccess& CPath,
291 const FileAccess& DestPath, 291 const FileAccess& DestPath,
292 MergeFileInfos& mfi ); 292 MergeFileInfos& mfi );
293 QListView* getInfoList() {return m_pInfoList;} 293 QListView* getInfoList() {return m_pInfoList;}
294 virtual bool eventFilter( QObject* o, QEvent* e );
295 signals:
296 void gotFocus();
294 private: 297 private:
295 QLabel* m_pInfoA; 298 QLabel* m_pInfoA;
296 QLabel* m_pInfoB; 299 QLabel* m_pInfoB;
297 QLabel* m_pInfoC; 300 QLabel* m_pInfoC;
298 QLabel* m_pInfoDest; 301 QLabel* m_pInfoDest;