Commit 5250432d authored by Damien Caliste's avatar Damien Caliste

[fingerterm] Install QML files, icons and data under /usr/share/fingerterm...

[fingerterm] Install QML files, icons and data under /usr/share/fingerterm instead of using resources.
parent e28ec34b
......@@ -15,6 +15,8 @@ isEmpty(DEFAULT_FONT) {
DEFAULT_FONT = monospace
}
DEPLOYMENT_PATH = /usr/share/$$TARGET
DEFINES += DEPLOYMENT_PATH=\\\"$$DEPLOYMENT_PATH\\\"
DEFINES += DEFAULT_FONTFAMILY=\\\"$$DEFAULT_FONT\\\"
TEMPLATE = app
......@@ -40,8 +42,7 @@ SOURCES += \
util.cpp \
keyloader.cpp
OTHER_FILES += \
qml/Main.qml \
qml.files = qml/Main.qml \
qml/Keyboard.qml \
qml/Key.qml \
qml/Lineview.qml \
......@@ -51,10 +52,34 @@ OTHER_FILES += \
qml/UrlWindow.qml \
qml/LayoutWindow.qml \
qml/PopupWindow.qml
qml.path = $$DEPLOYMENT_PATH
INSTALLS += qml
RESOURCES += \
resources.qrc
icons.files = icons/backspace.png \
icons/down.png \
icons/enter.png \
icons/left.png \
icons/menu.png \
icons/right.png \
icons/scroll-indicator.png \
icons/shift.png \
icons/tab.png \
icons/up.png
icons.path = $$DEPLOYMENT_PATH/icons
INSTALLS += icons
userdata.files = data/menu.xml \
data/english.layout \
data/finnish.layout \
data/french.layout \
data/german.layout \
data/qwertz.layout
userdata.path = $$DEPLOYMENT_PATH/data
INSTALLS += userdata
target.path = /usr/bin
INSTALLS += target
......
......@@ -40,7 +40,7 @@ extern "C" {
#include "version.h"
#include "keyloader.h"
static void copyFileFromResources(QString from, QString to);
static void copyFilesFromPath(QString from, QString to);
int main(int argc, char *argv[])
{
......@@ -132,12 +132,7 @@ int main(int argc, char *argv[])
QString startupErrorMsg;
// copy the default config files to the config dir if they don't already exist
copyFileFromResources(":/data/menu.xml", util.configPath()+"/menu.xml");
copyFileFromResources(":/data/english.layout", util.configPath()+"/english.layout");
copyFileFromResources(":/data/finnish.layout", util.configPath()+"/finnish.layout");
copyFileFromResources(":/data/french.layout", util.configPath()+"/french.layout");
copyFileFromResources(":/data/german.layout", util.configPath()+"/german.layout");
copyFileFromResources(":/data/qwertz.layout", util.configPath()+"/qwertz.layout");
copyFilesFromPath(QStringLiteral(DEPLOYMENT_PATH) + QDir::separator() + QStringLiteral("data"), util.configPath());
KeyLoader keyLoader;
keyLoader.setUtil(&util);
......@@ -164,7 +159,8 @@ int main(int argc, char *argv[])
QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl("qrc:/qml/Main.qml"));
view.engine()->addImportPath(QStringLiteral(DEPLOYMENT_PATH));
view.setSource(QUrl::fromLocalFile(QStringLiteral(DEPLOYMENT_PATH) + QDir::separator() + QStringLiteral("Main.qml")));
QObject *root = view.rootObject();
if(!root)
......@@ -184,18 +180,13 @@ int main(int argc, char *argv[])
return app.exec();
}
static void copyFileFromResources(QString from, QString to)
static void copyFilesFromPath(QString from, QString to)
{
// copy a file from resources to the config dir if it does not exist there
QFileInfo toFile(to);
if(!toFile.exists()) {
QFile newToFile(toFile.absoluteFilePath());
QResource res(from);
if (newToFile.open(QIODevice::WriteOnly)) {
newToFile.write( reinterpret_cast<const char*>(res.data()) );
newToFile.close();
} else {
qWarning() << "Failed to copy default config from resources to" << toFile.filePath();
}
QDir fromDir(from);
QDir toDir(to);
// Copy files from fromDir to toDir, but don't overwrite existing ones
foreach (const QString &filename, fromDir.entryList(QDir::Files)) {
QFile::copy(fromDir.filePath(filename), toDir.filePath(filename));
}
}
......@@ -48,7 +48,7 @@ Rectangle {
id: keyImage
anchors.centerIn: parent
opacity: key.labelOpacity
source: { if(key.label.length>1 && key.label.charAt(0)==':') return "qrc:/icons/"+key.label.substring(1)+".png"; else return ""; }
source: { if(key.label.length>1 && key.label.charAt(0)==':') return "icons/"+key.label.substring(1)+".png"; else return ""; }
scale: window.pixelRatio
}
......
......@@ -184,14 +184,14 @@ Item {
id: menuImg
anchors.centerIn: parent
source: "qrc:/icons/menu.png"
source: "icons/menu.png"
scale: window.pixelRatio
}
}
Image {
// terminal buffer scroll indicator
source: "qrc:/icons/scroll-indicator.png"
source: "icons/scroll-indicator.png"
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
visible: textrender.showBufferScrollIndicator
......
<RCC>
<qresource prefix="/">
<file>qml/Main.qml</file>
<file>qml/Key.qml</file>
<file>qml/Keyboard.qml</file>
<file>qml/Lineview.qml</file>
<file>qml/Button.qml</file>
<file>qml/MenuFingerterm.qml</file>
<file>qml/NotifyWin.qml</file>
<file>qml/PopupWindow.qml</file>
<file>icons/backspace.png</file>
<file>icons/down.png</file>
<file>icons/enter.png</file>
<file>icons/left.png</file>
<file>icons/menu.png</file>
<file>icons/right.png</file>
<file>icons/shift.png</file>
<file>icons/tab.png</file>
<file>icons/up.png</file>
<file>qml/UrlWindow.qml</file>
<file>data/menu.xml</file>
<file>icons/scroll-indicator.png</file>
<file>data/english.layout</file>
<file>data/finnish.layout</file>
<file>data/french.layout</file>
<file>data/german.layout</file>
<file>data/qwertz.layout</file>
<file>qml/LayoutWindow.qml</file>
</qresource>
</RCC>
Name: fingerterm
Version: 1.3.2
Version: 1.3.5
Release: 1
Summary: A terminal emulator with a custom virtual keyboard
Group: System/Base
......@@ -24,7 +24,9 @@ Provides: meego-terminal > 0.2.2
%defattr(-,root,root,-)
%{_bindir}/*
%{_datadir}/applications/*.desktop
%{_datadir}/%{name}/*.qml
%{_datadir}/%{name}/data/*
%{_datadir}/%{name}/icons/*
%prep
%setup -q -n %{name}-%{version}
......
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