]> git.lyx.org Git - lyx.git/commitdiff
* src/frontends/qt4/QBranches.C:
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 4 Nov 2006 15:08:53 +0000 (15:08 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 4 Nov 2006 15:08:53 +0000 (15:08 +0000)
- fix item selection after update
- improve gui
* src/frontends/qt4/QBranches.[Ch]: add alterColor method (alter color on double click)
* src/frontends/qt4/QocumentDialog.C: add comment

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15737 a592a061-630c-0410-9148-cb99ea01b6c8

Status.15x
src/frontends/qt4/QBranches.C
src/frontends/qt4/QBranches.h
src/frontends/qt4/QDocumentDialog.C

index a70eb7d86d655bdbe3eae85b66be477023a2e9ae..2f64f6a2f454a952f21d486980c4bd3b4a6a923f 100644 (file)
@@ -210,4 +210,8 @@ focus.
 
 * No icon for "note-next" in the "review" toolbar
 
-ADDED (JSpitzm 2006-11-04).
\ No newline at end of file
+ADDED (JSpitzm 2006-11-04).
+
+* Branches gui broken (buttons do nothing)
+
+FIXED (JSpitzm 2006-11-04).
\ No newline at end of file
index 35f5c3ad779ca2afc4bff34f5e71d0b8d9d839e1..de5c1111396d9e53ce5253e063abee8434bdb2a6 100644 (file)
@@ -38,9 +38,11 @@ QBranches::QBranches(QWidget * parent, Qt::WFlags f)
        : QWidget(parent, f)
 {
        setupUi(this);
-       branchesTW->setColumnCount(2);
+       branchesTW->setColumnCount(3);
        branchesTW->headerItem()->setText(0, qt_("Branch"));
        branchesTW->headerItem()->setText(1, qt_("Activated"));
+       branchesTW->headerItem()->setText(2, qt_("Color"));
+       branchesTW->setSortingEnabled(true);
 }
 
 void QBranches::update(BufferParams const & params)
@@ -73,13 +75,15 @@ void QBranches::update()
 
                QColor const itemcolor = rgb2qcolor(it->getColor());
                if (itemcolor.isValid()) {
-                       QPixmap coloritem(32, 32);
+                       QPixmap coloritem(30, 10);
                        coloritem.fill(itemcolor);
-                       newItem->setIcon(0, QIcon(coloritem));
+                       newItem->setIcon(2, QIcon(coloritem));
                }
                // restore selected branch
-               if (bname == sel_branch)
+               if (bname == sel_branch) {
+                       branchesTW->setCurrentItem(newItem);
                        branchesTW->setItemSelected(newItem, true);
+               }
        }
        // emit signal
        changed();
@@ -122,9 +126,12 @@ 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);
+       if (col < 2)
+               toggleBranch(item);
+       else
+               toggleColor(item);
 }
 
 
@@ -147,11 +154,16 @@ void QBranches::toggleBranch(QTreeWidgetItem * item)
 
 void QBranches::on_colorPB_clicked()
 {
-       QTreeWidgetItem * selItem =
-               branchesTW->currentItem();
-       QString sel_branch;
-       if (selItem != 0)
-               sel_branch = selItem->text(0);
+       toggleColor(branchesTW->currentItem());
+}
+
+
+void QBranches::toggleColor(QTreeWidgetItem * item)
+{
+       if (item == 0)
+               return;
+
+       QString sel_branch = item->text(0);
        if (!sel_branch.isEmpty()) {
                docstring current_branch = qstring_to_ucs4(sel_branch);
                Branch * branch =
index 8330adf19bac9ff0cdbf9aee089e7452c955e367..1b2d8a42dc28f3f003364e14dd1b63273df4bac6 100644 (file)
@@ -45,6 +45,7 @@ Q_SIGNALS:
 
 protected:
        void toggleBranch(QTreeWidgetItem *);
+       void toggleColor(QTreeWidgetItem *);
        void update();
 
 protected Q_SLOTS:
index 4a99962ed7e3d3e7b7b82d059cbc22cc1e5298b0..930a722acc4912b4783dfe6d5a5a10548f2fcc7e 100644 (file)
@@ -372,12 +372,10 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
                }
        }
 
-
-
+       // branches
        branchesModule = new QBranches;
        connect(branchesModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
 
-
        // preamble
        preambleModule = new UiWidget<Ui::PreambleUi>;
        connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));