aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2015-07-26 20:54:57 +0200
committerAdrian Kummerlaender2015-07-26 20:54:57 +0200
commit3af7553b2e7cf4f301d61eeac563f07bd405c66c (patch)
treec85ad486864105d7da2214a5b560b4967de8f78d
parent311dd6e4e885ff5833756fd9cfa6e8c9c4a8668a (diff)
downloadMetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar.gz
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar.bz2
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar.lz
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar.xz
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.tar.zst
MetaTerm-3af7553b2e7cf4f301d61eeac563f07bd405c66c.zip
Added support for permanently storing settings
-rw-r--r--main.cpp14
-rw-r--r--qml/EmbeddedTerminal.qml21
-rw-r--r--qml/TerminalItem.qml1
-rw-r--r--qml/main.qml7
4 files changed, 31 insertions, 12 deletions
diff --git a/main.cpp b/main.cpp
index 8f7eafc..617b43a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,19 +1,19 @@
#include <QApplication>
#include <QQmlApplicationEngine>
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QQmlApplicationEngine engine;
+int main(int argc, char *argv[]) {
+ QApplication application(argc, argv);
+ application.setOrganizationName("akr");
+ application.setApplicationName("MetaTerm");
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ QQmlApplicationEngine engine(QUrl(QStringLiteral("qrc:/main.qml")));
QObject::connect(
static_cast<QObject*>(&engine),
SIGNAL(quit()),
- static_cast<QObject*>(&app),
+ static_cast<QObject*>(&application),
SLOT(quit())
);
- return app.exec();
+ return application.exec();
}
diff --git a/qml/EmbeddedTerminal.qml b/qml/EmbeddedTerminal.qml
index aa22328..ef53b12 100644
--- a/qml/EmbeddedTerminal.qml
+++ b/qml/EmbeddedTerminal.qml
@@ -1,18 +1,29 @@
import QtQuick 2.0
import QMLTermWidget 1.0
import QtQuick.Layouts 1.1
+import Qt.labs.settings 1.0
Item {
id: item
property string program
property string workingDirectory
- property int lines
+
+ property int lines : 20
property int frameWidth : 10
height: terminal.height
width: parent.width - frameWidth
+ Settings {
+ category: "terminal"
+
+ property alias frameWidth : item.frameWidth
+ property alias colorScheme : terminal.colorScheme
+ property alias fontFamily : terminal.font.family
+ property alias fontSize : terminal.font.pointSize
+ }
+
function select() { highlighter.select() }
function deselect() { highlighter.deselect() }
@@ -36,10 +47,12 @@ Item {
QMLTermWidget {
id: terminal
- font.family: "Monospace"
- font.pointSize: 8
+ font {
+ family: "Monospace"
+ pointSize: 8
+ }
- Layout.fillWidth: true
+ Layout.fillWidth: true
Layout.preferredHeight: fontMetrics.height * item.lines
colorScheme: "cool-retro-term"
diff --git a/qml/TerminalItem.qml b/qml/TerminalItem.qml
index 48fb9f7..eeeed1c 100644
--- a/qml/TerminalItem.qml
+++ b/qml/TerminalItem.qml
@@ -96,7 +96,6 @@ Item {
var terminalComponent = Qt.createComponent("qrc:/EmbeddedTerminal.qml");
var instantiateTerminal = function() {
item.terminal = terminalComponent.createObject(elementList, {
- "lines" : 20,
"program" : program,
"workingDirectory" : "$HOME",
"focus" : true
diff --git a/qml/main.qml b/qml/main.qml
index 836f97c..a45ee73 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
import QtQuick.Window 2.0
import QtQuick.Controls 1.2
+import Qt.labs.settings 1.0
ApplicationWindow {
id: root
@@ -13,6 +14,12 @@ ApplicationWindow {
terminalList.focusCurrent();
}
+ Settings {
+ category: "window"
+
+ property alias color : root.color
+ }
+
Flickable {
id: terminalListFlickable