Chris@88
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@88
|
2
|
Chris@88
|
3 /*
|
Chris@88
|
4 EasyMercurial
|
Chris@88
|
5
|
Chris@88
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@88
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@560
|
8 Copyright (c) 2012 Chris Cannam
|
Chris@560
|
9 Copyright (c) 2012 Queen Mary, University of London
|
Chris@88
|
10
|
Chris@88
|
11 This program is free software; you can redistribute it and/or
|
Chris@88
|
12 modify it under the terms of the GNU General Public License as
|
Chris@88
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@88
|
14 License, or (at your option) any later version. See the file
|
Chris@88
|
15 COPYING included with this distribution for more information.
|
Chris@88
|
16 */
|
Chris@88
|
17
|
Chris@88
|
18 #ifndef FILESTATUSWIDGET_H
|
Chris@88
|
19 #define FILESTATUSWIDGET_H
|
Chris@88
|
20
|
Chris@92
|
21 #include "filestates.h"
|
Chris@88
|
22
|
Chris@88
|
23 #include <QWidget>
|
Chris@230
|
24 #include <QList>
|
Chris@88
|
25
|
Chris@88
|
26 class QLabel;
|
Chris@88
|
27 class QListWidget;
|
Chris@331
|
28 class QListWidgetItem;
|
Chris@115
|
29 class QPushButton;
|
Chris@93
|
30 class QFileInfo;
|
Chris@199
|
31 class QCheckBox;
|
Chris@558
|
32 class FindWidget;
|
Chris@88
|
33
|
Chris@88
|
34 class FileStatusWidget : public QWidget
|
Chris@88
|
35 {
|
Chris@88
|
36 Q_OBJECT
|
Chris@88
|
37
|
Chris@88
|
38 public:
|
Chris@88
|
39 FileStatusWidget(QWidget *parent = 0);
|
Chris@93
|
40 ~FileStatusWidget();
|
Chris@88
|
41
|
Chris@283
|
42 QString localPath() const;
|
Chris@88
|
43 void setLocalPath(QString p);
|
Chris@88
|
44
|
Chris@283
|
45 FileStates fileStates() const;
|
Chris@92
|
46 void setFileStates(FileStates sp);
|
Chris@88
|
47
|
Chris@95
|
48 bool haveChangesToCommit() const;
|
Chris@95
|
49 bool haveSelection() const;
|
Chris@90
|
50
|
Chris@103
|
51 QStringList getAllCommittableFiles() const;
|
Chris@109
|
52 QStringList getAllRevertableFiles() const;
|
Chris@326
|
53 QStringList getAllUnresolvedFiles() const;
|
Chris@109
|
54
|
Chris@95
|
55 QStringList getSelectedAddableFiles() const;
|
Chris@326
|
56 QStringList getSelectedRemovableFiles() const;
|
Chris@103
|
57
|
Chris@484
|
58 bool shouldShowAll() const;
|
Chris@542
|
59 bool shouldShow(FileStates::State) const;
|
Chris@484
|
60
|
Chris@95
|
61 signals:
|
Chris@95
|
62 void selectionChanged();
|
Chris@484
|
63 void showAllChanged();
|
Chris@94
|
64
|
Chris@326
|
65 void annotateFiles(QStringList);
|
Chris@326
|
66 void diffFiles(QStringList);
|
Chris@326
|
67 void commitFiles(QStringList);
|
Chris@326
|
68 void revertFiles(QStringList);
|
Chris@361
|
69 void renameFiles(QStringList);
|
Chris@361
|
70 void copyFiles(QStringList);
|
Chris@326
|
71 void addFiles(QStringList);
|
Chris@326
|
72 void removeFiles(QStringList);
|
Chris@326
|
73 void redoFileMerges(QStringList);
|
Chris@326
|
74 void markFilesResolved(QStringList);
|
Chris@326
|
75 void ignoreFiles(QStringList);
|
Chris@326
|
76 void unIgnoreFiles(QStringList);
|
Chris@326
|
77
|
Chris@94
|
78 public slots:
|
Chris@94
|
79 void clearSelections();
|
Chris@230
|
80 void updateWidgets();
|
Chris@608
|
81 void clearWidgets(); // e.g. while cloning a new repo slowly
|
Chris@94
|
82
|
Chris@555
|
83 void setSearchText(QString text);
|
Chris@555
|
84
|
Chris@95
|
85 private slots:
|
Chris@326
|
86 void menuActionActivated();
|
Chris@95
|
87 void itemSelectionChanged();
|
Chris@331
|
88 void itemDoubleClicked(QListWidgetItem *);
|
Chris@95
|
89
|
Chris@88
|
90 private:
|
Chris@287
|
91 QString m_localPath;
|
Chris@115
|
92 QLabel *m_noModificationsLabel;
|
Chris@106
|
93
|
Chris@558
|
94 FindWidget *m_findWidget;
|
Chris@199
|
95 QCheckBox *m_showAllFiles;
|
Chris@199
|
96
|
Chris@92
|
97 FileStates m_fileStates;
|
Chris@100
|
98 QMap<FileStates::State, QString> m_simpleLabels;
|
Chris@100
|
99 QMap<FileStates::State, QString> m_descriptions;
|
Chris@94
|
100 QMap<FileStates::State, QListWidget *> m_stateListMap;
|
Chris@325
|
101 QMap<FileStates::Activity, QString> m_actionLabels;
|
Chris@100
|
102 QString m_highlightExplanation;
|
Chris@88
|
103
|
Chris@93
|
104 QFileInfo *m_dateReference;
|
Chris@95
|
105 QStringList m_selectedFiles;
|
Chris@93
|
106
|
Chris@230
|
107 bool m_gridlyLayout;
|
Chris@230
|
108 int m_lastGridlyCount;
|
Chris@230
|
109 QList<QWidget *> m_boxes;
|
Chris@230
|
110 QWidget *m_boxesParent;
|
Chris@230
|
111
|
Chris@555
|
112 QString m_searchText;
|
Chris@555
|
113
|
Chris@230
|
114 void layoutBoxesGridly(int count);
|
Chris@230
|
115 void layoutBoxesLinearly();
|
Chris@230
|
116 void setNoModificationsLabelText();
|
Chris@100
|
117 QString labelFor(FileStates::State, bool addHighlightExplanation = false);
|
Chris@100
|
118 void setLabelFor(QWidget *w, FileStates::State, bool addHighlightExplanation);
|
Chris@326
|
119
|
Chris@326
|
120 QStringList getSelectedFilesInState(FileStates::State s) const;
|
Chris@326
|
121 QStringList getSelectedFilesSupportingActivity(FileStates::Activity) const;
|
Chris@88
|
122 };
|
Chris@88
|
123
|
Chris@88
|
124 #endif
|