summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/fakevim/fakevim.pro3
-rw-r--r--src/plugins/fakevim/fakevimconstants.h53
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp10
-rw-r--r--src/plugins/fakevim/fakevimplugin.h2
-rw-r--r--src/plugins/fakevim/handler.cpp12
-rw-r--r--src/plugins/fakevim/handler.h2
6 files changed, 78 insertions, 4 deletions
diff --git a/src/plugins/fakevim/fakevim.pro b/src/plugins/fakevim/fakevim.pro
index 6a160774e6..20be8c355f 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 0000000000..13c7169543
--- /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 f0fd5d001a..3bc3c7c5c7 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 afbbe89d4a..a6ae8f3753 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 fc120dbf2a..f094bcea89 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 bd8b483403..3e80dc7117 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);