File indexing completed on 2024-04-28 09:36:10

0001 /*
0002     SPDX-FileCopyrightText: 2011 Vishesh Yadav <vishesh3y@gmail.com>
0003     SPDX-FileCopyrightText: 2015 Tomasz Bojczuk <seelook@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef STATUSLIST_H
0009 #define STATUSLIST_H
0010 
0011 #include <QGroupBox>
0012 #include <QString>
0013 
0014 class QTableWidget;
0015 
0016 /**
0017  * Shows a list of files and their corresponding version states in a table.
0018  * Used in commit dialog.
0019  */
0020 class HgStatusList : public QGroupBox
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit HgStatusList(QWidget *parent = nullptr);
0026 
0027     /**
0028      * Appends the list of selected files whose changes should be 
0029      * committed. If all files are selected, nothing is appended and true 
0030      * is returned. If no files are selected, false is returned.
0031      *
0032      * @param files Append all the selected files to this. If all files are
0033      *              selected, nothing is appended
0034      * @return If at least one file is selected, true is returned; otherwise
0035      *          false.
0036      */
0037     bool getSelectionForCommit(QStringList &files);
0038 
0039 private Q_SLOTS:
0040     void reloadStatusTable();
0041     void currentItemChangedSlot();
0042     void headerClickedSlot(int index);
0043 
0044 Q_SIGNALS:
0045     void itemSelectionChanged(const char status, const QString &fileName);
0046 
0047 private:
0048     QString         m_hgBaseDir;
0049     QTableWidget   *m_statusTable;
0050     bool            m_allWhereChecked; // state of all check boxes
0051     bool            m_sortIndex; // true - ascending, false - descending
0052 };
0053 
0054 #endif // STATUSLIST_H
0055