]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiBranches.h
Fix handling of the add branch textfield in GuiBranches
[lyx.git] / src / frontends / qt4 / GuiBranches.h
1 // -*- C++ -*-
2 /**
3  * \file GuiBranches.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GUIBRANCHES_H
13 #define GUIBRANCHES_H
14
15 #include "BranchList.h"
16 #include "ButtonController.h"
17
18 #include "ui_BranchesUnknownUi.h"
19 #include "ui_BranchesUi.h"
20
21 #include <QDialog>
22 #include <QWidget>
23
24 class QTreeWidgetItem;
25
26 namespace lyx {
27
28 class BufferParams;
29
30 namespace frontend {
31
32 class BranchesUnknownDialog : public QDialog, public Ui::BranchesUnknownUi
33 {
34 public:
35         BranchesUnknownDialog(QWidget * parent) : QDialog(parent)
36         {
37                 Ui::BranchesUnknownUi::setupUi(this);
38                 QDialog::setModal(true);
39         }
40 };
41
42 class GuiBranches : public QWidget, public Ui::BranchesUi
43 {
44         Q_OBJECT
45 public:
46         GuiBranches(QWidget * parent = 0);
47
48         void update(BufferParams const & params);
49         void apply(BufferParams & params) const;
50         void setUnknownBranches(QStringList const & b) { unknown_branches_ = b; }
51
52         bool eventFilter(QObject * obj, QEvent * event);
53
54 Q_SIGNALS:
55         void changed();
56         void renameBranches(docstring const &, docstring const &);
57         void okPressed();
58
59 protected:
60         void toggleBranch(QTreeWidgetItem *);
61         void toggleColor(QTreeWidgetItem *);
62         void toggleSuffix(QTreeWidgetItem *);
63         void updateView();
64
65 protected Q_SLOTS:
66         void on_newBranchLE_textChanged(QString);
67         void on_addBranchPB_pressed();
68         void on_removePB_pressed();
69         void on_renamePB_pressed();
70         void on_activatePB_pressed();
71         void on_branchesTW_itemDoubleClicked(QTreeWidgetItem *, int);
72         void on_branchesTW_itemSelectionChanged();
73         void on_colorPB_clicked();
74         void on_suffixPB_pressed();
75         void on_unknownPB_pressed();
76         void addUnknown();
77         void addAllUnknown();
78         void unknownBranchSelChanged();
79
80 private:
81         /// Contains all legal branches for this doc
82         BranchList branchlist_;
83         ///
84         BranchesUnknownDialog * undef_;
85         ///
86         ButtonController undef_bc_;
87         ///
88         QStringList unknown_branches_;
89 };
90
91 } // namespace frontend
92 } // namespace lyx
93
94 #endif // GUIBRANCHES_H