Refactoring: move all apps inside a sub folder
This commit is contained in:
1 parent
33e4fe0c4e
commit
b1ca2a7cff
41 files changed
+54
-45
No files matched your search
@@ -0,0 +1,77 @@
|
||||
.pragma library
|
||||
|
||||
// Mise en forme des durées et des libellés de médias.
|
||||
|
||||
var TICKS_PER_MS = 10000; // Jellyfin compte en « ticks » de 100 ns
|
||||
|
||||
function ticksToMs(ticks) {
|
||||
return Math.floor((ticks || 0) / TICKS_PER_MS);
|
||||
}
|
||||
|
||||
function msToTicks(ms) {
|
||||
return Math.floor((ms || 0) * TICKS_PER_MS);
|
||||
}
|
||||
|
||||
// « 1 h 34 min », « 52 min »
|
||||
function runtime(ticks) {
|
||||
var minutes = Math.round(ticksToMs(ticks) / 60000);
|
||||
if (minutes <= 0)
|
||||
return "";
|
||||
if (minutes < 60)
|
||||
return minutes + " min";
|
||||
var m = minutes % 60;
|
||||
return Math.floor(minutes / 60) + " h" + (m > 0 ? " " + (m < 10 ? "0" : "") + m + " min" : "");
|
||||
}
|
||||
|
||||
// « 1:02:03 », « 4:05 »
|
||||
function clock(ms) {
|
||||
var total = Math.max(0, Math.floor((ms || 0) / 1000));
|
||||
var h = Math.floor(total / 3600);
|
||||
var m = Math.floor((total % 3600) / 60);
|
||||
var s = total % 60;
|
||||
var mm = h > 0 && m < 10 ? "0" + m : String(m);
|
||||
return (h > 0 ? h + ":" : "") + mm + ":" + (s < 10 ? "0" : "") + s;
|
||||
}
|
||||
|
||||
// « S1 · É3 » pour un épisode
|
||||
function episodeCode(item) {
|
||||
if (!item || item.type !== "Episode")
|
||||
return "";
|
||||
return "S" + (item.parentIndexNumber || 0) + " · É" + (item.indexNumber || 0);
|
||||
}
|
||||
|
||||
// Libellés des cartes du catalogue.
|
||||
function cardTitle(item) {
|
||||
return item.type === "Episode" && item.seriesName ? item.seriesName : item.name;
|
||||
}
|
||||
|
||||
function cardSubtitle(item) {
|
||||
if (item.type === "Episode")
|
||||
return episodeCode(item) + " – " + item.name;
|
||||
if (item.type === "Series" && item.childCount)
|
||||
return item.childCount + " saison" + (item.childCount > 1 ? "s" : "");
|
||||
return item.year ? String(item.year) : "";
|
||||
}
|
||||
|
||||
// Avancement 0..1 (pour la barre de progression des cartes).
|
||||
function progress(item) {
|
||||
if (item.playedPercentage)
|
||||
return item.playedPercentage / 100;
|
||||
return item.runtimeTicks ? item.positionTicks / item.runtimeTicks : 0;
|
||||
}
|
||||
|
||||
// Ligne d'informations : « 1997 · 1 h 34 min · Tous publics »
|
||||
function infoLine(item) {
|
||||
var parts = [];
|
||||
if (item.type === "Episode")
|
||||
parts.push(episodeCode(item));
|
||||
if (item.year)
|
||||
parts.push(String(item.year));
|
||||
if (item.runtimeTicks)
|
||||
parts.push(runtime(item.runtimeTicks));
|
||||
if (item.rating)
|
||||
parts.push(item.rating);
|
||||
if (item.communityRating)
|
||||
parts.push(item.communityRating.toFixed(1).replace(".", ",") + "/10");
|
||||
return parts.join(" · ");
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
.pragma library
|
||||
|
||||
// Correspondance des touches de la télécommande Freebox.
|
||||
// Plusieurs codes sont acceptés tant que le mapping exact sur la box n'est pas vérifié.
|
||||
|
||||
function isAccept(key) {
|
||||
return key === Qt.Key_Return || key === Qt.Key_Enter || key === Qt.Key_Select;
|
||||
}
|
||||
|
||||
function isBack(key) {
|
||||
return key === Qt.Key_Back || key === Qt.Key_Escape;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
pragma Singleton
|
||||
import QtQuick 2.5
|
||||
|
||||
// Couleurs, tailles et animations partagées par toute l'application.
|
||||
QtObject {
|
||||
// Couleurs (inspirées de la palette Jellyfin)
|
||||
readonly property color background: "#101010"
|
||||
readonly property color panel: "#000B25"
|
||||
readonly property color surface: "#202020"
|
||||
readonly property color border: "#3A3A3A"
|
||||
readonly property color focusBackground: "#FFFFFF"
|
||||
readonly property color text: "#FFFFFF"
|
||||
readonly property color textMuted: "#A0A0A0"
|
||||
readonly property color textOnFocus: "#101010"
|
||||
readonly property color textOnFocusMuted: "#505050"
|
||||
readonly property color accent: "#00A4DC"
|
||||
readonly property color accentAlt: "#AA5CC3"
|
||||
readonly property color error: "#FF5252"
|
||||
readonly property var avatarColors: ["#AA5CC3", "#00A4DC", "#E67E22", "#27AE60", "#C0392B", "#2C3E50"]
|
||||
|
||||
// Espacements
|
||||
readonly property int pageMargin: 48
|
||||
readonly property int spacingS: 8
|
||||
readonly property int spacingM: 16
|
||||
readonly property int spacingL: 24
|
||||
readonly property int spacingXL: 40
|
||||
|
||||
// Typographie
|
||||
readonly property int fontSmall: 14
|
||||
readonly property int fontBody: 18
|
||||
readonly property int fontTitle: 32
|
||||
readonly property int fontCode: 56
|
||||
|
||||
// Cartes du catalogue (affiche 2:3, vignette 16:9)
|
||||
readonly property int posterWidth: 150
|
||||
readonly property int posterHeight: 225
|
||||
readonly property int thumbWidth: 267
|
||||
readonly property int thumbHeight: 150
|
||||
readonly property int cardTextHeight: 52
|
||||
|
||||
// Contrôles
|
||||
readonly property int controlHeight: 48
|
||||
readonly property int radius: 6
|
||||
readonly property int animFast: 120
|
||||
|
||||
// Couleur stable dérivée d'un nom (avatars, icônes de serveur).
|
||||
function avatarColor(name) {
|
||||
var hash = 0;
|
||||
for (var i = 0; i < name.length; i++)
|
||||
hash = (hash * 31 + name.charCodeAt(i)) % 100000;
|
||||
return avatarColors[hash % avatarColors.length];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
singleton Theme 1.0 Theme.qml
|
||||
Reference in new issue
Block a user