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@244
|
8 Copyright (c) 2011 Chris Cannam
|
Chris@244
|
9 Copyright (c) 2011 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@115
|
28 class QPushButton;
|
Chris@93
|
29 class QFileInfo;
|
Chris@199
|
30 class QCheckBox;
|
Chris@88
|
31
|
Chris@88
|
32 class FileStatusWidget : public QWidget
|
Chris@88
|
33 {
|
Chris@88
|
34 Q_OBJECT
|
Chris@88
|
35
|
Chris@88
|
36 public:
|
Chris@88
|
37 FileStatusWidget(QWidget *parent = 0);
|
Chris@93
|
38 ~FileStatusWidget();
|
Chris@88
|
39
|
Chris@283
|
40 QString localPath() const;
|
Chris@88
|
41 void setLocalPath(QString p);
|
Chris@88
|
42
|
Chris@283
|
43 FileStates fileStates() const;
|
Chris@92
|
44 void setFileStates(FileStates sp);
|
Chris@88
|
45
|
Chris@95
|
46 bool haveChangesToCommit() const;
|
Chris@95
|
47 bool haveSelection() const;
|
Chris@90
|
48
|
Chris@95
|
49 QStringList getAllSelectedFiles() const;
|
Chris@103
|
50
|
Chris@95
|
51 QStringList getSelectedCommittableFiles() const;
|
Chris@103
|
52 QStringList getAllCommittableFiles() const;
|
Chris@103
|
53
|
Chris@109
|
54 QStringList getSelectedRevertableFiles() const;
|
Chris@109
|
55 QStringList getAllRevertableFiles() const;
|
Chris@109
|
56
|
Chris@95
|
57 QStringList getSelectedAddableFiles() const;
|
Chris@103
|
58 QStringList getAllAddableFiles() const;
|
Chris@103
|
59
|
Chris@95
|
60 QStringList getSelectedRemovableFiles() const;
|
Chris@103
|
61 QStringList getAllRemovableFiles() const;
|
Chris@95
|
62
|
Chris@163
|
63 QStringList getSelectedUnresolvedFiles() const;
|
Chris@163
|
64 QStringList getAllUnresolvedFiles() const;
|
Chris@163
|
65
|
Chris@95
|
66 signals:
|
Chris@95
|
67 void selectionChanged();
|
Chris@199
|
68 void showAllChanged(bool);
|
Chris@94
|
69
|
Chris@94
|
70 public slots:
|
Chris@94
|
71 void clearSelections();
|
Chris@230
|
72 void updateWidgets();
|
Chris@94
|
73
|
Chris@95
|
74 private slots:
|
Chris@95
|
75 void itemSelectionChanged();
|
Chris@95
|
76
|
Chris@88
|
77 private:
|
Chris@287
|
78 QString m_localPath;
|
Chris@115
|
79 QLabel *m_noModificationsLabel;
|
Chris@106
|
80
|
Chris@199
|
81 QCheckBox *m_showAllFiles;
|
Chris@199
|
82
|
Chris@92
|
83 FileStates m_fileStates;
|
Chris@100
|
84 QMap<FileStates::State, QString> m_simpleLabels;
|
Chris@100
|
85 QMap<FileStates::State, QString> m_descriptions;
|
Chris@94
|
86 QMap<FileStates::State, QListWidget *> m_stateListMap;
|
Chris@325
|
87 QMap<FileStates::Activity, QString> m_actionLabels;
|
Chris@100
|
88 QString m_highlightExplanation;
|
Chris@88
|
89
|
Chris@93
|
90 QFileInfo *m_dateReference;
|
Chris@95
|
91 QStringList m_selectedFiles;
|
Chris@93
|
92
|
Chris@230
|
93 bool m_gridlyLayout;
|
Chris@230
|
94 int m_lastGridlyCount;
|
Chris@230
|
95 QList<QWidget *> m_boxes;
|
Chris@230
|
96 QWidget *m_boxesParent;
|
Chris@230
|
97
|
Chris@230
|
98 void layoutBoxesGridly(int count);
|
Chris@230
|
99 void layoutBoxesLinearly();
|
Chris@230
|
100 void setNoModificationsLabelText();
|
Chris@100
|
101 QString labelFor(FileStates::State, bool addHighlightExplanation = false);
|
Chris@100
|
102 void setLabelFor(QWidget *w, FileStates::State, bool addHighlightExplanation);
|
Chris@88
|
103 };
|
Chris@88
|
104
|
Chris@88
|
105 #endif
|