diff --git a/src/plugins/fakevim/fakevim.pro b/src/plugins/fakevim/fakevim.pro index 6a160774e6ac7bcebac1d68c7d37d0467d29e2f5..20be8c355f5b4e12adabbd5aa14673c5faa086a7 100644 --- a/src/plugins/fakevim/fakevim.pro +++ b/src/plugins/fakevim/fakevim.pro @@ -16,4 +16,5 @@ SOURCES += \ HEADERS += \ handler.h \ - fakevimplugin.h + fakevimplugin.h \ + fakevimconstants.h diff --git a/src/plugins/fakevim/fakevimconstants.h b/src/plugins/fakevim/fakevimconstants.h new file mode 100644 index 0000000000000000000000000000000000000000..13c716954344f39867672f625c7afef95f2e86e6 --- /dev/null +++ b/src/plugins/fakevim/fakevimconstants.h @@ -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 + diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index f0fd5d001a2e16db17c650f4cbc82580192c5ad3..3bc3c7c5c7898d4fc8a68f1e4d7c849f1335d677 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -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" diff --git a/src/plugins/fakevim/fakevimplugin.h b/src/plugins/fakevim/fakevimplugin.h index afbbe89d4a8d9c546b16393d78e7a11201636a4a..a6ae8f3753c8febd1e2b4ce9ef406d931d8fa059 100644 --- a/src/plugins/fakevim/fakevimplugin.h +++ b/src/plugins/fakevim/fakevimplugin.h @@ -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; diff --git a/src/plugins/fakevim/handler.cpp b/src/plugins/fakevim/handler.cpp index fc120dbf2ae6d3b57cb4d55e913fc7cd985c94c8..f094bcea8988e8516ae77dc9859115736281043e 100644 --- a/src/plugins/fakevim/handler.cpp +++ b/src/plugins/fakevim/handler.cpp @@ -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) diff --git a/src/plugins/fakevim/handler.h b/src/plugins/fakevim/handler.h index bd8b4834035dc3fbad918e65ae390d10bdd9d8bd..3e80dc71178011a4f7a19b3964e9998a8b3214bd 100644 --- a/src/plugins/fakevim/handler.h +++ b/src/plugins/fakevim/handler.h @@ -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);