From ef713b1183cf1a7f226e4c9d24e1968c9603e1e7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 11 Jan 2023 13:03:32 +0200 Subject: [PATCH] Added desktop files. --- dist/puzzle.desktop | 6 ++++-- dist/tape.desktop | 6 ++++-- dist/valentina.desktop | 5 ++++- qbs/imports/VToolApp.qbs | 19 +++++++++++++++++++ qbs/modules/freedesktop2/FreeDesktop2.qbs | 1 - qbs/modules/freedesktop2/freedesktop2.js | 2 -- src/app/puzzle/main.cpp | 4 ++++ src/app/puzzle/puzzle.qbs | 1 - src/app/tape/main.cpp | 6 +++++- src/app/tape/tape.qbs | 1 - src/app/valentina/main.cpp | 4 ++++ src/app/valentina/valentina.qbs | 1 - 12 files changed, 44 insertions(+), 12 deletions(-) diff --git a/dist/puzzle.desktop b/dist/puzzle.desktop index b166d63fe..7164788f4 100644 --- a/dist/puzzle.desktop +++ b/dist/puzzle.desktop @@ -2,13 +2,15 @@ Type=Application Name=Puzzle Exec=puzzle %F -Version=1.0 +Version=1.1 GenericName=Valentina's layout editor +GenericName[uk]=Редактор розкладки Валентини Comment=Create and edit layouts Comment[uk]=Створюйте і редагуйте розкладки -Comment[ru]=Создавайте и редактируйте раскладку Icon=puzzle Terminal=false MimeType=application/x-valentina-layout; Categories=Qt;Utility;FileTools; TryExec=puzzle +Keywords=layout;nesting +StartupWMClass=puzzle diff --git a/dist/tape.desktop b/dist/tape.desktop index 589da7ac1..b1c6ca9d3 100644 --- a/dist/tape.desktop +++ b/dist/tape.desktop @@ -2,13 +2,15 @@ Type=Application Name=Tape Exec=tape %F -Version=1.0 +Version=1.1 GenericName=Valentina's measurements editor +GenericName[uk]=Редактор мірок Валентини Comment=Create and edit measurements Comment[uk]=Створюйте і редагуйте мірки -Comment[ru]=Создавайте и редактируйте мерки Icon=tape Terminal=false MimeType=application/x-valentina-s-measurements;application/x-valentina-i-measurements; Categories=Qt;Utility;FileTools; TryExec=tape +Keywords=measurements +StartupWMClass=tape diff --git a/dist/valentina.desktop b/dist/valentina.desktop index a563e9656..1e3e22a98 100644 --- a/dist/valentina.desktop +++ b/dist/valentina.desktop @@ -2,8 +2,9 @@ Type=Application Name=Valentina Exec=valentina %F -Version=1.0 +Version=1.1 GenericName=Pattern making program +GenericName[uk]=Програма створення викрійок Comment=Creating pattern of clothes Comment[uk]=Створеня викрійок одягу Icon=valentina @@ -11,3 +12,5 @@ Terminal=false MimeType=application/x-valentina-pattern; Categories=Graphics;VectorGraphics;2DGraphics;Qt;Engineering; TryExec=valentina +Keywords=pattern +StartupWMClass=valentina diff --git a/qbs/imports/VToolApp.qbs b/qbs/imports/VToolApp.qbs index e280540e5..cf0c4b197 100644 --- a/qbs/imports/VToolApp.qbs +++ b/qbs/imports/VToolApp.qbs @@ -1,7 +1,26 @@ +import qbs.FileInfo + VApp { + Depends { name: "freedesktop2" } + version: "0.7.52" type: base.concat("testSuit") install: true installDir: buildconfig.installAppPath installDebugInformation: true + + Group { + name: "freedesktop" + prefix: FileInfo.joinPaths(project.sourceDirectory, "dist", FileInfo.pathSeparator()) + files: [ + product.targetName + ".desktop" + ] + } + + freedesktop2.desktopKeys: ({ + 'Exec': FileInfo.joinPaths(qbs.installPrefix, + product.installDir, + product.targetName) + ' %F', + 'X-Application-Version': product.version, + }) } diff --git a/qbs/modules/freedesktop2/FreeDesktop2.qbs b/qbs/modules/freedesktop2/FreeDesktop2.qbs index 5ddba03da..2c2c372fb 100644 --- a/qbs/modules/freedesktop2/FreeDesktop2.qbs +++ b/qbs/modules/freedesktop2/FreeDesktop2.qbs @@ -73,7 +73,6 @@ Module { cmd.highlight = "codegen"; cmd.sourceCode = function() { var aggregateDesktopKeys = Fdo.parseDesktopFile(input.filePath); - console.info(JSON.stringify(aggregateDesktopKeys)); var desktopKeys = ModUtils.moduleProperty(product, "desktopKeys") || {} var mainSection = aggregateDesktopKeys['Desktop Entry']; for (key in desktopKeys) { diff --git a/qbs/modules/freedesktop2/freedesktop2.js b/qbs/modules/freedesktop2/freedesktop2.js index 2de0bef1d..90151dc4f 100644 --- a/qbs/modules/freedesktop2/freedesktop2.js +++ b/qbs/modules/freedesktop2/freedesktop2.js @@ -40,8 +40,6 @@ function parseDesktopFile(filePath) { if (line.length == 0) continue; if (line[0] == '#') continue; var match = sectionRex.exec(line); - console.info(line) - console.info(match) if (match) { var currentSectionName = match[1]; fileValues[currentSectionName] = {}; diff --git a/src/app/puzzle/main.cpp b/src/app/puzzle/main.cpp index 161bab225..5964d2173 100644 --- a/src/app/puzzle/main.cpp +++ b/src/app/puzzle/main.cpp @@ -71,6 +71,10 @@ auto main(int argc, char *argv[]) -> int VPApplication app(argc, argv); app.InitOptions(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) + app.setDesktopFileName("puzzle.desktop"); +#endif + QTimer::singleShot(0, &app, &VPApplication::ProcessCMD); #if defined(APPIMAGE) && defined(Q_OS_LINUX) diff --git a/src/app/puzzle/puzzle.qbs b/src/app/puzzle/puzzle.qbs index c22a34802..d8e14af42 100644 --- a/src/app/puzzle/puzzle.qbs +++ b/src/app/puzzle/puzzle.qbs @@ -3,7 +3,6 @@ import qbs.FileInfo VToolApp { Depends { name: "buildconfig" } Depends { name: "ib"; condition: qbs.targetOS.contains("macos") } - Depends { name: "freedesktop" } Depends { name: "Qt"; submodules: ["widgets", "svg"] } Depends { name: "VMiscLib" } Depends { name: "VLayoutLib" } diff --git a/src/app/tape/main.cpp b/src/app/tape/main.cpp index 0db4e342b..3fc1f13ce 100644 --- a/src/app/tape/main.cpp +++ b/src/app/tape/main.cpp @@ -66,7 +66,11 @@ auto main(int argc, char *argv[]) -> int #endif //Q_OS_MAC MApplication app(argc, argv); - app.InitOptions(); + app.InitOptions(); + +#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) + app.setDesktopFileName("tape.desktop"); +#endif QTimer::singleShot(0, &app, &MApplication::ProcessCMD); diff --git a/src/app/tape/tape.qbs b/src/app/tape/tape.qbs index 6598472a8..b744ca5ef 100644 --- a/src/app/tape/tape.qbs +++ b/src/app/tape/tape.qbs @@ -4,7 +4,6 @@ import qbs.File VToolApp { Depends { name: "buildconfig" } Depends { name: "ib"; condition: qbs.targetOS.contains("macos") } - Depends { name: "freedesktop" } Depends { name: "Qt"; submodules: ["widgets", "svg"] } Depends { name: "VMiscLib"; } Depends { name: "VPatternDBLib"; } diff --git a/src/app/valentina/main.cpp b/src/app/valentina/main.cpp index be34e752f..4d1bda49a 100644 --- a/src/app/valentina/main.cpp +++ b/src/app/valentina/main.cpp @@ -80,6 +80,10 @@ auto main(int argc, char *argv[]) -> int VApplication app(argc, argv); app.InitOptions(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) + app.setDesktopFileName("valentina.desktop"); +#endif + if (VApplication::IsGUIMode() && VAbstractApplication::VApp()->Settings()->IsAutomaticallyCheckUpdates()) { // Set feed URL before doing anything else diff --git a/src/app/valentina/valentina.qbs b/src/app/valentina/valentina.qbs index 618f703e8..d89281a42 100644 --- a/src/app/valentina/valentina.qbs +++ b/src/app/valentina/valentina.qbs @@ -4,7 +4,6 @@ import qbs.File VToolApp { Depends { name: "buildconfig" } Depends { name: "ib"; condition: qbs.targetOS.contains("macos") } - Depends { name: "freedesktop" } Depends { name: "Qt"; submodules: ["widgets", "svg", "xmlpatterns", "concurrent"] } Depends { name: "VPatternDBLib"; } Depends { name: "VWidgetsLib"; }