#include "qt_helpers.h"
#include "BufferParams.h"
-#include "controllers/ControlDocument.h"
#include "support/lstrings.h"
updateView();
}
+
void GuiBranches::updateView()
{
// store the selected branch
BranchList::const_iterator it = branchlist_.begin();
BranchList::const_iterator const end = branchlist_.end();
for (; it != end; ++it) {
- QTreeWidgetItem * newItem =
- new QTreeWidgetItem(branchesTW);
+ QTreeWidgetItem * newItem = new QTreeWidgetItem(branchesTW);
QString const bname = toqstr(it->getBranch());
newItem->setText(0, bname);
-
- QString const sel = it->getSelected() ? qt_("Yes") : qt_("No");
- newItem->setText(1, sel);
+ newItem->setText(1, it->getSelected() ? qt_("Yes") : qt_("No"));
QColor const itemcolor = rgb2qcolor(it->getColor());
if (itemcolor.isValid()) {
changed();
}
+
void GuiBranches::apply(BufferParams & params) const
{
params.branchlist() = branchlist_;
}
+
void GuiBranches::on_addBranchPB_pressed()
{
QString const new_branch = newBranchLE->text();
void GuiBranches::on_removePB_pressed()
{
- QTreeWidgetItem * selItem =
- branchesTW->currentItem();
+ QTreeWidgetItem * selItem = branchesTW->currentItem();
QString sel_branch;
if (selItem != 0)
sel_branch = selItem->text(0);
return;
QString sel_branch = item->text(0);
- if (!sel_branch.isEmpty()) {
- bool const selected = item->text(1) == qt_("Yes");
- Branch * branch = branchlist_.find(qstring_to_ucs4(sel_branch));
- if (branch && branch->setSelected(!selected)) {
- newBranchLE->clear();
- updateView();
- }
+ if (sel_branch.isEmpty())
+ return;
+
+ bool const selected = (item->text(1) == qt_("Yes"));
+ Branch * branch = branchlist_.find(qstring_to_ucs4(sel_branch));
+ if (branch && branch->setSelected(!selected)) {
+ newBranchLE->clear();
+ updateView();
}
}
return;
QString sel_branch = item->text(0);
- if (!sel_branch.isEmpty()) {
- docstring current_branch = qstring_to_ucs4(sel_branch);
- Branch * branch =
- branchlist_.find(current_branch);
- if (!branch)
- return;
-
- QColor const initial = rgb2qcolor(branch->getColor());
- QColor ncol(QColorDialog::getColor(initial, qApp->focusWidget()));
- if (ncol.isValid()){
- // add the color to the branchlist
- branch->setColor(fromqstr(ncol.name()));
- newBranchLE->clear();
- updateView();
- }
- }
+ if (sel_branch.isEmpty())
+ return;
+
+ docstring current_branch = qstring_to_ucs4(sel_branch);
+ Branch * branch =
+ branchlist_.find(current_branch);
+ if (!branch)
+ return;
+
+ QColor const initial = rgb2qcolor(branch->getColor());
+ QColor ncol = QColorDialog::getColor(initial, qApp->focusWidget());
+ if (!ncol.isValid())
+ return;
+
+ // add the color to the branchlist
+ branch->setColor(fromqstr(ncol.name()));
+ newBranchLE->clear();
+ updateView();
}
} // namespace frontend