forked from qt-creator/qt-creator
fakevim: provide a means to see configuration variables
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
@@ -149,6 +150,8 @@ void FakeVimPlugin::installHandler()
|
||||
if (!textEditor)
|
||||
return;
|
||||
|
||||
connect(m_handler, SIGNAL(extraInformationChanged(QString)),
|
||||
this, SLOT(showExtraInformation(QString)));
|
||||
connect(m_handler, SIGNAL(commandBufferChanged(QString)),
|
||||
this, SLOT(showCommandBuffer(QString)));
|
||||
connect(m_handler, SIGNAL(quitRequested(QWidget *)),
|
||||
@@ -171,6 +174,11 @@ void FakeVimPlugin::showCommandBuffer(const QString &contents)
|
||||
tr("Quit FakeVim"), m_handler, SLOT(quit()));
|
||||
}
|
||||
|
||||
void FakeVimPlugin::showExtraInformation(const QString &text)
|
||||
{
|
||||
QMessageBox::information(0, tr("FakeVim Information"), text);
|
||||
}
|
||||
|
||||
|
||||
//#include "fakevimplugin.moc"
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ private slots:
|
||||
void installHandler();
|
||||
void removeHandler(QWidget *widget);
|
||||
void showCommandBuffer(const QString &contents);
|
||||
void showExtraInformation(const QString &msg);
|
||||
|
||||
private:
|
||||
FakeVimHandler *m_handler;
|
||||
|
||||
@@ -1004,6 +1004,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
|
||||
|
||||
static QRegExp reWrite("^w!?( (.*))?$");
|
||||
static QRegExp reDelete("^d( (.*))?$");
|
||||
static QRegExp reSet("^set?( (.*))?$");
|
||||
|
||||
if (cmd.isEmpty()) {
|
||||
m_tc.setPosition(positionForLine(beginLine));
|
||||
@@ -1093,6 +1094,14 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
|
||||
redo();
|
||||
enterCommandMode();
|
||||
updateMiniBuffer();
|
||||
} else if (reSet.indexIn(cmd) != -1) { // :set
|
||||
QString arg = reSet.cap(2);
|
||||
if (arg.isEmpty()) {
|
||||
QString info;
|
||||
foreach (const QString &key, m_config.keys())
|
||||
info += key + ": " + m_config.value(key) + "\n";
|
||||
emit q->extraInformationChanged(info);
|
||||
}
|
||||
} else {
|
||||
showRedMessage("E492: Not an editor command: " + cmd0);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ public slots:
|
||||
signals:
|
||||
void commandBufferChanged(const QString &msg);
|
||||
void statusDataChanged(const QString &msg);
|
||||
void extraInformationChanged(const QString &msg);
|
||||
void quitRequested(QWidget *);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user