Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a Yat terminal screen as a plugin
This should hopfully make it easier for others to use Yat for other applications. No styling etc is possible, but maybe someone finds a good way to make it customizable.
- Loading branch information
Showing
24 changed files
with
175 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
YAT is a terminal emulator written in qml and c++ | ||
Yat is a qml plugin for the a VT100 emulation screen and an example of how to use this plugin | ||
|
||
The main goal of the project was to find out if it was possible to use qml to | ||
write a terminal emulator which performed on par with xterm and konsole. | ||
|
||
Turns out, it's possible. | ||
Do | ||
$ qmake && make | ||
in the top level directory. Then you can run the example from the same directory with the command: | ||
$ qmlscene -I imports yat_app/main.qml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
|
||
import QtQuick 2.0 | ||
|
||
import org.yat 1.0 | ||
import Yat 1.0 | ||
|
||
ObjectDestructItem { | ||
id: cursor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
QT += core-private gui-private qml-private quick quick-private | ||
TARGET = yat_qml_plugin | ||
TEMPLATE = lib | ||
CONFIG += plugin | ||
|
||
include(../../backend/backend.pri) | ||
|
||
SOURCES += \ | ||
plugin/terminal_screen.cpp \ | ||
plugin/object_destruct_item.cpp \ | ||
plugin/mono_text.cpp \ | ||
plugin/yat_extension_plugin.cpp \ | ||
|
||
HEADERS += \ | ||
plugin/terminal_screen.h \ | ||
plugin/object_destruct_item.h \ | ||
plugin/mono_text.h \ | ||
plugin/yat_extension_plugin.h \ | ||
|
||
OTHER_FILES = \ | ||
Line.qml \ | ||
Screen.qml \ | ||
Text.qml \ | ||
Selection.qml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Jørgen Lind | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
*******************************************************************************/ | ||
|
||
#include "yat_extension_plugin.h" | ||
|
||
#include <QtCore/QByteArray> | ||
|
||
#include <QQmlEngine> | ||
|
||
#include "terminal_screen.h" | ||
#include "object_destruct_item.h" | ||
#include "screen.h" | ||
#include "text.h" | ||
#include "cursor.h" | ||
#include "mono_text.h" | ||
#include "selection.h" | ||
|
||
static const struct { | ||
const char *type; | ||
int major, minor; | ||
} qmldir [] = { | ||
{ "Screen", 1, 0}, | ||
{ "Text", 1, 0}, | ||
{ "Cursor", 1, 0}, | ||
{ "Selection", 1, 0}, | ||
}; | ||
|
||
void YatExtensionPlugin::registerTypes(const char *uri) | ||
{ | ||
Q_ASSERT(uri == QByteArrayLiteral("Yat")); | ||
qmlRegisterType<TerminalScreen>("Yat", 1, 0, "TerminalScreen"); | ||
qmlRegisterType<ObjectDestructItem>("Yat", 1, 0, "ObjectDestructItem"); | ||
qmlRegisterType<MonoText>("Yat", 1, 0, "MonoText"); | ||
qmlRegisterType<Screen>(); | ||
qmlRegisterType<Text>(); | ||
qmlRegisterType<Cursor>(); | ||
qmlRegisterType<Selection>(); | ||
|
||
const QString filesLocation = baseUrl().toString(); | ||
for (int i = 0; i < int(sizeof(qmldir)/sizeof(qmldir[0])); i++) | ||
qmlRegisterType(QUrl(filesLocation + "/" + qmldir[i].type + ".qml"), uri, qmldir[i].major, qmldir[i].minor, qmldir[i].type); | ||
} | ||
|
||
void YatExtensionPlugin::initializeEngine(QQmlEngine *engine, const char *uri) | ||
{ | ||
Q_UNUSED(uri); | ||
Q_UNUSED(engine); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2014 Jørgen Lind | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
*******************************************************************************/ | ||
|
||
#ifndef YAT_EXTENSION_PLUGIN | ||
#define YAT_EXTENSION_PLUGIN | ||
|
||
#include <QtQml/qqmlextensionplugin.h> | ||
|
||
class YatExtensionPlugin : public QQmlExtensionPlugin | ||
{ | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0") | ||
public: | ||
void registerTypes(const char *uri); | ||
void initializeEngine(QQmlEngine *engine, const char *uri); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Yat | ||
plugin yat_qml_plugin | ||
classname YatExtensionPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
TEMPLATE=subdirs | ||
SUBDIRS= \ | ||
Yat \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
TEMPLATE=subdirs | ||
CONFIG += ordered | ||
SUBDIRS= \ | ||
yat_declarative \ | ||
imports \ | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.