Commit a0b4b8cd authored by hjk's avatar hjk

add tiny test application

parent 43bdddec
FAKEVIMHOME = ../../../src/plugins/fakevim
SOURCES += \
main.cpp \
$$FAKEVIMHOME/handler.cpp
HEADERS += \
$$FAKEVIMHOME/handler.h
INCLUDEPATH += $$FAKEVIMHOME
#include "handler.h"
#include <QtCore/QDebug>
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QPlainTextEdit>
#include <QtGui/QStatusBar>
#include <QtGui/QTextEdit>
using namespace FakeVim::Internal;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QStringList args = app.arguments();
(void) args.takeFirst();
QWidget *widget = 0;
QString title;
bool usePlainTextEdit = args.size() < 2;
if (usePlainTextEdit) {
widget = new QPlainTextEdit;
title = "PlainTextEdit";
} else {
widget = new QTextEdit;
title = "TextEdit";
}
widget->resize(450, 350);
widget->setFocus();
FakeVimHandler fakeVim;
QMainWindow mw;
mw.setWindowTitle("Fakevim (" + title + ")");
mw.setCentralWidget(widget);
mw.resize(500, 650);
mw.move(0, 0);
mw.show();
QFont font = mw.statusBar()->font();
font.setFamily("Monospace");
font.setStretch(QFont::SemiCondensed);
mw.statusBar()->setFont(font);
QObject::connect(&fakeVim, SIGNAL(commandBufferChanged(QString)),
mw.statusBar(), SLOT(showMessage(QString)));
QObject::connect(&fakeVim, SIGNAL(quitRequested(QWidget *)),
&app, SLOT(quit()));
fakeVim.addWidget(widget);
if (args.size() >= 1)
fakeVim.handleCommand(widget, "r " + args.at(0));
return app.exec();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment