Commit b449f84c authored by Aard's avatar Aard

Import fingerterm from 1.0.2 tarball

parents
Makefile
*.pro.user*
*.o
moc_*
./fingerterm
qrc_resources.cpp
This diff is collapsed.
; use keycodes from:
; http://doc.qt.nokia.com/4.7/qt.html#Key-enum
;
; - [] will leave an empty space in the keyboard
; - Recognized modifier keys are shift, alt, ctrl
; - Letters will automatically handle upper/lowercase
; - Empty row in the file acts as a keyboard row separator
["esc", 0x1000000, "", 0x0]
[">", 0x3e, "<", 0x3c]
["|", 0x7c, "&", 0x26]
["!", 0x21, "?", 0x3f]
["\"", 0x22, "$", 0x24]
["'", 0x27, "`", 0x60]
["_", 0x5f, "@", 0x40]
["=", 0x3d, "~", 0x7e]
["/", 0x2f, "\\", 0x5c]
["*", 0x2a, "del", 0x1000007]
[":backspace", 0x1000003, "", 0x0]
[":tab", 0x1000001, "", 0x0]
["1", 0x31, "+", 0x2b]
["2", 0x32, "^", 0x5e]
["3", 0x33, "#", 0x23]
["4", 0x34, "%", 0x25]
["5", 0x35, "(", 0x28]
["6", 0x36, ")", 0x29]
["7", 0x37, "[", 0x5b]
["8", 0x38, "]", 0x5d]
["9", 0x39, "{", 0x7b]
["0", 0x30, "}", 0x7d]
["q", 0x51, "", 0x0]
["w", 0x57, "", 0x0]
["e", 0x45, "", 0x0]
["r", 0x52, "", 0x0]
["t", 0x54, "", 0x0]
["y", 0x59, "", 0x0]
["u", 0x55, "", 0x0]
["i", 0x49, "", 0x0]
["o", 0x4f, "", 0x0]
["p", 0x50, "", 0x0]
[":enter", 0x1000004, "", 0x0]
["a", 0x41, "", 0x0]
["s", 0x53, "", 0x0]
["d", 0x44, "", 0x0]
["f", 0x46, "", 0x0]
["g", 0x47, "", 0x0]
["h", 0x48, "", 0x0]
["j", 0x4a, "", 0x0]
["k", 0x4b, "", 0x0]
["l", 0x4c, "", 0x0]
[":", 0x3a, "", 0x0]
["pgup", 0x1000016, "home", 0x1000010]
[":shift", 0x2000000, "", 0x0]
["z", 0x5a, "", 0x0]
["x", 0x58, "", 0x0]
["c", 0x43, "", 0x0]
["v", 0x56, "", 0x0]
["b", 0x42, "", 0x0]
["n", 0x4e, "", 0x0]
["m", 0x4d, "", 0x0]
[";", 0x3b, "", 0x0]
[":up", 0x1000013, "", 0x0]
["pgdn", 0x1000017, "end", 0x1000011]
["ctrl", 0x4000000, "", 0x0]
["alt", 0x8000000, "", 0x0]
["-", 0x2d, "", 0x0]
[",", 0x2c, "", 0x0]
[[[" ", 0x20, "", 0x0]]]
[".", 0x2e, "", 0x0]
[":left", 0x1000012, "", 0x0]
[":down", 0x1000015, "", 0x0]
[":right", 0x1000014, "", 0x0]
; use keycodes from:
; http://doc.qt.nokia.com/4.7/qt.html#Key-enum
;
; - [] will leave an empty space in the keyboard
; - Recognized modifier keys are shift, alt, ctrl
; - Letters will automatically handle upper/lowercase
; - Empty row in the file acts as a keyboard row separator
["esc", 0x1000000, "", 0x0]
[">", 0x3e, "<", 0x3c]
["|", 0x7c, "&", 0x26]
["!", 0x21, "?", 0x3f]
["\"", 0x22, "$", 0x24]
["'", 0x27, "`", 0x60]
["_", 0x5f, "@", 0x40]
["=", 0x3d, "~", 0x7e]
["/", 0x2f, "\\", 0x5c]
["-", 0x2d, "*", 0x2a]
[":backspace", 0x1000003, "", 0x0]
[":tab", 0x1000001, "", 0x0]
["1", 0x31, "+", 0x2b]
["2", 0x32, "^", 0x5e]
["3", 0x33, "#", 0x23]
["4", 0x34, "%", 0x25]
["5", 0x35, "(", 0x28]
["6", 0x36, ")", 0x29]
["7", 0x37, "[", 0x5b]
["8", 0x38, "]", 0x5d]
["9", 0x39, "{", 0x7b]
["0", 0x30, "}", 0x7d]
["q", 0x51, "", 0x0]
["w", 0x57, "", 0x0]
["e", 0x45, "", 0x0]
["r", 0x52, "", 0x0]
["t", 0x54, "", 0x0]
["y", 0x59, "", 0x0]
["u", 0x55, "", 0x0]
["i", 0x49, "", 0x0]
["o", 0x4f, "", 0x0]
["p", 0x50, "", 0x0]
[":enter", 0x1000004, "", 0x0]
["a", 0x41, "", 0x0]
["s", 0x53, "", 0x0]
["d", 0x44, "", 0x0]
["f", 0x46, "", 0x0]
["g", 0x47, "", 0x0]
["h", 0x48, "", 0x0]
["j", 0x4a, "", 0x0]
["k", 0x4b, "", 0x0]
["l", 0x4c, "", 0x0]
["ä", 0xc4, "", 0x0]
["pgup", 0x1000016, "home", 0x1000010]
[":shift", 0x2000000, "", 0x0]
["z", 0x5a, "", 0x0]
["x", 0x58, "", 0x0]
["c", 0x43, "", 0x0]
["v", 0x56, "", 0x0]
["b", 0x42, "", 0x0]
["n", 0x4e, "", 0x0]
["m", 0x4d, "", 0x0]
["ö", 0xd6, "", 0x0]
[":up", 0x1000013, "", 0x0]
["pgdn", 0x1000017, "end", 0x1000011]
["ctrl", 0x4000000, "", 0x0]
["alt", 0x8000000, "", 0x0]
["å", 0xc2, "", 0x0]
[",", 0x2c, ";", 0x3b]
[[[" ", 0x20, "", 0x0]]]
[".", 0x2e, ":", 0x3a]
[":left", 0x1000012, "", 0x0]
[":down", 0x1000015, "", 0x0]
[":right", 0x1000014, "", 0x0]
<?xml version="1.0" encoding="utf-8"?>
<userMenu>
<item>
<title>ssh screen example</title>
<command>ssh -t user@example.com screen -UDr\r</command>
<!-- The disableOn element is optional and can be used to
disable the button when using certain programs. The
button is disabled when the window title contains the
specified string. Note that for this to work your shell
and/or application must set the window title correctly. -->
<disableOn>irssi</disableOn>
</item>
<item>
<title>ssh example</title>
<command>ssh user@example.com\r</command>
</item>
<item>
<title>screen -Dr</title>
<command>screen -Dr\r</command>
</item>
<item>
<title>Ctrl-A-D</title>
<command>\x01\x04</command>
</item>
<item>
<title>Ctrl-C</title>
<command>\x03</command>
</item>
</userMenu>
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QApplication>
#include <QWidget>
#include "dbusadaptor.h"
#include "mainwindow.h"
#ifdef MEEGO_EDITION_HARMATTAN
DbusAdaptor::DbusAdaptor(QObject *parent):
MApplicationService("org.hqh.fingerterm", parent),
mainWin(0)
{
}
DbusAdaptor::~DbusAdaptor()
{
}
void DbusAdaptor::launch()
{
MApplicationService::launch();
if (mainWin) {
mainWin->raise();
}
}
void DbusAdaptor::launch(const QStringList &parameters)
{
if (parameters.contains("new"))
launchAnotherWithQProcess();
else
launch();
}
void DbusAdaptor::handleServiceRegistrationFailure()
{
// for some reason the subsequent instances get the default "com.nokia..." prefix
incrementAndRegister();
}
#endif // MEEGO_EDITION_HARMATTAN
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DBUSADAPTOR_H
#define DBUSADAPTOR_H
#include "qplatformdefs.h"
class MainWindow;
#ifdef MEEGO_EDITION_HARMATTAN
// handles dbus registration & multiple instances on harmattan
#include <MApplicationService>
class DbusAdaptor : public MApplicationService
{
Q_OBJECT
public:
explicit DbusAdaptor(QObject *parent = 0);
virtual ~DbusAdaptor();
public slots:
virtual void launch();
virtual void launch(const QStringList &parameters);
virtual void handleServiceRegistrationFailure();
void setAppWindow(MainWindow* win) { mainWin = win; }
private:
Q_DISABLE_COPY(DbusAdaptor)
MainWindow* mainWin;
};
#endif // MEEGO_EDITION_HARMATTAN
#endif // DBUSADAPTOR_H
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=FingerTerm
GenericName=FingerTerm
Comment=Terminal emulator
Exec=/usr/bin/invoker --single-instance --type=e /opt/fingerterm/bin/fingerterm
Terminal=false
Type=Application
Icon=/usr/share/icons/hicolor/80x80/apps/fingerterm.png
QT = core gui declarative opengl dbus
contains(MEEGO_EDITION,harmattan): {
CONFIG += meegotouch
}
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
LIBS += -lutil
system($$PWD/updateversion.sh)
# Input
HEADERS += \
ptyiface.h \
terminal.h \
textrender.h \
version.h \
util.h \
keyloader.h \
mainwindow.h \
dbusadaptor.h
SOURCES += main.cpp terminal.cpp textrender.cpp \
ptyiface.cpp \
util.cpp \
keyloader.cpp \
mainwindow.cpp \
dbusadaptor.cpp
OTHER_FILES += \
qml/Main.qml \
qml/Keyboard.qml \
qml/Key.qml \
qml/Lineview.qml \
qtc_packaging/debian_harmattan/rules \
qtc_packaging/debian_harmattan/copyright \
qtc_packaging/debian_harmattan/control \
qtc_packaging/debian_harmattan/compat \
qtc_packaging/debian_harmattan/changelog \
qml/Button.qml \
qml/Menu.qml \
qml/NotifyWin.qml \
qml/UrlWindow.qml \
qml/LayoutWindow.qml
RESOURCES += \
resources.qrc
unix:!symbian:!maemo5 {
target.path = /opt/fingerterm/bin
INSTALLS += target
}
maemo5 {
target.path = /opt/fingerterm/bin
INSTALLS += target
}
contains(MEEGO_EDITION,harmattan) {
desktopfile.files = $${TARGET}fingerterm.desktop
desktopfile.path = /usr/share/applications
INSTALLS += desktopfile
}
contains(MEEGO_EDITION,harmattan) {
icon.files = fingerterm.png
icon.path = /usr/share/icons/hicolor/80x80/apps
INSTALLS += icon
}
icons/down.png

965 Bytes

icons/left.png

829 Bytes

icons/menu.png

818 Bytes

icons/up.png

929 Bytes

/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtCore>
#include <QDebug>
#include "keyloader.h"
#include "util.h"
KeyLoader::KeyLoader(QObject *parent) :
QObject(parent),
iVkbRows(0),
iVkbColumns(0),
iUtil(0)
{
}
KeyLoader::~KeyLoader()
{
}
bool KeyLoader::loadLayout(QString layout)
{
bool ret = false;
if(layout.isEmpty() || !iUtil)
return false;
if (layout.at(0)==':') { // load from resources
QResource res(layout);
QByteArray resArr( reinterpret_cast<const char*>(res.data()) );
QBuffer resBuf( &resArr );
ret = loadLayoutInternal(resBuf);
}
else { // load from file
QFile f(iUtil->configPath() + "/" + layout + ".layout");
ret = loadLayoutInternal(f);
}
return ret;
}
bool KeyLoader::loadLayoutInternal(QIODevice &from)
{
iKeyData.clear();
bool ret = true;
iVkbRows = 0;
iVkbColumns = 0;
bool lastLineHadKey = false;
if( !from.open(QIODevice::ReadOnly | QIODevice::Text) )
return false;
QList<KeyData> keyRow;
while(!from.atEnd()) {
QString line = QString::fromUtf8(from.readLine()).simplified();
if(line.length()>=2 && line.at(0)!=';' && line.at(0)=='[' && line.at(line.length()-1)==']')
{
KeyData key;
key.label = "";
key.code = 0;
key.label_alt = "";
key.code_alt = 0;
key.isModifier = false;
line.replace("\\\\", "\\x5C");
line.replace("\" \"", "\\x20");
line.replace(" ", "");
line.replace("\"[\"", "\\x5B");
line.replace("\"]\"", "\\x5D");
line.replace("\",\"", "\\x2C");
line.replace("\\\"", "\\x22");
line.replace("\"", "");
key.width = line.count('[');
line.replace("[", "");
line.replace("]", "");
line.replace("\\x20", " ");
line.replace("\\x22", "\"");
line.replace("\\x5B", "[");
line.replace("\\x5D", "]");
line.replace("\\x5C", "\\");
QStringList parts = line.split(",", QString::KeepEmptyParts);
if(parts.count()>=2) {
bool ok = true;
key.label = parts.at(0);
key.label.replace("\\x2C",",");
parts[1].replace("0x","");
key.code = parts.at(1).toInt(&ok,16);
if(!ok) {
ret = false;
break;
}
if(key.code==Qt::AltModifier || key.code==Qt::ControlModifier || key.code==Qt::ShiftModifier)
key.isModifier = true;
if(parts.count()>=4 && !key.isModifier) {
key.label_alt = parts.at(2);
key.label_alt.replace("\\x2C",",");
parts[3].replace("0x","");
key.code_alt = parts.at(3).toInt(&ok,16);
if(!ok) {
ret = false;
break;
}
}
}
lastLineHadKey = true;
cleanUpKey(key);
keyRow.append(key);
}
else if(line.length()==0 && lastLineHadKey) {
if(keyRow.count() > iVkbColumns) {
iVkbColumns = keyRow.count();
}
iKeyData.append(keyRow);
keyRow.clear();
lastLineHadKey = false;
}
else {
lastLineHadKey = false;
}
}
if(keyRow.count() > 0)
iKeyData.append(keyRow);
iVkbRows = iKeyData.count();
foreach(QList<KeyData> r, iKeyData) {
if(r.count() > iVkbColumns)
iVkbColumns = r.count();
}
from.close();
if (iVkbColumns <= 0 || iVkbRows <= 0)
ret = false;
if (!ret)
iKeyData.clear();
return ret;
}
QVariantList KeyLoader::keyAt(int row, int col)
{
QVariantList ret;
ret.append(""); //label
ret.append(0); //code
ret.append(""); //label_alt
ret.append(0); //code_alt
ret.append(0); //width
ret.append(false); //isModifier
if(iKeyData.count() <= row)
return ret;
if(iKeyData.at(row).count() <= col)
return ret;
ret[0] = iKeyData.at(row).at(col).label;
ret[1] = iKeyData.at(row).at(col).code;
ret[2] = iKeyData.at(row).at(col).label_alt;
ret[3] = iKeyData.at(row).at(col).code_alt;
ret[4] = iKeyData.at(row).at(col).width;
ret[5] = iKeyData.at(row).at(col).isModifier;
return ret;
}
const QStringList KeyLoader::availableLayouts()
{
if (!iUtil)
return QStringList();
QDir confDir(iUtil->configPath());
QStringList filter("*.layout");
QStringList results = confDir.entryList(filter, QDir::Files|QDir::Readable, QDir::Name);
QStringList ret;
foreach(QString s, results) {
ret << s.left(s.lastIndexOf('.'));
}
return ret;
}
void KeyLoader::cleanUpKey(KeyData &key)
{
// make sure that a key does not try to use some (currently) unsupported feature...
// if the label is an image or a modifier, we do not support an alternative label
if ((key.label.startsWith(':') && key.label.length()>1) || key.isModifier) {
key.label_alt = "";
key.code_alt = 0;
}
// if the alternative label is an image (and the default one was not), use it as the (only) default
if (key.label_alt.startsWith(':') && key.label_alt.length()>1) {
key.label = key.label_alt;
key.code = key.code_alt;
key.label_alt = "";
key.code_alt = 0;
}
// alphabet letters can't have an alternative, they just switch between lower and upper case
if (key.label.length()==1 && key.label.at(0).isLetter()) {
key.label_alt = "";
key.code_alt = 0;
}
// ... also, can't have alphabet letters as an alternative label
if (key.label_alt.length()==1 && key.label_alt.at(0).isLetter()) {
key.label_alt = "";
key.code_alt = 0;
}
}
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KEYLOADER_H
#define KEYLOADER_H
#include <QtCore>
#include <QtDeclarative>
class Util;
struct KeyData {
QString label;
int code;
QString label_alt;
int code_alt;
int width;
bool isModifier;
};
class KeyLoader : public QObject
{
Q_OBJECT
public:
explicit KeyLoader(QObject *parent = 0);
virtual ~KeyLoader();
void setUtil(Util* util) { iUtil = util; }
Q_INVOKABLE bool loadLayout(QString layout);
Q_INVOKABLE int vkbRows() { return iVkbRows; }
Q_INVOKABLE int vkbColumns() { return iVkbColumns; }
Q_INVOKABLE QVariantList keyAt(int row, int col);
Q_INVOKABLE const QStringList availableLayouts();
signals:
public slots:
private:
Q_DISABLE_COPY(KeyLoader)
bool loadLayoutInternal(QIODevice &from);
void cleanUpKey(KeyData &key);
int iVkbRows;
int iVkbColumns;
QList<QList<KeyData> > iKeyData;
Util *iUtil;
};
#endif // KEYLOADER_H
/*
Copyright 2011-2012 Heikki Holstila <heikki.holstila@gmail.com>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#include "qplatformdefs.h"
#include <QtGui>