Merge pull request #1341
pull/2/head7d8d477
Redesigned the daemon console pop-upacefb96
Added 'Windows.js' for dialogs/windows47f9a17
Modify password dialog and move customdecorations function out of main.qml4d56ed9
Make the titlebar more modular7fe9d71
Added daemonConsole component to main.qml75ccc7a
Added Utils.js, for miscellaneous Javascript functions
commit
679d18166f
@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Formats a date.
|
||||
* @param {date} date - toggle decorations
|
||||
* @param {params} params -
|
||||
*/
|
||||
function formatDate( date, params ) {
|
||||
var options = {
|
||||
weekday: "short",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
timeZone: "UTC",
|
||||
timeZoneName: "short",
|
||||
};
|
||||
|
||||
options = [options, params].reduce(function (r, o) {
|
||||
Object.keys(o).forEach(function (k) { r[k] = o[k]; });
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
|
||||
return new Date( date ).toLocaleString( 'en-US', options );
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
var flagsCustomDecorations = (Qt.FramelessWindowHint | Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint);
|
||||
var flags = (Qt.WindowSystemMenuHint | Qt.Window | Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint | Qt.WindowTitleHint | Qt.WindowMaximizeButtonHint);
|
||||
|
||||
/**
|
||||
* Toggles window decorations
|
||||
* @param {bool} custom - toggle decorations
|
||||
*/
|
||||
function setCustomWindowDecorations(custom) {
|
||||
// save x,y positions, because we need to hide/show the window
|
||||
var x = appWindow.x
|
||||
var y = appWindow.y
|
||||
if (x < 0) x = 0
|
||||
if (y < 0) y = 0
|
||||
|
||||
// Update persistentSettings
|
||||
persistentSettings.customDecorations = custom;
|
||||
|
||||
titleBar.visible = custom;
|
||||
daemonConsolePopup.titleBar.visible = custom;
|
||||
|
||||
if (custom) {
|
||||
appWindow.flags = flagsCustomDecorations;
|
||||
daemonConsolePopup.flags = flagsCustomDecorations;
|
||||
} else {
|
||||
appWindow.flags = flags;
|
||||
daemonConsolePopup.flags = flags;
|
||||
}
|
||||
|
||||
// Reset window
|
||||
appWindow.hide()
|
||||
appWindow.x = x
|
||||
appWindow.y = y
|
||||
appWindow.show()
|
||||
}
|
Reference in new issue