annotate src/filestatuswidget.h @ 490:cd3dd285d0ff

OS/X build fixes
author Chris Cannam
date Thu, 18 Aug 2011 12:57:35 +0100
parents 896b7903e8f2
children 7829da6abe97
rev   line source
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@331 28 class QListWidgetItem;
Chris@115 29 class QPushButton;
Chris@93 30 class QFileInfo;
Chris@199 31 class QCheckBox;
Chris@88 32
Chris@88 33 class FileStatusWidget : public QWidget
Chris@88 34 {
Chris@88 35 Q_OBJECT
Chris@88 36
Chris@88 37 public:
Chris@88 38 FileStatusWidget(QWidget *parent = 0);
Chris@93 39 ~FileStatusWidget();
Chris@88 40
Chris@283 41 QString localPath() const;
Chris@88 42 void setLocalPath(QString p);
Chris@88 43
Chris@283 44 FileStates fileStates() const;
Chris@92 45 void setFileStates(FileStates sp);
Chris@88 46
Chris@95 47 bool haveChangesToCommit() const;
Chris@95 48 bool haveSelection() const;
Chris@90 49
Chris@103 50 QStringList getAllCommittableFiles() const;
Chris@109 51 QStringList getAllRevertableFiles() const;
Chris@326 52 QStringList getAllUnresolvedFiles() const;
Chris@109 53
Chris@95 54 QStringList getSelectedAddableFiles() const;
Chris@326 55 QStringList getSelectedRemovableFiles() const;
Chris@103 56
Chris@484 57 bool shouldShowAll() const;
Chris@484 58
Chris@95 59 signals:
Chris@95 60 void selectionChanged();
Chris@484 61 void showAllChanged();
Chris@94 62
Chris@326 63 void annotateFiles(QStringList);
Chris@326 64 void diffFiles(QStringList);
Chris@326 65 void commitFiles(QStringList);
Chris@326 66 void revertFiles(QStringList);
Chris@361 67 void renameFiles(QStringList);
Chris@361 68 void copyFiles(QStringList);
Chris@326 69 void addFiles(QStringList);
Chris@326 70 void removeFiles(QStringList);
Chris@326 71 void redoFileMerges(QStringList);
Chris@326 72 void markFilesResolved(QStringList);
Chris@326 73 void ignoreFiles(QStringList);
Chris@326 74 void unIgnoreFiles(QStringList);
Chris@326 75
Chris@94 76 public slots:
Chris@94 77 void clearSelections();
Chris@230 78 void updateWidgets();
Chris@94 79
Chris@95 80 private slots:
Chris@326 81 void menuActionActivated();
Chris@95 82 void itemSelectionChanged();
Chris@331 83 void itemDoubleClicked(QListWidgetItem *);
Chris@95 84
Chris@88 85 private:
Chris@287 86 QString m_localPath;
Chris@115 87 QLabel *m_noModificationsLabel;
Chris@106 88
Chris@199 89 QCheckBox *m_showAllFiles;
Chris@199 90
Chris@92 91 FileStates m_fileStates;
Chris@100 92 QMap<FileStates::State, QString> m_simpleLabels;
Chris@100 93 QMap<FileStates::State, QString> m_descriptions;
Chris@94 94 QMap<FileStates::State, QListWidget *> m_stateListMap;
Chris@325 95 QMap<FileStates::Activity, QString> m_actionLabels;
Chris@100 96 QString m_highlightExplanation;
Chris@88 97
Chris@93 98 QFileInfo *m_dateReference;
Chris@95 99 QStringList m_selectedFiles;
Chris@93 100
Chris@230 101 bool m_gridlyLayout;
Chris@230 102 int m_lastGridlyCount;
Chris@230 103 QList<QWidget *> m_boxes;
Chris@230 104 QWidget *m_boxesParent;
Chris@230 105
Chris@230 106 void layoutBoxesGridly(int count);
Chris@230 107 void layoutBoxesLinearly();
Chris@230 108 void setNoModificationsLabelText();
Chris@100 109 QString labelFor(FileStates::State, bool addHighlightExplanation = false);
Chris@100 110 void setLabelFor(QWidget *w, FileStates::State, bool addHighlightExplanation);
Chris@326 111
Chris@326 112 QStringList getSelectedFilesInState(FileStates::State s) const;
Chris@326 113 QStringList getSelectedFilesSupportingActivity(FileStates::Activity) const;
Chris@88 114 };
Chris@88 115
Chris@88 116 #endif