File indexing completed on 2024-05-05 04:40:12
0001 /* 0002 SPDX-FileCopyrightText: 2006-2009 David Nolden <david.nolden.kdevelop@art-master.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_PATCHREVIEWTOOLVIEW_H 0008 #define KDEVPLATFORM_PLUGIN_PATCHREVIEWTOOLVIEW_H 0009 0010 #include <QWidget> 0011 #include <QPointer> 0012 #include <QTime> 0013 0014 #include <ui_patchreview.h> 0015 0016 namespace Sublime { class Area; } 0017 namespace KDevelop { class IDocument; } 0018 namespace Purpose { class Menu; } 0019 0020 class QStandardItem; 0021 class KJob; 0022 class PatchReviewPlugin; 0023 class LocalPatchSource; 0024 class QModelIndex; 0025 class QSortFilterProxyModel; 0026 0027 class PatchReviewToolView : public QWidget 0028 { 0029 Q_OBJECT 0030 public: 0031 PatchReviewToolView( QWidget* parent, PatchReviewPlugin* plugin ); 0032 ~PatchReviewToolView() override; 0033 0034 // opens the document which should be part of the patch, 0035 // ensuring that the tabs are sorted correctly 0036 void open( const QUrl& url, bool activate ) const; 0037 0038 Q_SIGNALS: 0039 void dialogClosed( PatchReviewToolView* ); 0040 void stateChanged( PatchReviewToolView* ); 0041 private Q_SLOTS: 0042 0043 void startingNewReview(); 0044 0045 void fileDoubleClicked( const QModelIndex& i ); 0046 0047 void nextHunk(); 0048 void prevHunk(); 0049 void prevFile(); 0050 void nextFile(); 0051 void seekFile(bool forwards); 0052 0053 void patchChanged(); 0054 0055 void slotAppliedChanged( int newState ); 0056 0057 void finishReview(); 0058 0059 void runTests(); 0060 0061 void selectAll(); 0062 void deselectAll(); 0063 0064 void fileItemChanged( QStandardItem* item ); 0065 0066 private: 0067 void resizeEvent(QResizeEvent*) override; 0068 0069 void kompareModelChanged(); 0070 0071 void showEditDialog(); 0072 ///Fills the editor views from m_editingPatch 0073 void fillEditFromPatch(); 0074 /// Retrieve the patch from plugin and perform all necessary casts 0075 LocalPatchSource* GetLocalPatchSource(); 0076 0077 Ui_EditPatch m_editPatch; 0078 0079 QTime m_lastDataTime; 0080 QString m_lastTerminalData; 0081 0082 /// Whether the set of checked URLs should be reset on the next update 0083 bool m_resetCheckedUrls; 0084 0085 PatchReviewPlugin* m_plugin; 0086 0087 QPointer< QWidget > m_customWidget; 0088 QAction* m_selectAllAction; 0089 QAction* m_deselectAllAction; 0090 Purpose::Menu* m_exportMenu; 0091 0092 class PatchFilesModel* m_fileModel; 0093 QSortFilterProxyModel* m_fileSortProxyModel; 0094 0095 public Q_SLOTS: 0096 void documentActivated( KDevelop::IDocument* ); 0097 void customContextMenuRequested(const QPoint& p); 0098 void testJobResult(KJob* job); 0099 void testJobPercent(KJob* job, unsigned long percent); 0100 }; 0101 0102 #endif // KDEVPLATFORM_PLUGIN_PATCHREVIEWTOOLVIEW_H