forked from qt-creator/qt-creator
fakevim: begin work on tab/space configuration
This commit is contained in:
@@ -16,4 +16,5 @@ SOURCES += \
|
||||
|
||||
HEADERS += \
|
||||
handler.h \
|
||||
fakevimplugin.h
|
||||
fakevimplugin.h \
|
||||
fakevimconstants.h
|
||||
|
||||
53
src/plugins/fakevim/fakevimconstants.h
Normal file
53
src/plugins/fakevim/fakevimconstants.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FAKEVIMCONSTANTS_H
|
||||
#define FAKEVIMCONSTANTS_H
|
||||
|
||||
namespace FakeVim {
|
||||
namespace Constants {
|
||||
|
||||
const char * const ConfigOn = "on";
|
||||
const char * const ConfigOff = "off";
|
||||
|
||||
const char * const ConfigStartOfLine = "startofline";
|
||||
const char * const ConfigTabStop = "tabstop";
|
||||
const char * const ConfigSmartTab = "smarttab";
|
||||
const char * const ConfigShiftWidth = "shiftwidth";
|
||||
const char * const ConfigExpandTab = "expandtab";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace FakeVim
|
||||
|
||||
#endif // FAKEVIMCONSTANTS_H
|
||||
|
||||
@@ -156,6 +156,8 @@ void FakeVimPlugin::installHandler()
|
||||
this, SLOT(showCommandBuffer(QString)));
|
||||
connect(m_handler, SIGNAL(quitRequested(QWidget *)),
|
||||
this, SLOT(removeHandler(QWidget *)));
|
||||
connect(m_handler, SIGNAL(configurationNeeded(QHash<QString, QString> *)),
|
||||
this, SLOT(initializeConfiguration(QHash<QString, QString> *)));
|
||||
|
||||
m_handler->addWidget(textEditor->widget());
|
||||
}
|
||||
@@ -179,6 +181,14 @@ void FakeVimPlugin::showExtraInformation(const QString &text)
|
||||
QMessageBox::information(0, tr("FakeVim Information"), text);
|
||||
}
|
||||
|
||||
void FakeVimPlugin::initializeConfiguaration(QHash<QString, QString> *config)
|
||||
{
|
||||
qDebug() << "INIT CONFIG";
|
||||
//set shiftwidth=4
|
||||
//set expandtab
|
||||
//set smarttab
|
||||
}
|
||||
|
||||
|
||||
//#include "fakevimplugin.moc"
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QCursor;
|
||||
class QAbstractItemView;
|
||||
template <class Key, class Value> class QHash;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
@@ -83,6 +84,7 @@ private slots:
|
||||
void removeHandler(QWidget *widget);
|
||||
void showCommandBuffer(const QString &contents);
|
||||
void showExtraInformation(const QString &msg);
|
||||
void initializeConfiguaration(QHash<QString, QString> *config);
|
||||
|
||||
private:
|
||||
FakeVimHandler *m_handler;
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "handler.h"
|
||||
|
||||
#include "fakevimconstants.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QObject>
|
||||
@@ -53,6 +55,7 @@
|
||||
|
||||
|
||||
using namespace FakeVim::Internal;
|
||||
using namespace FakeVim::Constants;
|
||||
|
||||
#define StartOfLine QTextCursor::StartOfLine
|
||||
#define EndOfLine QTextCursor::EndOfLine
|
||||
@@ -114,9 +117,6 @@ enum VisualMode
|
||||
VisualBlockMode,
|
||||
};
|
||||
|
||||
static const QString ConfigStartOfLine = "startofline";
|
||||
static const QString ConfigOn = "on";
|
||||
|
||||
struct EditOperation
|
||||
{
|
||||
EditOperation() : m_position(-1), m_itemCount(0) {}
|
||||
@@ -282,6 +282,12 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent)
|
||||
m_visualMode = NoVisualMode;
|
||||
|
||||
m_config[ConfigStartOfLine] = ConfigOn;
|
||||
m_config[ConfigTabStop] = 8;
|
||||
m_config[ConfigSmartTab] = ConfigOff;
|
||||
m_config[ConfigShiftWidth] = 8;
|
||||
m_config[ConfigExpandTab] = ConfigOff;
|
||||
|
||||
emit q->configurationNeeded(&m_config);
|
||||
}
|
||||
|
||||
bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
class QEvent;
|
||||
template <class Key, class Value> class QHash;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace FakeVim {
|
||||
@@ -68,6 +69,7 @@ signals:
|
||||
void statusDataChanged(const QString &msg);
|
||||
void extraInformationChanged(const QString &msg);
|
||||
void quitRequested(QWidget *);
|
||||
void configurationNeeded(QHash<QString, QString> *config);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *ob, QEvent *ev);
|
||||
|
||||
Reference in New Issue
Block a user