Merge pull request #256946 from TomaSajt/actiona

actiona: init at 3.10.2
This commit is contained in:
Pol Dellaiera 2024-04-03 07:30:26 +02:00 committed by GitHub
commit 08b9151ed4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 207 additions and 0 deletions

View file

@ -0,0 +1,112 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
wrapQtAppsHook,
bluez,
libnotify,
libXdmcp,
libXtst,
opencv,
qtbase,
qtmultimedia,
qtscript,
qttools,
qtx11extras,
qtxmlpatterns,
# Running with TTS support causes the program to freeze for a few seconds every time at startup,
# so it is disabled by default
textToSpeechSupport ? false,
qtspeech,
}:
let
# For some reason qtscript wants to use the same version of qtbase as itself
# This override makes it think that they are the same version
qtscript' = qtscript.overrideAttrs (oldAttrs: {
inherit (qtbase) version;
postPatch = ''
substituteInPlace .qmake.conf \
--replace-fail ${oldAttrs.version} ${qtbase.version}
'';
});
in
stdenv.mkDerivation (finalAttrs: {
pname = "actiona";
version = "3.10.2";
src = fetchFromGitHub {
owner = "Jmgr";
repo = "actiona";
rev = "v${finalAttrs.version}";
hash = "sha256-4RKCNEniBBx0kDwdHVZOqXYeGCsH8g6SfVc8JdDV0hI=";
fetchSubmodules = true;
};
patches =
[
# Sets the proper search location for the `.so` files and the translations
./fix-paths.patch
]
++ lib.optionals (!textToSpeechSupport) [
# Removes TTS support
./disable-tts.patch
];
postPatch = ''
substituteInPlace gui/src/mainwindow.cpp executer/src/executer.cpp tools/src/languages.cpp \
--subst-var out
'';
nativeBuildInputs = [
cmake
pkg-config
wrapQtAppsHook
];
buildInputs = [
bluez
libnotify
libXdmcp
libXtst
opencv
qtbase
qtmultimedia
qtscript'
qttools
qtx11extras
qtxmlpatterns
] ++ lib.optionals textToSpeechSupport [ qtspeech ];
# RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
cmakeFlags = [ (lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) ];
# udev is used by the system-actionpack
env.NIX_LDFLAGS = "-ludev";
installPhase = ''
runHook preInstall
install -Dm755 {execution,actiontools,tools}/*.so -t $out/lib
install -Dm755 actions/actionpack*.so -t $out/lib/actions
install -Dm755 actiona actexec -t $out/bin
install -Dm644 translations/*.qm -t $out/share/actiona/translations
install -Dm644 $src/actiona.desktop -t $out/share/applications
install -Dm644 $src/gui/icons/actiona.png -t $out/share/icons/hicolor/48x48/apps
runHook postInstall
'';
meta = {
description = "A cross-platform automation tool";
homepage = "https://github.com/Jmgr/actiona";
license = lib.licenses.gpl3Only;
mainProgram = "actiona";
maintainers = with lib.maintainers; [ tomasajt ];
platforms = lib.platforms.linux;
};
})

View file

@ -0,0 +1,54 @@
diff --git a/actions/system/CMakeLists.txt b/actions/system/CMakeLists.txt
index ca861145..3e3d3d3b 100644
--- a/actions/system/CMakeLists.txt
+++ b/actions/system/CMakeLists.txt
@@ -66,8 +66,6 @@ set(HEADERS
${HEADERS_PREFIX}/actions/playsoundinstance.hpp
${HEADERS_PREFIX}/actions/systemdefinition.hpp
${HEADERS_PREFIX}/actions/systeminstance.hpp
- ${HEADERS_PREFIX}/actions/texttospeechdefinition.hpp
- ${HEADERS_PREFIX}/actions/texttospeechinstance.hpp
${HEADERS_PREFIX}/code/mediaplaylist.hpp
${HEADERS_PREFIX}/code/notify.hpp
${HEADERS_PREFIX}/code/process.hpp
@@ -131,7 +129,6 @@ find_package(Qt5 ${ACT_MINIMUM_QT_VERSION} COMPONENTS
DBus
Multimedia
MultimediaWidgets
- TextToSpeech
REQUIRED)
target_include_directories(${PROJECT}
@@ -153,7 +150,6 @@ target_link_libraries(${PROJECT}
Qt5::DBus
Qt5::Multimedia
Qt5::MultimediaWidgets
- Qt5::TextToSpeech
${LIBNOTIFY_LIBRARIES}
${BLUEZ_LIBRARIES}
${UDEV_LIBRARIES}
diff --git a/actions/system/src/actionpacksystem.hpp b/actions/system/src/actionpacksystem.hpp
index c5768415..27a899d6 100644
--- a/actions/system/src/actionpacksystem.hpp
+++ b/actions/system/src/actionpacksystem.hpp
@@ -31,10 +31,6 @@
#include "actions/playsounddefinition.hpp"
#include "actions/findimagedefinition.hpp"
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
-#include "actions/texttospeechdefinition.hpp"
-#endif
-
#include "code/system.hpp"
#include "code/mediaplaylist.hpp"
#include "code/notify.hpp"
@@ -67,9 +63,6 @@ public:
addActionDefinition(new Actions::DetachedCommandDefinition(this));
addActionDefinition(new Actions::PlaySoundDefinition(this));
addActionDefinition(new Actions::FindImageDefinition(this));
-#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
- addActionDefinition(new Actions::TextToSpeechDefinition(this));
-#endif
}
QString id() const override { return QStringLiteral("system"); }

View file

@ -0,0 +1,39 @@
diff --git a/executer/src/executer.cpp b/executer/src/executer.cpp
index da848dad..5bd7e986 100644
--- a/executer/src/executer.cpp
+++ b/executer/src/executer.cpp
@@ -45,7 +45,7 @@ bool Executer::start(QIODevice *device, const QString &filename)
QSettings settings;
QString locale = settings.value(QStringLiteral("gui/locale"), QLocale::system().name()).toString();
- mActionFactory->loadActionPacks(QApplication::applicationDirPath() + QStringLiteral("/actions"), locale);
+ mActionFactory->loadActionPacks(QStringLiteral("@out@/lib/actions"), locale);
#ifndef Q_OS_WIN
if(mActionFactory->actionPackCount() == 0)
mActionFactory->loadActionPacks(QStringLiteral("actiona/actions/"), locale);
diff --git a/gui/src/mainwindow.cpp b/gui/src/mainwindow.cpp
index 6052648e..3c802d93 100644
--- a/gui/src/mainwindow.cpp
+++ b/gui/src/mainwindow.cpp
@@ -322,7 +322,7 @@ void MainWindow::postInit()
if(mSplashScreen)
mSplashScreen->showMessage(tr("Loading actions..."));
- mActionFactory->loadActionPacks(QApplication::applicationDirPath() + QStringLiteral("/actions"), mUsedLocale);
+ mActionFactory->loadActionPacks(QStringLiteral("@out@/lib/actions"), mUsedLocale);
#ifndef Q_OS_WIN
if(mActionFactory->actionPackCount() == 0)
mActionFactory->loadActionPacks(QStringLiteral("actiona/actions/"), mUsedLocale);
diff --git a/tools/src/languages.cpp b/tools/src/languages.cpp
index 4926936e..18e9aabb 100644
--- a/tools/src/languages.cpp
+++ b/tools/src/languages.cpp
@@ -79,7 +79,7 @@ namespace Tools
void Languages::installTranslator(const QString &componentName, const QString &locale)
{
auto translator = new QTranslator(QCoreApplication::instance());
- if(!translator->load(QStringLiteral("%1/translations/%2_%3").arg(QCoreApplication::applicationDirPath()).arg(componentName).arg(locale)))
+ if(!translator->load(QStringLiteral("@out@/share/actiona/translations/%1_%2").arg(componentName).arg(locale)))
{
auto path = QStringLiteral("%1/translations/%2_%3").arg(QDir::currentPath()).arg(componentName).arg(locale);
if(!translator->load(path))

View file

@ -18012,6 +18012,8 @@ with pkgs;
abuild = callPackage ../development/tools/abuild { };
actiona = libsForQt5.callPackage ../applications/misc/actiona { };
actionlint = callPackage ../development/tools/analysis/actionlint { };
adreaper = callPackage ../tools/security/adreaper { };