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@88
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@88
|
9 Copyright (c) 2010 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@88
|
24
|
Chris@88
|
25 class QLabel;
|
Chris@88
|
26 class QListWidget;
|
Chris@93
|
27 class QFileInfo;
|
Chris@88
|
28
|
Chris@88
|
29 class FileStatusWidget : public QWidget
|
Chris@88
|
30 {
|
Chris@88
|
31 Q_OBJECT
|
Chris@88
|
32
|
Chris@88
|
33 public:
|
Chris@88
|
34 FileStatusWidget(QWidget *parent = 0);
|
Chris@93
|
35 ~FileStatusWidget();
|
Chris@88
|
36
|
Chris@88
|
37 QString localPath() const { return m_localPath; }
|
Chris@88
|
38 void setLocalPath(QString p);
|
Chris@88
|
39
|
Chris@88
|
40 QString remoteURL() const { return m_remoteURL; }
|
Chris@88
|
41 void setRemoteURL(QString u);
|
Chris@88
|
42
|
Chris@106
|
43 QString branch() const { return m_branch; }
|
Chris@106
|
44 void setBranch(QString b);
|
Chris@106
|
45
|
Chris@92
|
46 FileStates fileStates() const { return m_fileStates; }
|
Chris@92
|
47 void setFileStates(FileStates sp);
|
Chris@88
|
48
|
Chris@95
|
49 bool haveChangesToCommit() const;
|
Chris@95
|
50 bool haveSelection() const;
|
Chris@90
|
51
|
Chris@95
|
52 QStringList getAllSelectedFiles() const;
|
Chris@103
|
53
|
Chris@95
|
54 QStringList getSelectedCommittableFiles() const;
|
Chris@103
|
55 QStringList getAllCommittableFiles() const;
|
Chris@103
|
56
|
Chris@109
|
57 QStringList getSelectedRevertableFiles() const;
|
Chris@109
|
58 QStringList getAllRevertableFiles() const;
|
Chris@109
|
59
|
Chris@95
|
60 QStringList getSelectedAddableFiles() const;
|
Chris@103
|
61 QStringList getAllAddableFiles() const;
|
Chris@103
|
62
|
Chris@95
|
63 QStringList getSelectedRemovableFiles() const;
|
Chris@103
|
64 QStringList getAllRemovableFiles() const;
|
Chris@95
|
65
|
Chris@95
|
66 signals:
|
Chris@95
|
67 void selectionChanged();
|
Chris@94
|
68
|
Chris@94
|
69 public slots:
|
Chris@94
|
70 void clearSelections();
|
Chris@94
|
71
|
Chris@95
|
72 private slots:
|
Chris@95
|
73 void itemSelectionChanged();
|
Chris@95
|
74
|
Chris@88
|
75 private:
|
Chris@88
|
76 QString m_localPath;
|
Chris@88
|
77 QLabel *m_localPathLabel;
|
Chris@88
|
78
|
Chris@88
|
79 QString m_remoteURL;
|
Chris@88
|
80 QLabel *m_remoteURLLabel;
|
Chris@106
|
81
|
Chris@106
|
82 QString m_branch;
|
Chris@106
|
83 QLabel *m_branchLabel;
|
Chris@106
|
84
|
Chris@92
|
85 FileStates m_fileStates;
|
Chris@100
|
86 QMap<FileStates::State, QString> m_simpleLabels;
|
Chris@100
|
87 QMap<FileStates::State, QString> m_descriptions;
|
Chris@94
|
88 QMap<FileStates::State, QListWidget *> m_stateListMap;
|
Chris@100
|
89 QString m_highlightExplanation;
|
Chris@88
|
90
|
Chris@93
|
91 QFileInfo *m_dateReference;
|
Chris@95
|
92 QStringList m_selectedFiles;
|
Chris@93
|
93
|
Chris@88
|
94 void updateWidgets();
|
Chris@100
|
95 QString labelFor(FileStates::State, bool addHighlightExplanation = false);
|
Chris@100
|
96 void setLabelFor(QWidget *w, FileStates::State, bool addHighlightExplanation);
|
Chris@88
|
97 };
|
Chris@88
|
98
|
Chris@88
|
99 #endif
|