]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/QBranches.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QBranches.C
index fcbe74678868c3db6aa6beb289f666ffcddf8047..eafdc536aec9490eddf0fff5406f8f23889b1d90 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "QBranches.h"
 
-#include "lcolorcache.h"
+#include "GuiApplication.h"
 #include "validators.h"
 #include "qt_helpers.h"
 
@@ -39,10 +39,9 @@ QBranches::QBranches(QWidget * parent, Qt::WFlags f)
        : QWidget(parent, f)
 {
        setupUi(this);
-       branchesTW->setColumnCount(3);
-       branchesTW->headerItem()->setText(0, qt_("Name"));
+       branchesTW->setColumnCount(2);
+       branchesTW->headerItem()->setText(0, qt_("Branch"));
        branchesTW->headerItem()->setText(1, qt_("Activated"));
-       branchesTW->headerItem()->setText(2, qt_("Color"));
 }
 
 QBranches::~QBranches()
@@ -57,10 +56,8 @@ void QBranches::update(BufferParams const & params)
 
 void QBranches::update()
 {
-
        // store the selected branch
-       QTreeWidgetItem * item =
-               branchesTW->currentItem();
+       QTreeWidgetItem * item = branchesTW->currentItem();
        QString sel_branch;
        if (item != 0)
                sel_branch = item->text(0);
@@ -81,15 +78,16 @@ void QBranches::update()
 
                QColor const itemcolor = rgb2qcolor(it->getColor());
                if (itemcolor.isValid()) {
-                       QPixmap coloritem(30, 10);
+                       QPixmap coloritem(32, 32);
                        coloritem.fill(itemcolor);
-                       newItem->setIcon(2, QIcon(coloritem));
+                       newItem->setIcon(0, QIcon(coloritem));
                }
                // restore selected branch
                if (bname == sel_branch)
                        branchesTW->setItemSelected(newItem, true);
        }
-       emit changed();
+       // emit signal
+       changed();
 }
 
 void QBranches::apply(BufferParams & params) const
@@ -129,7 +127,7 @@ void QBranches::on_activatePB_pressed()
 }
 
 
-void QBranches::on_branchesTW_itemDoubleClicked(QTreeWidgetItem * item, int col)
+void QBranches::on_branchesTW_itemDoubleClicked(QTreeWidgetItem * item, int /*col*/)
 {
        toggleBranch(item);
 }
@@ -167,7 +165,7 @@ void QBranches::on_colorPB_clicked()
                        return;
 
                QColor const initial = rgb2qcolor(branch->getColor());
-               QColor ncol(QColorDialog::getColor(initial, qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget()));
+               QColor ncol(QColorDialog::getColor(initial, qApp->focusWidget()));
                if (ncol.isValid()){
                        // add the color to the branchlist
                        branch->setColor(fromqstr(ncol.name()));
@@ -179,3 +177,5 @@ void QBranches::on_colorPB_clicked()
 
 } // namespace frontend
 } // namespace lyx
+
+#include "QBranches_moc.cpp"