2009-02-25 09:15:00 +01:00
|
|
|
/**************************************************************************
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
|
|
|
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
|
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Commercial Usage
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at qt-sales@nokia.com.
|
2008-12-19 12:20:04 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
**************************************************************************/
|
2008-12-19 12:20:04 +01:00
|
|
|
|
|
|
|
|
#ifndef FAKEVIM_HANDLER_H
|
|
|
|
|
#define FAKEVIM_HANDLER_H
|
|
|
|
|
|
2009-01-13 13:47:00 +01:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtGui/QTextEdit>
|
2008-12-19 12:20:04 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QString;
|
|
|
|
|
class QEvent;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace FakeVim {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class FakeVimHandler : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2009-01-23 15:12:04 +01:00
|
|
|
FakeVimHandler(QWidget *widget, QObject *parent = 0);
|
2008-12-19 12:20:04 +01:00
|
|
|
~FakeVimHandler();
|
|
|
|
|
|
2009-01-23 15:12:04 +01:00
|
|
|
QWidget *widget();
|
|
|
|
|
|
|
|
|
|
void setExtraData(QObject *data);
|
|
|
|
|
QObject *extraData() const;
|
|
|
|
|
|
2009-01-07 18:05:45 +01:00
|
|
|
public slots:
|
2009-01-15 15:27:14 +01:00
|
|
|
void setCurrentFileName(const QString &fileName);
|
2008-12-27 16:42:07 +01:00
|
|
|
|
|
|
|
|
// This executes an "ex" style command taking context
|
2009-01-23 15:12:04 +01:00
|
|
|
// information from widget;
|
|
|
|
|
void handleCommand(const QString &cmd);
|
2009-01-09 17:31:20 +01:00
|
|
|
void setConfigValue(const QString &key, const QString &value);
|
2009-01-23 15:12:04 +01:00
|
|
|
void quit();
|
|
|
|
|
|
|
|
|
|
// Convenience
|
|
|
|
|
void setupWidget();
|
|
|
|
|
void restoreWidget();
|
2008-12-27 16:42:07 +01:00
|
|
|
|
2008-12-19 12:20:04 +01:00
|
|
|
signals:
|
2008-12-27 16:42:07 +01:00
|
|
|
void commandBufferChanged(const QString &msg);
|
2009-01-07 18:05:45 +01:00
|
|
|
void statusDataChanged(const QString &msg);
|
2009-01-23 15:12:04 +01:00
|
|
|
void extraInformationChanged(const QString &msg);
|
|
|
|
|
void quitRequested();
|
|
|
|
|
void selectionChanged(const QList<QTextEdit::ExtraSelection> &selection);
|
|
|
|
|
void writeFileRequested(bool *handled,
|
|
|
|
|
const QString &fileName, const QString &contents);
|
2009-01-28 22:03:51 +01:00
|
|
|
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
|
2009-03-06 13:03:33 +01:00
|
|
|
void indentRegion(int *amount, int beginLine, int endLine, QChar typedChar);
|
2008-12-19 12:20:04 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool eventFilter(QObject *ob, QEvent *ev);
|
|
|
|
|
|
|
|
|
|
class Private;
|
|
|
|
|
friend class Private;
|
|
|
|
|
Private *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace FakeVim
|
|
|
|
|
|
|
|
|
|
#endif // FAKEVIM_H
|