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