lyx_mirror/src/frontends/qt4/GuiBranches.h
Vincent van Ravesteijn 1991488377 Fix handling of the add branch textfield in GuiBranches
- Enter in the textfield adds the branch,
- Make sure the dialog is not closed when pressing enter, 
- Pressing Ctrl+Enter or the Enter on the numpad closes the dialog.

Patch based on a patch from Scott Kostyshak.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40839 a592a061-630c-0410-9148-cb99ea01b6c8
2012-03-03 14:39:32 +00:00

95 lines
2.0 KiB
C++

// -*- C++ -*-
/**
* \file GuiBranches.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#ifndef GUIBRANCHES_H
#define GUIBRANCHES_H
#include "BranchList.h"
#include "ButtonController.h"
#include "ui_BranchesUnknownUi.h"
#include "ui_BranchesUi.h"
#include <QDialog>
#include <QWidget>
class QTreeWidgetItem;
namespace lyx {
class BufferParams;
namespace frontend {
class BranchesUnknownDialog : public QDialog, public Ui::BranchesUnknownUi
{
public:
BranchesUnknownDialog(QWidget * parent) : QDialog(parent)
{
Ui::BranchesUnknownUi::setupUi(this);
QDialog::setModal(true);
}
};
class GuiBranches : public QWidget, public Ui::BranchesUi
{
Q_OBJECT
public:
GuiBranches(QWidget * parent = 0);
void update(BufferParams const & params);
void apply(BufferParams & params) const;
void setUnknownBranches(QStringList const & b) { unknown_branches_ = b; }
bool eventFilter(QObject * obj, QEvent * event);
Q_SIGNALS:
void changed();
void renameBranches(docstring const &, docstring const &);
void okPressed();
protected:
void toggleBranch(QTreeWidgetItem *);
void toggleColor(QTreeWidgetItem *);
void toggleSuffix(QTreeWidgetItem *);
void updateView();
protected Q_SLOTS:
void on_newBranchLE_textChanged(QString);
void on_addBranchPB_pressed();
void on_removePB_pressed();
void on_renamePB_pressed();
void on_activatePB_pressed();
void on_branchesTW_itemDoubleClicked(QTreeWidgetItem *, int);
void on_branchesTW_itemSelectionChanged();
void on_colorPB_clicked();
void on_suffixPB_pressed();
void on_unknownPB_pressed();
void addUnknown();
void addAllUnknown();
void unknownBranchSelChanged();
private:
/// Contains all legal branches for this doc
BranchList branchlist_;
///
BranchesUnknownDialog * undef_;
///
ButtonController undef_bc_;
///
QStringList unknown_branches_;
};
} // namespace frontend
} // namespace lyx
#endif // GUIBRANCHES_H