]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBranches.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiBranches.cpp
index dd3cdba6cf476a9359ed747e66450562f1bc4e60..cbef8d399af7990f352be97be5c7554d15dcb30c 100644 (file)
@@ -18,7 +18,6 @@
 #include "qt_helpers.h"
 
 #include "BufferParams.h"
-#include "controllers/ControlDocument.h"
 
 #include "support/lstrings.h"
 
@@ -51,6 +50,7 @@ void GuiBranches::update(BufferParams const & params)
        updateView();
 }
 
+
 void GuiBranches::updateView()
 {
        // store the selected branch
@@ -64,14 +64,11 @@ void GuiBranches::updateView()
        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()) {
@@ -89,11 +86,13 @@ void GuiBranches::updateView()
        changed();
 }
 
+
 void GuiBranches::apply(BufferParams & params) const
 {
        params.branchlist() = branchlist_;
 }
 
+
 void GuiBranches::on_addBranchPB_pressed()
 {
        QString const new_branch = newBranchLE->text();
@@ -107,8 +106,7 @@ void GuiBranches::on_addBranchPB_pressed()
 
 void GuiBranches::on_removePB_pressed()
 {
-       QTreeWidgetItem * selItem =
-               branchesTW->currentItem();
+       QTreeWidgetItem * selItem = branchesTW->currentItem();
        QString sel_branch;
        if (selItem != 0)
                sel_branch = selItem->text(0);
@@ -141,13 +139,14 @@ void GuiBranches::toggleBranch(QTreeWidgetItem * item)
                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();
        }
 }
 
@@ -164,22 +163,24 @@ void GuiBranches::toggleColor(QTreeWidgetItem * item)
                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