comparison hgtabwidget.cpp @ 163:5c262ac73948

* First cut of work on merge/resolve logic
author Chris Cannam
date Fri, 03 Dec 2010 19:35:04 +0000
parents 6bcb4a4d6521
children 4bad3c5c053a
comparison
equal deleted inserted replaced
162:910c2c5d1873 163:5c262ac73948
76 m_fileStatusWidget->clearSelections(); 76 m_fileStatusWidget->clearSelections();
77 } 77 }
78 78
79 void HgTabWidget::setCurrent(QStringList ids, QString branch) 79 void HgTabWidget::setCurrent(QStringList ids, QString branch)
80 { 80 {
81 m_historyWidget->setCurrent(ids, branch, canCommit()); 81 bool showUncommitted = false;
82 if (canRevert()) showUncommitted = true;
83 m_historyWidget->setCurrent(ids, branch, showUncommitted);
82 } 84 }
83 85
84 void HgTabWidget::updateHistory() 86 void HgTabWidget::updateHistory()
85 { 87 {
86 m_historyWidget->update(); 88 m_historyWidget->update();
87 } 89 }
88 90
91 bool HgTabWidget::canDiff() const
92 {
93 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
94 return m_fileStatusWidget->haveChangesToCommit() ||
95 !m_fileStatusWidget->getAllUnresolvedFiles().empty();
96 }
97
89 bool HgTabWidget::canCommit() const 98 bool HgTabWidget::canCommit() const
90 { 99 {
91 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false; 100 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
92 return m_fileStatusWidget->haveChangesToCommit(); 101 return m_fileStatusWidget->haveChangesToCommit() &&
102 m_fileStatusWidget->getAllUnresolvedFiles().empty();
93 } 103 }
94 104
95 bool HgTabWidget::canRevert() const 105 bool HgTabWidget::canRevert() const
96 { 106 {
107 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
97 return m_fileStatusWidget->haveChangesToCommit() || 108 return m_fileStatusWidget->haveChangesToCommit() ||
98 !m_fileStatusWidget->getSelectedRevertableFiles().empty(); 109 !m_fileStatusWidget->getAllUnresolvedFiles().empty();
99 } 110 }
100 111
101 bool HgTabWidget::canAdd() const 112 bool HgTabWidget::canAdd() const
102 { 113 {
103 if (m_fileStatusWidget->getSelectedAddableFiles().empty()) return false; 114 if (m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
111 if (m_fileStatusWidget->getSelectedRemovableFiles().empty()) return false; 122 if (m_fileStatusWidget->getSelectedRemovableFiles().empty()) return false;
112 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false; 123 if (!m_fileStatusWidget->getSelectedAddableFiles().empty()) return false;
113 return true; 124 return true;
114 } 125 }
115 126
116 bool HgTabWidget::canDoDiff() const 127 bool HgTabWidget::canResolve() const
117 { 128 {
118 return canCommit(); 129 return !m_fileStatusWidget->getSelectedUnresolvedFiles().empty();
119 } 130 }
120 131
121 QStringList HgTabWidget::getAllSelectedFiles() const 132 QStringList HgTabWidget::getAllSelectedFiles() const
122 { 133 {
123 return m_fileStatusWidget->getAllSelectedFiles(); 134 return m_fileStatusWidget->getAllSelectedFiles();
154 } 165 }
155 166
156 QStringList HgTabWidget::getSelectedRemovableFiles() const 167 QStringList HgTabWidget::getSelectedRemovableFiles() const
157 { 168 {
158 return m_fileStatusWidget->getSelectedRemovableFiles(); 169 return m_fileStatusWidget->getSelectedRemovableFiles();
170 }
171
172 QStringList HgTabWidget::getAllUnresolvedFiles() const
173 {
174 return m_fileStatusWidget->getAllUnresolvedFiles();
175 }
176
177 QStringList HgTabWidget::getSelectedUnresolvedFiles() const
178 {
179 return m_fileStatusWidget->getSelectedUnresolvedFiles();
159 } 180 }
160 181
161 void HgTabWidget::updateWorkFolderFileList(QString fileList) 182 void HgTabWidget::updateWorkFolderFileList(QString fileList)
162 { 183 {
163 m_fileStates.parseStates(fileList); 184 m_fileStates.parseStates(fileList);