comparison src/filestatuswidget.h @ 370:b9c153e00e84

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