mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2025-04-19 01:00:47 +01:00
Revert "Handle db upgrades and prepare work for old profiles deprecation."
This reverts commit 6fb8ceb5010357cf1a8d2ae305305a793b3b33a8.
This commit is contained in:
parent
6fb8ceb501
commit
04a64e1312
@ -24,9 +24,7 @@ import QtQuick.Controls 1.0
|
|||||||
import "utils.js" as Utils
|
import "utils.js" as Utils
|
||||||
|
|
||||||
QtObject{
|
QtObject{
|
||||||
readonly property string version: "1.0.1"
|
property string version: "1.0.1"
|
||||||
readonly property int profileVersion: 2
|
|
||||||
|
|
||||||
|
|
||||||
// STATIC CONSTANTS ////////////////////////////////////////////////////////
|
// STATIC CONSTANTS ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -111,8 +109,6 @@ QtObject{
|
|||||||
|
|
||||||
signal initializedSettings()
|
signal initializedSettings()
|
||||||
|
|
||||||
signal showErrorMessage(string message)
|
|
||||||
|
|
||||||
property Loader fontManager: Loader{
|
property Loader fontManager: Loader{
|
||||||
states: [
|
states: [
|
||||||
State { when: rasterization == no_rasterization
|
State { when: rasterization == no_rasterization
|
||||||
@ -335,17 +331,6 @@ QtObject{
|
|||||||
burnInQuality = settings.burnInQuality !== undefined ? settings.burnInQuality : burnInQuality;
|
burnInQuality = settings.burnInQuality !== undefined ? settings.burnInQuality : burnInQuality;
|
||||||
}
|
}
|
||||||
|
|
||||||
function userLoadProfileString(profileString) {
|
|
||||||
var profile = JSON.parse(profileString);
|
|
||||||
var version = profile.version !== undefined ? profile.version : 1;
|
|
||||||
|
|
||||||
if (version === profileVersion) {
|
|
||||||
loadProfileString(profileString);
|
|
||||||
} else {
|
|
||||||
showErrorMessage("This profile is not supported on this version of CRT.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadProfileString(profileString){
|
function loadProfileString(profileString){
|
||||||
var settings = JSON.parse(profileString);
|
var settings = JSON.parse(profileString);
|
||||||
|
|
||||||
|
@ -23,20 +23,9 @@ import QtQuick.LocalStorage 2.0
|
|||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
property bool initialized: false
|
property bool initialized: false
|
||||||
property string dbVersion: "1.1"
|
|
||||||
|
|
||||||
function getDatabase() {
|
function getDatabase() {
|
||||||
try {
|
return LocalStorage.openDatabaseSync("coolretroterm", "1.0", "StorageDatabase", 100000);
|
||||||
return _getDatabase(dbVersion);
|
|
||||||
} catch (error) {
|
|
||||||
console.log("Error while reading from settings database:", error);
|
|
||||||
updateAndResetDatabase(_getDatabase(""));
|
|
||||||
return _getDatabase(dbVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _getDatabase(version) {
|
|
||||||
return LocalStorage.openDatabaseSync("coolretroterm", version, "StorageDatabase", 100000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
@ -85,22 +74,9 @@ QtObject {
|
|||||||
|
|
||||||
function dropSettings(){
|
function dropSettings(){
|
||||||
var db = getDatabase();
|
var db = getDatabase();
|
||||||
dropSettingsFromDB(db);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateAndResetDatabase(db) {
|
|
||||||
console.log("Updating and resetting database.");
|
|
||||||
db.changeVersion(db.version, dbVersion);
|
|
||||||
|
|
||||||
try {
|
|
||||||
dropSettingsFromDB(db);
|
|
||||||
} catch (error) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function dropSettingsFromDB(db) {
|
|
||||||
db.transaction(
|
db.transaction(
|
||||||
function(tx) {
|
function(tx) {
|
||||||
tx.executeSql('DROP TABLE settings');
|
tx.executeSql('DROP TABLE settings');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user