File indexing completed on 2024-04-28 05:40:48
0001 /* 0002 SPDX-FileCopyrightText: 2011 Vishesh Yadav <vishesh3y@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef HGPATH_CONFIG_H 0008 #define HGPATH_CONFIG_H 0009 0010 #include <QWidget> 0011 #include <QMap> 0012 #include <QString> 0013 0014 class QTableWidget; 0015 class QTableWidgetItem; 0016 class QPushButton; 0017 class QAction; 0018 class QMenu; 0019 0020 /** 0021 * UI to add, remove and modify paths in repository's hgrc file. Can be used with 0022 * repository hgrc file only. 0023 */ 0024 class HgPathConfigWidget : public QWidget 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit HgPathConfigWidget(QWidget *parent = nullptr); 0030 0031 public Q_SLOTS: 0032 void saveConfig(); 0033 void loadConfig(); 0034 0035 private: 0036 void setupUI(); 0037 0038 /** 0039 * Prepare context menu and its actions for table widget showing path. 0040 */ 0041 void setupContextMenu(); 0042 0043 private Q_SLOTS: 0044 /** 0045 * Show context menu and changed enabled status of actions according 0046 * to the position where menu is requested. 0047 */ 0048 void slotContextMenuRequested(const QPoint &pos); 0049 void slotCellChanged(int row, int col); 0050 void slotSelectionChanged(); 0051 0052 void slotAddPath(); 0053 void slotModifyPath(); 0054 void slotDeletePath(); 0055 0056 private: 0057 QTableWidget *m_pathsListWidget; 0058 bool m_loadingCell; 0059 bool m_allValidData; 0060 bool m_newAdd; 0061 QString m_oldSelValue; 0062 0063 QPushButton *m_addPathButton; 0064 QPushButton *m_deletePathButton; 0065 QPushButton *m_modifyPathButton; 0066 0067 QAction *m_addAction; 0068 QAction *m_modifyAction; 0069 QAction *m_deleteAction; 0070 QMenu *m_contextMenu; 0071 0072 QMap<QString, QString> m_remotePathMap; 0073 QStringList m_removeList; 0074 }; 0075 0076 #endif // HGPATH_CONFIG_H 0077