comparison kdiff3/src/directorymergewindow.h @ 69:8febbfb1148c

KDiff3 0.9.89
author joachim99
date Mon, 10 Apr 2006 08:40:51 +0000
parents efe33e938730
children 5bbfe4784324
comparison
equal deleted inserted replaced
68:d7cafcda8c99 69:8febbfb1148c
1 /*************************************************************************** 1 /***************************************************************************
2 directorymergewindow.h 2 directorymergewindow.h
3 ------------------- 3 -------------------
4 begin : Sat Oct 19 2002 4 begin : Sat Oct 19 2002
5 copyright : (C) 2002-2004 by Joachim Eibl 5 copyright : (C) 2002-2005 by Joachim Eibl
6 email : joachim.eibl@gmx.de 6 email : joachim.eibl at gmx.de
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9 /*************************************************************************** 9 /***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
28 #include "fileaccess.h" 28 #include "fileaccess.h"
29 #include "diff.h" //TotalDiffStatus 29 #include "diff.h" //TotalDiffStatus
30 30
31 class OptionDialog; 31 class OptionDialog;
32 class KIconLoader; 32 class KIconLoader;
33 class StatusMessageBox;
34 class StatusInfo; 33 class StatusInfo;
35 class DirectoryMergeInfo; 34 class DirectoryMergeInfo;
36 class OneDirectoryInfo; 35 class OneDirectoryInfo;
37 class QLabel; 36 class QLabel;
38 class KAction; 37 class KAction;
108 public: 107 public:
109 DirMergeItem( QListView* pParent, const QString&, MergeFileInfos*); 108 DirMergeItem( QListView* pParent, const QString&, MergeFileInfos*);
110 DirMergeItem( DirMergeItem* pParent, const QString&, MergeFileInfos*); 109 DirMergeItem( DirMergeItem* pParent, const QString&, MergeFileInfos*);
111 ~DirMergeItem(); 110 ~DirMergeItem();
112 MergeFileInfos* m_pMFI; 111 MergeFileInfos* m_pMFI;
113 #if QT_VERSION!=230
114 virtual int compare(QListViewItem *i, int col, bool ascending) const; 112 virtual int compare(QListViewItem *i, int col, bool ascending) const;
115 #endif 113 virtual void paintCell(QPainter * p, const QColorGroup & cg, int column, int width, int align );
116 void init(MergeFileInfos* pMFI); 114 void init(MergeFileInfos* pMFI);
117 }; 115 };
118 116
119 class DirectoryMergeWindow : public QListView 117 class DirectoryMergeWindow : public QListView
120 { 118 {
137 bool isSyncMode() { return m_bSyncMode; } 135 bool isSyncMode() { return m_bSyncMode; }
138 bool isScanning() { return m_bScanning; } 136 bool isScanning() { return m_bScanning; }
139 void initDirectoryMergeActions( QObject* pKDiff3App, KActionCollection* ac ); 137 void initDirectoryMergeActions( QObject* pKDiff3App, KActionCollection* ac );
140 void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible, 138 void updateAvailabilities( bool bDirCompare, bool bDiffWindowVisible,
141 KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC ); 139 KToggleAction* chooseA, KToggleAction* chooseB, KToggleAction* chooseC );
140 void updateFileVisibilities();
142 141
143 virtual void keyPressEvent( QKeyEvent* e ); 142 virtual void keyPressEvent( QKeyEvent* e );
144 virtual void focusInEvent( QFocusEvent* e ); 143 virtual void focusInEvent( QFocusEvent* e );
145 virtual void focusOutEvent( QFocusEvent* e ); 144 virtual void focusOutEvent( QFocusEvent* e );
146 145
156 void slotChooseCEverywhere(); 155 void slotChooseCEverywhere();
157 void slotAutoChooseEverywhere(); 156 void slotAutoChooseEverywhere();
158 void slotNoOpEverywhere(); 157 void slotNoOpEverywhere();
159 void slotFoldAllSubdirs(); 158 void slotFoldAllSubdirs();
160 void slotUnfoldAllSubdirs(); 159 void slotUnfoldAllSubdirs();
160 void slotShowIdenticalFiles();
161 void slotShowDifferentFiles();
162 void slotShowFilesOnlyInA();
163 void slotShowFilesOnlyInB();
164 void slotShowFilesOnlyInC();
165
166 void slotSynchronizeDirectories();
167 void slotChooseNewerFiles();
168
169 void slotCompareExplicitlySelectedFiles();
170 void slotMergeExplicitlySelectedFiles();
171
161 // Merge current item (merge mode) 172 // Merge current item (merge mode)
162 void slotCurrentDoNothing(); 173 void slotCurrentDoNothing();
163 void slotCurrentChooseA(); 174 void slotCurrentChooseA();
164 void slotCurrentChooseB(); 175 void slotCurrentChooseB();
165 void slotCurrentChooseC(); 176 void slotCurrentChooseC();
173 void slotCurrentDeleteAAndB(); 184 void slotCurrentDeleteAAndB();
174 void slotCurrentMergeToA(); 185 void slotCurrentMergeToA();
175 void slotCurrentMergeToB(); 186 void slotCurrentMergeToB();
176 void slotCurrentMergeToAAndB(); 187 void slotCurrentMergeToAAndB();
177 188
189 void slotSaveMergeState();
190 void slotLoadMergeState();
191
178 protected: 192 protected:
179 void mergeContinue( bool bStart, bool bVerbose ); 193 void mergeContinue( bool bStart, bool bVerbose );
180 void resizeEvent(QResizeEvent* e); 194 void resizeEvent(QResizeEvent* e);
181 bool m_bAllowResizeEvents; 195 bool m_bAllowResizeEvents;
182 196
215 FileAccess m_dirB; 229 FileAccess m_dirB;
216 FileAccess m_dirC; 230 FileAccess m_dirC;
217 FileAccess m_dirDest; 231 FileAccess m_dirDest;
218 FileAccess m_dirDestInternal; 232 FileAccess m_dirDestInternal;
219 233
234 QString m_dirMergeStateFilename;
235
220 std::map<QString, MergeFileInfos> m_fileMergeMap; 236 std::map<QString, MergeFileInfos> m_fileMergeMap;
221 237
222 bool m_bFollowDirLinks; 238 bool m_bFollowDirLinks;
223 bool m_bFollowFileLinks; 239 bool m_bFollowFileLinks;
224 bool m_bSimulatedMergeStarted; 240 bool m_bSimulatedMergeStarted;
225 bool m_bRealMergeStarted; 241 bool m_bRealMergeStarted;
226 bool m_bError; 242 bool m_bError;
227 bool m_bSyncMode; 243 bool m_bSyncMode;
228 bool m_bDirectoryMerge; // if true, then merge is the default operation, otherwise it's diff. 244 bool m_bDirectoryMerge; // if true, then merge is the default operation, otherwise it's diff.
245 bool m_bCaseSensitive;
229 246
230 bool m_bScanning; // true while in init() 247 bool m_bScanning; // true while in init()
231 248
232 OptionDialog* m_pOptions; 249 OptionDialog* m_pOptions;
233 KIconLoader* m_pIconLoader; 250 KIconLoader* m_pIconLoader;
234 StatusMessageBox* m_pStatusMessageBox;
235 DirectoryMergeInfo* m_pDirectoryMergeInfo; 251 DirectoryMergeInfo* m_pDirectoryMergeInfo;
236 StatusInfo* m_pStatusInfo; 252 StatusInfo* m_pStatusInfo;
237 253
238 typedef std::list<DirMergeItem*> MergeItemList; 254 typedef std::list<DirMergeItem*> MergeItemList;
239 MergeItemList m_mergeItemList; 255 MergeItemList m_mergeItemList;
240 MergeItemList::iterator m_currentItemForOperation; 256 MergeItemList::iterator m_currentItemForOperation;
241 257
242 KAction* dirStartOperation; 258 DirMergeItem* m_pSelection1Item;
243 KAction* dirRunOperationForCurrentItem; 259 int m_selection1Column;
244 KAction* dirCompareCurrent; 260 DirMergeItem* m_pSelection2Item;
245 KAction* dirMergeCurrent; 261 int m_selection2Column;
246 KAction* dirRescan; 262 DirMergeItem* m_pSelection3Item;
247 KAction* dirChooseAEverywhere; 263 int m_selection3Column;
248 KAction* dirChooseBEverywhere; 264 void selectItemAndColumn(DirMergeItem* pDMI, int c, bool bContextMenu);
249 KAction* dirChooseCEverywhere; 265 friend class DirMergeItem;
250 KAction* dirAutoChoiceEverywhere; 266
251 KAction* dirDoNothingEverywhere; 267 KAction* m_pDirStartOperation;
252 KAction* dirFoldAll; 268 KAction* m_pDirRunOperationForCurrentItem;
253 KAction* dirUnfoldAll; 269 KAction* m_pDirCompareCurrent;
254 270 KAction* m_pDirMergeCurrent;
255 KAction* dirCurrentDoNothing; 271 KAction* m_pDirRescan;
256 KAction* dirCurrentChooseA; 272 KAction* m_pDirChooseAEverywhere;
257 KAction* dirCurrentChooseB; 273 KAction* m_pDirChooseBEverywhere;
258 KAction* dirCurrentChooseC; 274 KAction* m_pDirChooseCEverywhere;
259 KAction* dirCurrentMerge; 275 KAction* m_pDirAutoChoiceEverywhere;
260 KAction* dirCurrentDelete; 276 KAction* m_pDirDoNothingEverywhere;
261 277 KAction* m_pDirFoldAll;
262 KAction* dirCurrentSyncDoNothing; 278 KAction* m_pDirUnfoldAll;
263 KAction* dirCurrentSyncCopyAToB; 279
264 KAction* dirCurrentSyncCopyBToA; 280 KToggleAction* m_pDirShowIdenticalFiles;
265 KAction* dirCurrentSyncDeleteA; 281 KToggleAction* m_pDirShowDifferentFiles;
266 KAction* dirCurrentSyncDeleteB; 282 KToggleAction* m_pDirShowFilesOnlyInA;
267 KAction* dirCurrentSyncDeleteAAndB; 283 KToggleAction* m_pDirShowFilesOnlyInB;
268 KAction* dirCurrentSyncMergeToA; 284 KToggleAction* m_pDirShowFilesOnlyInC;
269 KAction* dirCurrentSyncMergeToB; 285
270 KAction* dirCurrentSyncMergeToAAndB; 286 KToggleAction* m_pDirSynchronizeDirectories;
287 KToggleAction* m_pDirChooseNewerFiles;
288
289 KAction* m_pDirCompareExplicit;
290 KAction* m_pDirMergeExplicit;
291
292 KAction* m_pDirCurrentDoNothing;
293 KAction* m_pDirCurrentChooseA;
294 KAction* m_pDirCurrentChooseB;
295 KAction* m_pDirCurrentChooseC;
296 KAction* m_pDirCurrentMerge;
297 KAction* m_pDirCurrentDelete;
298
299 KAction* m_pDirCurrentSyncDoNothing;
300 KAction* m_pDirCurrentSyncCopyAToB;
301 KAction* m_pDirCurrentSyncCopyBToA;
302 KAction* m_pDirCurrentSyncDeleteA;
303 KAction* m_pDirCurrentSyncDeleteB;
304 KAction* m_pDirCurrentSyncDeleteAAndB;
305 KAction* m_pDirCurrentSyncMergeToA;
306 KAction* m_pDirCurrentSyncMergeToB;
307 KAction* m_pDirCurrentSyncMergeToAAndB;
308
309 KAction* m_pDirSaveMergeState;
310 KAction* m_pDirLoadMergeState;
271 signals: 311 signals:
272 void startDiffMerge(QString fn1,QString fn2, QString fn3, QString ofn, QString,QString,QString,TotalDiffStatus*); 312 void startDiffMerge(QString fn1,QString fn2, QString fn3, QString ofn, QString,QString,QString,TotalDiffStatus*);
273 void checkIfCanContinue( bool* pbContinue ); 313 void checkIfCanContinue( bool* pbContinue );
274 void updateAvailabilities(); 314 void updateAvailabilities();
275 void statusBarMessage( const QString& msg ); 315 void statusBarMessage( const QString& msg );
276 protected slots: 316 protected slots:
277 void onDoubleClick( QListViewItem* lvi ); 317 void onDoubleClick( QListViewItem* lvi );
278 void onClick( QListViewItem* lvi, const QPoint&, int c ); 318 void onClick( int button, QListViewItem* lvi, const QPoint&, int c );
319 void slotShowContextMenu(QListViewItem* lvi,const QPoint &,int c);
279 void onSelectionChanged(QListViewItem* lvi); 320 void onSelectionChanged(QListViewItem* lvi);
280 }; 321 };
281 322
282 class DirectoryMergeInfo : public QFrame 323 class DirectoryMergeInfo : public QFrame
283 { 324 {