mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-04-19 01:00:47 +01:00
Use provided settings database
This commit is contained in:
parent
bfab242344
commit
b7f632077c
@ -81,7 +81,12 @@ int main(int argc, char *argv[])
|
|||||||
importPathList.prepend(QCoreApplication::applicationDirPath() + "/../../../qmltermwidget");
|
importPathList.prepend(QCoreApplication::applicationDirPath() + "/../../../qmltermwidget");
|
||||||
engine.setImportPathList(importPathList);
|
engine.setImportPathList(importPathList);
|
||||||
|
|
||||||
engine.load(QUrl("qrc:/main.qml"));
|
engine.load(QUrl(QStringLiteral ("qrc:/main.qml")));
|
||||||
|
|
||||||
|
if (engine.rootObjects().isEmpty()) {
|
||||||
|
qDebug() << "Cannot load QML interface";
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Quit the application when the engine closes.
|
// Quit the application when the engine closes.
|
||||||
QObject::connect((QObject*) &engine, SIGNAL(quit()), (QObject*) &app, SLOT(quit()));
|
QObject::connect((QObject*) &engine, SIGNAL(quit()), (QObject*) &app, SLOT(quit()));
|
||||||
|
@ -33,6 +33,11 @@ QtObject{
|
|||||||
|
|
||||||
// GENERAL SETTINGS ///////////////////////////////////////////////////////
|
// GENERAL SETTINGS ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
property int x: 100
|
||||||
|
property int y: 100
|
||||||
|
property int width: 1024
|
||||||
|
property int height: 768
|
||||||
|
|
||||||
property bool fullscreen: false
|
property bool fullscreen: false
|
||||||
property bool showMenubar: true
|
property bool showMenubar: true
|
||||||
|
|
||||||
@ -211,6 +216,10 @@ QtObject{
|
|||||||
function composeSettingsString(){
|
function composeSettingsString(){
|
||||||
var settings = {
|
var settings = {
|
||||||
fps: fps,
|
fps: fps,
|
||||||
|
x: x,
|
||||||
|
y: y,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
windowScaling: windowScaling,
|
windowScaling: windowScaling,
|
||||||
showTerminalSize: showTerminalSize,
|
showTerminalSize: showTerminalSize,
|
||||||
fontScaling: fontScaling,
|
fontScaling: fontScaling,
|
||||||
@ -291,6 +300,11 @@ QtObject{
|
|||||||
fps = settings.fps !== undefined ? settings.fps: fps
|
fps = settings.fps !== undefined ? settings.fps: fps
|
||||||
windowScaling = settings.windowScaling !== undefined ? settings.windowScaling : windowScaling
|
windowScaling = settings.windowScaling !== undefined ? settings.windowScaling : windowScaling
|
||||||
|
|
||||||
|
x = settings.x !== undefined ? settings.x : x
|
||||||
|
y = settings.y !== undefined ? settings.y : y
|
||||||
|
width = settings.width !== undefined ? settings.width : width
|
||||||
|
height = settings.height !== undefined ? settings.height : height
|
||||||
|
|
||||||
fontNames = settings.fontNames !== undefined ? settings.fontNames : fontNames
|
fontNames = settings.fontNames !== undefined ? settings.fontNames : fontNames
|
||||||
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
|
fontScaling = settings.fontScaling !== undefined ? settings.fontScaling : fontScaling
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
import QtQuick 2.2
|
import QtQuick 2.2
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.1
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
import Qt.labs.settings 1.0
|
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
ApplicationWindow{
|
ApplicationWindow{
|
||||||
@ -29,23 +28,33 @@ ApplicationWindow{
|
|||||||
|
|
||||||
width: 1024
|
width: 1024
|
||||||
height: 768
|
height: 768
|
||||||
|
|
||||||
|
// Save window properties automatically
|
||||||
|
onXChanged: appSettings.x = x
|
||||||
|
onYChanged: appSettings.y = y
|
||||||
|
onWidthChanged: appSettings.width = width
|
||||||
|
onHeightChanged: appSettings.height = height
|
||||||
|
|
||||||
|
// Load saved window geometry and show the window
|
||||||
|
Component.onCompleted: {
|
||||||
|
appSettings.handleFontChanged();
|
||||||
|
|
||||||
|
x = appSettings.x
|
||||||
|
y = appSettings.y
|
||||||
|
width = appSettings.width
|
||||||
|
height = appSettings.height
|
||||||
|
|
||||||
|
visible = true
|
||||||
|
}
|
||||||
|
|
||||||
minimumWidth: 320
|
minimumWidth: 320
|
||||||
minimumHeight: 240
|
minimumHeight: 240
|
||||||
|
|
||||||
visible: true
|
visible: false
|
||||||
|
|
||||||
property bool fullscreen: appSettings.fullscreen
|
property bool fullscreen: appSettings.fullscreen
|
||||||
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
onFullscreenChanged: visibility = (fullscreen ? Window.FullScreen : Window.Windowed)
|
||||||
|
|
||||||
// Save window size automatically
|
|
||||||
Settings {
|
|
||||||
category: "MainWindow"
|
|
||||||
property alias x: terminalWindow.x
|
|
||||||
property alias y: terminalWindow.y
|
|
||||||
property alias width: terminalWindow.width
|
|
||||||
property alias height: terminalWindow.height
|
|
||||||
}
|
|
||||||
|
|
||||||
//Workaround: Without __contentItem a ugly thin border is visible.
|
//Workaround: Without __contentItem a ugly thin border is visible.
|
||||||
menuBar: CRTMainMenuBar{
|
menuBar: CRTMainMenuBar{
|
||||||
id: mainMenu
|
id: mainMenu
|
||||||
@ -150,7 +159,6 @@ ApplicationWindow{
|
|||||||
terminalSize: terminalContainer.terminalSize
|
terminalSize: terminalContainer.terminalSize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: appSettings.handleFontChanged();
|
|
||||||
onClosing: {
|
onClosing: {
|
||||||
// OSX Since we are currently supporting only one window
|
// OSX Since we are currently supporting only one window
|
||||||
// quit the application when it is closed.
|
// quit the application when it is closed.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user