diff -Nru qjackctl-0.4.5/aclocal.m4 qjackctl-0.6.0/aclocal.m4
--- qjackctl-0.4.5/aclocal.m4 2017-04-27 14:45:15.097012434 +0000
+++ qjackctl-0.6.0/aclocal.m4 2019-10-17 07:46:11.520671700 +0000
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -12,9 +12,9 @@
# PARTICULAR PURPOSE.
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29.1)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
dnl Copyright © 2004 Scott James Remnant .
dnl Copyright © 2012-2015 Dan Nicholson
dnl
@@ -288,3 +288,71 @@
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+ [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+ [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+ [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+ AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+ [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+ [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+ [auto],[PKG_CHECK_MODULES([$1],[$2],
+ [m4_n([def_action_if_found]) $3],
+ [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+ [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
diff -Nru qjackctl-0.4.5/ChangeLog qjackctl-0.6.0/ChangeLog
--- qjackctl-0.4.5/ChangeLog 2017-04-27 14:44:14.544750473 +0000
+++ qjackctl-0.6.0/ChangeLog 2019-10-17 07:45:45.945673225 +0000
@@ -4,6 +4,212 @@
ChangeLog
+0.6.0 2019-10-17 An Autumn'19 Release.
+
+- Graph: avoid self-connecting over their own ports
+ when client nodes are selected as a whole group;
+ also try to match port-types in a oderly fashion
+ when connecting multiple selected ports.
+
+- Changing current JACK buffer size from Setup dialog
+ (cf. Settings / Frames/Period) may now take effect
+ just immediately ;)
+
+- An 'Apply' button as been added to the Setup dialog;
+ ask whether to restart the JACK audio server, if any
+ settings are changed.
+
+- Added alternate yet non-official CMake build option.
+
+- Fix HiDPI display screen effective support (Qt >= 5.6).
+
+- Command line arguments (--start, --preset=[label] and
+ --active-patchbay=[path]) are passed and take effect
+ on the current singleton/unique application instance,
+ when enabled and already running.
+
+- System-tray icon context menu has been refactored to
+ be exactly the same as the main-window context menu
+ that is re-instantiated on demand.
+
+- Make sure compiler flags comply to c++11 as standard.
+
+
+0.5.9 2019-07-12 A Summer'19 Release.
+
+- Updated for the newer Qt5 translation tools (>= 5.13).
+
+- Configure updated to check for qtchooser availability.
+
+
+
+0.5.8 2019-05-25 A Spring'19 Release.
+
+- When enabled the current default preset settings are
+ now read from the last known JACK D-BUS configuration.
+
+- Minor update to Debian packaging control file.
+
+- Removed all the remaining leftovers of old pre-FFADO
+ 'freebob' driver support.
+
+
+0.5.7 2019-03-11 A Spring-Break'19 Release.
+
+- Graph node and port title renaming and nodes position
+ move changes are now undo/redo-able.
+
+- Graph client and port title in-place renaming is now
+ integrated to native aliases and JACK metadata (aka.
+ pretty-names).
+
+- Refactored all native client/port name aliases.
+
+- Re-defined all main application UNIX signal handling.
+
+
+0.5.6 2019-03-11 Pre-LAC2019 Release Frenzy.
+
+- Refactored all singleton/unique application instance
+ setup logic away from X11/Xcb hackery.
+
+- At last, JACK freewheel mode is now being detected
+ as to postpone any active patchbay scans as much as
+ possible.
+
+- Removed old pre-FFADO 'freebob' driver support.
+
+- HiDPI display screen support (Qt >= 5.6).
+
+- Graph port temporary highlighting while hovering,
+ if and only if connecting ports of same type and
+ complementary modes.
+
+- Bumped copyright headers into the New Year (2019).
+
+
+0.5.5 2018-11-23 A Black-Friday'18 Release!
+
+- Old deprecated Qt4 build support is no more.
+
+- Graph port sort options added as View / Sort menu.
+
+- System tray options now subject to current desktop
+ environment availability.
+
+- Also disable Setup / Misc / Other / Save JACK server
+ configuration to (.jackdrc) when JACK D-Bus interface
+ is enabled.
+
+- Whether to use server synchronous mode option added
+ to Setup / Settings / Parameters (only applied when
+ JACK D-BUS interface is enabled).
+
+- Disable some Setup / Settings / Advanced parameters
+ when JACK D-Bus interface is enabled and vice-versa.
+
+- Attempt to power-cycle JACK D-Bus service on demand;
+
+- Marked as probably useless anyway, old "H/W Monitor"
+ option (-H) is now being ditched from Setup / Settings
+ / Advanced tab.
+
+- Graph port/connections highlighting.
+
+
+0.5.4 2018-09-24 An Early Autumn'18 Release.
+
+- Graph port-type colors are now configurable (cf. menu
+ View > Colors.
+
+- Make Graph nodes (ie. client boxes) transparent for yet
+ some eye-candiness ;). Also keep the (Graph) current
+ selection across port (dis)connections.
+
+- Drawing patchbay connector lines as (bezier) curves is
+ now a difinitive and fixed feature (as long as no more
+ remains from the so called "Cambric explosion era" are
+ still lurking in there).
+
+- AppStream metadata updated to be the most compliant with
+ latest freedesktop.org specification and recommendation.
+
+- Graph auto-layout improvement for brand new node clients.
+
+- Avoid showing setup warning when no server settings have
+ changed.
+
+- Fixed JACK D-Bus settings for MIDI driver parameter.
+
+
+0.5.3 2018-07-22 A Summer'18 Release.
+
+- Portuguese (pt) translation added (by Heitor Rocha).
+
+- AppData/AppStream metadata is now settled under an all
+ permisssive license (FSFAP).
+
+- Improved Graph rubberband add (Shift) and toggle (Ctrl)
+ multiple (de)selections.
+
+- Added user preference option: Setup / Misc / Buttons /
+ Replace Connections with Graph button (on main window).
+
+- Added a zoom slider control to the Graph view status bar.
+
+
+0.5.2 2018-05-27 Pre-LAC2018 release frenzy hotfix.
+
+- Respect ALSA Sequencer support option also on Graph view.
+
+- Regression to new Graph node/ports sorting comparator;
+ also fixed multiple and many port removals, most probably
+ causing it to crash due to double-free/delete potential.
+
+- Fixed the automatic aggregation of new Graph client nodes
+ that are split as either input or output only (ie. system,
+ terminal, physical or otherwise non-duplex nodes).
+
+- Added View/Zoom Range mode option to Graph tool.
+
+
+0.5.1 2018-05-21 Pre-LAC2018 release frenzy.
+
+- Half a decade later, recent new custom entries may now get
+ removed from Session Infra-client list.
+
+- Some rather old, better said "Cambric explosion era", user
+ preference options have been ditched altogether: Display /
+ Time Format; Display / Shiny glass light effect; Display /
+ Connections/Draw connections and patchbay lines as Bezier
+ curves; Misc/Configure as temporary server.
+
+- A brand new and way long overdue connections Graph widget
+ is finally introduced, only to be accessible through the
+ context menu at this time.
+
+- Extended multi-selection is now supported on all Connections
+ client/port lists, allowing for multiple (dis)connections at
+ once.
+
+- Disable singleton/unique application instance setup logic
+ when the display server platform is not X11.
+
+- A little hardening on the configure (autoconf) macro side.
+
+
+0.5.0 2017-12-16 End of Autum'17 release.
+
+- Current preset is always taken into account if ever changes
+ while the Setup dialog is hidden (eg. via context menu).
+
+- Desktop entry specification file is now finally independent
+ from build/configure template chains.
+
+- Updated target path for freedesktop.org's AppStream metainfo
+ file (formerly AppData).
+
+
0.4.5 2017-04-27 Pre-LAC2017 release frenzy.
- On some desktop-shells, the system tray icon blinking on
diff -Nru qjackctl-0.4.5/CMakeLists.txt qjackctl-0.6.0/CMakeLists.txt
--- qjackctl-0.4.5/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/CMakeLists.txt 2019-10-17 07:45:45.944673225 +0000
@@ -0,0 +1,244 @@
+project(QJACKCTL)
+
+cmake_minimum_required(VERSION 3.1)
+
+set (VERSION "0.6.0")
+
+set (CONFIG_VERSION ${VERSION})
+execute_process (
+ COMMAND git describe --tags --dirty --abbrev=6
+ OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
+ RESULT_VARIABLE GIT_DESCRIBE_RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+if (GIT_DESCRIBE_RESULT EQUAL 0)
+ set (VERSION "${GIT_DESCRIBE_OUTPUT}")
+ string (REGEX REPLACE "^[^_]+" "" VERSION "${VERSION}")
+ string (REGEX REPLACE "^[_vV]+" "" VERSION "${VERSION}")
+ string (REGEX REPLACE "-g" "git." VERSION "${VERSION}")
+ string (REGEX REPLACE "[_|-]+" "." VERSION "${VERSION}")
+ execute_process (
+ COMMAND git rev-parse --abbrev-ref HEAD
+ OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
+ RESULT_VARIABLE GIT_REVPARSE_RESULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master")
+ set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")
+ endif ()
+endif ()
+
+set (PACKAGE_NAME "QjackCtl")
+set (PACKAGE_VERSION "${VERSION}")
+set (PACKAGE_BUGREPORT "rncbc@rncbc.org")
+set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+set (PACKAGE_TARNAME "qjackctl")
+
+set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
+
+if (CMAKE_BUILD_TYPE)
+ set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE})
+else ()
+ set (CONFIG_BUILD_TYPE "release")
+endif ()
+
+set (CONFIG_DEBUG 0)
+if (CONFIG_BUILD_TYPE MATCHES "debug")
+ set (CONFIG_DEBUG 1)
+endif ()
+
+set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
+
+include (GNUInstallDirs)
+set (CONFIG_BINDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+set (CONFIG_LIBDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+set (CONFIG_DATADIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_DATADIR}")
+set (CONFIG_MANDIR "${CONFIG_PREFIX}/${CMAKE_INSTALL_MANDIR}")
+
+
+# Disable system tray argument option.
+option (CONFIG_SYSTEM_TRAY "Enable system tray (default=yes)" 1)
+
+# Disable JACK MIDI support option.
+option (CONFIG_JACK_MIDI "Enable JACK MIDI support (default=yes)" 1)
+
+# Enable JACK session support.
+option (CONFIG_JACK_SESSION "Enable JACK session support (default=yes)" 1)
+
+# Enable JACK port aliases support.
+option (CONFIG_JACK_PORT_ALIASES "Enable JACK port aliases support (default=yes)" 1)
+
+# Enable JACK metadata support.
+option (CONFIG_JACK_METADATA "Enable JACK metadata support (default=yes)" 1)
+
+# Enable JACK version support.
+option (CONFIG_JACK_VERSION "Enable JACK version support (default=no)" 0)
+
+# Enable ALSA sequencer support option.
+option (CONFIG_ALSA_SEQ "Enable ALSA/MIDI sequencer support (default=yes)" 1)
+
+# Enable PortAudio argument option.
+option (CONFIG_PORTAUDIO "Enable PortAudio interface (default=yes)" 1)
+
+# Enable D-Bus argument option.
+option (CONFIG_DBUS "Enable D-Bus interface (default=yes)" 1)
+
+# Enable unique/single instance.
+option (CONFIG_XUNIQUE "Enable unique/single instance (default=yes)" 1)
+
+# Enable debugger stack-trace option (assumes --enable-debug).
+option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
+
+
+# Fix for new CMAKE_REQUIRED_LIBRARIES policy.
+if (POLICY CMP0075)
+ cmake_policy (SET CMP0075 NEW)
+endif ()
+
+# Check for Qt
+find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets Xml)
+
+if (CONFIG_XUNIQUE)
+ find_package (Qt5 REQUIRED COMPONENTS Network)
+endif ()
+
+if (CONFIG_DBUS)
+ find_package (Qt5 REQUIRED COMPONENTS DBus)
+endif ()
+
+find_package (Qt5LinguistTools)
+
+include (CheckIncludeFile)
+include (CheckIncludeFiles)
+include (CheckIncludeFileCXX)
+include (CheckFunctionExists)
+include (CheckLibraryExists)
+
+
+# Checks for header files.
+if (UNIX AND NOT APPLE)
+ check_include_files ("fcntl.h;unistd.h;signal.h" HAVE_SIGNAL_H)
+endif ()
+
+
+# Find package modules
+find_package (PkgConfig REQUIRED)
+
+# Check for JACK libraries.
+pkg_check_modules (JACK REQUIRED jack>=0.100.0)
+set (CONFIG_JACK ${JACK_FOUND})
+if (CONFIG_JACK)
+ include_directories (${JACK_INCLUDE_DIRS})
+ link_directories (${JACK_LIBRARY_DIRS})
+# link_libraries (${JACK_LIBRARIES})
+ set (CMAKE_REQUIRED_LIBRARIES "${JACK_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
+ # Check for jack/statistics.h header.
+ check_include_file (jack/statistics.h CONFIG_JACK_STATISTICS)
+ # Check for JACK MIDI headers availability.
+ if (CONFIG_JACK_MIDI)
+ check_include_file (jack/midiport.h CONFIG_JACK_MIDI)
+ endif ()
+ # Check for JACK session headers availability.
+ if (CONFIG_JACK_SESSION)
+ check_include_file (jack/session.h CONFIG_JACK_SESSION)
+ endif ()
+ # Check for JACK metadata headers availability.
+ if (CONFIG_JACK_METADATA)
+ check_include_file (jack/metadata.h CONFIG_JACK_METADATA)
+ endif ()
+ # Check for jack_transport_query function.
+ check_function_exists (jack_transport_query CONFIG_JACK_TRANSPORT)
+ # Check for jack_is_realtime function.
+ check_function_exists (jack_is_realtime CONFIG_JACK_REALTIME)
+ # Check for jack_get_xrun_delayed_usecs function.
+ check_function_exists (jack_get_xrun_delayed_usecs CONFIG_JACK_XRUN_DELAY)
+ # Check for jack_get_max_delayed_usecs function.
+ check_function_exists (jack_get_max_delayed_usecs CONFIG_JACK_MAX_DELAY)
+ # Check for jack_set_port_rename_callback
+ check_function_exists (jack_set_port_rename_callback CONFIG_JACK_PORT_RENAME)
+ # Check for jack_port_get_aliases function.
+ if (CONFIG_JACK_PORT_ALIASES)
+ check_function_exists (jack_port_get_aliases CONFIG_JACK_PORT_ALIASES)
+ endif ()
+ # Check for jack_get_version_string function.
+ if (CONFIG_JACK_VERSION)
+ check_function_exists (jack_get_version_string CONFIG_JACK_VERSION)
+ endif ()
+ # Check for jack_free function.
+ check_function_exists (jack_free CONFIG_JACK_FREE)
+else ()
+ message (FATAL_ERROR "*** JACK library not found.")
+endif ()
+
+# Check for ALSA libraries.
+if (CONFIG_ALSA_SEQ)
+ pkg_check_modules (ALSA alsa)
+ set (CONFIG_ALSA_SEQ ${ALSA_FOUND})
+ if (CONFIG_ALSA_SEQ)
+ include_directories (${ALSA_INCLUDE_DIRS})
+ link_directories (${ALSA_LIBRARY_DIRS})
+ link_libraries (${ALSA_LIBRARIES})
+ # set (CMAKE_REQUIRED_LIBRARIES "${ALSA_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
+ else ()
+ message (WARNING "*** ALSA library not found.")
+ endif ()
+endif ()
+
+# Check for PORTAUDIO libraries.
+if (CONFIG_PORTAUDIO)
+ pkg_check_modules (PORTAUDIO portaudio-2.0)
+ set (CONFIG_PORTAUDIO ${PORTAUDIO_FOUND})
+ if (CONFIG_PORTAUDIO)
+ include_directories (${PORTAUDIO_INCLUDE_DIRS})
+ link_directories (${PORTAUDIO_LIBRARY_DIRS})
+ link_libraries (${PORTAUDIO_LIBRARIES})
+ # set (CMAKE_REQUIRED_LIBRARIES "${PORTAUDIO_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
+ else ()
+ message (WARNING "*** PORTAUDIO library not found.")
+ endif ()
+endif ()
+
+
+if (APPLE AND CONFIG_COREAUDIO)
+ check_include_file (CoreAudio/CoreAudio.h CONFIG_COREAUDIO)
+endif ()
+
+
+add_subdirectory (src)
+
+configure_file (qjackctl.spec.in qjackctl.spec IMMEDIATE @ONLY)
+
+install (FILES qjackctl.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+install (FILES qjackctl.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qjackctl.1)
+
+# Configuration status
+macro (SHOW_OPTION text value)
+ if (${value})
+ message ("${text}: yes")
+ else ()
+ message ("${text}: no")
+ endif ()
+endmacro ()
+
+
+message ("\n ${PACKAGE_NAME} ${PACKAGE_VERSION}")
+message ("\n Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
+show_option (" JACK Audio Connection Kit support . . . . . . . ." CONFIG_JACK)
+show_option (" JACK Realtime support . . . . . . . . . . . . . ." CONFIG_JACK_REALTIME)
+show_option (" JACK Transport support . . . . . . . . . . . . . ." CONFIG_JACK_TRANSPORT)
+show_option (" JACK XRUN delay support . . . . . . . . . . . . ." CONFIG_JACK_XRUN_DELAY)
+show_option (" JACK Maximum scheduling delay support . . . . . ." CONFIG_JACK_MAX_DELAY)
+show_option (" JACK Port aliases support . . . . . . . . . . . ." CONFIG_JACK_PORT_ALIASES)
+show_option (" JACK Metadata support . . . . . . . . . . . . . ." CONFIG_JACK_METADATA)
+show_option (" JACK MIDI support . . . . . . . . . . . . . . . ." CONFIG_JACK_MIDI)
+show_option (" JACK Session support . . . . . . . . . . . . . . ." CONFIG_JACK_SESSION)
+show_option (" JACK Version support (JACK2) . . . . . . . . . . ." CONFIG_JACK_VERSION)
+show_option (" ALSA MIDI Sequencer support . . . . . . . . . . ." CONFIG_ALSA_SEQ)
+show_option (" System tray icon support . . . . . . . . . . . . ." CONFIG_SYSTEM_TRAY)
+show_option (" D-Bus interface support . . . . . . . . . . . . ." CONFIG_DBUS)
+show_option (" PortAudio interface support . . . . . . . . . . ." CONFIG_PORTAUDIO)
+show_option (" CoreAudio interface support . . . . . . . . . . ." CONFIG_COREAUDIO)
+message ("")
+show_option (" System tray icon support . . . . . . . . . . . . ." CONFIG_SYSTEM_TRAY)
+show_option (" Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
+show_option (" Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
+message ("\n Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")
+message ("\nNow type 'make', followed by 'make install' as root.\n")
diff -Nru qjackctl-0.4.5/configure qjackctl-0.6.0/configure
--- qjackctl-0.4.5/configure 2017-04-27 14:45:15.783355444 +0000
+++ qjackctl-0.6.0/configure 2019-10-17 07:46:11.875671679 +0000
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for QjackCtl 0.4.5.
+# Generated by GNU Autoconf 2.69 for QjackCtl 0.6.0.
#
# Report bugs to .
#
@@ -580,8 +580,8 @@
# Identity of this package.
PACKAGE_NAME='QjackCtl'
PACKAGE_TARNAME='qjackctl'
-PACKAGE_VERSION='0.4.5'
-PACKAGE_STRING='QjackCtl 0.4.5'
+PACKAGE_VERSION='0.6.0'
+PACKAGE_STRING='QjackCtl 0.6.0'
PACKAGE_BUGREPORT='rncbc@rncbc.org'
PACKAGE_URL=''
@@ -629,12 +629,10 @@
ac_incpath
ac_ldflags
ac_cflags
-ac_qx11extras
-QT5X11EXTRAS_LIBS
-QT5X11EXTRAS_CFLAGS
+ac_qnetwork
+QT5NETWORK_LIBS
+QT5NETWORK_CFLAGS
ac_qdbus
-QT4DBUS_LIBS
-QT4DBUS_CFLAGS
QT5DBUS_LIBS
QT5DBUS_CFLAGS
EGREP
@@ -645,12 +643,15 @@
ALSA_CFLAGS
JACK_LIBS
JACK_CFLAGS
+ac_cv_lrelease
ac_lrelease
+ac_cv_lupdate
ac_lupdate
ac_uic
ac_moc
ac_cv_qmake
ac_qmake
+ac_qtchooser
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
@@ -715,7 +716,6 @@
ac_user_opts='
enable_option_checking
enable_debug
-enable_qt4
enable_system_tray
enable_jack_midi
enable_jack_session
@@ -727,8 +727,7 @@
enable_dbus
enable_xunique
enable_stacktrace
-with_qt4
-with_qt5
+with_qt
with_jack
with_alsa
with_portaudio
@@ -757,10 +756,8 @@
PORTAUDIO_LIBS
QT5DBUS_CFLAGS
QT5DBUS_LIBS
-QT4DBUS_CFLAGS
-QT4DBUS_LIBS
-QT5X11EXTRAS_CFLAGS
-QT5X11EXTRAS_LIBS'
+QT5NETWORK_CFLAGS
+QT5NETWORK_LIBS'
# Initialize some variables set by options.
@@ -1301,7 +1298,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures QjackCtl 0.4.5 to adapt to many kinds of systems.
+\`configure' configures QjackCtl 0.6.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1362,7 +1359,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of QjackCtl 0.4.5:";;
+ short | recursive ) echo "Configuration of QjackCtl 0.6.0:";;
esac
cat <<\_ACEOF
@@ -1371,7 +1368,6 @@
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-debug enable debugging (default=no)
- --enable-qt4 enable Qt4 build (default=no)
--enable-system-tray enable system tray (default=yes)
--enable-jack-midi enable JACK MIDI support (default=yes)
--enable-jack-session enable JACK session support (default=yes)
@@ -1382,14 +1378,13 @@
--enable-alsa-seq enable ALSA/MIDI sequencer support (default=yes)
--enable-portaudio enable PortAudio interface (default=yes)
--enable-dbus enable D-Bus interface (default=yes)
- --enable-xunique enable X11 unique/single instance (default=yes)
+ --enable-xunique enable unique/single instance (default=yes)
--enable-stacktrace enable debugger stack-trace (default=no)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-qt4=PATH use alternate Qt4 install path
- --with-qt5=PATH use alternate Qt5 install path
+ --with-qt=PATH use alternate Qt install path
--with-jack=PATH use alternate JACK install path
--with-alsa=PATH use alternate ALSA install path
--with-portaudio=PATH use alternate PortAudio install path
@@ -1423,14 +1418,10 @@
C compiler flags for QT5DBUS, overriding pkg-config
QT5DBUS_LIBS
linker flags for QT5DBUS, overriding pkg-config
- QT4DBUS_CFLAGS
- C compiler flags for QT4DBUS, overriding pkg-config
- QT4DBUS_LIBS
- linker flags for QT4DBUS, overriding pkg-config
- QT5X11EXTRAS_CFLAGS
- C compiler flags for QT5X11EXTRAS, overriding pkg-config
- QT5X11EXTRAS_LIBS
- linker flags for QT5X11EXTRAS, overriding pkg-config
+ QT5NETWORK_CFLAGS
+ C compiler flags for QT5NETWORK, overriding pkg-config
+ QT5NETWORK_LIBS
+ linker flags for QT5NETWORK, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -1498,7 +1489,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-QjackCtl configure 0.4.5
+QjackCtl configure 0.6.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1942,7 +1933,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by QjackCtl $as_me 0.4.5, which was
+It was created by QjackCtl $as_me 0.6.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2294,7 +2285,7 @@
ac_config_headers="$ac_config_headers src/config.h"
-ac_config_files="$ac_config_files Makefile qjackctl.spec src/src.pri src/qjackctl.desktop"
+ac_config_files="$ac_config_files Makefile qjackctl.spec src/src.pri"
# Build version string.
@@ -2329,7 +2320,7 @@
$as_echo_n "(cached) " >&6
else
- ac_cv_version=$(echo $ac_cv_build_version | sed -r 's/^([0-9|\.]+).*$/\1/')
+ ac_cv_version=$(echo $PACKAGE_VERSION | sed -r 's/^([0-9|\.]+).*$/\1/')
fi
@@ -2412,15 +2403,6 @@
-# Enable Qt4/5 availability.
-# Check whether --enable-qt4 was given.
-if test "${enable_qt4+set}" = set; then :
- enableval=$enable_qt4; ac_qt4="$enableval"
-else
- ac_qt4="no"
-fi
-
-
# Disable system tray argument option.
# Check whether --enable-system_tray was given.
if test "${enable_system_tray+set}" = set; then :
@@ -2475,7 +2457,7 @@
fi
-# Disable ALSA sequencer support option.
+# Enable ALSA sequencer support option.
# Check whether --enable-alsa_seq was given.
if test "${enable_alsa_seq+set}" = set; then :
enableval=$enable_alsa_seq; ac_alsa_seq="$enableval"
@@ -2502,7 +2484,7 @@
fi
-# Enable X11 unique/single instance.
+# Enable unique/single instance.
# Check whether --enable-xunique was given.
if test "${enable_xunique+set}" = set; then :
enableval=$enable_xunique; ac_xunique="$enableval"
@@ -2520,35 +2502,21 @@
# Standard installation base dirs.
+ac_path=$PATH
ac_with_paths=""
-# Set for alternate Qt4/5 installation dir.
-
-# Check whether --with-qt4 was given.
-if test "${with_qt4+set}" = set; then :
- withval=$with_qt4; ac_qt4_path="$withval"
-else
- ac_qt4_path="no"
-fi
-
-
+# Set for alternate Qt installation dir.
-# Check whether --with-qt5 was given.
-if test "${with_qt5+set}" = set; then :
- withval=$with_qt5; ac_qt5_path="$withval"
+# Check whether --with-qt was given.
+if test "${with_qt+set}" = set; then :
+ withval=$with_qt; ac_qt_path="$withval"
else
- ac_qt5_path="no"
+ ac_qt_path="no"
fi
-if test "x$ac_qt4_path" != "xno"; then
- ac_with_paths="$ac_with_paths $ac_qt4_path"
- ac_qt4="yes"
-fi
-
-if test "x$ac_qt5_path" != "xno"; then
- ac_with_paths="$ac_with_paths $ac_qt5_path"
- ac_qt4="no"
+if test "x$ac_qt_path" != "xno"; then
+ ac_path="$ac_qt_path/bin:$ac_path"
fi
# Set for alternate JACK installation dir.
@@ -4046,8 +4014,9 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gxx_version_major" >&5
$as_echo "$ac_cv_gxx_version_major" >&6; }
ac_gxx_version_major=$ac_cv_gxx_version_major
-if test $ac_gxx_version_major -gt 4 -a $ac_gxx_version_major -lt 6; then
- CXXFLAGS="-std=c++11 $CXXFLAGS"
+if test $ac_gxx_version_major -ge 4 -a $ac_gxx_version_major -lt 6; then
+ CPPFLAGS="-std=c++11 $CPPFLAGS"
+ ac_cflags="-std=c++11 $ac_cflags"
fi
# Check for proper flags.
@@ -4064,39 +4033,38 @@
CPPFLAGS="-fPIC $CPPFLAGS"
# Prepend alternate dependencies paths.
-ac_path=$PATH
-
for X in $ac_with_paths; do
if test -d $X/bin; then
- ac_path="$X/bin:$ac_path"
+ ac_path="$X/bin:$ac_path"
fi
if test -d $X/include; then
- CFLAGS="-I$X/include $CFLAGS "
- CPPFLAGS="-I$X/include $CPPFLAGS"
- ac_incpath="$X/include $ac_incpath"
+ CFLAGS="-I$X/include $CFLAGS "
+ CPPFLAGS="-I$X/include $CPPFLAGS"
+ ac_incpath="$X/include $ac_incpath"
fi
for Y in $ac_libdirs; do
- if test -d $X/$Y; then
- LIBS="-L$X/$Y $LIBS"
- ac_libs="-L$X/$Y $ac_libs"
- fi
+ if test -d $X/$Y; then
+ LIBS="-L$X/$Y $LIBS"
+ ac_libs="-L$X/$Y $ac_libs"
+ fi
done
done
# A common error message:
ac_errmsg="not found in current PATH. Maybe QT development environment isn't available."
-if test "x$ac_qt4" = "xyes"; then
- # Extract the first word of "qmake-qt4", so it can be a program name with args.
-set dummy qmake-qt4; ac_word=$2
+# Check for qtchooser availability.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}qtchooser", so it can be a program name with args.
+set dummy ${ac_tool_prefix}qtchooser; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_qmake+:} false; then :
+if ${ac_cv_path_ac_qtchooser+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $ac_qmake in
+ case $ac_qtchooser in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_qmake="$ac_qmake" # Let the user override the test with a path.
+ ac_cv_path_ac_qtchooser="$ac_qtchooser" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4106,7 +4074,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_qmake="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_ac_qtchooser="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -4114,23 +4082,84 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_qmake" && ac_cv_path_ac_qmake="no"
;;
esac
fi
-ac_qmake=$ac_cv_path_ac_qmake
-if test -n "$ac_qmake"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_qmake" >&5
-$as_echo "$ac_qmake" >&6; }
+ac_qtchooser=$ac_cv_path_ac_qtchooser
+if test -n "$ac_qtchooser"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_qtchooser" >&5
+$as_echo "$ac_qtchooser" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+fi
+if test -z "$ac_cv_path_ac_qtchooser"; then
+ ac_pt_ac_qtchooser=$ac_qtchooser
+ # Extract the first word of "qtchooser", so it can be a program name with args.
+set dummy qtchooser; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_qtchooser+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- # Extract the first word of "qmake-qt5", so it can be a program name with args.
-set dummy qmake-qt5; ac_word=$2
+ case $ac_pt_ac_qtchooser in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_qtchooser="$ac_pt_ac_qtchooser" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_qtchooser="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_qtchooser=$ac_cv_path_ac_pt_ac_qtchooser
+if test -n "$ac_pt_ac_qtchooser"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_qtchooser" >&5
+$as_echo "$ac_pt_ac_qtchooser" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_qtchooser" = x; then
+ ac_qtchooser="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_qtchooser=$ac_pt_ac_qtchooser
+ fi
+else
+ ac_qtchooser="$ac_cv_path_ac_qtchooser"
+fi
+
+if test -x $ac_qtchooser; then
+ export QT_SELECT=5
+fi
+
+# Check for proper qmake path/version alternatives.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}qmake", so it can be a program name with args.
+set dummy ${ac_tool_prefix}qmake; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_qmake+:} false; then :
@@ -4156,7 +4185,6 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_qmake" && ac_cv_path_ac_qmake="no"
;;
esac
fi
@@ -4171,11 +4199,68 @@
fi
-if test "x$ac_qmake" = "xno"; then
- # Extract the first word of "qmake", so it can be a program name with args.
+if test -z "$ac_cv_path_ac_qmake"; then
+ ac_pt_ac_qmake=$ac_qmake
+ # Extract the first word of "qmake", so it can be a program name with args.
set dummy qmake; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_qmake+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_qmake in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_qmake="$ac_pt_ac_qmake" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_qmake="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_qmake=$ac_cv_path_ac_pt_ac_qmake
+if test -n "$ac_pt_ac_qmake"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_qmake" >&5
+$as_echo "$ac_pt_ac_qmake" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_qmake" = x; then
+ ac_qmake="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_qmake=$ac_pt_ac_qmake
+ fi
+else
+ ac_qmake="$ac_cv_path_ac_qmake"
+fi
+
+if test "x$ac_qmake" = "xno"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}qmake-qt5", so it can be a program name with args.
+set dummy ${ac_tool_prefix}qmake-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_cv_qmake+:} false; then :
$as_echo_n "(cached) " >&6
else
@@ -4199,7 +4284,6 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_cv_qmake" && ac_cv_path_ac_cv_qmake="no"
;;
esac
fi
@@ -4213,10 +4297,64 @@
fi
- ac_qmake=$ac_cv_qmake
fi
-if test "x$ac_qmake" = "xno"; then
- as_fn_error $? "qmake $ac_errmsg" "$LINENO" 5
+if test -z "$ac_cv_path_ac_cv_qmake"; then
+ ac_pt_ac_cv_qmake=$ac_cv_qmake
+ # Extract the first word of "qmake-qt5", so it can be a program name with args.
+set dummy qmake-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_cv_qmake+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_cv_qmake in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_cv_qmake="$ac_pt_ac_cv_qmake" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_cv_qmake="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_cv_qmake=$ac_cv_path_ac_pt_ac_cv_qmake
+if test -n "$ac_pt_ac_cv_qmake"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_cv_qmake" >&5
+$as_echo "$ac_pt_ac_cv_qmake" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_cv_qmake" = x; then
+ ac_cv_qmake="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_cv_qmake=$ac_pt_ac_cv_qmake
+ fi
+else
+ ac_cv_qmake="$ac_cv_path_ac_cv_qmake"
+fi
+
+ ac_qmake=$ac_cv_qmake
fi
# Check for proper Qt major version.
@@ -4233,14 +4371,110 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_qt_version_major" >&5
$as_echo "$ac_cv_qt_version_major" >&6; }
ac_qt_version_major=$ac_cv_qt_version_major
-if test "x$ac_qt4" = "xyes"; then
- if test $ac_qt_version_major -ne 4; then
- as_fn_error $? "qmake-qt4 $ac_errmsg (qt4-devel)" "$LINENO" 5
- fi
+if test $ac_qt_version_major -ne 5; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}qmake-qt5", so it can be a program name with args.
+set dummy ${ac_tool_prefix}qmake-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_cv_qmake+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- if test $ac_qt_version_major -ne 5; then
- as_fn_error $? "qmake-qt5 $ac_errmsg (qt5-devel)" "$LINENO" 5
- fi
+ case $ac_cv_qmake in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_cv_qmake="$ac_cv_qmake" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_cv_qmake="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_cv_qmake=$ac_cv_path_ac_cv_qmake
+if test -n "$ac_cv_qmake"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_qmake" >&5
+$as_echo "$ac_cv_qmake" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_ac_cv_qmake"; then
+ ac_pt_ac_cv_qmake=$ac_cv_qmake
+ # Extract the first word of "qmake-qt5", so it can be a program name with args.
+set dummy qmake-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_cv_qmake+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_cv_qmake in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_cv_qmake="$ac_pt_ac_cv_qmake" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_cv_qmake="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_cv_qmake=$ac_cv_path_ac_pt_ac_cv_qmake
+if test -n "$ac_pt_ac_cv_qmake"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_cv_qmake" >&5
+$as_echo "$ac_pt_ac_cv_qmake" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_cv_qmake" = x; then
+ ac_cv_qmake="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_cv_qmake=$ac_pt_ac_cv_qmake
+ fi
+else
+ ac_cv_qmake="$ac_cv_path_ac_cv_qmake"
+fi
+
+ ac_qmake=$ac_cv_qmake
+fi
+
+if test "x$ac_qmake" = "xno"; then
+ as_fn_error $? "qmake-qt5 $ac_errmsg (qt5-devel)" "$LINENO" 5
fi
# Check for proper Qt install path.
@@ -4261,8 +4495,9 @@
fi
# Check it again, now with updated PATH, just in case...
-# Extract the first word of "qmake", so it can be a program name with args.
-set dummy qmake; ac_word=$2
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}qmake", so it can be a program name with args.
+set dummy ${ac_tool_prefix}qmake; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_cv_qmake+:} false; then :
@@ -4288,7 +4523,6 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_cv_qmake" && ac_cv_path_ac_cv_qmake="no"
;;
esac
fi
@@ -4302,19 +4536,76 @@
fi
-ac_qmake=$ac_cv_qmake
-if test "x$ac_qmake" = "xno"; then
- as_fn_error $? "qmake $ac_errmsg" "$LINENO" 5
fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt install headers" >&5
-$as_echo_n "checking for Qt install headers... " >&6; }
-if ${ac_cv_qt_install_headers+:} false; then :
+if test -z "$ac_cv_path_ac_cv_qmake"; then
+ ac_pt_ac_cv_qmake=$ac_cv_qmake
+ # Extract the first word of "qmake", so it can be a program name with args.
+set dummy qmake; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_cv_qmake+:} false; then :
$as_echo_n "(cached) " >&6
else
-
+ case $ac_pt_ac_cv_qmake in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_cv_qmake="$ac_pt_ac_cv_qmake" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_cv_qmake="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_cv_qmake=$ac_cv_path_ac_pt_ac_cv_qmake
+if test -n "$ac_pt_ac_cv_qmake"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_cv_qmake" >&5
+$as_echo "$ac_pt_ac_cv_qmake" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_cv_qmake" = x; then
+ ac_cv_qmake="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_cv_qmake=$ac_pt_ac_cv_qmake
+ fi
+else
+ ac_cv_qmake="$ac_cv_path_ac_cv_qmake"
+fi
+
+ac_qmake=$ac_cv_qmake
+if test "x$ac_qmake" = "xno"; then
+ as_fn_error $? "qmake $ac_errmsg" "$LINENO" 5
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt install headers" >&5
+$as_echo_n "checking for Qt install headers... " >&6; }
+if ${ac_cv_qt_install_headers+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
ac_cv_qt_install_headers=$($ac_qmake -query QT_INSTALL_HEADERS)
fi
@@ -4344,25 +4635,24 @@
ac_libs="-L$ac_qt_install_libs $ac_libs"
fi
-# Finally, check for proper Qt4/5 version.
-if test "x$ac_qt4" = "xyes"; then
+# Finally, check for proper Qt version.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt library version >= 4.4" >&5
-$as_echo_n "checking for Qt library version >= 4.4... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt library version >= 5.1" >&5
+$as_echo_n "checking for Qt library version >= 5.1... " >&6; }
if ${ac_cv_qtversion+:} false; then :
$as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include "QtCore/qglobal.h"
int
main ()
{
- #if QT_VERSION < 0x040400 || QT_VERSION >= 0x050000
- #error Qt library 4.4 or greater required.
- #endif
+ #if QT_VERSION < 0x050100
+ #error Qt library 5.1 or greater required.
+ #endif
;
return 0;
@@ -4372,8 +4662,8 @@
ac_cv_qtversion="yes"
else
- echo "no; Qt 4.4 or greater is required"
- exit 1
+ echo "no; Qt 5.1 or greater is required"
+ exit 1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
@@ -4381,54 +4671,434 @@
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_qtversion" >&5
$as_echo "$ac_cv_qtversion" >&6; }
+
+# Check for Qt moc utility.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}moc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}moc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_moc+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Qt library version >= 5.1" >&5
-$as_echo_n "checking for Qt library version >= 5.1... " >&6; }
-if ${ac_cv_qtversion+:} false; then :
+ case $ac_moc in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_moc="$ac_moc" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_moc="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_moc=$ac_cv_path_ac_moc
+if test -n "$ac_moc"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_moc" >&5
+$as_echo "$ac_moc" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_ac_moc"; then
+ ac_pt_ac_moc=$ac_moc
+ # Extract the first word of "moc", so it can be a program name with args.
+set dummy moc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_moc+:} false; then :
$as_echo_n "(cached) " >&6
else
+ case $ac_pt_ac_moc in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_moc="$ac_pt_ac_moc" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_moc="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_moc=$ac_cv_path_ac_pt_ac_moc
+if test -n "$ac_pt_ac_moc"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_moc" >&5
+$as_echo "$ac_pt_ac_moc" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include "QtCore/qglobal.h"
-int
-main ()
-{
+ if test "x$ac_pt_ac_moc" = x; then
+ ac_moc="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_moc=$ac_pt_ac_moc
+ fi
+else
+ ac_moc="$ac_cv_path_ac_moc"
+fi
+
+if test "x$ac_moc" = "xno"; then
+ as_fn_error $? "moc $ac_errmsg" "$LINENO" 5
+fi
+
+
+# Check for Qt uic utility.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}uic", so it can be a program name with args.
+set dummy ${ac_tool_prefix}uic; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_uic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_uic in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_uic="$ac_uic" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_uic="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_uic=$ac_cv_path_ac_uic
+if test -n "$ac_uic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_uic" >&5
+$as_echo "$ac_uic" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
- #if QT_VERSION < 0x050100 || QT_VERSION >= 0x060000
- #error Qt library 5.1 or greater required.
- #endif
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
- ac_cv_qtversion="yes"
+fi
+if test -z "$ac_cv_path_ac_uic"; then
+ ac_pt_ac_uic=$ac_uic
+ # Extract the first word of "uic", so it can be a program name with args.
+set dummy uic; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_uic+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_uic in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_uic="$ac_pt_ac_uic" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_uic="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_uic=$ac_cv_path_ac_pt_ac_uic
+if test -n "$ac_pt_ac_uic"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_uic" >&5
+$as_echo "$ac_pt_ac_uic" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_uic" = x; then
+ ac_uic="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_uic=$ac_pt_ac_uic
+ fi
+else
+ ac_uic="$ac_cv_path_ac_uic"
+fi
+
+if test "x$ac_uic" = "xno"; then
+ as_fn_error $? "uic $ac_errmsg" "$LINENO" 5
+fi
+
+
+
+# Check for Qt lupdate utility.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lupdate", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lupdate; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_lupdate+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_lupdate in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_lupdate="$ac_lupdate" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_lupdate="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_lupdate=$ac_cv_path_ac_lupdate
+if test -n "$ac_lupdate"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lupdate" >&5
+$as_echo "$ac_lupdate" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_ac_lupdate"; then
+ ac_pt_ac_lupdate=$ac_lupdate
+ # Extract the first word of "lupdate", so it can be a program name with args.
+set dummy lupdate; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_lupdate+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_lupdate in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_lupdate="$ac_pt_ac_lupdate" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_lupdate="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_lupdate=$ac_cv_path_ac_pt_ac_lupdate
+if test -n "$ac_pt_ac_lupdate"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_lupdate" >&5
+$as_echo "$ac_pt_ac_lupdate" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_pt_ac_lupdate" = x; then
+ ac_lupdate="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_lupdate=$ac_pt_ac_lupdate
+ fi
+else
+ ac_lupdate="$ac_cv_path_ac_lupdate"
+fi
+
+if test "x$ac_lupdate" = "xno"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lupdate-qt5", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lupdate-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_cv_lupdate+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_cv_lupdate in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_cv_lupdate="$ac_cv_lupdate" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_cv_lupdate="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_cv_lupdate=$ac_cv_path_ac_cv_lupdate
+if test -n "$ac_cv_lupdate"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lupdate" >&5
+$as_echo "$ac_cv_lupdate" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_ac_cv_lupdate"; then
+ ac_pt_ac_cv_lupdate=$ac_cv_lupdate
+ # Extract the first word of "lupdate-qt5", so it can be a program name with args.
+set dummy lupdate-qt5; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_ac_cv_lupdate+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $ac_pt_ac_cv_lupdate in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_ac_pt_ac_cv_lupdate="$ac_pt_ac_cv_lupdate" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ac_path
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_ac_pt_ac_cv_lupdate="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+ac_pt_ac_cv_lupdate=$ac_cv_path_ac_pt_ac_cv_lupdate
+if test -n "$ac_pt_ac_cv_lupdate"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_cv_lupdate" >&5
+$as_echo "$ac_pt_ac_cv_lupdate" >&6; }
else
-
- echo "no; Qt 5.1 or greater is required"
- exit 1
-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test "x$ac_pt_ac_cv_lupdate" = x; then
+ ac_cv_lupdate="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_cv_lupdate=$ac_pt_ac_cv_lupdate
+ fi
+else
+ ac_cv_lupdate="$ac_cv_path_ac_cv_lupdate"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_qtversion" >&5
-$as_echo "$ac_cv_qtversion" >&6; }
+
+ if test "x$ac_cv_lupdate" = "xno"; then
+ as_fn_error $? "lupdate $ac_errmsg (qt5-linguist)" "$LINENO" 5
+ else
+ ac_lupdate=$ac_cv_lupdate;
+ fi
fi
-# Check for Qt moc utility.
-# Extract the first word of "moc", so it can be a program name with args.
-set dummy moc; ac_word=$2
+
+# Check for Qt lrelease utility.
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lrelease", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lrelease; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_moc+:} false; then :
+if ${ac_cv_path_ac_lrelease+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $ac_moc in
+ case $ac_lrelease in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_moc="$ac_moc" # Let the user override the test with a path.
+ ac_cv_path_ac_lrelease="$ac_lrelease" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4438,7 +5108,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_moc="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_ac_lrelease="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -4446,36 +5116,32 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_moc" && ac_cv_path_ac_moc="no"
;;
esac
fi
-ac_moc=$ac_cv_path_ac_moc
-if test -n "$ac_moc"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_moc" >&5
-$as_echo "$ac_moc" >&6; }
+ac_lrelease=$ac_cv_path_ac_lrelease
+if test -n "$ac_lrelease"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lrelease" >&5
+$as_echo "$ac_lrelease" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-if test "x$ac_moc" = "xno"; then
- as_fn_error $? "moc $ac_errmsg" "$LINENO" 5
fi
-
-
-# Check for Qt uic utility.
-# Extract the first word of "uic", so it can be a program name with args.
-set dummy uic; ac_word=$2
+if test -z "$ac_cv_path_ac_lrelease"; then
+ ac_pt_ac_lrelease=$ac_lrelease
+ # Extract the first word of "lrelease", so it can be a program name with args.
+set dummy lrelease; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_uic+:} false; then :
+if ${ac_cv_path_ac_pt_ac_lrelease+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $ac_uic in
+ case $ac_pt_ac_lrelease in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_uic="$ac_uic" # Let the user override the test with a path.
+ ac_cv_path_ac_pt_ac_lrelease="$ac_pt_ac_lrelease" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4485,7 +5151,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_uic="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_ac_pt_ac_lrelease="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -4493,36 +5159,45 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_uic" && ac_cv_path_ac_uic="no"
;;
esac
fi
-ac_uic=$ac_cv_path_ac_uic
-if test -n "$ac_uic"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_uic" >&5
-$as_echo "$ac_uic" >&6; }
+ac_pt_ac_lrelease=$ac_cv_path_ac_pt_ac_lrelease
+if test -n "$ac_pt_ac_lrelease"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_lrelease" >&5
+$as_echo "$ac_pt_ac_lrelease" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-
-if test "x$ac_uic" = "xno"; then
- as_fn_error $? "uic $ac_errmsg" "$LINENO" 5
+ if test "x$ac_pt_ac_lrelease" = x; then
+ ac_lrelease="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_lrelease=$ac_pt_ac_lrelease
+ fi
+else
+ ac_lrelease="$ac_cv_path_ac_lrelease"
fi
-
-# Check for Qt lupdate utility.
-# Extract the first word of "lupdate", so it can be a program name with args.
-set dummy lupdate; ac_word=$2
+if test "x$ac_lrelease" = "xno"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lrelease-qt5", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lrelease-qt5; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_lupdate+:} false; then :
+if ${ac_cv_path_ac_cv_lrelease+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $ac_lupdate in
+ case $ac_cv_lrelease in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_lupdate="$ac_lupdate" # Let the user override the test with a path.
+ ac_cv_path_ac_cv_lrelease="$ac_cv_lrelease" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4532,7 +5207,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_lupdate="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_ac_cv_lrelease="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -4540,36 +5215,32 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_lupdate" && ac_cv_path_ac_lupdate="no"
;;
esac
fi
-ac_lupdate=$ac_cv_path_ac_lupdate
-if test -n "$ac_lupdate"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lupdate" >&5
-$as_echo "$ac_lupdate" >&6; }
+ac_cv_lrelease=$ac_cv_path_ac_cv_lrelease
+if test -n "$ac_cv_lrelease"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lrelease" >&5
+$as_echo "$ac_cv_lrelease" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-if test "x$ac_lupdate" = "xno"; then
- as_fn_error $? "lupdate $ac_errmsg" "$LINENO" 5
fi
-
-
-# Check for Qt lrelease utility.
-# Extract the first word of "lrelease", so it can be a program name with args.
-set dummy lrelease; ac_word=$2
+if test -z "$ac_cv_path_ac_cv_lrelease"; then
+ ac_pt_ac_cv_lrelease=$ac_cv_lrelease
+ # Extract the first word of "lrelease-qt5", so it can be a program name with args.
+set dummy lrelease-qt5; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_lrelease+:} false; then :
+if ${ac_cv_path_ac_pt_ac_cv_lrelease+:} false; then :
$as_echo_n "(cached) " >&6
else
- case $ac_lrelease in
+ case $ac_pt_ac_cv_lrelease in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_lrelease="$ac_lrelease" # Let the user override the test with a path.
+ ac_cv_path_ac_pt_ac_cv_lrelease="$ac_pt_ac_cv_lrelease" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4579,7 +5250,7 @@
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_ac_lrelease="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path_ac_pt_ac_cv_lrelease="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -4587,22 +5258,38 @@
done
IFS=$as_save_IFS
- test -z "$ac_cv_path_ac_lrelease" && ac_cv_path_ac_lrelease="no"
;;
esac
fi
-ac_lrelease=$ac_cv_path_ac_lrelease
-if test -n "$ac_lrelease"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lrelease" >&5
-$as_echo "$ac_lrelease" >&6; }
+ac_pt_ac_cv_lrelease=$ac_cv_path_ac_pt_ac_cv_lrelease
+if test -n "$ac_pt_ac_cv_lrelease"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_ac_cv_lrelease" >&5
+$as_echo "$ac_pt_ac_cv_lrelease" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
+ if test "x$ac_pt_ac_cv_lrelease" = x; then
+ ac_cv_lrelease="no"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ ac_cv_lrelease=$ac_pt_ac_cv_lrelease
+ fi
+else
+ ac_cv_lrelease="$ac_cv_path_ac_cv_lrelease"
+fi
-if test "x$ac_release" = "xno"; then
- as_fn_error $? "lrelease $ac_errmsg" "$LINENO" 5
+ if test "x$ac_cv_lrelease" = "xno"; then
+ as_fn_error $? "lrelease $ac_errmsg (qt5-linguist)" "$LINENO" 5
+ else
+ ac_lrelease=$ac_cv_lrelease;
+ fi
fi
@@ -4726,54 +5413,6 @@
fi
-# Check for round math function.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lroundf in -lm" >&5
-$as_echo_n "checking for lroundf in -lm... " >&6; }
-if ${ac_cv_lib_m_lroundf+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char lroundf ();
-int
-main ()
-{
-return lroundf ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- ac_cv_lib_m_lroundf=yes
-else
- ac_cv_lib_m_lroundf=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_lroundf" >&5
-$as_echo "$ac_cv_lib_m_lroundf" >&6; }
-if test "x$ac_cv_lib_m_lroundf" = xyes; then :
- ac_round="yes"
-else
- ac_round="no"
-fi
-
-if test "x$ac_round" = "xyes"; then
-
-$as_echo "#define CONFIG_ROUND 1" >>confdefs.h
-
-fi
# Check for JACK libraries.
@@ -5452,7 +6091,6 @@
# Check D-Bus interface support.
if test "x$ac_dbus" = "xyes"; then
- if test "x$ac_qt4" = "xno"; then
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT5DBUS" >&5
@@ -5524,79 +6162,6 @@
$as_echo "yes" >&6; }
ac_dbus="yes"
fi
- else
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT4DBUS" >&5
-$as_echo_n "checking for QT4DBUS... " >&6; }
-
-if test -n "$QT4DBUS_CFLAGS"; then
- pkg_cv_QT4DBUS_CFLAGS="$QT4DBUS_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QtDBus\""; } >&5
- ($PKG_CONFIG --exists --print-errors "QtDBus") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_QT4DBUS_CFLAGS=`$PKG_CONFIG --cflags "QtDBus" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$QT4DBUS_LIBS"; then
- pkg_cv_QT4DBUS_LIBS="$QT4DBUS_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"QtDBus\""; } >&5
- ($PKG_CONFIG --exists --print-errors "QtDBus") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_QT4DBUS_LIBS=`$PKG_CONFIG --libs "QtDBus" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- QT4DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "QtDBus" 2>&1`
- else
- QT4DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "QtDBus" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$QT4DBUS_PKG_ERRORS" >&5
-
- ac_dbus="no"
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ac_dbus="no"
-else
- QT4DBUS_CFLAGS=$pkg_cv_QT4DBUS_CFLAGS
- QT4DBUS_LIBS=$pkg_cv_QT4DBUS_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- ac_dbus="yes"
-fi
- fi
fi
if test "x$ac_dbus" = "xyes"; then
@@ -5606,23 +6171,23 @@
fi
-# Check for X11 unique/single instance.
-if test "x$ac_xunique" = "xyes" -a "x$ac_qt4" = "xno"; then
+# Check for unique/single instance support.
+if test "x$ac_xunique" = "xyes"; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT5X11EXTRAS" >&5
-$as_echo_n "checking for QT5X11EXTRAS... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for QT5NETWORK" >&5
+$as_echo_n "checking for QT5NETWORK... " >&6; }
-if test -n "$QT5X11EXTRAS_CFLAGS"; then
- pkg_cv_QT5X11EXTRAS_CFLAGS="$QT5X11EXTRAS_CFLAGS"
+if test -n "$QT5NETWORK_CFLAGS"; then
+ pkg_cv_QT5NETWORK_CFLAGS="$QT5NETWORK_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5X11Extras\""; } >&5
- ($PKG_CONFIG --exists --print-errors "Qt5X11Extras") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Network\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "Qt5Network") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_QT5X11EXTRAS_CFLAGS=`$PKG_CONFIG --cflags "Qt5X11Extras" 2>/dev/null`
+ pkg_cv_QT5NETWORK_CFLAGS=`$PKG_CONFIG --cflags "Qt5Network" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5630,16 +6195,16 @@
else
pkg_failed=untried
fi
-if test -n "$QT5X11EXTRAS_LIBS"; then
- pkg_cv_QT5X11EXTRAS_LIBS="$QT5X11EXTRAS_LIBS"
+if test -n "$QT5NETWORK_LIBS"; then
+ pkg_cv_QT5NETWORK_LIBS="$QT5NETWORK_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5X11Extras\""; } >&5
- ($PKG_CONFIG --exists --print-errors "Qt5X11Extras") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"Qt5Network\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "Qt5Network") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_QT5X11EXTRAS_LIBS=`$PKG_CONFIG --libs "Qt5X11Extras" 2>/dev/null`
+ pkg_cv_QT5NETWORK_LIBS=`$PKG_CONFIG --libs "Qt5Network" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
@@ -5660,36 +6225,30 @@
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- QT5X11EXTRAS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5X11Extras" 2>&1`
+ QT5NETWORK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "Qt5Network" 2>&1`
else
- QT5X11EXTRAS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5X11Extras" 2>&1`
+ QT5NETWORK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "Qt5Network" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$QT5X11EXTRAS_PKG_ERRORS" >&5
+ echo "$QT5NETWORK_PKG_ERRORS" >&5
- ac_xunique="no"
+ ac_qt5network="no"
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- ac_xunique="no"
+ ac_qt5network="no"
else
- QT5X11EXTRAS_CFLAGS=$pkg_cv_QT5X11EXTRAS_CFLAGS
- QT5X11EXTRAS_LIBS=$pkg_cv_QT5X11EXTRAS_LIBS
+ QT5NETWORK_CFLAGS=$pkg_cv_QT5NETWORK_CFLAGS
+ QT5NETWORK_LIBS=$pkg_cv_QT5NETWORK_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- ac_xunique="yes"
-fi
+ ac_qt5network="yes"
fi
-if test "x$ac_xunique" = "xyes"; then
+ if test "x$ac_qt5network" = "xyes"; then
$as_echo "#define CONFIG_XUNIQUE 1" >>confdefs.h
- if test "x$ac_qt4" = "xno"; then
- ac_qx11extras="x11extras"
- fi
- # Some recent distros (eg. fedora, debian) require this.
- if test "x$ac_cv_lib_X11_main" = "xyes"; then
- ac_libs="$ac_libs -lX11"
+ ac_qnetwork="network"
fi
fi
@@ -5933,6 +6492,77 @@
fi
+# Check for jack_set_port_rename_callback
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack_set_port_rename_callback in -ljack" >&5
+$as_echo_n "checking for jack_set_port_rename_callback in -ljack... " >&6; }
+if ${ac_cv_lib_jack_jack_set_port_rename_callback+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljack $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char jack_set_port_rename_callback ();
+int
+main ()
+{
+return jack_set_port_rename_callback ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_lib_jack_jack_set_port_rename_callback=yes
+else
+ ac_cv_lib_jack_jack_set_port_rename_callback=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jack_jack_set_port_rename_callback" >&5
+$as_echo "$ac_cv_lib_jack_jack_set_port_rename_callback" >&6; }
+if test "x$ac_cv_lib_jack_jack_set_port_rename_callback" = xyes; then :
+ ac_jack_port_rename="yes"
+else
+ ac_jack_port_rename="no"
+fi
+
+if test "x$ac_jack_port_rename" = "xyes"; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include
+int
+main ()
+{
+
+ void port_rename(jack_port_id_t, const char *, const char *, void *);
+ jack_set_port_rename_callback(0, port_rename, 0);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_jack_port_rename="yes"
+else
+ ac_jack_port_rename="no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+if test "x$ac_jack_port_rename" = "xyes"; then
+
+$as_echo "#define CONFIG_JACK_PORT_RENAME 1" >>confdefs.h
+
+fi
+
# Check for jack_port_get_aliases function.
if test "x$ac_jack_port_aliases" = "xyes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for jack_port_get_aliases in -ljack" >&5
@@ -6591,7 +7221,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by QjackCtl $as_me 0.4.5, which was
+This file was extended by QjackCtl $as_me 0.6.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6653,7 +7283,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-QjackCtl config.status 0.4.5
+QjackCtl config.status 0.6.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -6778,7 +7408,6 @@
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"qjackctl.spec") CONFIG_FILES="$CONFIG_FILES qjackctl.spec" ;;
"src/src.pri") CONFIG_FILES="$CONFIG_FILES src/src.pri" ;;
- "src/qjackctl.desktop") CONFIG_FILES="$CONFIG_FILES src/qjackctl.desktop" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -7386,7 +8015,7 @@
echo " PortAudio interface support . . . . . . . . . . .: $ac_portaudio"
echo " CoreAudio interface support . . . . . . . . . . .: $ac_coreaudio"
echo
-echo " X11 Unique/Single instance . . . . . . . . . . . .: $ac_xunique"
+echo " Unique/Single instance support . . . . . . . . . .: $ac_xunique"
echo " Debugger stack-trace (gdb) . . . . . . . . . . . .: $ac_stacktrace"
echo
echo " Install prefix . . . . . . . . . . . . . . . . . .: $ac_prefix"
diff -Nru qjackctl-0.4.5/configure.ac qjackctl-0.6.0/configure.ac
--- qjackctl-0.4.5/configure.ac 2017-04-27 14:44:14.544750473 +0000
+++ qjackctl-0.6.0/configure.ac 2019-10-17 07:45:45.945673225 +0000
@@ -1,9 +1,9 @@
# Process this file with autoconf to produce a configure script.
-AC_INIT(QjackCtl, 0.4.5, rncbc@rncbc.org, qjackctl)
+AC_INIT(QjackCtl, 0.6.0, rncbc@rncbc.org, qjackctl)
AC_CONFIG_SRCDIR(src/qjackctl.cpp)
AC_CONFIG_HEADERS(src/config.h)
-AC_CONFIG_FILES(Makefile qjackctl.spec src/src.pri src/qjackctl.desktop)
+AC_CONFIG_FILES(Makefile qjackctl.spec src/src.pri)
# Build version string.
AC_CACHE_VAL([ac_cv_build_version], [
@@ -25,7 +25,7 @@
# Sanitized version string.
AC_CACHE_VAL([ac_cv_version], [
- ac_cv_version=$(echo $ac_cv_build_version | sed -r 's/^([[0-9|\.]]+).*$/\1/')
+ ac_cv_version=$(echo $PACKAGE_VERSION | sed -r 's/^([[0-9|\.]]+).*$/\1/')
])
ac_version="$ac_cv_version"
AC_DEFINE_UNQUOTED(CONFIG_VERSION, ["$ac_version"], [Version string.])
@@ -64,7 +64,7 @@
# Enable debugging argument option.
AC_ARG_ENABLE(debug,
- AC_HELP_STRING([--enable-debug], [enable debugging (default=no)]),
+ AS_HELP_STRING([--enable-debug], [enable debugging (default=no)]),
[ac_debug="$enableval"])
if test "x$ac_debug" = "xyes"; then
@@ -78,113 +78,98 @@
AC_SUBST(ac_debug)
-# Enable Qt4/5 availability.
-AC_ARG_ENABLE(qt4,
- AC_HELP_STRING([--enable-qt4], [enable Qt4 build (default=no)]),
- [ac_qt4="$enableval"],
- [ac_qt4="no"])
-
# Disable system tray argument option.
AC_ARG_ENABLE(system_tray,
- AC_HELP_STRING([--enable-system-tray], [enable system tray (default=yes)]),
+ AS_HELP_STRING([--enable-system-tray], [enable system tray (default=yes)]),
[ac_system_tray="$enableval"],
[ac_system_tray="yes"])
# Disable JACK MIDI support option.
AC_ARG_ENABLE(jack_midi,
- AC_HELP_STRING([--enable-jack-midi], [enable JACK MIDI support (default=yes)]),
+ AS_HELP_STRING([--enable-jack-midi], [enable JACK MIDI support (default=yes)]),
[ac_jack_midi="$enableval"],
[ac_jack_midi="yes"])
# Enable JACK session support.
AC_ARG_ENABLE(jack_session,
- AC_HELP_STRING([--enable-jack-session], [enable JACK session support (default=yes)]),
+ AS_HELP_STRING([--enable-jack-session], [enable JACK session support (default=yes)]),
[ac_jack_session="$enableval"],
[ac_jack_session="yes"])
# Enable JACK port aliases support.
AC_ARG_ENABLE(jack_port_aliases,
- AC_HELP_STRING([--enable-jack-port-aliases], [enable JACK port aliases support (default=yes)]),
+ AS_HELP_STRING([--enable-jack-port-aliases], [enable JACK port aliases support (default=yes)]),
[ac_jack_port_aliases="$enableval"],
[ac_jack_port_aliases="yes"])
# Enable JACK metadata support.
AC_ARG_ENABLE(jack_metadata,
- AC_HELP_STRING([--enable-jack-metadata], [enable JACK metadata support (default=yes)]),
+ AS_HELP_STRING([--enable-jack-metadata], [enable JACK metadata support (default=yes)]),
[ac_jack_metadata="$enableval"],
[ac_jack_metadata="yes"])
# Enable JACK version support.
AC_ARG_ENABLE(jack_version,
- AC_HELP_STRING([--enable-jack-version], [enable JACK version support (default=no)]),
+ AS_HELP_STRING([--enable-jack-version], [enable JACK version support (default=no)]),
[ac_jack_version="$enableval"],
[ac_jack_version="no"])
-# Disable ALSA sequencer support option.
+# Enable ALSA sequencer support option.
AC_ARG_ENABLE(alsa_seq,
- AC_HELP_STRING([--enable-alsa-seq], [enable ALSA/MIDI sequencer support (default=yes)]),
+ AS_HELP_STRING([--enable-alsa-seq], [enable ALSA/MIDI sequencer support (default=yes)]),
[ac_alsa_seq="$enableval"],
[ac_alsa_seq="yes"])
# Enable PortAudio argument option.
AC_ARG_ENABLE(portaudio,
- AC_HELP_STRING([--enable-portaudio], [enable PortAudio interface (default=yes)]),
+ AS_HELP_STRING([--enable-portaudio], [enable PortAudio interface (default=yes)]),
[ac_portaudio="$enableval"],
[ac_portaudio="yes"])
# Enable D-Bus argument option.
AC_ARG_ENABLE(dbus,
- AC_HELP_STRING([--enable-dbus], [enable D-Bus interface (default=yes)]),
+ AS_HELP_STRING([--enable-dbus], [enable D-Bus interface (default=yes)]),
[ac_dbus="$enableval"],
[ac_dbus="yes"])
-# Enable X11 unique/single instance.
+# Enable unique/single instance.
AC_ARG_ENABLE(xunique,
- AC_HELP_STRING([--enable-xunique], [enable X11 unique/single instance (default=yes)]),
+ AS_HELP_STRING([--enable-xunique], [enable unique/single instance (default=yes)]),
[ac_xunique="$enableval"],
[ac_xunique="yes"])
# Enable debugger stack-trace option (assumes --enable-debug).
AC_ARG_ENABLE(stacktrace,
- AC_HELP_STRING([--enable-stacktrace], [enable debugger stack-trace (default=no)]),
+ AS_HELP_STRING([--enable-stacktrace], [enable debugger stack-trace (default=no)]),
[ac_stacktrace="$enableval"])
# Standard installation base dirs.
+ac_path=$PATH
ac_with_paths=""
-# Set for alternate Qt4/5 installation dir.
-AC_ARG_WITH(qt4,
- AC_HELP_STRING([--with-qt4=PATH], [use alternate Qt4 install path]),
- [ac_qt4_path="$withval"], [ac_qt4_path="no"])
-
-AC_ARG_WITH(qt5,
- AC_HELP_STRING([--with-qt5=PATH], [use alternate Qt5 install path]),
- [ac_qt5_path="$withval"], [ac_qt5_path="no"])
-
-if test "x$ac_qt4_path" != "xno"; then
- ac_with_paths="$ac_with_paths $ac_qt4_path"
- ac_qt4="yes"
-fi
-
-if test "x$ac_qt5_path" != "xno"; then
- ac_with_paths="$ac_with_paths $ac_qt5_path"
- ac_qt4="no"
+# Set for alternate Qt installation dir.
+AC_ARG_WITH(qt,
+ AS_HELP_STRING([--with-qt=PATH], [use alternate Qt install path]),
+ [ac_qt_path="$withval"], [ac_qt_path="no"])
+
+if test "x$ac_qt_path" != "xno"; then
+ ac_path="$ac_qt_path/bin:$ac_path"
fi
# Set for alternate JACK installation dir.
AC_ARG_WITH(jack,
- AC_HELP_STRING([--with-jack=PATH], [use alternate JACK install path]),
+ AS_HELP_STRING([--with-jack=PATH], [use alternate JACK install path]),
[ac_with_paths="$ac_with_paths $withval"])
# Set for alternate ALSA installation dir.
AC_ARG_WITH(alsa,
- AC_HELP_STRING([--with-alsa=PATH], [use alternate ALSA install path]),
+ AS_HELP_STRING([--with-alsa=PATH], [use alternate ALSA install path]),
[ac_with_paths="$ac_with_paths $withval"])
# Set for alternate PortAudio installation dir.
AC_ARG_WITH(portaudio,
- AC_HELP_STRING([--with-portaudio=PATH], [use alternate PortAudio install path]),
+ AS_HELP_STRING([--with-portaudio=PATH], [use alternate PortAudio install path]),
[ac_with_paths="$ac_with_paths $withval"])
@@ -213,8 +198,9 @@
ac_gxx_version_major=$(($ac_cv_gxx_version_major + 0))
])
ac_gxx_version_major=$ac_cv_gxx_version_major
-if test $ac_gxx_version_major -gt 4 -a $ac_gxx_version_major -lt 6; then
- CXXFLAGS="-std=c++11 $CXXFLAGS"
+if test $ac_gxx_version_major -ge 4 -a $ac_gxx_version_major -lt 6; then
+ CPPFLAGS="-std=c++11 $CPPFLAGS"
+ ac_cflags="-std=c++11 $ac_cflags"
fi
# Check for proper flags.
@@ -231,40 +217,38 @@
CPPFLAGS="-fPIC $CPPFLAGS"
# Prepend alternate dependencies paths.
-ac_path=$PATH
-
for X in $ac_with_paths; do
if test -d $X/bin; then
- ac_path="$X/bin:$ac_path"
+ ac_path="$X/bin:$ac_path"
fi
if test -d $X/include; then
- CFLAGS="-I$X/include $CFLAGS "
- CPPFLAGS="-I$X/include $CPPFLAGS"
- ac_incpath="$X/include $ac_incpath"
+ CFLAGS="-I$X/include $CFLAGS "
+ CPPFLAGS="-I$X/include $CPPFLAGS"
+ ac_incpath="$X/include $ac_incpath"
fi
for Y in $ac_libdirs; do
- if test -d $X/$Y; then
- LIBS="-L$X/$Y $LIBS"
- ac_libs="-L$X/$Y $ac_libs"
- fi
+ if test -d $X/$Y; then
+ LIBS="-L$X/$Y $LIBS"
+ ac_libs="-L$X/$Y $ac_libs"
+ fi
done
done
# A common error message:
ac_errmsg="not found in current PATH. Maybe QT development environment isn't available."
-if test "x$ac_qt4" = "xyes"; then
- AC_PATH_PROG(ac_qmake, qmake-qt4, [no], $ac_path)
-else
- AC_PATH_PROG(ac_qmake, qmake-qt5, [no], $ac_path)
+# Check for qtchooser availability.
+AC_PATH_TOOL(ac_qtchooser, qtchooser, [no], $ac_path)
+if test -x $ac_qtchooser; then
+ export QT_SELECT=5
fi
+
+# Check for proper qmake path/version alternatives.
+AC_PATH_TOOL(ac_qmake, qmake, [no], $ac_path)
if test "x$ac_qmake" = "xno"; then
- AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path)
+ AC_PATH_TOOL(ac_cv_qmake, qmake-qt5, [no], $ac_path)
ac_qmake=$ac_cv_qmake
fi
-if test "x$ac_qmake" = "xno"; then
- AC_MSG_ERROR([qmake $ac_errmsg])
-fi
# Check for proper Qt major version.
AC_CACHE_CHECK([for Qt major version], [ac_cv_qt_version_major], [
@@ -272,14 +256,13 @@
ac_cv_qt_version_major=$(($ac_cv_qt_version_major + 0))
])
ac_qt_version_major=$ac_cv_qt_version_major
-if test "x$ac_qt4" = "xyes"; then
- if test $ac_qt_version_major -ne 4; then
- AC_MSG_ERROR([qmake-qt4 $ac_errmsg (qt4-devel)])
- fi
-else
- if test $ac_qt_version_major -ne 5; then
- AC_MSG_ERROR([qmake-qt5 $ac_errmsg (qt5-devel)])
- fi
+if test $ac_qt_version_major -ne 5; then
+ AC_PATH_TOOL(ac_cv_qmake, qmake-qt5, [no], $ac_path)
+ ac_qmake=$ac_cv_qmake
+fi
+
+if test "x$ac_qmake" = "xno"; then
+ AC_MSG_ERROR([qmake-qt5 $ac_errmsg (qt5-devel)])
fi
# Check for proper Qt install path.
@@ -292,7 +275,7 @@
fi
# Check it again, now with updated PATH, just in case...
-AC_PATH_PROG(ac_cv_qmake, qmake, [no], $ac_path)
+AC_PATH_TOOL(ac_cv_qmake, qmake, [no], $ac_path)
ac_qmake=$ac_cv_qmake
if test "x$ac_qmake" = "xno"; then
AC_MSG_ERROR([qmake $ac_errmsg])
@@ -319,58 +302,55 @@
ac_libs="-L$ac_qt_install_libs $ac_libs"
fi
-# Finally, check for proper Qt4/5 version.
-if test "x$ac_qt4" = "xyes"; then
- AC_CACHE_CHECK([for Qt library version >= 4.4],
- ac_cv_qtversion, [
- AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
- #if QT_VERSION < 0x040400 || QT_VERSION >= 0x050000
- #error Qt library 4.4 or greater required.
- #endif
- ], ac_cv_qtversion="yes", [
- echo "no; Qt 4.4 or greater is required"
- exit 1
- ])
+# Finally, check for proper Qt version.
+AC_CACHE_CHECK([for Qt library version >= 5.1],
+ ac_cv_qtversion, [
+ AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
+ #if QT_VERSION < 0x050100
+ #error Qt library 5.1 or greater required.
+ #endif
+ ], ac_cv_qtversion="yes", [
+ echo "no; Qt 5.1 or greater is required"
+ exit 1
])
-else
- AC_CACHE_CHECK([for Qt library version >= 5.1],
- ac_cv_qtversion, [
- AC_TRY_COMPILE([#include "QtCore/qglobal.h"], [
- #if QT_VERSION < 0x050100 || QT_VERSION >= 0x060000
- #error Qt library 5.1 or greater required.
- #endif
- ], ac_cv_qtversion="yes", [
- echo "no; Qt 5.1 or greater is required"
- exit 1
- ])
- ])
-fi
+])
# Check for Qt moc utility.
-AC_PATH_PROG(ac_moc, moc, [no], $ac_path)
+AC_PATH_TOOL(ac_moc, moc, [no], $ac_path)
if test "x$ac_moc" = "xno"; then
AC_MSG_ERROR([moc $ac_errmsg])
fi
AC_SUBST(ac_moc)
# Check for Qt uic utility.
-AC_PATH_PROG(ac_uic, uic, [no], $ac_path)
+AC_PATH_TOOL(ac_uic, uic, [no], $ac_path)
if test "x$ac_uic" = "xno"; then
AC_MSG_ERROR([uic $ac_errmsg])
fi
AC_SUBST(ac_uic)
+
# Check for Qt lupdate utility.
-AC_PATH_PROG(ac_lupdate, lupdate, [no], $ac_path)
+AC_PATH_TOOL(ac_lupdate, lupdate, [no], $ac_path)
if test "x$ac_lupdate" = "xno"; then
- AC_MSG_ERROR([lupdate $ac_errmsg])
+ AC_PATH_TOOL(ac_cv_lupdate, lupdate-qt5, [no], $ac_path)
+ if test "x$ac_cv_lupdate" = "xno"; then
+ AC_MSG_ERROR([lupdate $ac_errmsg (qt5-linguist)])
+ else
+ ac_lupdate=$ac_cv_lupdate;
+ fi
fi
AC_SUBST(ac_lupdate)
# Check for Qt lrelease utility.
-AC_PATH_PROG(ac_lrelease, lrelease, [no], $ac_path)
-if test "x$ac_release" = "xno"; then
- AC_MSG_ERROR([lrelease $ac_errmsg])
+AC_PATH_TOOL(ac_lrelease, lrelease, [no], $ac_path)
+if test "x$ac_lrelease" = "xno"; then
+ AC_PATH_TOOL(ac_cv_lrelease, lrelease-qt5, [no], $ac_path)
+ if test "x$ac_cv_lrelease" = "xno"; then
+ AC_MSG_ERROR([lrelease $ac_errmsg (qt5-linguist)])
+ else
+ ac_lrelease=$ac_cv_lrelease;
+ fi
fi
AC_SUBST(ac_lrelease)
@@ -380,11 +360,6 @@
AC_CHECK_LIB(X11, main)
AC_CHECK_LIB(Xext, main)
-# Check for round math function.
-AC_CHECK_LIB(m, lroundf, [ac_round="yes"], [ac_round="no"])
-if test "x$ac_round" = "xyes"; then
- AC_DEFINE(CONFIG_ROUND, 1, [Define if round is available.])
-fi
# Check for JACK libraries.
PKG_CHECK_MODULES([JACK], [jack >= 0.100.0], [ac_jack_lib="yes"], [ac_jack_lib="no"])
@@ -481,11 +456,7 @@
# Check D-Bus interface support.
if test "x$ac_dbus" = "xyes"; then
- if test "x$ac_qt4" = "xno"; then
- PKG_CHECK_MODULES([QT5DBUS], [Qt5DBus], [ac_dbus="yes"], [ac_dbus="no"])
- else
- PKG_CHECK_MODULES([QT4DBUS], [QtDBus], [ac_dbus="yes"], [ac_dbus="no"])
- fi
+ PKG_CHECK_MODULES([QT5DBUS], [Qt5DBus], [ac_dbus="yes"], [ac_dbus="no"])
fi
if test "x$ac_dbus" = "xyes"; then
AC_DEFINE(CONFIG_DBUS, 1, [Define if D-Bus interface is enabled.])
@@ -493,21 +464,15 @@
fi
AC_SUBST(ac_qdbus)
-# Check for X11 unique/single instance.
-if test "x$ac_xunique" = "xyes" -a "x$ac_qt4" = "xno"; then
- PKG_CHECK_MODULES([QT5X11EXTRAS], [Qt5X11Extras], [ac_xunique="yes"], [ac_xunique="no"])
-fi
+# Check for unique/single instance support.
if test "x$ac_xunique" = "xyes"; then
- AC_DEFINE(CONFIG_XUNIQUE, 1, [Define if X11 unique/single instance is enabled.])
- if test "x$ac_qt4" = "xno"; then
- ac_qx11extras="x11extras"
- fi
- # Some recent distros (eg. fedora, debian) require this.
- if test "x$ac_cv_lib_X11_main" = "xyes"; then
- ac_libs="$ac_libs -lX11"
+ PKG_CHECK_MODULES([QT5NETWORK], [Qt5Network], [ac_qt5network="yes"], [ac_qt5network="no"])
+ if test "x$ac_qt5network" = "xyes"; then
+ AC_DEFINE(CONFIG_XUNIQUE, 1, [Define if unique/single instance is enabled.])
+ ac_qnetwork="network"
fi
fi
-AC_SUBST(ac_qx11extras)
+AC_SUBST(ac_qnetwork)
# Check for debugging stack-trace.
if test "x$ac_stacktrace" = "xyes"; then
@@ -559,6 +524,18 @@
AC_DEFINE(CONFIG_JACK_MAX_DELAY, 1, [Define if jack_get_max_delayed_usecs is available.])
fi
+# Check for jack_set_port_rename_callback
+AC_CHECK_LIB(jack, jack_set_port_rename_callback, [ac_jack_port_rename="yes"], [ac_jack_port_rename="no"])
+if test "x$ac_jack_port_rename" = "xyes"; then
+ AC_TRY_COMPILE([#include ], [
+ void port_rename(jack_port_id_t, const char *, const char *, void *);
+ jack_set_port_rename_callback(0, port_rename, 0);
+ ], ac_jack_port_rename="yes", ac_jack_port_rename="no")
+fi
+if test "x$ac_jack_port_rename" = "xyes"; then
+ AC_DEFINE(CONFIG_JACK_PORT_RENAME, 1, [Define if jack_set_port_rename_callback is available.])
+fi
+
# Check for jack_port_get_aliases function.
if test "x$ac_jack_port_aliases" = "xyes"; then
AC_CHECK_LIB(jack, jack_port_get_aliases, [ac_jack_port_aliases="yes"], [ac_jack_port_aliases="no"])
@@ -609,7 +586,7 @@
echo " PortAudio interface support . . . . . . . . . . .: $ac_portaudio"
echo " CoreAudio interface support . . . . . . . . . . .: $ac_coreaudio"
echo
-echo " X11 Unique/Single instance . . . . . . . . . . . .: $ac_xunique"
+echo " Unique/Single instance support . . . . . . . . . .: $ac_xunique"
echo " Debugger stack-trace (gdb) . . . . . . . . . . . .: $ac_stacktrace"
echo
echo " Install prefix . . . . . . . . . . . . . . . . . .: $ac_prefix"
diff -Nru qjackctl-0.4.5/debian/changelog qjackctl-0.6.0/debian/changelog
--- qjackctl-0.4.5/debian/changelog 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/changelog 2019-11-17 22:20:08.000000000 +0000
@@ -1,15 +1,66 @@
-qjackctl (0.4.5-1ubuntu1) artful; urgency=medium
+qjackctl (0.6.0-1~18.04) bionic; urgency=medium
- * Merge with Debian unstable (LP: #1709796).
- * Drop: New upstream minor release.
- - Partially fixes issues with systray icon (LP: #1546328).
- * Remaining changes:
- - Fix and refresh Ubuntu-specific patches to fix FTBFS.
- - Refresh 90_dbus_setting.patch.
- - Extend 90_dbus_setting.patch to enable JACK D-Bus interface too
- (LP: #1567589).
+ * Backport.
- -- Ross Gammon Mon, 21 Aug 2017 23:06:44 +0200
+ -- DNS Tue, 17 Nov 2019 23:20:08 +0100
+
+qjackctl (0.6.0-1) unstable; urgency=medium
+
+ * Team upload
+
+ [ Ondřej Nový ]
+ * Bump Standards-Version to 4.4.1
+
+ [ Olivier Humbert ]
+ * Update copyright (http -> https)
+
+ [ Dennis Braun ]
+ * New upstream release.
+ * debian/copyright
+ + Update copyright years and authors.
+ + Add FSAP license.
+
+ -- Dennis Braun Mon, 16 Dec 2019 12:40:21 +0100
+
+qjackctl (0.5.9-1) unstable; urgency=medium
+
+ [ Ondřej Nový ]
+ * d/copyright: Use https protocol in Format field
+ * d/control: Set Vcs-* to salsa.debian.org
+
+ [ Felipe Sateler ]
+ * Change maintainer address to debian-multimedia@lists.debian.org
+
+ [ Olivier Humbert ]
+ * Update copyright years for Rui (upstream)
+
+ [ Ondřej Nový ]
+ * Use debhelper-compat instead of debian/compat
+
+ [ Sebastian Ramacher ]
+ * New upstream release.
+ - Use AC_PATH_TOOL. (Closes: #902403)
+ * debian/control:
+ - Bump debhelper compat to 12.
+ - Bump Standards-Version.
+ * debian/rules: Remove QT_SELECT, no longer needed.
+
+ -- Sebastian Ramacher Fri, 06 Sep 2019 08:59:08 +0200
+
+qjackctl (0.5.0-1) unstable; urgency=medium
+
+ * New upstream version 0.5.0
+ * Bump Standards.
+ * Use git instead of cgit in VCS.
+ * Use secure uri where possible.
+ * Delete unused ubuntu patches.
+ * Don't delete desktop file after build.
+ * Delete redundant files.
+ * Introduce postclone.sh script to ignore .pc/ dir.
+ * Switch to short dh.
+ * Add patch to fix hardening.
+
+ -- Jaromír Mikeš Sun, 17 Dec 2017 15:42:35 +0100
qjackctl (0.4.5-1) unstable; urgency=medium
@@ -59,27 +110,6 @@
-- Jaromír Mikeš Tue, 14 Jun 2016 20:05:46 +0200
-qjackctl (0.4.2-0ubuntu2) xenial; urgency=medium
-
- * Extend 90_dbus_setting.patch to enable JACK D-Bus interface too
- (LP: #1567589).
-
- -- Dmitry Shachnev Thu, 07 Apr 2016 23:01:12 +0200
-
-qjackctl (0.4.2-0ubuntu1) xenial; urgency=medium
-
- * New upstream minor release.
- - Partially fixes issues with systray icon (LP: #1546328).
- * Refresh 90_dbus_setting.patch.
-
- -- Dmitry Shachnev Wed, 06 Apr 2016 22:38:28 +0200
-
-qjackctl (0.4.1-1ubuntu1) xenial; urgency=medium
-
- * Fix and refresh Ubuntu-specific patches to fix FTBFS.
-
- -- Logan Rosen Sun, 08 Nov 2015 05:07:06 -0500
-
qjackctl (0.4.1-1) unstable; urgency=medium
* Imported Upstream version 0.4.1
diff -Nru qjackctl-0.4.5/debian/compat qjackctl-0.6.0/debian/compat
--- qjackctl-0.4.5/debian/compat 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/compat 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-10
diff -Nru qjackctl-0.4.5/debian/control qjackctl-0.6.0/debian/control
--- qjackctl-0.4.5/debian/control 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/control 2019-11-17 22:20:08.000000000 +0000
@@ -1,25 +1,23 @@
Source: qjackctl
Section: sound
Priority: optional
-Maintainer: Ubuntu Developers
-XSBC-Original-Maintainer: Debian Multimedia Maintainers
+Maintainer: Debian Multimedia Maintainers
Uploaders:
Adrian Knoth ,
Jaromír Mikeš ,
Free Ekanayaka
Build-Depends:
- cdbs,
- debhelper (>= 10),
+ debhelper-compat (= 12),
libasound2-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386],
libjack-dev,
qtbase5-dev,
qttools5-dev-tools,
libqt5x11extras5-dev,
libx11-dev
-Standards-Version: 4.0.0
-Homepage: http://qjackctl.sourceforge.net
-Vcs-Git: https://anonscm.debian.org/git/pkg-multimedia/qjackctl.git
-Vcs-Browser: https://anonscm.debian.org/cgit/pkg-multimedia/qjackctl.git
+Standards-Version: 4.4.1
+Homepage: https://qjackctl.sourceforge.io
+Vcs-Git: https://salsa.debian.org/multimedia-team/qjackctl.git
+Vcs-Browser: https://salsa.debian.org/multimedia-team/qjackctl
Package: qjackctl
Architecture: any
@@ -27,8 +25,6 @@
jackd,
${misc:Depends},
${shlibs:Depends}
-Recommends:
- ${dist:Recommends}
Suggests:
pulseaudio-utils
Description: User interface for controlling the JACK sound server
diff -Nru qjackctl-0.4.5/debian/copyright qjackctl-0.6.0/debian/copyright
--- qjackctl-0.4.5/debian/copyright 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/copyright 2019-11-17 22:20:08.000000000 +0000
@@ -1,19 +1,27 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qjackctl
Upstream-Contact: Rui Nuno Capela
-Source: http://sourceforge.net/projects/qjackctl/files/
-Copyright: 2003-2014 rncbc aka Rui Nuno Capela
+Source: https://sourceforge.net/projects/qjackctl/files/
+Copyright: 2003-2019 rncbc aka Rui Nuno Capela
Files: *
Copyright:
- 2003-2014 Rui Nuno Capela
+ 2003-2019 Rui Nuno Capela
License: GPL-2+
Files:
+ src/appdata/qjackctl.appdata.xml
+Copyright:
+ 2003-2018 Rui Nuno Capela
+ 2015 Olivier Humbert
+License: FSFAP
+
+Files:
src/qjackctlInterfaceComboBox.cpp
src/qjackctlInterfaceComboBox.h
Copyright:
- 2003-2013 Rui Nuno Capela
+ 2003-2019 Rui Nuno Capela
+ 2015, Kjetil Matheussen
2013, Arnout Engelen
License: GPL-2+
@@ -26,6 +34,12 @@
2014-2017 Jaromír Mikeš
License: GPL-2+
+License: FSFAP
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. This file is offered as-is,
+ without any warranty.
+
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -38,7 +52,7 @@
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+ along with this program. If not, see .
.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL-2'.
diff -Nru qjackctl-0.4.5/debian/gbp/postclone.sh qjackctl-0.6.0/debian/gbp/postclone.sh
--- qjackctl-0.4.5/debian/gbp/postclone.sh 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/debian/gbp/postclone.sh 2019-11-17 22:20:08.000000000 +0000
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+## script to initialize a cloned repository
+## with per (local) repository settings.
+
+# - ignore quilt's .pc/ directory
+# - enable the "--follow-tags" mode for pushing
+
+echo "tuning git-repository for ${NAME}"
+git config push.followTags true && echo "enabled push.followTags"
+
+GITEXCLUDE=".git/info/exclude"
+egrep "^/?\.pc/?$" "${GITEXCLUDE}" >/dev/null 2>&1 \
+ || (echo "/.pc/" >> "${GITEXCLUDE}" && echo "ignoring /.pc/")
diff -Nru qjackctl-0.4.5/debian/patches/0001-hardening.patch qjackctl-0.6.0/debian/patches/0001-hardening.patch
--- qjackctl-0.4.5/debian/patches/0001-hardening.patch 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/debian/patches/0001-hardening.patch 2019-11-17 22:20:08.000000000 +0000
@@ -0,0 +1,20 @@
+Description: Fix hardening by passing flags
+Author: Jaromír Mikeš
+Forwarded: no
+
+Index: qjackctl/src/src.pri.in
+===================================================================
+--- qjackctl.orig/src/src.pri.in
++++ qjackctl/src/src.pri.in
+@@ -13,8 +13,9 @@ INCLUDEPATH += @ac_incpath@
+ LIBS += @ac_libs@
+
+ # Extra optimization flags
+-QMAKE_CXXFLAGS += @ac_cflags@
+-QMAKE_LFLAGS += @ac_ldflags@
++QMAKE_CXXFLAGS += $(CPPFLAGS) @ac_cflags@
++QMAKE_CFLAGS += $(CPPFLAGS)
++QMAKE_LFLAGS += $(LDFLAGS) @ac_ldflags@
+
+ # D-BUS support
+ QDBUS = @ac_qdbus@
diff -Nru qjackctl-0.4.5/debian/patches/00_settings.patch qjackctl-0.6.0/debian/patches/00_settings.patch
--- qjackctl-0.4.5/debian/patches/00_settings.patch 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/patches/00_settings.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,29 +0,0 @@
-Description: Apply Debian-specific patches.
- This patch was modified from the original debian patch.
- It changes the default jackd patch to /usr/bin/jackd.
- In addition, the preset sample rate is 44100.
-Origin: Debian
-Author: Chris J Arges
-Forwarded: not-needed
-Last-Update: <2012-06-21>
-
---- a/src/qjackctlSetup.cpp
-+++ b/src/qjackctlSetup.cpp
-@@ -363,7 +363,7 @@
- #if defined(WIN32)
- preset.sServerPrefix = m_settings.value("/Server", "jackd -S").toString();
- #else
-- preset.sServerPrefix = m_settings.value("/Server", "jackd").toString();
-+ preset.sServerPrefix = m_settings.value("/Server", "/usr/bin/jackd").toString();
- #endif
- preset.sServerName = m_settings.value("/ServerName").toString();
- preset.bRealtime = m_settings.value("/Realtime", true).toBool();
-@@ -377,7 +377,7 @@
- preset.bIgnoreHW = m_settings.value("/IgnoreHW", false).toBool();
- preset.iPriority = m_settings.value("/Priority", 0).toInt();
- preset.iFrames = m_settings.value("/Frames", 1024).toInt();
-- preset.iSampleRate = m_settings.value("/SampleRate", 48000).toInt();
-+ preset.iSampleRate = m_settings.value("/SampleRate", 44100).toInt();
- preset.iPeriods = m_settings.value("/Periods", 2).toInt();
- preset.iWordLength = m_settings.value("/WordLength", 16).toInt();
- preset.iWait = m_settings.value("/Wait", 21333).toInt();
diff -Nru qjackctl-0.4.5/debian/patches/90_dbus_setting.patch qjackctl-0.6.0/debian/patches/90_dbus_setting.patch
--- qjackctl-0.4.5/debian/patches/90_dbus_setting.patch 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/patches/90_dbus_setting.patch 1970-01-01 00:00:00.000000000 +0000
@@ -1,20 +0,0 @@
-Description: Enable dbus by default to ease cooperation between JACK and Pulse
-Author: David Henningsson
-Bug-Ubuntu: https://launchpad.net/bugs/803026
----
- src/qjackctlSetup.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/src/qjackctlSetup.cpp
-+++ b/src/qjackctlSetup.cpp
-@@ -122,8 +122,8 @@
- sServerConfigName = m_settings.value("/ServerConfigName", ".jackdrc").toString();
- bServerConfigTemp = m_settings.value("/ServerConfigTemp", false).toBool();
- bAlsaSeqEnabled = m_settings.value("/AlsaSeqEnabled", true).toBool();
-- bDBusEnabled = m_settings.value("/DBusEnabled", false).toBool();
-- bJackDBusEnabled = m_settings.value("/JackDBusEnabled", false).toBool();
-+ bDBusEnabled = m_settings.value("/DBusEnabled", true).toBool();
-+ bJackDBusEnabled = m_settings.value("/JackDBusEnabled", true).toBool();
- bAliasesEnabled = m_settings.value("/AliasesEnabled", false).toBool();
- bAliasesEditing = m_settings.value("/AliasesEditing", false).toBool();
- bLeftButtons = m_settings.value("/LeftButtons", true).toBool();
diff -Nru qjackctl-0.4.5/debian/patches/series qjackctl-0.6.0/debian/patches/series
--- qjackctl-0.4.5/debian/patches/series 2017-08-15 15:57:14.000000000 +0000
+++ qjackctl-0.6.0/debian/patches/series 2019-11-17 22:20:08.000000000 +0000
@@ -1,2 +1 @@
-00_settings.patch
-90_dbus_setting.patch
+0001-hardening.patch
diff -Nru qjackctl-0.4.5/debian/patches/ubuntu.series qjackctl-0.6.0/debian/patches/ubuntu.series
--- qjackctl-0.4.5/debian/patches/ubuntu.series 2017-08-15 15:57:14.000000000 +0000
+++ qjackctl-0.6.0/debian/patches/ubuntu.series 1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-00_settings.patch
-90_dbus_setting.patch
diff -Nru qjackctl-0.4.5/debian/qjackctl.install qjackctl-0.6.0/debian/qjackctl.install
--- qjackctl-0.4.5/debian/qjackctl.install 2017-08-15 15:57:14.000000000 +0000
+++ qjackctl-0.6.0/debian/qjackctl.install 1970-01-01 00:00:00.000000000 +0000
@@ -1 +0,0 @@
-debian/qjackctl.xpm usr/share/pixmaps
diff -Nru qjackctl-0.4.5/debian/qjackctl.xpm qjackctl-0.6.0/debian/qjackctl.xpm
--- qjackctl-0.4.5/debian/qjackctl.xpm 2017-08-15 15:57:14.000000000 +0000
+++ qjackctl-0.6.0/debian/qjackctl.xpm 1970-01-01 00:00:00.000000000 +0000
@@ -1,50 +0,0 @@
-/* XPM */
-static char * qjackctl_xpm[] = {
-"32 32 15 1",
-" c None",
-". c #000000",
-"+ c #4C4C4C",
-"@ c #666666",
-"# c #191919",
-"$ c #B2B2B2",
-"% c #333333",
-"& c #999999",
-"* c #CCCCCC",
-"= c #827F00",
-"- c #E5E5E5",
-"; c #7F0000",
-"> c #7F7F7F",
-", c #FFFF00",
-"' c #FFFFFF",
-" ",
-" @.. ",
-" ..-. ",
-" @..-. ",
-" @..-.+.. ",
-" @..@.%%## ",
-" @.%&$&+#. ",
-" +.%=$$$&@## ",
-" +.@*$&$*&@#. ",
-" +#@&,$&$*$@.# ",
-" @#%;&,*&&++=%. ",
-" @#+%$,$@@*$&%# ",
-" +#++$=&$=$*&%# ",
-" +;%;+*,$&$&%%. ",
-" +#%+$*,$@%%@%+ ",
-" +#;+&*=+;&*&. ",
-" +##%@+#$=+=# ",
-" +#%;%$=#>.+ ",
-" +##%=+&-'. ",
-" +.;+=.>-'. ",
-" @...@.>-'. ",
-" +#@-'. ",
-" @.>-'. ",
-" @.@@*. ",
-" @.>-$. ",
-" @.>@.> ",
-" @.#-. ",
-" +.. ",
-" ",
-" ",
-" ",
-" "};
diff -Nru qjackctl-0.4.5/debian/README.source qjackctl-0.6.0/debian/README.source
--- qjackctl-0.4.5/debian/README.source 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/debian/README.source 2019-11-17 22:20:08.000000000 +0000
@@ -0,0 +1,22 @@
+gbp clone
+---------
+
+Starting with gbp>0.8.1, here's an simple way to automatically fine-tune the
+repository in the following ways:
+- make git ignore any .pc/ directory (created by quilt)
+- enable the "--follow-tags" when running 'git-push', so it's harder
+ to forget to push packaging tags along with the branches.
+
+To enable this, run gbp-clone with the '--postclone debian/gbp/postclone.sh'
+option.
+To enable this for ALL repositories cloned via 'gbp' (in the future), do
+something like the following:
+
+ $ mkdir -p ~/bin
+ $ cp debian/gbp/postclone.sh ~/bin/gbphook-postclone
+ $ cat >> ~/.gbp.conf < Mon, 1 Aug 2016 12:15:50 +0200
diff -Nru qjackctl-0.4.5/debian/rules qjackctl-0.6.0/debian/rules
--- qjackctl-0.4.5/debian/rules 2017-08-21 21:06:44.000000000 +0000
+++ qjackctl-0.6.0/debian/rules 2019-11-17 22:20:08.000000000 +0000
@@ -1,24 +1,13 @@
#!/usr/bin/make -f
-CFLAGS = -Wall -g
-export QTDIR=/usr/share/qt5
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-export QT_SELECT=qt5
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/autotools.mk
+%:
+ dh $@
-ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
- DEB_DH_GENCONTROL_ARGS_qjackctl = -- -Vdist:Recommends="pulseaudio-utils"
-else
- DEB_DH_GENCONTROL_ARGS_qjackctl = -- -Vdist:Recommends=""
-endif
+override_dh_clean:
+ dh_clean --exclude=qjackctl.pro
-DEB_MAKE_CLEAN_TARGET := clean
-DEB_CLEAN_EXCLUDE := qjackctl.pro
-
-cleanbuilddir::
- rm -rf src/.moc/ src/.obj/ src/.ui/
- rm -rf src/config.h src/qjackctl.desktop src/src.pri \
- src/translations/*.qm
+override_dh_auto_configure:
+ dh_auto_configure -- --enable-debug
diff -Nru qjackctl-0.4.5/debian/watch qjackctl-0.6.0/debian/watch
--- qjackctl-0.4.5/debian/watch 2017-08-15 15:57:14.000000000 +0000
+++ qjackctl-0.6.0/debian/watch 2019-11-17 22:20:08.000000000 +0000
@@ -1,2 +1,2 @@
version=3
-http://sf.net/qjackctl/qjackctl-(.+)\.tar\.gz
+https://sf.net/qjackctl/qjackctl-(.+)\.tar\.gz
diff -Nru qjackctl-0.4.5/Makefile.git qjackctl-0.6.0/Makefile.git
--- qjackctl-0.4.5/Makefile.git 2017-04-27 14:44:14.544750473 +0000
+++ qjackctl-0.6.0/Makefile.git 2019-10-17 07:45:45.945673225 +0000
@@ -7,9 +7,9 @@
@rm -rf *.cache
clean:
- @if [ -f Makefile ]; then make clean; fi
+ @if [ -f Makefile ]; then make clean; fi || true
@rm -rvf Makefile configure config.* src/.ui src/.obj src/.moc
- @rm -rvf src/config.* src/*.pri src/*.desktop
+ @rm -rvf src/config.* src/*.pri
@rm -rvf src/Makefile src/Makefile.* src/*.mak src/*.mak.*
@rm -rvf *.cache *.log *.status *.spec *.mak *.m4 .m4
@rm -rvf .qmake.stash src/.qmake.stash
diff -Nru qjackctl-0.4.5/Makefile.in qjackctl-0.6.0/Makefile.in
--- qjackctl-0.4.5/Makefile.in 2017-04-27 14:44:14.544750473 +0000
+++ qjackctl-0.6.0/Makefile.in 2019-10-17 07:45:45.945673225 +0000
@@ -6,12 +6,17 @@
headers = \
src/config.h \
+ src/qjackctl.h \
src/qjackctlAbout.h \
src/qjackctlAlsaConnect.h \
+ src/qjackctlAlsaGraph.h \
src/qjackctlConnect.h \
- src/qjackctlConnectAlias.h \
+ src/qjackctlAliases.h \
+ src/qjackctlGraph.h \
+ src/qjackctlGraphCommand.h \
src/qjackctlInterfaceComboBox.h \
src/qjackctlJackConnect.h \
+ src/qjackctlJackGraph.h \
src/qjackctlPatchbay.h \
src/qjackctlPatchbayFile.h \
src/qjackctlPatchbayRack.h \
@@ -21,6 +26,7 @@
src/qjackctlSystemTray.h \
src/qjackctlAboutForm.h \
src/qjackctlConnectionsForm.h \
+ src/qjackctlGraphForm.h \
src/qjackctlMainForm.h \
src/qjackctlMessagesStatusForm.h \
src/qjackctlPatchbayForm.h \
@@ -31,10 +37,14 @@
sources = \
src/qjackctl.cpp \
src/qjackctlAlsaConnect.cpp \
+ src/qjackctlAlsaGraph.cpp \
src/qjackctlConnect.cpp \
- src/qjackctlConnectAlias.cpp \
+ src/qjackctlAliases.cpp \
+ src/qjackctlGraph.cpp \
+ src/qjackctlGraphCommand.cpp \
src/qjackctlInterfaceComboBox.cpp \
src/qjackctlJackConnect.cpp \
+ src/qjackctlJackGraph.cpp \
src/qjackctlPatchbay.cpp \
src/qjackctlPatchbayFile.cpp \
src/qjackctlPatchbayRack.cpp \
@@ -43,6 +53,7 @@
src/qjackctlSystemTray.cpp \
src/qjackctlAboutForm.cpp \
src/qjackctlConnectionsForm.cpp \
+ src/qjackctlGraphForm.cpp \
src/qjackctlMainForm.cpp \
src/qjackctlMessagesStatusForm.cpp \
src/qjackctlPatchbayForm.cpp \
@@ -53,6 +64,7 @@
forms = \
src/qjackctlAboutForm.ui \
src/qjackctlConnectionsForm.ui \
+ src/qjackctlGraphForm.ui \
src/qjackctlMainForm.ui \
src/qjackctlMessagesStatusForm.ui \
src/qjackctlPatchbayForm.ui \
@@ -72,6 +84,7 @@
src/translations/qjackctl_it.ts \
src/translations/qjackctl_ja.ts \
src/translations/qjackctl_nl.ts \
+ src/translations/qjackctl_pt.ts \
src/translations/qjackctl_ru.ts
translations_targets = \
@@ -82,6 +95,7 @@
src/translations/qjackctl_it.qm \
src/translations/qjackctl_ja.qm \
src/translations/qjackctl_nl.qm \
+ src/translations/qjackctl_pt.qm \
src/translations/qjackctl_ru.qm
@@ -106,8 +120,8 @@
@$(QMAKE) -o $(name).mak $(name).pro
-translations_lupdate: $(name).pro
- @$(LUPDATE) -verbose -no-obsolete $(name).pro
+translations_lupdate: $(translations_sources)
+ @$(LUPDATE) -verbose -no-obsolete -recursive src -ts $(translations_sources)
translations_lrelease: translations_lupdate $(translations_targets)
@@ -130,7 +144,7 @@
clean: $(name).mak
- @$(MAKE) -f $(name).mak distclean
+ @$(MAKE) -f $(name).mak distclean || true
@rm -f $(target) $(target).mak $(name).mak
@rm -rf *.cache *.log *.status $(translations_targets)
diff -Nru qjackctl-0.4.5/qjackctl.fr.1 qjackctl-0.6.0/qjackctl.fr.1
--- qjackctl-0.4.5/qjackctl.fr.1 2017-04-27 14:44:14.545750974 +0000
+++ qjackctl-0.6.0/qjackctl.fr.1 2019-10-17 07:45:45.946673225 +0000
@@ -22,7 +22,7 @@
.HP
\fB\-s\fR, \fB\-\-start\fR
.IP
-Démarre le serveur audio JACK immédiatemment
+Démarre le serveur audio JACK immédiatement
.HP
\fB\-p\fR, \fB\-\-preset\fR=[\fIétiquette\fR]
.IP
@@ -48,7 +48,7 @@
.SH FICHIER
Les paramètres de configuration sont stockés dans ~/.config/rncbc.org/QjackCtl.conf
.SH AUTEUR
-QjackCtl a été écrit pas Rui Nuno Capela.
+QjackCtl a été écrit par Rui Nuno Capela.
.PP
Cette page de manuel a été écrite par Guenter Geiger , pour
le projet Debian (mais peut être utilisée par d'autres).
diff -Nru qjackctl-0.4.5/qjackctl.spec.in qjackctl-0.6.0/qjackctl.spec.in
--- qjackctl-0.4.5/qjackctl.spec.in 2017-04-27 14:44:14.545750974 +0000
+++ qjackctl-0.6.0/qjackctl.spec.in 2019-10-17 07:45:45.946673225 +0000
@@ -1,6 +1,6 @@
%define name @PACKAGE_TARNAME@
%define version @PACKAGE_VERSION@
-%define release 28
+%define release 39
%define _prefix @ac_prefix@
@@ -20,19 +20,16 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-#BuildRequires: libqt4-devel >= 4.4
%if %{defined fedora}
BuildRequires: pkgconfig
BuildRequires: qt5-qtbase-devel >= 5.1, qt5-linguist
-BuildRequires: qt5-qtx11extras-devel >= 5.1
BuildRequires: alsa-lib-devel
%else
BuildRequires: pkg-config
BuildRequires: libqt5-qtbase-devel >= 5.1, libqt5-linguist
-BuildRequires: libqt5-qtx11extras-devel >= 5.1
BuildRequires: alsa-devel
%endif
-BuildRequires: libjack-devel >= 0.100.0
+BuildRequires: libjack-devel
%description
JACK Audio Connection Kit - Qt GUI Interface: A simple Qt application
@@ -66,17 +63,39 @@
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/translations
-%dir %{_datadir}/appdata
+%dir %{_datadir}/metainfo
#dir %{_datadir}/man
#dir %{_datadir}/man/man1
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/32x32/apps/%{name}.png
%{_datadir}/%{name}/translations/%{name}_*.qm
-%{_datadir}/appdata/%{name}.appdata.xml
+%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/man/man1/%{name}*.1.gz
%changelog
+* Thu Oct 17 2019 Rui Nuno Capela 0.6.0
+- Autumn'19 release.
+* Fri Jul 12 2019 Rui Nuno Capela 0.5.9
+- Summer'19 release.
+* Sat May 25 2019 Rui Nuno Capela 0.5.8
+- Spring'19 release.
+* Thu Apr 11 2019 Rui Nuno Capela 0.5.7
+- Spring-Break'19 release.
+* Mon Mar 11 2019 Rui Nuno Capela 0.5.6
+- Pre-LAC2019 release frenzy.
+* Fri Nov 23 2018 Rui Nuno Capela 0.5.5
+- Black-Friday'18 release.
+* Mon Sep 24 2018 Rui Nuno Capela 0.5.4
+- Early Autumn'18 release.
+* Sun Jul 22 2018 Rui Nuno Capela 0.5.3
+- Summer'18 release.
+* Sun May 27 2018 Rui Nuno Capela 0.5.2
+- Pre-LAC2018 release frenzy hotfix.
+* Mon May 21 2018 Rui Nuno Capela 0.5.1
+- Pre-LAC2018 release frenzy.
+* Sat Dec 16 2017 Rui Nuno Capela 0.5.0
+- End of Autumn'17 release.
* Thu Apr 27 2017 Rui Nuno Capela 0.4.5
- Pre-LAC2017 release frenzy.
* Mon Nov 14 2016 Rui Nuno Capela 0.4.4
diff -Nru qjackctl-0.4.5/README qjackctl-0.6.0/README
--- qjackctl-0.4.5/README 2017-04-27 14:44:14.544750473 +0000
+++ qjackctl-0.6.0/README 2019-10-17 07:45:45.945673225 +0000
@@ -141,4 +141,5 @@
Thanks to you all.
--
rncbc aka Rui Nuno Capela
-rncbc@rncbc.org
+rncbc at rncbc dot org
+http://www.rncbc.org
diff -Nru qjackctl-0.4.5/README.cmake qjackctl-0.6.0/README.cmake
--- qjackctl-0.4.5/README.cmake 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/README.cmake 2019-10-17 07:45:45.945673225 +0000
@@ -0,0 +1,77 @@
+What is CMake?
+==============
+
+CMake is a cross platform build system, that can be used to replace the old
+auto-tools, providing a nice building environment and advanced features.
+
+Some of these features are:
+* Out of sources build: CMake allows you to build your software into a directory
+ different to the source tree. You can safely delete the build directory and
+ all its contents once you are done.
+* Multiple generators: classic makefiles can be generated for Unix and MinGW,
+ but also Visual Studio, XCode and Eclipse CDT projects among other types.
+* Graphic front-ends for configuration and build options.
+
+More information and documentation is available at the CMake project site:
+ http://www.cmake.org
+
+CMake is free software. You can get the sources and pre-compiled packages for
+Linux and other systems at:
+ http://www.cmake.org/cmake/resources/software.html
+
+How to use it?
+==============
+
+1. You need CMake 3.1 or newer to build QjackCtl
+
+2. Unpack the QjackCtl sources somewhere, or checkout the repository,
+ and create a build directory. For instance, using a command line shell:
+
+$ tar -xvzf Downloads/qjackctl-x.y.z.tar.gz
+$ cd qjackctl-x.y.z
+$ mkdir build
+
+2. Execute CMake from the build directory, providing the source directory
+ location and optionally, the build options. There are several ways.
+
+* From a command line shell:
+
+$ pwd
+qjackctl-x.y.z
+$ cd build
+$ cmake -DCMAKE_BUILD_TYPE=debug ..
+
+3. Execute the build command. If you used the Makefiles generator (the default
+ in Linux and other Unix systems) then execute make, gmake, or mingw32-make.
+ If you generated a project file, use your IDE to build it.
+
+Compiling with make
+===================
+
+There are many targets available. To see a complete list of them, type:
+
+$ make help
+
+The build process usually hides the compiler command lines, to show them:
+
+$ make VERBOSE=1
+
+There is a "clean" target, but not a "distclean" one. You should use a build
+directory different to the source tree. In this case, the "distclean" target
+would be equivalent to simply removing the build directory.
+
+If something fails
+==================
+
+If there is an error message while executing CMake, this probably means that a
+required package is missing in your system. You should install the missing
+component and run CMake again.
+
+If there is an error executing the build process, after running a flawless CMake
+configuration process, this means that there may be an error in the source code,
+or in the build system, or something incompatible in 3rd party libraries.
+
+The CMake build system for QjackCtl is experimental. It will take a while
+until it becomes stable and fully tested. You can help providing feedback,
+please send a report containing your problems to the QjackCtl development
+mailing list, https://lists.sourceforge.net/mailman/listinfo/qjackctl-devel
diff -Nru qjackctl-0.4.5/src/appdata/qjackctl.appdata.xml qjackctl-0.6.0/src/appdata/qjackctl.appdata.xml
--- qjackctl-0.4.5/src/appdata/qjackctl.appdata.xml 2017-04-27 14:44:14.545750974 +0000
+++ qjackctl-0.6.0/src/appdata/qjackctl.appdata.xml 2019-10-17 07:45:45.946673225 +0000
@@ -1,9 +1,9 @@
-
+
- qjackctl.desktop
- GPL-2.0+
+ org.rncbc.qjackctl
+ FSFAP
GPL-2.0+
QjackCtl
JACK Audio Connection Kit Qt GUI Interface
@@ -26,6 +26,10 @@
incluant une baie de brassage améliorée et des fonctionnalités de contrôle
de connexion.
+ qjackctl.desktop
+
+ qjackctl
+
http://qjackctl.sourceforge.net/qjackctlMainForm1.png
@@ -40,11 +44,8 @@
JACK
Qt
- http://qjackctl.sourceforge.net
- rncbc@rncbc.org
+ https://qjackctl.sourceforge.io
rncbc.org
-
- HiDpiIcon
- ModernToolkit
-
+ rncbc aka. Rui Nuno Capela
+ rncbc@rncbc.org
diff -Nru qjackctl-0.4.5/src/cmake_config.h.in qjackctl-0.6.0/src/cmake_config.h.in
--- qjackctl-0.4.5/src/cmake_config.h.in 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/cmake_config.h.in 2019-10-17 07:45:45.946673225 +0000
@@ -0,0 +1,101 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME "@PACKAGE_NAME@"
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING "@PACKAGE_STRING@"
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION "@PACKAGE_VERSION@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME "@PACKAGE_TARNAME@"
+
+/* Define to the version of this package. */
+#cmakedefine CONFIG_VERSION "@CONFIG_VERSION@"
+
+/* Define to the build version of this package. */
+#cmakedefine CONFIG_BUILD_VERSION "@CONFIG_BUILD_VERSION@"
+
+/* Default installation prefix. */
+#cmakedefine CONFIG_PREFIX "@CONFIG_PREFIX@"
+
+/* Define to target installation dirs. */
+#cmakedefine CONFIG_BINDIR "@CONFIG_BINDIR@"
+#cmakedefine CONFIG_LIBDIR "@CONFIG_LIBDIR@"
+#cmakedefine CONFIG_DATADIR "@CONFIG_DATADIR@"
+#cmakedefine CONFIG_MANDIR "@CONFIG_MANDIR@"
+
+/* Define if debugging is enabled. */
+#cmakedefine CONFIG_DEBUG @CONFIG_DEBUG@
+
+/* Define to 1 if you have the header file. */
+#cmakedefine HAVE_SIGNAL_H @HAVE_SIGNAL_H@
+
+/* Define if JACK library is available. */
+#cmakedefine CONFIG_JACK @CONFIG_JACK@
+
+/* Define if ALSA library is available. */
+#cmakedefine CONFIG_ALSA_SEQ @CONFIG_ALSA_SEQ@
+
+/* Define if PORTAUDIO library is available. */
+#cmakedefine CONFIG_PORTAUDIO @CONFIG_PORTAUDIO@
+
+/* Define if jack/statistics.h is available. */
+#cmakedefine CONFIG_JACK_STATISTICS @CONFIG_JACK_STATISTICS@
+
+/* Define if CoreAudio/CoreAudio.h is available (Mac OS X). */
+#cmakedefine CONFIG_COREAUDIO @CONFIG_COREAUDIO@
+
+/* Define if JACK MIDI support is available. */
+#cmakedefine CONFIG_JACK_MIDI @CONFIG_JACK_MIDI@
+
+/* Define if JACK session support is available. */
+#cmakedefine CONFIG_JACK_SESSION @CONFIG_JACK_SESSION@
+
+/* Define if JACK metadata support is available. */
+#cmakedefine CONFIG_JACK_METADATA @CONFIG_JACK_METADATA@
+
+/* Define if D-Bus interface is enabled. */
+#cmakedefine CONFIG_DBUS @CONFIG_DBUS@
+
+/* Define if unique/single instance is enabled. */
+#cmakedefine CONFIG_XUNIQUE @CONFIG_XUNIQUE@
+
+/* Define if debugger stack-trace is enabled. */
+#cmakedefine CONFIG_STACKTRACE @CONFIG_STACKTRACE@
+
+/* Define if system tray is enabled. */
+#cmakedefine CONFIG_SYSTEM_TRAY @CONFIG_SYSTEM_TRAY@
+
+/* Define if jack_tranport_query is available. */
+#cmakedefine CONFIG_JACK_TRANSPORT @CONFIG_JACK_TRANSPORT@
+
+/* Define if jack_is_realtime is available. */
+#cmakedefine CONFIG_JACK_REALTIME @CONFIG_JACK_REALTIME@
+
+/* Define if jack_get_xrun_delayed_usecs is available. */
+#cmakedefine CONFIG_JACK_XRUN_DELAY @CONFIG_JACK_XRUN_DELAY@
+
+/* Define if jack_get_max_delayed_usecs is available. */
+#cmakedefine CONFIG_JACK_MAX_DELAY @CONFIG_JACK_MAX_DELAY@
+
+/* Define if jack_set_port_rename_callback is available. */
+#cmakedefine CONFIG_JACK_PORT_RENAME @CONFIG_JACK_PORT_RENAME@
+
+/* Define if jack_port_get_aliases is available. */
+#cmakedefine CONFIG_JACK_PORT_ALIASES @CONFIG_JACK_PORT_ALIASES@
+
+/* Define if jack_get_version_string is available. */
+#cmakedefine CONFIG_JACK_VERSION @CONFIG_JACK_VERSION@
+
+/* Define if jack_free is available. */
+#cmakedefine CONFIG_JACK_FREE @CONFIG_JACK_FREE@
+
+
+#endif /* CONFIG_H */
diff -Nru qjackctl-0.4.5/src/CMakeLists.txt qjackctl-0.6.0/src/CMakeLists.txt
--- qjackctl-0.4.5/src/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/CMakeLists.txt 2019-10-17 07:45:45.946673225 +0000
@@ -0,0 +1,184 @@
+set(NAME qjackctl)
+
+include_directories (
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+configure_file (cmake_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+set (HEADERS
+ qjackctl.h
+ qjackctlAbout.h
+ qjackctlAlsaConnect.h
+ qjackctlAlsaGraph.h
+ qjackctlConnect.h
+ qjackctlAliases.h
+ qjackctlGraph.h
+ qjackctlGraphCommand.h
+ qjackctlInterfaceComboBox.h
+ qjackctlJackConnect.h
+ qjackctlJackGraph.h
+ qjackctlPatchbay.h
+ qjackctlPatchbayFile.h
+ qjackctlPatchbayRack.h
+ qjackctlSession.h
+ qjackctlSetup.h
+ qjackctlStatus.h
+ qjackctlSystemTray.h
+ qjackctlAboutForm.h
+ qjackctlConnectionsForm.h
+ qjackctlGraphForm.h
+ qjackctlMainForm.h
+ qjackctlMessagesStatusForm.h
+ qjackctlPatchbayForm.h
+ qjackctlSessionForm.h
+ qjackctlSetupForm.h
+ qjackctlSocketForm.h
+)
+
+set (SOURCES
+ qjackctl.cpp
+ qjackctlAlsaConnect.cpp
+ qjackctlAlsaGraph.cpp
+ qjackctlConnect.cpp
+ qjackctlAliases.cpp
+ qjackctlGraph.cpp
+ qjackctlGraphCommand.cpp
+ qjackctlInterfaceComboBox.cpp
+ qjackctlJackConnect.cpp
+ qjackctlJackGraph.cpp
+ qjackctlPatchbay.cpp
+ qjackctlPatchbayFile.cpp
+ qjackctlPatchbayRack.cpp
+ qjackctlSession.cpp
+ qjackctlSetup.cpp
+ qjackctlSystemTray.cpp
+ qjackctlAboutForm.cpp
+ qjackctlConnectionsForm.cpp
+ qjackctlGraphForm.cpp
+ qjackctlMainForm.cpp
+ qjackctlMessagesStatusForm.cpp
+ qjackctlPatchbayForm.cpp
+ qjackctlSessionForm.cpp
+ qjackctlSetupForm.cpp
+ qjackctlSocketForm.cpp
+)
+
+set (FORMS
+ qjackctlAboutForm.ui
+ qjackctlConnectionsForm.ui
+ qjackctlGraphForm.ui
+ qjackctlMainForm.ui
+ qjackctlMessagesStatusForm.ui
+ qjackctlPatchbayForm.ui
+ qjackctlSessionForm.ui
+ qjackctlSetupForm.ui
+ qjackctlSocketForm.ui
+)
+
+set (RESOURCES
+ qjackctl.qrc
+)
+
+set (TRANSLATIONS
+ translations/qjackctl_cs.ts
+ translations/qjackctl_de.ts
+ translations/qjackctl_es.ts
+ translations/qjackctl_fr.ts
+ translations/qjackctl_it.ts
+ translations/qjackctl_ja.ts
+ translations/qjackctl_nl.ts
+ translations/qjackctl_pt.ts
+ translations/qjackctl_ru.ts
+)
+
+qt5_add_translation ( QM_FILES ${TRANSLATIONS} )
+add_custom_target( translations ALL DEPENDS ${QM_FILES} )
+
+qt5_wrap_ui (UI_SOURCES ${FORMS})
+qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
+qt5_add_resources (QRC_SOURCES ${RESOURCES})
+
+if (WIN32)
+ set (RC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/win32/${NAME}.rc)
+ set (RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.res.obj)
+ find_program (WINDRES_EXECUTABLE NAMES windres mingw32-windres i686-mingw32-windres)
+ if (MINGW)
+ exec_program (${WINDRES_EXECUTABLE}
+ ARGS "-i ${RC_FILE} -o ${RES_FILE} --include-dir=${CMAKE_CURRENT_SOURCE_DIR}/images")
+ list (APPEND SOURCES ${RES_FILE})
+ else ()
+ list (APPEND SOURCES ${RC_FILE})
+ endif ()
+endif ()
+
+if (APPLE)
+ set (ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/${NAME}.icns)
+ list (APPEND SOURCES ${ICON_FILE})
+ set (MACOSX_BUNDLE_ICON_FILE ${NAME}.icns)
+ set_source_files_properties (${ICON_FILE} PROPERTIES
+ MACOSX_PACKAGE_LOCATION Resources)
+endif ()
+
+
+add_executable (${NAME}
+ ${UI_SOURCES}
+ ${MOC_SOURCES}
+ ${QRC_SOURCES}
+ ${SOURCES}
+)
+
+set_target_properties (${NAME} PROPERTIES CXX_STANDARD 11)
+
+if (WIN32)
+ set_target_properties (${NAME} PROPERTIES WIN32_EXECUTABLE true)
+endif ()
+
+if (APPLE)
+ set_target_properties (${NAME} PROPERTIES MACOSX_BUNDLE true)
+endif ()
+
+target_link_libraries (${NAME} PRIVATE Qt5::Widgets Qt5::Xml)
+
+if (CONFIG_XUNIQUE)
+ target_link_libraries (${NAME} PRIVATE Qt5::Network)
+endif ()
+
+if (CONFIG_DBUS)
+ target_link_libraries (${NAME} PRIVATE Qt5::DBus)
+endif ()
+
+if (CONFIG_JACK)
+ target_link_libraries (${NAME} PRIVATE ${JACK_LIBRARIES})
+endif ()
+
+if (CONFIG_ALSA_SEQ)
+ target_link_libraries (${NAME} PRIVATE ${ALSA_LIBRARIES})
+endif ()
+
+if (CONFIG_PORTAUDIO)
+ target_link_libraries (${NAME} PRIVATE ${PORTAUDIO_LIBRARIES})
+endif ()
+
+
+if (UNIX AND NOT APPLE)
+ install (TARGETS ${NAME} RUNTIME
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install (FILES ${QM_FILES}
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/${NAME}/translations)
+ install (FILES ${NAME}.desktop
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+ install (FILES images/${NAME}.png
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps)
+ install (FILES appdata/${NAME}.appdata.xml
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
+endif ()
+
+if (WIN32)
+ install (TARGETS ${NAME} RUNTIME
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ install (FILES ${QM_FILES}
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/${NAME}/translations)
+endif ()
+
diff -Nru qjackctl-0.4.5/src/config.h.in qjackctl-0.6.0/src/config.h.in
--- qjackctl-0.4.5/src/config.h.in 2017-04-27 14:45:15.000000000 +0000
+++ qjackctl-0.6.0/src/config.h.in 2019-10-17 07:46:11.747671604 +0000
@@ -39,6 +39,9 @@
/* Define if jack_port_get_aliases is available. */
#undef CONFIG_JACK_PORT_ALIASES
+/* Define if jack_set_port_rename_callback is available. */
+#undef CONFIG_JACK_PORT_RENAME
+
/* Define if jack_is_realtime is available. */
#undef CONFIG_JACK_REALTIME
@@ -66,9 +69,6 @@
/* Default installation prefix. */
#undef CONFIG_PREFIX
-/* Define if round is available. */
-#undef CONFIG_ROUND
-
/* Define if debugger stack-trace is enabled. */
#undef CONFIG_STACKTRACE
@@ -78,7 +78,7 @@
/* Version string. */
#undef CONFIG_VERSION
-/* Define if X11 unique/single instance is enabled. */
+/* Define if unique/single instance is enabled. */
#undef CONFIG_XUNIQUE
/* Define to 1 if you have the header file. */
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graph1.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graph1.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphAlsa.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphAlsa.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphCenter.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphCenter.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphColors.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphColors.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphConnect.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphConnect.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphDisconnect.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphDisconnect.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphJack.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphJack.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphRedo.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphRedo.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphRename.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphRename.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphUndo.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphUndo.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomFit.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomFit.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomIn.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomIn.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomOut.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomOut.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomRange.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomRange.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomReset.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomReset.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/graphZoomTool.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/graphZoomTool.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/qtlogo1.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/qtlogo1.png differ
Binary files /tmp/tmp61Azp2/qY9Q3TQxlI/qjackctl-0.4.5/src/images/qtlogo.png and /tmp/tmp61Azp2/CsmcH8uQJW/qjackctl-0.6.0/src/images/qtlogo.png differ
diff -Nru qjackctl-0.4.5/src/qjackctlAboutForm.cpp qjackctl-0.6.0/src/qjackctlAboutForm.cpp
--- qjackctl-0.4.5/src/qjackctlAboutForm.cpp 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAboutForm.cpp 2019-10-17 07:45:45.951673224 +0000
@@ -1,7 +1,7 @@
// qjackctlAboutForm.cpp
//
/****************************************************************************
- Copyright (C) 2003-2016, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -69,12 +69,12 @@
list << tr("JACK Session support disabled.");
#endif
#ifndef CONFIG_ALSA_SEQ
-#if !defined(WIN32)
+#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32)
list << tr("ALSA/MIDI sequencer support disabled.");
#endif
#endif
#ifndef CONFIG_DBUS
-#if !defined(WIN32)
+#if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32)
list << tr("D-Bus interface support disabled.");
#endif
#endif
diff -Nru qjackctl-0.4.5/src/qjackctlAboutForm.h qjackctl-0.6.0/src/qjackctlAboutForm.h
--- qjackctl-0.4.5/src/qjackctlAboutForm.h 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAboutForm.h 2019-10-17 07:45:45.951673224 +0000
@@ -1,7 +1,7 @@
// qjackctlAboutForm.h
//
/****************************************************************************
- Copyright (C) 2003-2016, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff -Nru qjackctl-0.4.5/src/qjackctlAboutForm.ui qjackctl-0.6.0/src/qjackctlAboutForm.ui
--- qjackctl-0.4.5/src/qjackctlAboutForm.ui 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAboutForm.ui 2019-10-17 07:45:45.951673224 +0000
@@ -3,7 +3,7 @@
rncbc aka Rui Nuno Capela
JACK Audio Connection Kit - Qt GUI Interface.
- Copyright (C) 2003-2016, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -34,7 +34,7 @@
- About QjackCtl
+ About
:/images/about1.png
@@ -90,7 +90,7 @@
- :/images/qtlogo.png
+ :/images/qtlogo1.png
diff -Nru qjackctl-0.4.5/src/qjackctlAbout.h qjackctl-0.6.0/src/qjackctlAbout.h
--- qjackctl-0.4.5/src/qjackctlAbout.h 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAbout.h 2019-10-17 07:45:45.951673224 +0000
@@ -1,7 +1,7 @@
// qjackctlAbout.h
//
/****************************************************************************
- Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -31,8 +31,8 @@
#define QJACKCTL_SUBTITLE2 "Qt GUI Interface"
#define QJACKCTL_SUBTITLE QJACKCTL_SUBTITLE1 " - " QJACKCTL_SUBTITLE2
-#define QJACKCTL_WEBSITE "http://qjackctl.sourceforge.net"
-#define QJACKCTL_COPYRIGHT "Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved."
+#define QJACKCTL_WEBSITE "https://qjackctl.sourceforge.io"
+#define QJACKCTL_COPYRIGHT "Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved."
#define QJACKCTL_DOMAIN "rncbc.org"
diff -Nru qjackctl-0.4.5/src/qjackctlAliases.cpp qjackctl-0.6.0/src/qjackctlAliases.cpp
--- qjackctl-0.4.5/src/qjackctlAliases.cpp 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlAliases.cpp 2019-10-17 07:45:45.951673224 +0000
@@ -0,0 +1,298 @@
+// qjackctlAliases.cpp
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#include "qjackctlAliases.h"
+
+#include
+
+#include
+
+
+//----------------------------------------------------------------------
+// class qjackctlAliasItem -- Client/port item alias map.
+
+// Constructor.
+qjackctlAliasItem::qjackctlAliasItem (
+ const QString& sClientName, const QString& sClientAlias )
+{
+ if (sClientAlias.isEmpty()) {
+ m_rxClientName.setPattern(escapeRegExpDigits(sClientName));
+ m_sClientAlias = sClientName;
+ } else {
+ m_rxClientName.setPattern(sClientName);
+ m_sClientAlias = sClientAlias;
+ }
+}
+
+// Default destructor.
+qjackctlAliasItem::~qjackctlAliasItem (void)
+{
+ m_ports.clear();
+}
+
+
+// Client name method.
+QString qjackctlAliasItem::clientName (void) const
+{
+ return m_rxClientName.pattern();
+}
+
+
+// Client name matcher.
+bool qjackctlAliasItem::matchClientName ( const QString& sClientName ) const
+{
+ return m_rxClientName.exactMatch(sClientName);
+}
+
+
+// Client aliasing methods.
+const QString& qjackctlAliasItem::clientAlias (void) const
+{
+ return m_sClientAlias;
+}
+
+
+void qjackctlAliasItem::setClientAlias ( const QString& sClientAlias )
+{
+ m_sClientAlias = sClientAlias;
+}
+
+
+// Port aliasing methods.
+QString qjackctlAliasItem::portAlias ( const QString& sPortName ) const
+{
+ return m_ports.value(sPortName, sPortName);
+}
+
+
+void qjackctlAliasItem::setPortAlias (
+ const QString& sPortName, const QString& sPortAlias )
+{
+ if (sPortAlias.isEmpty())
+ m_ports.remove(sPortName);
+ else
+ m_ports.insert(sPortName, sPortAlias);
+}
+
+
+// Save client/port aliases definitions.
+void qjackctlAliasItem::saveSettings (
+ QSettings& settings, const QString& sClientKey )
+{
+ settings.beginGroup(sClientKey);
+ settings.setValue("/Name", m_rxClientName.pattern());
+ settings.setValue("/Alias", m_sClientAlias);
+ int iPort = 0;
+ QMap::ConstIterator iter = m_ports.constBegin();
+ const QMap::ConstIterator& iter_end
+ = m_ports.constEnd();
+ for ( ; iter != iter_end; ++iter) {
+ const QString& sPortName
+ = iter.key();
+ const QString& sPortAlias
+ = iter.value();
+ if (!sPortName.isEmpty() && !sPortAlias.isEmpty()) {
+ settings.beginGroup("/Port" + QString::number(++iPort));
+ settings.setValue("/Name", sPortName);
+ settings.setValue("/Alias", sPortAlias);
+ settings.endGroup();
+ }
+ }
+ settings.endGroup();
+}
+
+
+// Escape and format a string as a regular expresion.
+QString qjackctlAliasItem::escapeRegExpDigits (
+ const QString& s, int iThreshold )
+{
+ const QString& sEscape
+ = QRegExp::escape(s);
+
+ QString sDigits;
+ QString sResult;
+ int iDigits = 0;
+
+ for (int i = 0; i < sEscape.length(); i++) {
+ const QChar& ch = sEscape.at(i);
+ if (ch.isDigit()) {
+ if (iDigits < iThreshold)
+ sDigits += ch;
+ else
+ sDigits = "[0-9]+";
+ iDigits++;
+ } else {
+ if (iDigits > 0) {
+ sResult += sDigits;
+ sDigits.clear();
+ iDigits = 0;
+ }
+ sResult += ch;
+ }
+ }
+
+ if (iDigits > 0)
+ sResult += sDigits;
+
+ return sResult;
+}
+
+
+// Need for generic sort.
+bool qjackctlAliasItem::operator< ( const qjackctlAliasItem& other )
+{
+ return (m_sClientAlias < other.clientAlias());
+}
+
+
+//----------------------------------------------------------------------
+// class qjackctlAliasList -- Client/port list alias map.
+
+// Constructor.
+qjackctlAliasList::qjackctlAliasList (void)
+{
+}
+
+// Default destructor.
+qjackctlAliasList::~qjackctlAliasList (void)
+{
+ qDeleteAll(*this);
+ clear();
+}
+
+
+// Client finders.
+qjackctlAliasItem *qjackctlAliasList::findClientName (
+ const QString& sClientName )
+{
+ QListIterator iter(*this);
+ while (iter.hasNext()) {
+ qjackctlAliasItem *pClient = iter.next();
+ if (pClient->matchClientName(sClientName))
+ return pClient;
+ }
+
+ return nullptr;
+}
+
+
+// Client aliasing methods.
+void qjackctlAliasList::setClientAlias (
+ const QString& sClientName, const QString& sClientAlias )
+{
+ qjackctlAliasItem *pClient = findClientName(sClientName);
+ if (pClient == nullptr) {
+ pClient = new qjackctlAliasItem(sClientName);
+ append(pClient);
+ }
+ pClient->setClientAlias(sClientAlias);
+}
+
+
+QString qjackctlAliasList::clientAlias ( const QString& sClientName )
+{
+ qjackctlAliasItem *pClient = findClientName(sClientName);
+ if (pClient == nullptr)
+ return sClientName;
+
+ return pClient->clientAlias();
+}
+
+
+// Client/port aliasing methods.
+void qjackctlAliasList::setPortAlias ( const QString& sClientName,
+ const QString& sPortName, const QString& sPortAlias )
+{
+ qjackctlAliasItem *pClient = findClientName(sClientName);
+ if (pClient == nullptr) {
+ pClient = new qjackctlAliasItem(sClientName);
+ append(pClient);
+ }
+ pClient->setPortAlias(sPortName, sPortAlias);
+}
+
+
+QString qjackctlAliasList::portAlias (
+ const QString& sClientName, const QString& sPortName )
+{
+ qjackctlAliasItem *pClient = findClientName(sClientName);
+ if (pClient == nullptr)
+ return sPortName;
+
+ return pClient->portAlias(sPortName);
+}
+
+
+// Load/save aliases definitions.
+void qjackctlAliasList::loadSettings (
+ QSettings& settings, const QString& sAliasesKey )
+{
+ clear();
+
+ settings.beginGroup(sAliasesKey);
+ QStringListIterator client_iter(settings.childGroups());
+ while (client_iter.hasNext()) {
+ const QString& sClientKey
+ = client_iter.next();
+ const QString& sClientName
+ = settings.value(sClientKey + "/Name").toString();
+ const QString& sClientAlias
+ = settings.value(sClientKey + "/Alias").toString();
+ if (!sClientName.isEmpty() && !sClientAlias.isEmpty()) {
+ qjackctlAliasItem *pClient =
+ new qjackctlAliasItem(sClientName, sClientAlias);
+ append(pClient);
+ settings.beginGroup(sClientKey);
+ QStringListIterator port_iter(settings.childGroups());
+ while (port_iter.hasNext()) {
+ const QString& sPortKey
+ = port_iter.next();
+ const QString& sPortName
+ = settings.value(sPortKey + "/Name").toString();
+ const QString& sPortAlias
+ = settings.value(sPortKey + "/Alias").toString();
+ if (!sPortName.isEmpty() && !sPortAlias.isEmpty())
+ pClient->setPortAlias(sPortName, sPortAlias);
+ }
+ settings.endGroup();
+ }
+ }
+ settings.endGroup();
+}
+
+
+void qjackctlAliasList::saveSettings (
+ QSettings& settings, const QString& sAliasesKey )
+{
+ std::sort(begin(), end());
+
+ settings.beginGroup(sAliasesKey);
+ int iClient = 0;
+ QListIterator iter(*this);
+ while (iter.hasNext()) {
+ (iter.next())->saveSettings(settings,
+ "Client" + QString::number(++iClient));
+ }
+ settings.endGroup();
+}
+
+
+// end of qjackctlAliases.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlAliases.h qjackctl-0.6.0/src/qjackctlAliases.h
--- qjackctl-0.4.5/src/qjackctlAliases.h 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlAliases.h 2019-10-17 07:45:45.951673224 +0000
@@ -0,0 +1,131 @@
+// qjackctlAliases.h
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#ifndef __qjackctlAliases_h
+#define __qjackctlAliases_h
+
+#include
+#include
+#include
+
+
+// Client/port item alias map.
+class qjackctlAliasItem
+{
+public:
+
+ // Constructor.
+ qjackctlAliasItem(const QString& sClientName,
+ const QString& sClientAlias = QString());
+
+ // Default destructor.
+ ~qjackctlAliasItem();
+
+ // Client name accessor.
+ QString clientName() const;
+
+ // Client name matcher.
+ bool matchClientName(const QString& sClientName) const;
+
+ // Client aliasing methods.
+ const QString& clientAlias() const;
+ void setClientAlias(const QString& sClientAlias);
+
+ // Port aliasing methods.
+ QString portAlias(const QString& sPortName) const;
+ void setPortAlias(const QString& sPortName, const QString& sPortAlias);
+
+ // Save client/port aliases definitions.
+ void saveSettings(QSettings& settings, const QString& sClientKey);
+
+ // Need for generic sort.
+ bool operator< (const qjackctlAliasItem& other);
+
+ // Escape and format a string as a regular expresion.
+ static QString escapeRegExpDigits(const QString& s, int iThreshold = 3);
+
+private:
+
+ // Client name regexp.
+ QRegExp m_rxClientName;
+ // Client alias.
+ QString m_sClientAlias;
+
+ // Port aliases map.
+ QMap m_ports;
+};
+
+
+// Client/port list alias map.
+class qjackctlAliasList : public QList
+{
+public:
+
+ // Constructor.
+ qjackctlAliasList();
+ // Default destructor.
+ ~qjackctlAliasList();
+
+ // Client aliasing methods.
+ QString clientAlias(const QString& sClientName);
+ void setClientAlias(const QString& sClientName,
+ const QString& sClientAlias);
+
+ // Port aliasing methods.
+ QString portAlias(const QString& sClientName,
+ const QString& sPortName);
+ void setPortAlias(const QString& sClientName,
+ const QString& sPortName,const QString& sPortAlias);
+
+ // Load/save aliases definitions.
+ void loadSettings(QSettings& settings, const QString& sAliasesKey);
+ void saveSettings(QSettings& settings, const QString& sAliasesKey);
+
+private:
+
+ // Client item finder.
+ qjackctlAliasItem *findClientName (const QString& sClientName);
+};
+
+
+// Client/port alias map.
+class qjackctlAliases
+{
+public:
+
+ // Constructor.
+ qjackctlAliases() : dirty(false) {}
+
+ qjackctlAliasList audioOutputs;
+ qjackctlAliasList audioInputs;
+ qjackctlAliasList midiOutputs;
+ qjackctlAliasList midiInputs;
+ qjackctlAliasList alsaOutputs;
+ qjackctlAliasList alsaInputs;
+
+ QString key;
+ bool dirty;
+};
+
+
+#endif // __qjackctlAliases_h
+
+// end of qjackctlAliases.h
diff -Nru qjackctl-0.4.5/src/qjackctlAlsaConnect.cpp qjackctl-0.6.0/src/qjackctlAlsaConnect.cpp
--- qjackctl-0.4.5/src/qjackctlAlsaConnect.cpp 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAlsaConnect.cpp 2019-10-17 07:45:45.951673224 +0000
@@ -1,7 +1,7 @@
// qjackctlAlsaConnect.cpp
//
/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -31,12 +31,9 @@
//
// Constructor.
-qjackctlAlsaPort::qjackctlAlsaPort (
- qjackctlAlsaClient *pClient, int iAlsaPort )
+qjackctlAlsaPort::qjackctlAlsaPort ( qjackctlAlsaClient *pClient )
: qjackctlPortItem(pClient)
{
- m_iAlsaPort = iAlsaPort;
-
qjackctlAlsaConnect *pAlsaConnect
= static_cast (
((pClient->clientList())->listView())->binding());
@@ -66,7 +63,7 @@
int qjackctlAlsaPort::alsaPort (void) const
{
- return m_iAlsaPort;
+ return portName().section(':', 0, 0).toInt();
}
@@ -75,12 +72,9 @@
//
// Constructor.
-qjackctlAlsaClient::qjackctlAlsaClient (
- qjackctlAlsaClientList *pClientList, int iAlsaClient )
+qjackctlAlsaClient::qjackctlAlsaClient ( qjackctlAlsaClientList *pClientList )
: qjackctlClientItem(pClientList)
{
- m_iAlsaClient = iAlsaClient;
-
qjackctlAlsaConnect *pAlsaConnect
= static_cast (
(pClientList->listView())->binding());
@@ -105,7 +99,7 @@
// Jack client accessor.
int qjackctlAlsaClient::alsaClient (void) const
{
- return m_iAlsaClient;
+ return clientName().section(':', 0, 0).toInt();
}
@@ -120,7 +114,7 @@
return pPort;
}
- return NULL;
+ return nullptr;
}
@@ -152,7 +146,7 @@
return pClient;
}
- return NULL;
+ return nullptr;
}
@@ -161,8 +155,8 @@
int iAlsaPort )
{
qjackctlAlsaClient *pClient = findClient(iAlsaClient);
- if (pClient == NULL)
- return NULL;
+ if (pClient == nullptr)
+ return nullptr;
return pClient->findPort(iAlsaPort);
}
@@ -172,11 +166,11 @@
int qjackctlAlsaClientList::updateClientPorts (void)
{
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
- if (pMainForm == NULL)
+ if (pMainForm == nullptr)
return 0;
snd_seq_t *pAlsaSeq = pMainForm->alsaSeq();
- if (pAlsaSeq == NULL)
+ if (pAlsaSeq == nullptr)
return 0;
int iDirtyCount = 0;
@@ -216,7 +210,7 @@
qjackctlAlsaPort *pPort = 0;
const int iAlsaPort = snd_seq_port_info_get_port(pPortInfo);
if (pClient == 0) {
- pClient = new qjackctlAlsaClient(this, iAlsaClient);
+ pClient = new qjackctlAlsaClient(this);
pClient->setClientName(sClientName);
iDirtyCount++;
} else {
@@ -231,7 +225,7 @@
sPortName += QString::fromUtf8(
snd_seq_port_info_get_name(pPortInfo));
if (pPort == 0) {
- pPort = new qjackctlAlsaPort(pClient, iAlsaPort);
+ pPort = new qjackctlAlsaPort(pClient);
pPort->setPortName(sPortName);
iDirtyCount++;
} else if (sPortName != pPort->portName()) {
@@ -298,7 +292,7 @@
for (int i = 0; i < QJACKCTL_ALSA_PIXMAPS; i++) {
if (m_apPixmaps[i])
delete m_apPixmaps[i];
- m_apPixmaps[i] = NULL;
+ m_apPixmaps[i] = nullptr;
}
}
@@ -310,11 +304,11 @@
#ifdef CONFIG_ALSA_SEQ
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
- if (pMainForm == NULL)
+ if (pMainForm == nullptr)
return false;
snd_seq_t *pAlsaSeq = pMainForm->alsaSeq();
- if (pAlsaSeq == NULL)
+ if (pAlsaSeq == nullptr)
return false;
qjackctlAlsaPort *pOAlsa = static_cast (pOPort);
@@ -350,11 +344,11 @@
#ifdef CONFIG_ALSA_SEQ
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
- if (pMainForm == NULL)
+ if (pMainForm == nullptr)
return false;
snd_seq_t *pAlsaSeq = pMainForm->alsaSeq();
- if (pAlsaSeq == NULL)
+ if (pAlsaSeq == nullptr)
return false;
qjackctlAlsaPort *pOAlsa = static_cast (pOPort);
@@ -389,11 +383,11 @@
#ifdef CONFIG_ALSA_SEQ
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
- if (pMainForm == NULL)
+ if (pMainForm == nullptr)
return;
snd_seq_t *pAlsaSeq = pMainForm->alsaSeq();
- if (pAlsaSeq == NULL)
+ if (pAlsaSeq == nullptr)
return;
snd_seq_query_subscribe_t *pAlsaSubs;
diff -Nru qjackctl-0.4.5/src/qjackctlAlsaConnect.h qjackctl-0.6.0/src/qjackctlAlsaConnect.h
--- qjackctl-0.4.5/src/qjackctlAlsaConnect.h 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlAlsaConnect.h 2019-10-17 07:45:45.951673224 +0000
@@ -1,7 +1,7 @@
// qjackctlAlsaConnect.h
//
/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -51,18 +51,13 @@
public:
// Constructor.
- qjackctlAlsaPort(qjackctlAlsaClient *pClient, int iAlsaPort);
+ qjackctlAlsaPort(qjackctlAlsaClient *pClient);
// Default destructor.
~qjackctlAlsaPort();
// Jack handles accessors.
int alsaClient() const;
- int alsaPort() const;
-
-private:
-
- // Instance variables.
- int m_iAlsaPort;
+ int alsaPort() const;
};
@@ -72,7 +67,7 @@
public:
// Constructor.
- qjackctlAlsaClient(qjackctlAlsaClientList *pClientList, int iAlsaClient);
+ qjackctlAlsaClient(qjackctlAlsaClientList *pClientList);
// Default destructor.
~qjackctlAlsaClient();
@@ -81,11 +76,6 @@
// Port finder by id.
qjackctlAlsaPort *findPort(int iAlsaPort);
-
-private:
-
- // Instance variables.
- int m_iAlsaClient;
};
diff -Nru qjackctl-0.4.5/src/qjackctlAlsaGraph.cpp qjackctl-0.6.0/src/qjackctlAlsaGraph.cpp
--- qjackctl-0.4.5/src/qjackctlAlsaGraph.cpp 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlAlsaGraph.cpp 2019-10-17 07:45:45.951673224 +0000
@@ -0,0 +1,436 @@
+// qjackctlAlsaGraph.cpp
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#include "qjackctlAlsaGraph.h"
+
+#include "qjackctlMainForm.h"
+
+
+#ifdef CONFIG_ALSA_SEQ
+
+#include
+
+
+//----------------------------------------------------------------------------
+// qjackctlAlsaGraph -- ALSA graph driver
+
+QMutex qjackctlAlsaGraph::g_mutex;
+
+
+// Constructor.
+qjackctlAlsaGraph::qjackctlAlsaGraph ( qjackctlGraphCanvas *canvas )
+ : qjackctlGraphSect(canvas)
+{
+ resetPortTypeColors();
+}
+
+
+// ALSA port (dis)connection.
+void qjackctlAlsaGraph::connectPorts (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2, bool connect )
+{
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm == nullptr)
+ return;
+
+ snd_seq_t *seq = pMainForm->alsaSeq();
+ if (seq == nullptr)
+ return;
+
+ if (port1 == nullptr || port2 == nullptr)
+ return;
+
+ const qjackctlGraphNode *node1 = port1->portNode();
+ const qjackctlGraphNode *node2 = port2->portNode();
+
+ if (node1 == nullptr || node2 == nullptr)
+ return;
+
+ QMutexLocker locker(&g_mutex);
+
+ const int client_id1
+ = node1->nodeName().section(':', 0, 0).toInt();
+ const int port_id1
+ = port1->portName().section(':', 0, 0).toInt();
+
+ const int client_id2
+ = node2->nodeName().section(':', 0, 0).toInt();
+ const int port_id2
+ = port2->portName().section(':', 0, 0).toInt();
+
+#ifdef CONFIG_DEBUG
+ qDebug("qjackctlAlsaGraph::connectPorts(%d:%d, %d:%d, %d)",
+ client_id1, port_id1, client_id2, port_id2, connect);
+#endif
+
+ snd_seq_port_subscribe_t *seq_subs;
+ snd_seq_addr_t seq_addr;
+
+ snd_seq_port_subscribe_alloca(&seq_subs);
+
+ seq_addr.client = client_id1;
+ seq_addr.port = port_id1;
+ snd_seq_port_subscribe_set_sender(seq_subs, &seq_addr);
+
+ seq_addr.client = client_id2;
+ seq_addr.port = port_id2;
+ snd_seq_port_subscribe_set_dest(seq_subs, &seq_addr);
+
+ if (connect) {
+ snd_seq_subscribe_port(seq, seq_subs);
+ } else {
+ snd_seq_unsubscribe_port(seq, seq_subs);
+ }
+}
+
+
+// ALSA node type inquirer. (static)
+bool qjackctlAlsaGraph::isNodeType ( uint node_type )
+{
+ return (node_type == qjackctlAlsaGraph::nodeType());
+}
+
+
+// ALSA node type.
+uint qjackctlAlsaGraph::nodeType (void)
+{
+ static
+ const uint AlsaNodeType
+ = qjackctlGraphItem::itemType("ALSA_NODE_TYPE");
+
+ return AlsaNodeType;
+}
+
+
+// ALSA port type inquirer. (static)
+bool qjackctlAlsaGraph::isPortType ( uint port_type )
+{
+ return (port_type == qjackctlAlsaGraph::midiPortType());
+}
+
+
+// ALSA port type.
+uint qjackctlAlsaGraph::midiPortType (void)
+{
+ static
+ const uint AlsaMidiPortType
+ = qjackctlGraphItem::itemType("ALSA_PORT_TYPE");
+
+ return AlsaMidiPortType;
+}
+
+
+// ALSA client:port finder and creator if not existing.
+bool qjackctlAlsaGraph::findClientPort (
+ snd_seq_client_info_t *client_info,
+ snd_seq_port_info_t *port_info,
+ qjackctlGraphItem::Mode port_mode,
+ qjackctlGraphNode **node,
+ qjackctlGraphPort **port,
+ bool add_new )
+{
+ const int client_id
+ = snd_seq_client_info_get_client(client_info);
+ const int port_id
+ = snd_seq_port_info_get_port(port_info);
+
+ const QString& client_name
+ = QString::number(client_id) + ':'
+ + QString::fromUtf8(snd_seq_client_info_get_name(client_info));
+ const QString& port_name
+ = QString::number(port_id) + ':'
+ + QString::fromUtf8(snd_seq_port_info_get_name(port_info));
+
+ const uint node_type
+ = qjackctlAlsaGraph::nodeType();
+ const uint port_type
+ = qjackctlAlsaGraph::midiPortType();
+
+ qjackctlGraphItem::Mode node_mode = port_mode;
+
+ *node = qjackctlGraphSect::findNode(client_name, node_mode, node_type);
+ *port = nullptr;
+
+ if (*node == nullptr && client_id >= 128) {
+ node_mode = qjackctlGraphItem::Duplex;
+ *node = qjackctlGraphSect::findNode(client_name, node_mode, node_type);
+ }
+
+ if (*node)
+ *port = (*node)->findPort(port_name, port_mode, port_type);
+
+ if (add_new && *node == nullptr) {
+ *node = new qjackctlGraphNode(client_name, node_mode, node_type);
+ (*node)->setNodeIcon(QIcon(":/images/graphAlsa.png"));
+ qjackctlGraphSect::addItem(*node);
+ }
+
+ if (add_new && *port == nullptr && *node) {
+ *port = (*node)->addPort(port_name, port_mode, port_type);
+ (*port)->updatePortTypeColors(canvas());
+ }
+
+ if (add_new && *node) {
+ int nchanged = 0;
+ QString node_title = (*node)->nodeTitle();
+ foreach (qjackctlAliasList *node_aliases, item_aliases(*node))
+ node_title = node_aliases->clientAlias(client_name);
+ if ((*node)->nodeTitle() != node_title) {
+ (*node)->setNodeTitle(node_title);
+ ++nchanged;
+ }
+ if (*port) {
+ QString port_title = (*port)->portTitle();
+ foreach (qjackctlAliasList *port_aliases, item_aliases(*port))
+ port_title = port_aliases->portAlias(client_name, port_name);
+ if ((*port)->portTitle() != port_title) {
+ (*port)->setPortTitle(port_title);
+ ++nchanged;
+ }
+ }
+ if (nchanged > 0)
+ (*node)->updatePath();
+ }
+
+ return (*node && *port);
+}
+
+
+// ALSA graph updater.
+void qjackctlAlsaGraph::updateItems (void)
+{
+ QMutexLocker locker(&g_mutex);
+
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm == nullptr)
+ return;
+
+ snd_seq_t *seq = pMainForm->alsaSeq();
+ if (seq == nullptr)
+ return;
+
+#ifdef CONFIG_DEBUG
+ qDebug("qjackctlAlsaGraph::updateItems()");
+#endif
+
+ // 1. Client/ports inventory...
+ //
+ snd_seq_client_info_t *client_info1;
+ snd_seq_port_info_t *port_info1;
+
+ snd_seq_client_info_alloca(&client_info1);
+ snd_seq_port_info_alloca(&port_info1);
+
+ snd_seq_client_info_set_client(client_info1, -1);
+
+ while (snd_seq_query_next_client(seq, client_info1) >= 0) {
+ const int client_id
+ = snd_seq_client_info_get_client(client_info1);
+ if (0 >= client_id) // Skip 0:System client...
+ continue;
+ snd_seq_port_info_set_client(port_info1, client_id);
+ snd_seq_port_info_set_port(port_info1, -1);
+ while (snd_seq_query_next_port(seq, port_info1) >= 0) {
+ const unsigned int port_caps1
+ = snd_seq_port_info_get_capability(port_info1);
+ if (port_caps1 & SND_SEQ_PORT_CAP_NO_EXPORT)
+ continue;
+ qjackctlGraphItem::Mode port_mode1 = qjackctlGraphItem::None;
+ const unsigned int port_is_input
+ = (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE);
+ if ((port_caps1 & port_is_input) == port_is_input) {
+ port_mode1 = qjackctlGraphItem::Input;
+ qjackctlGraphNode *node1 = nullptr;
+ qjackctlGraphPort *port1 = nullptr;
+ if (findClientPort(client_info1, port_info1,
+ port_mode1, &node1, &port1, true)) {
+ node1->setMarked(true);
+ port1->setMarked(true);
+ }
+ }
+ const unsigned int port_is_output
+ = (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ);
+ if ((port_caps1 & port_is_output) == port_is_output) {
+ port_mode1 = qjackctlGraphItem::Output;
+ qjackctlGraphNode *node1 = nullptr;
+ qjackctlGraphPort *port1 = nullptr;
+ if (findClientPort(client_info1, port_info1,
+ port_mode1, &node1, &port1, true)) {
+ node1->setMarked(true);
+ port1->setMarked(true);
+ }
+ }
+ }
+ }
+
+ // 2. Connections inventory...
+ //
+ snd_seq_client_info_t *client_info2;
+ snd_seq_port_info_t *port_info2;
+
+ snd_seq_client_info_alloca(&client_info2);
+ snd_seq_port_info_alloca(&port_info2);
+
+ snd_seq_query_subscribe_t *seq_subs;
+ snd_seq_addr_t seq_addr;
+
+ snd_seq_query_subscribe_alloca(&seq_subs);
+
+ snd_seq_client_info_set_client(client_info1, -1);
+
+ while (snd_seq_query_next_client(seq, client_info1) >= 0) {
+ const int client_id
+ = snd_seq_client_info_get_client(client_info1);
+ if (0 >= client_id) // Skip 0:system client...
+ continue;
+ snd_seq_port_info_set_client(port_info1, client_id);
+ snd_seq_port_info_set_port(port_info1, -1);
+ while (snd_seq_query_next_port(seq, port_info1) >= 0) {
+ const unsigned int port_caps1
+ = snd_seq_port_info_get_capability(port_info1);
+ if (port_caps1 & SND_SEQ_PORT_CAP_NO_EXPORT)
+ continue;
+ if (port_caps1 & (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ)) {
+ const qjackctlGraphItem::Mode port_mode1
+ = qjackctlGraphItem::Output;
+ qjackctlGraphNode *node1 = nullptr;
+ qjackctlGraphPort *port1 = nullptr;
+ if (!findClientPort(client_info1, port_info1,
+ port_mode1, &node1, &port1, false))
+ continue;
+ snd_seq_query_subscribe_set_type(seq_subs, SND_SEQ_QUERY_SUBS_READ);
+ snd_seq_query_subscribe_set_index(seq_subs, 0);
+ seq_addr.client = client_id;
+ seq_addr.port = snd_seq_port_info_get_port(port_info1);
+ snd_seq_query_subscribe_set_root(seq_subs, &seq_addr);
+ while (snd_seq_query_port_subscribers(seq, seq_subs) >= 0) {
+ seq_addr = *snd_seq_query_subscribe_get_addr(seq_subs);
+ if (snd_seq_get_any_client_info(seq,
+ seq_addr.client, client_info2) >= 0 &&
+ snd_seq_get_any_port_info(seq,
+ seq_addr.client, seq_addr.port, port_info2) >= 0) {
+ const qjackctlGraphItem::Mode port_mode2
+ = qjackctlGraphItem::Input;
+ qjackctlGraphNode *node2 = nullptr;
+ qjackctlGraphPort *port2 = nullptr;
+ if (findClientPort(client_info2, port_info2,
+ port_mode2, &node2, &port2, false)) {
+ qjackctlGraphConnect *connect = port1->findConnect(port2);
+ if (connect == nullptr) {
+ connect = new qjackctlGraphConnect();
+ connect->setPort1(port1);
+ connect->setPort2(port2);
+ connect->updatePortTypeColors();
+ connect->updatePath();
+ qjackctlGraphSect::addItem(connect);
+ }
+ if (connect)
+ connect->setMarked(true);
+ }
+ }
+ snd_seq_query_subscribe_set_index(seq_subs,
+ snd_seq_query_subscribe_get_index(seq_subs) + 1);
+ }
+ }
+ }
+ }
+
+ // 3. Clean-up all un-marked items...
+ //
+ qjackctlGraphSect::resetItems(qjackctlAlsaGraph::nodeType());
+}
+
+
+void qjackctlAlsaGraph::clearItems (void)
+{
+ QMutexLocker locker(&g_mutex);
+
+#ifdef CONFIG_DEBUG
+ qDebug("qjackctlAlsaGraph::clearItems()");
+#endif
+
+ qjackctlGraphSect::clearItems(qjackctlAlsaGraph::nodeType());
+}
+
+
+// Special port-type colors defaults (virtual).
+void qjackctlAlsaGraph::resetPortTypeColors (void)
+{
+ qjackctlGraphCanvas *canvas = qjackctlGraphSect::canvas();
+ if (canvas) {
+ canvas->setPortTypeColor(
+ qjackctlAlsaGraph::midiPortType(),
+ QColor(Qt::darkMagenta).darker(120));
+ }
+}
+
+
+// Client/port item aliases accessor.
+QList qjackctlAlsaGraph::item_aliases (
+ qjackctlGraphItem *item ) const
+{
+ QList alist;
+
+ qjackctlAliases *aliases = nullptr;
+ qjackctlGraphCanvas *canvas = qjackctlGraphSect::canvas();
+ if (canvas)
+ aliases = canvas->aliases();
+ if (aliases == nullptr)
+ return alist; // empty!
+
+ uint item_type = 0;
+ qjackctlGraphItem::Mode item_mode = qjackctlGraphItem::None;
+
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node) {
+ item_type = node->nodeType();
+ item_mode = node->nodeMode();
+ }
+ }
+ else
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port) {
+ item_type = port->portType();
+ item_mode = port->portMode();
+ }
+ }
+
+ if (!item_type || !item_mode)
+ return alist; // empty again!
+
+ if (item_type == qjackctlAlsaGraph::midiPortType()) {
+ // ALSA MIDI type...
+ if (item_mode & qjackctlGraphItem::Input)
+ alist.append(&(aliases->alsaInputs));
+ if (item_mode & qjackctlGraphItem::Output)
+ alist.append(&(aliases->alsaOutputs));
+ }
+
+ return alist; // hopefully non empty!
+}
+
+
+#endif // CONFIG_ALSA_SEQ
+
+
+// end of qjackctlAlsaGraph.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlAlsaGraph.h qjackctl-0.6.0/src/qjackctlAlsaGraph.h
--- qjackctl-0.4.5/src/qjackctlAlsaGraph.h 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlAlsaGraph.h 2019-10-17 07:45:45.951673224 +0000
@@ -0,0 +1,89 @@
+// qjackctlAlsaGraph.h
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#ifndef __qjackctlAlsaGraph_h
+#define __qjackctlAlsaGraph_h
+
+#include "qjackctlAbout.h"
+#include "qjackctlGraph.h"
+
+
+#ifdef CONFIG_ALSA_SEQ
+
+#include
+
+#include
+
+
+//----------------------------------------------------------------------------
+// qjackctlAlsaGraph -- ALSA graph driver
+
+class qjackctlAlsaGraph : public qjackctlGraphSect
+{
+public:
+
+ // Constructor.
+ qjackctlAlsaGraph(qjackctlGraphCanvas *canvas);
+
+ // ALSA port (dis)connection.
+ void connectPorts(
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2, bool connect);
+
+ // ALSA graph updaters.
+ void updateItems();
+ void clearItems();
+
+ // Special port-type colors defaults (virtual).
+ void resetPortTypeColors();
+
+ // ALSA node type inquirer.
+ static bool isNodeType(uint node_type);
+ // ALSA node type.
+ static uint nodeType();
+
+ // ALSA port type inquirer.
+ static bool isPortType(uint port_type);
+ // ALSA port type.
+ static uint midiPortType();
+
+protected:
+
+ // ALSA client:port finder and creator if not existing.
+ bool findClientPort(snd_seq_client_info_t *client_info,
+ snd_seq_port_info_t *port_info, qjackctlGraphItem::Mode port_mode,
+ qjackctlGraphNode **node, qjackctlGraphPort **port, bool add_new);
+
+ // Client/port item aliases accessor.
+ QList item_aliases(qjackctlGraphItem *item) const;
+
+private:
+
+ // Notifier sanity mutex.
+ static QMutex g_mutex;
+};
+
+
+#endif // CONFIG_ALSA_SEQ
+
+
+#endif // __qjackctlAlsaGraph_h
+
+// end of qjackctlAlsaGraph.h
diff -Nru qjackctl-0.4.5/src/qjackctlConnectAlias.cpp qjackctl-0.6.0/src/qjackctlConnectAlias.cpp
--- qjackctl-0.4.5/src/qjackctlConnectAlias.cpp 2017-04-27 14:44:14.553754974 +0000
+++ qjackctl-0.6.0/src/qjackctlConnectAlias.cpp 1970-01-01 00:00:00.000000000 +0000
@@ -1,275 +0,0 @@
-// qjackctlConnectAlias.cpp
-//
-/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-*****************************************************************************/
-
-#include "qjackctlConnectAlias.h"
-
-#include
-
-
-//----------------------------------------------------------------------
-// class qjackctlClientAlias -- Client item alias map.
-
-// Constructor.
-qjackctlClientAlias::qjackctlClientAlias ( const QString& sClientName,
- const QString& sClientAlias )
-{
- if (sClientAlias.isEmpty()) {
- m_rxClientName.setPattern(escapeRegExpDigits(sClientName));
- m_sClientAlias = sClientName;
- } else {
- m_rxClientName.setPattern(sClientName);
- m_sClientAlias = sClientAlias;
- }
-}
-
-// Default destructor.
-qjackctlClientAlias::~qjackctlClientAlias (void)
-{
- m_ports.clear();
-}
-
-
-// Client name method.
-QString qjackctlClientAlias::clientName (void) const
-{
- return m_rxClientName.pattern();
-}
-
-
-// Client name matcher.
-bool qjackctlClientAlias::matchClientName ( const QString& sClientName ) const
-{
- return m_rxClientName.exactMatch(sClientName);
-}
-
-
-// Client aliasing methods.
-const QString& qjackctlClientAlias::clientAlias (void) const
-{
- return m_sClientAlias;
-}
-
-void qjackctlClientAlias::setClientAlias ( const QString& sClientAlias )
-{
- m_sClientAlias = sClientAlias;
-}
-
-
-// Port aliasing methods.
-QString qjackctlClientAlias::portAlias ( const QString& sPortName ) const
-{
- QString sPortAlias = m_ports[sPortName];
- if (sPortAlias.isEmpty())
- sPortAlias = sPortName;
- return sPortAlias;
-}
-
-void qjackctlClientAlias::setPortAlias ( const QString& sPortName,
- const QString& sPortAlias )
-{
- m_ports[sPortName] = sPortAlias;
-}
-
-
-// Save client/port aliases definitions.
-void qjackctlClientAlias::saveSettings ( QSettings& settings,
- const QString& sClientKey )
-{
- settings.beginGroup(sClientKey);
- settings.setValue("/Name", m_rxClientName.pattern());
- settings.setValue("/Alias", m_sClientAlias);
- int iPort = 0;
- QMap::ConstIterator iter = m_ports.begin();
- while (iter != m_ports.end()) {
- settings.beginGroup("/Port" + QString::number(++iPort));
- settings.setValue("/Name", iter.key());
- settings.setValue("/Alias", iter.value());
- settings.endGroup();
- ++iter;
- }
- settings.endGroup();
-}
-
-
-// Escape and format a string as a regular expresion.
-QString qjackctlClientAlias::escapeRegExpDigits ( const QString& s,
- int iThreshold )
-{
- QString sDigits;
- QString sResult;
- QString sEscape = QRegExp::escape(s);
- int iDigits = 0;
-
- for (int i = 0; i < sEscape.length(); i++) {
- const QChar& ch = sEscape.at(i);
- if (ch.isDigit()) {
- if (iDigits < iThreshold)
- sDigits += ch;
- else
- sDigits = "[0-9]+";
- iDigits++;
- } else {
- if (iDigits > 0) {
- sResult += sDigits;
- sDigits = QString::null;
- iDigits = 0;
- }
- sResult += ch;
- }
- }
-
- if (iDigits > 0)
- sResult += sDigits;
-
- return sResult;
-}
-
-
-// Need for generic sort.
-bool qjackctlClientAlias::operator< ( const qjackctlClientAlias& other )
-{
- return (m_sClientAlias < other.clientAlias());
-}
-
-
-//----------------------------------------------------------------------
-// class qjackctlConnectAlias -- Client list alias map.
-
-// Constructor.
-qjackctlConnectAlias::qjackctlConnectAlias (void)
-{
-}
-
-// Default destructor.
-qjackctlConnectAlias::~qjackctlConnectAlias (void)
-{
- qDeleteAll(*this);
- clear();
-}
-
-
-// Client finders.
-qjackctlClientAlias *qjackctlConnectAlias::findClientName (
- const QString& sClientName )
-{
- QListIterator iter(*this);
- while (iter.hasNext()) {
- qjackctlClientAlias *pClient = iter.next();
- if (pClient->matchClientName(sClientName))
- return pClient;
- }
-
- return NULL;
-}
-
-// Client aliasing methods.
-void qjackctlConnectAlias::setClientAlias ( const QString& sClientName,
- const QString& sClientAlias )
-{
- qjackctlClientAlias *pClient = findClientName(sClientName);
- if (pClient == NULL) {
- pClient = new qjackctlClientAlias(sClientName);
- append(pClient);
- }
- pClient->setClientAlias(sClientAlias);
-}
-
-QString qjackctlConnectAlias::clientAlias ( const QString& sClientName )
-{
- qjackctlClientAlias *pClient = findClientName(sClientName);
- if (pClient == NULL)
- return sClientName;
-
- return pClient->clientAlias();
-}
-
-
-// Client/port aliasing methods.
-void qjackctlConnectAlias::setPortAlias ( const QString& sClientName,
- const QString& sPortName, const QString& sPortAlias )
-{
- qjackctlClientAlias *pClient = findClientName(sClientName);
- if (pClient == NULL) {
- pClient = new qjackctlClientAlias(sClientName);
- append(pClient);
- }
- pClient->setPortAlias(sPortName, sPortAlias);
-}
-
-QString qjackctlConnectAlias::portAlias ( const QString& sClientName,
- const QString& sPortName )
-{
- qjackctlClientAlias *pClient = findClientName(sClientName);
- if (pClient == NULL)
- return sPortName;
-
- return pClient->portAlias(sPortName);
-}
-
-
-// Load/save aliases definitions.
-void qjackctlConnectAlias::loadSettings ( QSettings& settings,
- const QString& sAliasesKey )
-{
- clear();
-
- settings.beginGroup(sAliasesKey);
- QStringListIterator iter(settings.childGroups());
- while (iter.hasNext()) {
- QString sClientKey = iter.next();
- QString sClientName = settings.value(sClientKey + "/Name").toString();
- QString sClientAlias = settings.value(sClientKey + "/Alias").toString();
- if (!sClientName.isEmpty() && !sClientAlias.isEmpty()) {
- qjackctlClientAlias *pClient =
- new qjackctlClientAlias(sClientName, sClientAlias);
- append(pClient);
- settings.beginGroup(sClientKey);
- QStringListIterator it(settings.childGroups());
- while (it.hasNext()) {
- QString sPortKey = it.next();
- QString sPortName = settings.value(sPortKey + "/Name").toString();
- QString sPortAlias = settings.value(sPortKey + "/Alias").toString();
- if (!sPortName.isEmpty() && !sPortAlias.isEmpty())
- pClient->setPortAlias(sPortName, sPortAlias);
- }
- settings.endGroup();
- }
- }
- settings.endGroup();
-}
-
-void qjackctlConnectAlias::saveSettings ( QSettings& settings,
- const QString& sAliasesKey )
-{
- qSort(*this);
-
- settings.beginGroup(sAliasesKey);
- int iClient = 0;
- QListIterator iter(*this);
- while (iter.hasNext()) {
- (iter.next())->saveSettings(settings,
- "Client" + QString::number(++iClient));
- }
- settings.endGroup();
-}
-
-
-// end of qjackctlConnectAlias.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlConnectAlias.h qjackctl-0.6.0/src/qjackctlConnectAlias.h
--- qjackctl-0.4.5/src/qjackctlConnectAlias.h 2017-04-27 14:44:14.553754974 +0000
+++ qjackctl-0.6.0/src/qjackctlConnectAlias.h 1970-01-01 00:00:00.000000000 +0000
@@ -1,112 +0,0 @@
-// qjackctlConnectAlias.h
-//
-/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-*****************************************************************************/
-
-#ifndef __qjackctlConnectAlias_h
-#define __qjackctlConnectAlias_h
-
-#include
-#include
-#include
-
-
-// Client item alias map.
-class qjackctlClientAlias
-{
-public:
-
- // Constructor.
- qjackctlClientAlias (const QString& sClientName,
- const QString& sClientAlias = QString::null);
-
- // Default destructor.
- ~qjackctlClientAlias();
-
- // Client name accessor.
- QString clientName() const;
-
- // Client name matcher.
- bool matchClientName(const QString& sClientName) const;
-
- // Client aliasing methods.
- const QString& clientAlias() const;
- void setClientAlias(const QString& sClientAlias);
-
- // Port aliasing methods.
- QString portAlias (const QString& sPortName) const;
- void setPortAlias (const QString& sPortName,
- const QString& sPortAlias);
-
- // Save client/port aliases definitions.
- void saveSettings(QSettings& settings, const QString& sClientKey);
-
- // Need for generid sort.
- bool operator< (const qjackctlClientAlias& other);
-
- // Escape and format a string as a regular expresion.
- static QString escapeRegExpDigits(const QString& s, int iThreshold = 3);
-
-private:
-
- // Client name regexp.
- QRegExp m_rxClientName;
- // Client alias.
- QString m_sClientAlias;
-
- // Port aliases map.
- QMap m_ports;
-};
-
-
-// Client list alias map.
-class qjackctlConnectAlias : public QList
-{
-public:
-
- // Constructor.
- qjackctlConnectAlias ();
- // Default destructor.
- ~qjackctlConnectAlias ();
-
- // Client aliasing methods.
- QString clientAlias (const QString& sClientName);
- void setClientAlias (const QString& sClientName,
- const QString& sClientAlias);
-
- // Port aliasing methods.
- QString portAlias (const QString& sClientName,
- const QString& sPortName);
- void setPortAlias (const QString& sClientName,
- const QString& sPortName, const QString& sPortAlias);
-
- // Load/save aliases definitions.
- void loadSettings(QSettings& settings, const QString& sAliasesKey);
- void saveSettings(QSettings& settings, const QString& sAliasesKey);
-
-private:
-
- // Client item finder.
- qjackctlClientAlias *findClientName (const QString& sClientName);
-};
-
-
-#endif // __qjackctlConnectAlias_h
-
-// end of qjackctlConnectAlias.h
diff -Nru qjackctl-0.4.5/src/qjackctlConnect.cpp qjackctl-0.6.0/src/qjackctlConnect.cpp
--- qjackctl-0.4.5/src/qjackctlConnect.cpp 2017-04-27 14:44:14.552754474 +0000
+++ qjackctl-0.6.0/src/qjackctlConnect.cpp 2019-10-17 07:45:45.952673224 +0000
@@ -1,7 +1,7 @@
// qjackctlConnect.cpp
//
/****************************************************************************
- Copyright (C) 2003-2015, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -36,7 +36,7 @@
#include
#include
-#if QT_VERSION >= 0x050000
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include
#include
#endif
@@ -99,12 +99,12 @@
// Check aliasing...
qjackctlClientListView *pClientListView
= (m_pClient->clientList())->listView();
- qjackctlConnectAlias *pAliases
- = pClientListView->aliases();
- if (pAliases) {
+ qjackctlAliasList *pAliasList
+ = pClientListView->aliasList();
+ if (pAliasList) {
const QString& sClientName = m_pClient->clientName();
- pAliases->setPortAlias(sClientName, m_sPortName, sPortNameAlias);
- pClientListView->setDirty(true);
+ pAliasList->setPortAlias(sClientName, m_sPortName, sPortNameAlias);
+ pClientListView->emitAliasesChanged();
}
}
@@ -116,11 +116,11 @@
// Check aliasing...
qjackctlClientListView *pClientListView
= (m_pClient->clientList())->listView();
- qjackctlConnectAlias *pAliases
- = pClientListView->aliases();
- if (pAliases) {
+ qjackctlAliasList *pAliasList
+ = pClientListView->aliasList();
+ if (pAliasList) {
const QString& sClientName = m_pClient->clientName();
- sPortNameAlias = pAliases->portAlias(sClientName, m_sPortName);
+ sPortNameAlias = pAliasList->portAlias(sClientName, m_sPortName);
bRenameEnabled = pClientListView->isRenameEnabled();
}
@@ -228,7 +228,7 @@
return pPort;
}
- return NULL;
+ return nullptr;
}
qjackctlPortItem *qjackctlPortItem::findConnectPtr ( qjackctlPortItem *pPortPtr )
@@ -240,7 +240,7 @@
return pPort;
}
- return NULL;
+ return nullptr;
}
@@ -268,11 +268,11 @@
// Set the new color.
QTreeWidget *pTreeWidget = QTreeWidgetItem::treeWidget();
- if (pTreeWidget == NULL)
+ if (pTreeWidget == nullptr)
return;
const QPalette& pal = pTreeWidget->palette();
- QTreeWidgetItem::setTextColor(0, m_bHilite
+ QTreeWidgetItem::setForeground(0, m_bHilite
? (pal.base().color().value() < 0x7f ? Qt::cyan : Qt::blue)
: pal.text().color());
}
@@ -324,7 +324,7 @@
return pPort;
}
- return NULL;
+ return nullptr;
}
@@ -361,11 +361,11 @@
{
qjackctlClientListView *pClientListView
= m_pClientList->listView();
- qjackctlConnectAlias *pAliases
- = pClientListView->aliases();
- if (pAliases) {
- pAliases->setClientAlias(m_sClientName, sClientNameAlias);
- pClientListView->setDirty(true);
+ qjackctlAliasList *pAliasList
+ = pClientListView->aliasList();
+ if (pAliasList) {
+ pAliasList->setClientAlias(m_sClientName, sClientNameAlias);
+ pClientListView->emitAliasesChanged();
}
}
@@ -377,10 +377,10 @@
// Check aliasing...
qjackctlClientListView *pClientListView
= m_pClientList->listView();
- qjackctlConnectAlias *pAliases
- = pClientListView->aliases();
- if (pAliases) {
- sClientNameAlias = pAliases->clientAlias(m_sClientName);
+ qjackctlAliasList *pAliasList
+ = pClientListView->aliasList();
+ if (pAliasList) {
+ sClientNameAlias = pAliasList->clientAlias(m_sClientName);
bRenameEnabled = pClientListView->isRenameEnabled();
}
@@ -481,11 +481,11 @@
// Set the new color.
QTreeWidget *pTreeWidget = QTreeWidgetItem::treeWidget();
- if (pTreeWidget == NULL)
+ if (pTreeWidget == nullptr)
return;
const QPalette& pal = pTreeWidget->palette();
- QTreeWidgetItem::setTextColor(0, m_iHilite > 0
+ QTreeWidgetItem::setForeground(0, m_iHilite > 0
? (pal.base().color().value() < 0x7f ? Qt::darkCyan : Qt::darkBlue)
: pal.text().color());
}
@@ -555,7 +555,7 @@
return pClient;
}
- return NULL;
+ return nullptr;
}
// Client:port finder.
@@ -678,52 +678,52 @@
// Natural decimal sorting comparator.
bool qjackctlClientList::lessThan (
- const QTreeWidgetItem& i1, const QTreeWidgetItem& i2 )
+ const QTreeWidgetItem& item1, const QTreeWidgetItem& item2 )
{
- const QString& s1 = i1.text(0);
- const QString& s2 = i2.text(0);
+ const QString& s1 = item1.text(0);
+ const QString& s2 = item2.text(0);
- const int cch1 = s1.length();
- const int cch2 = s2.length();
+ const int n1 = s1.length();
+ const int n2 = s2.length();
- int ich1, ich2;
+ int i1, i2;
- for (ich1 = ich2 = 0; ich1 < cch1 && ich2 < cch2; ich1++, ich2++) {
+ for (i1 = i2 = 0; i1 < n1 && i2 < n2; ++i1, ++i2) {
- // Skip (white)spaces...
- while (s1.at(ich1).isSpace())
- ich1++;
- while (s2.at(ich2).isSpace())
- ich2++;
+ // skip (white)spaces...
+ while (s1.at(i1).isSpace())
+ ++i1;
+ while (s2.at(i2).isSpace())
+ ++i2;
// Normalize (to uppercase) the next characters...
- QChar ch1 = s1.at(ich1).toUpper();
- QChar ch2 = s2.at(ich2).toUpper();
+ QChar c1 = s1.at(i1).toUpper();
+ QChar c2 = s2.at(i2).toUpper();
- if (ch1.isDigit() && ch2.isDigit()) {
+ if (c1.isDigit() && c2.isDigit()) {
// Find the whole length numbers...
- const int iDigits1 = ich1++;
- while (ich1 < cch1 && s1.at(ich1).isDigit())
- ich1++;
- const int iDigits2 = ich2++;
- while (ich2 < cch2 && s2.at(ich2).isDigit())
- ich2++;
+ int j1 = i1++;
+ while (i1 < n1 && s1.at(i1).isDigit())
+ ++i1;
+ int j2 = i2++;
+ while (i2 < n2 && s2.at(i2).isDigit())
+ ++i2;
// Compare as natural decimal-numbers...
- const int n1 = s1.mid(iDigits1, ich1 - iDigits1).toInt();
- const int n2 = s2.mid(iDigits2, ich2 - iDigits2).toInt();
- if (n1 != n2)
- return (n1 < n2);
+ j1 = s1.mid(j1, i1 - j1).toInt();
+ j2 = s2.mid(j2, i2 - j2).toInt();
+ if (j1 != j2)
+ return (j1 < j2);
// Never go out of bounds...
- if (ich1 >= cch1 || ich1 >= cch2)
+ if (i1 >= n1 || i2 >= n2)
break;
// Go on with this next char...
- ch1 = s1.at(ich1).toUpper();
- ch2 = s2.at(ich2).toUpper();
+ c1 = s1.at(i1).toUpper();
+ c2 = s2.at(i2).toUpper();
}
// Compare this char...
- if (ch1 != ch2)
- return (ch1 < ch2);
+ if (c1 != c2)
+ return (c1 < c2);
}
// Probable exact match.
@@ -754,16 +754,16 @@
m_pAutoOpenTimer = 0;
m_iAutoOpenTimeout = 0;
- m_pDragItem = NULL;
- m_pDragItem = NULL;
+ m_pDragItem = nullptr;
+ m_pDragItem = nullptr;
- m_pAliases = NULL;
+ m_pAliasList = nullptr;
m_bRenameEnabled = false;
QHeaderView *pHeader = QTreeWidget::header();
pHeader->setDefaultAlignment(Qt::AlignLeft);
// pHeader->setDefaultSectionSize(120);
-#if QT_VERSION >= 0x050000
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
// pHeader->setSectionResizeMode(QHeaderView::Custom);
pHeader->setSectionsMovable(false);
pHeader->setSectionsClickable(true);
@@ -781,7 +781,7 @@
QTreeWidget::setAcceptDrops(true);
QTreeWidget::setDropIndicatorShown(true);
QTreeWidget::setAutoScroll(true);
- QTreeWidget::setSelectionMode(QAbstractItemView::SingleSelection);
+ QTreeWidget::setSelectionMode(QAbstractItemView::ExtendedSelection);
QTreeWidget::setSizePolicy(
QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
QTreeWidget::setSortingEnabled(true);
@@ -828,7 +828,7 @@
if (m_pAutoOpenTimer)
delete m_pAutoOpenTimer;
- m_pAutoOpenTimer = NULL;
+ m_pAutoOpenTimer = nullptr;
if (m_iAutoOpenTimeout > 0) {
m_pAutoOpenTimer = new QTimer(this);
@@ -847,10 +847,10 @@
// Aliasing support methods.
-void qjackctlClientListView::setAliases (
- qjackctlConnectAlias *pAliases, bool bRenameEnabled )
+void qjackctlClientListView::setAliasList (
+ qjackctlAliasList *pAliasList, bool bRenameEnabled )
{
- m_pAliases = pAliases;
+ m_pAliasList = pAliasList;
m_bRenameEnabled = bRenameEnabled;
// For each client item, if any.
@@ -861,7 +861,7 @@
continue;
qjackctlClientItem *pClientItem
= static_cast (pItem);
- if (pClientItem == NULL)
+ if (pClientItem == nullptr)
continue;
pClientItem->updateClientName();
// For each port item...
@@ -872,16 +872,16 @@
continue;
qjackctlPortItem *pPortItem
= static_cast (pChildItem);
- if (pPortItem == NULL)
+ if (pPortItem == nullptr)
continue;
pPortItem->updatePortName();
}
}
}
-qjackctlConnectAlias *qjackctlClientListView::aliases (void) const
+qjackctlAliasList *qjackctlClientListView::aliasList (void) const
{
- return m_pAliases;
+ return m_pAliasList;
}
bool qjackctlClientListView::isRenameEnabled (void) const
@@ -902,11 +902,11 @@
// In-place aliasing slot.
void qjackctlClientListView::renamedSlot (void)
{
- if (m_pAliases == NULL)
+ if (m_pAliasList == nullptr)
return;
QTreeWidgetItem *pItem = QTreeWidget::currentItem();
- if (pItem == NULL)
+ if (pItem == nullptr)
return;
const QString& sText = pItem->text(0);
@@ -989,11 +989,11 @@
m_pAutoOpenTimer->start(m_iAutoOpenTimeout);
qjackctlConnect *pConnect = m_pConnectView->binding();
if ((pItem->flags() & Qt::ItemIsDropEnabled) == 0
- || pConnect == NULL || !pConnect->canConnectSelected())
- pItem = NULL;
+ || pConnect == nullptr || !pConnect->canConnectSelected())
+ pItem = nullptr;
}
} else {
- m_pDropItem = NULL;
+ m_pDropItem = nullptr;
if (m_pAutoOpenTimer)
m_pAutoOpenTimer->stop();
}
@@ -1074,9 +1074,9 @@
pDrag->setMimeData(pMimeData);
pDrag->setPixmap(m_pDragItem->icon(0).pixmap(16));
pDrag->setHotSpot(QPoint(-4, -12));
- pDrag->start(Qt::LinkAction);
+ pDrag->exec(Qt::LinkAction);
// We've dragged and maybe dropped it by now...
- m_pDragItem = NULL;
+ m_pDragItem = nullptr;
}
}
@@ -1121,15 +1121,10 @@
-// Dirty flag methods.
-void qjackctlClientListView::setDirty ( bool bDirty )
+// Dirty aliases notification.
+void qjackctlClientListView::emitAliasesChanged (void)
{
- m_pConnectView->setDirty(bDirty);
-}
-
-bool qjackctlClientListView::isDirty (void) const
-{
- return m_pConnectView->isDirty();
+ m_pConnectView->emitAliasesChanged();
}
@@ -1162,7 +1157,7 @@
QRect rect;
QTreeWidget *pList = pItem->treeWidget();
QTreeWidgetItem *pParent = pItem->parent();
- qjackctlClientItem *pClientItem = NULL;
+ qjackctlClientItem *pClientItem = nullptr;
if (pParent && pParent->type() == QJACKCTL_CLIENTITEM)
pClientItem = static_cast (pParent);
if (pClientItem && !pClientItem->isOpen()) {
@@ -1189,21 +1184,17 @@
if (y1 > h1)
pPainter->drawLine(x1, y1, x1 + 4, y1);
- // How do we'll draw it?
- if (m_pConnectView->isBezierLines()) {
- // Setup control points
- QPolygon spline(4);
- const int cp = int(float(x2 - x1 - 8) * 0.4f);
- spline.putPoints(0, 4,
- x1 + 4, y1, x1 + 4 + cp, y1,
- x2 - 4 - cp, y2, x2 - 4, y2);
- // The connection line, it self.
- QPainterPath path;
- path.moveTo(spline.at(0));
- path.cubicTo(spline.at(1), spline.at(2), spline.at(3));
- pPainter->strokePath(path, pen);
- }
- else pPainter->drawLine(x1 + 4, y1, x2 - 4, y2);
+ // Setup control points
+ QPolygon spline(4);
+ const int cp = int(float(x2 - x1 - 8) * 0.4f);
+ spline.putPoints(0, 4,
+ x1 + 4, y1, x1 + 4 + cp, y1,
+ x2 - 4 - cp, y2, x2 - 4, y2);
+ // The connection line, it self.
+ QPainterPath path;
+ path.moveTo(spline.at(0));
+ path.cubicTo(spline.at(1), spline.at(2), spline.at(3));
+ pPainter->strokePath(path, pen);
// Invisible input ports don't get a connecting dot.
if (y2 > h2)
@@ -1214,10 +1205,10 @@
// Draw visible port connection relation arrows.
void qjackctlConnectorView::paintEvent ( QPaintEvent * )
{
- if (m_pConnectView == NULL)
+ if (m_pConnectView == nullptr)
return;
- if (m_pConnectView->OListView() == NULL ||
- m_pConnectView->IListView() == NULL)
+ if (m_pConnectView->OListView() == nullptr ||
+ m_pConnectView->IListView() == nullptr)
return;
qjackctlClientListView *pOListView = m_pConnectView->OListView();
@@ -1254,7 +1245,7 @@
continue;
qjackctlClientItem *pOClient
= static_cast (pItem);
- if (pOClient == NULL)
+ if (pOClient == nullptr)
continue;
// Set new connector color.
++i;
@@ -1339,10 +1330,9 @@
m_pConnectorView = new qjackctlConnectorView(this);
m_pIListView = new qjackctlClientListView(this, false);
- m_pConnect = NULL;
+ m_pConnect = nullptr;
- m_bBezierLines = false;
- m_iIconSize = 0;
+ m_iIconSize = 0;
QSplitter::setHandleWidth(2);
@@ -1392,7 +1382,7 @@
if (m_pConnect)
return m_pConnect->OClientList();
else
- return NULL;
+ return nullptr;
}
qjackctlClientList *qjackctlConnectView::IClientList (void) const
@@ -1400,19 +1390,7 @@
if (m_pConnect)
return m_pConnect->OClientList();
else
- return NULL;
-}
-
-
-// Connector line style accessors.
-void qjackctlConnectView::setBezierLines ( bool bBezierLines )
-{
- m_bBezierLines = bBezierLines;
-}
-
-bool qjackctlConnectView::isBezierLines (void) const
-{
- return m_bBezierLines;
+ return nullptr;
}
@@ -1444,18 +1422,10 @@
}
-// Dirty flag methods.
-void qjackctlConnectView::setDirty ( bool bDirty )
-{
- m_bDirty = bDirty;
-
- if (bDirty)
- emit contentsChanged();
-}
-
-bool qjackctlConnectView::isDirty (void) const
+// Dirty aliases notification.
+void qjackctlConnectView::emitAliasesChanged (void)
{
- return m_bDirty;
+ emit aliasesChanged();
}
@@ -1468,8 +1438,8 @@
{
m_pConnectView = pConnectView;
- m_pOClientList = NULL;
- m_pIClientList = NULL;
+ m_pOClientList = nullptr;
+ m_pIClientList = nullptr;
m_iMutex = 0;
@@ -1482,15 +1452,15 @@
// Force end of works here.
m_iMutex++;
- m_pConnectView->setBinding(NULL);
+ m_pConnectView->setBinding(nullptr);
if (m_pOClientList)
delete m_pOClientList;
if (m_pIClientList)
delete m_pIClientList;
- m_pOClientList = NULL;
- m_pIClientList = NULL;
+ m_pOClientList = nullptr;
+ m_pIClientList = nullptr;
m_pConnectView->connectorView()->update();
}
@@ -1517,7 +1487,7 @@
bool qjackctlConnect::connectPortsEx (
qjackctlPortItem *pOPort, qjackctlPortItem *pIPort )
{
- if (pOPort->findConnectPtr(pIPort) != NULL)
+ if (pOPort->findConnectPtr(pIPort) != nullptr)
return false;
emit connecting(pOPort, pIPort);
@@ -1534,7 +1504,7 @@
bool qjackctlConnect::disconnectPortsEx (
qjackctlPortItem *pOPort, qjackctlPortItem *pIPort )
{
- if (pOPort->findConnectPtr(pIPort) == NULL)
+ if (pOPort->findConnectPtr(pIPort) == nullptr)
return false;
emit disconnecting(pOPort, pIPort);
@@ -1569,60 +1539,74 @@
m_pConnectView->connectorView()->update();
// Now with our predicate work...
- QTreeWidgetItem *pOItem = (m_pOClientList->listView())->currentItem();
- if (pOItem == NULL)
- return false;
+ const QList oitems
+ = (m_pOClientList->listView())->selectedItems();
+ const QList iitems
+ = (m_pIClientList->listView())->selectedItems();
- QTreeWidgetItem *pIItem = (m_pIClientList->listView())->currentItem();
- if (pIItem == NULL)
+ if (oitems.isEmpty() || iitems.isEmpty())
return false;
- if (pOItem->type() == QJACKCTL_CLIENTITEM) {
- qjackctlClientItem *pOClient
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // Each-to-each connections...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator oport(pOClient->ports());
- QListIterator iport(pIClient->ports());
- while (oport.hasNext() && iport.hasNext()) {
- qjackctlPortItem *pOPort = oport.next();
- qjackctlPortItem *pIPort = iport.next();
- if (pOPort->findConnectPtr(pIPort) == NULL)
- return true;
+ QListIterator oiter(oitems);
+ QListIterator iiter(iitems);
+
+ const int iNumItems
+ = qMax(oitems.count(), iitems.count());
+
+ for (int i = 0; i < iNumItems; ++i) {
+ if (!oiter.hasNext())
+ oiter.toFront();
+ if (!iiter.hasNext())
+ iiter.toFront();
+ QTreeWidgetItem *pOItem = oiter.next();
+ QTreeWidgetItem *pIItem = iiter.next();
+ if (pOItem->type() == QJACKCTL_CLIENTITEM) {
+ qjackctlClientItem *pOClient
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // Each-to-each connections...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator oport(pOClient->ports());
+ QListIterator iport(pIClient->ports());
+ while (oport.hasNext() && iport.hasNext()) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort = iport.next();
+ if (pOPort->findConnectPtr(pIPort) == nullptr)
+ return true;
+ }
+ } else {
+ // Many(all)-to-one/many connection...
+ QListIterator oport(pOClient->ports());
+ while (oport.hasNext()
+ && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort
+ = static_cast (pIItem);
+ if (pOPort->findConnectPtr(pIPort) == nullptr)
+ return true;
+ pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
+ }
}
} else {
- // Many(all)-to-one/many connection...
- QListIterator oport(pOClient->ports());
- while (oport.hasNext()
- && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
- qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pOPort
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // One-to-many(all) connection...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator iport(pIClient->ports());
+ while (iport.hasNext()) {
+ qjackctlPortItem *pIPort = iport.next();
+ if (pOPort->findConnectPtr(pIPort) == nullptr)
+ return true;
+ }
+ } else {
+ // One-to-one connection...
qjackctlPortItem *pIPort
= static_cast (pIItem);
- if (pOPort->findConnectPtr(pIPort) == NULL)
- return true;
- pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
- }
- }
- } else {
- qjackctlPortItem *pOPort
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // One-to-many(all) connection...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator iport(pIClient->ports());
- while (iport.hasNext()) {
- qjackctlPortItem *pIPort = iport.next();
- if (pOPort->findConnectPtr(pIPort) == NULL)
- return true;
+ return (pOPort->findConnectPtr(pIPort) == nullptr);
}
- } else {
- // One-to-one connection...
- qjackctlPortItem *pIPort
- = static_cast (pIItem);
- return (pOPort->findConnectPtr(pIPort) == NULL);
}
}
@@ -1650,58 +1634,72 @@
bool qjackctlConnect::connectSelectedEx (void)
{
- QTreeWidgetItem *pOItem = (m_pOClientList->listView())->currentItem();
- if (pOItem == NULL)
- return false;
+ const QList oitems
+ = (m_pOClientList->listView())->selectedItems();
+ const QList iitems
+ = (m_pIClientList->listView())->selectedItems();
- QTreeWidgetItem *pIItem = (m_pIClientList->listView())->currentItem();
- if (pIItem == NULL)
+ if (oitems.isEmpty() || iitems.isEmpty())
return false;
- if (pOItem->type() == QJACKCTL_CLIENTITEM) {
- qjackctlClientItem *pOClient
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // Each-to-each connections...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator oport(pOClient->ports());
- QListIterator iport(pIClient->ports());
- while (oport.hasNext() && iport.hasNext()) {
- qjackctlPortItem *pOPort = oport.next();
- qjackctlPortItem *pIPort = iport.next();
- connectPortsEx(pOPort, pIPort);
+ QListIterator oiter(oitems);
+ QListIterator iiter(iitems);
+
+ const int iNumItems
+ = qMax(oitems.count(), iitems.count());
+
+ for (int i = 0; i < iNumItems; ++i) {
+ if (!oiter.hasNext())
+ oiter.toFront();
+ if (!iiter.hasNext())
+ iiter.toFront();
+ QTreeWidgetItem *pOItem = oiter.next();
+ QTreeWidgetItem *pIItem = iiter.next();
+ if (pOItem->type() == QJACKCTL_CLIENTITEM) {
+ qjackctlClientItem *pOClient
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // Each-to-each connections...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator oport(pOClient->ports());
+ QListIterator iport(pIClient->ports());
+ while (oport.hasNext() && iport.hasNext()) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort = iport.next();
+ connectPortsEx(pOPort, pIPort);
+ }
+ } else {
+ // Many(all)-to-one/many connection...
+ QListIterator oport(pOClient->ports());
+ while (oport.hasNext()
+ && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort
+ = static_cast (pIItem);
+ connectPortsEx(pOPort, pIPort);
+ pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
+ }
}
} else {
- // Many(all)-to-one/many connection...
- QListIterator oport(pOClient->ports());
- while (oport.hasNext()
- && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
- qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pOPort
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // One-to-many(all) connection...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator iport(pIClient->ports());
+ while (iport.hasNext()) {
+ qjackctlPortItem *pIPort = iport.next();
+ connectPortsEx(pOPort, pIPort);
+ }
+ } else {
+ // One-to-one connection...
qjackctlPortItem *pIPort
= static_cast (pIItem);
connectPortsEx(pOPort, pIPort);
- pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
}
}
- } else {
- qjackctlPortItem *pOPort
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // One-to-many(all) connection...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator iport(pIClient->ports());
- while (iport.hasNext()) {
- qjackctlPortItem *pIPort = iport.next();
- connectPortsEx(pOPort, pIPort);
- }
- } else {
- // One-to-one connection...
- qjackctlPortItem *pIPort
- = static_cast (pIItem);
- connectPortsEx(pOPort, pIPort);
- }
}
return true;
@@ -1723,60 +1721,74 @@
bool qjackctlConnect::canDisconnectSelectedEx (void)
{
- QTreeWidgetItem *pOItem = (m_pOClientList->listView())->currentItem();
- if (!pOItem)
- return false;
+ const QList oitems
+ = (m_pOClientList->listView())->selectedItems();
+ const QList iitems
+ = (m_pIClientList->listView())->selectedItems();
- QTreeWidgetItem *pIItem = (m_pIClientList->listView())->currentItem();
- if (!pIItem)
+ if (oitems.isEmpty() || iitems.isEmpty())
return false;
- if (pOItem->type() == QJACKCTL_CLIENTITEM) {
- qjackctlClientItem *pOClient
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // Each-to-each connections...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator oport(pOClient->ports());
- QListIterator iport(pIClient->ports());
- while (oport.hasNext() && iport.hasNext()) {
- qjackctlPortItem *pOPort = oport.next();
- qjackctlPortItem *pIPort = iport.next();
- if (pOPort->findConnectPtr(pIPort) != NULL)
- return true;
+ QListIterator oiter(oitems);
+ QListIterator iiter(iitems);
+
+ const int iNumItems
+ = qMax(oitems.count(), iitems.count());
+
+ for (int i = 0; i < iNumItems; ++i) {
+ if (!oiter.hasNext())
+ oiter.toFront();
+ if (!iiter.hasNext())
+ iiter.toFront();
+ QTreeWidgetItem *pOItem = oiter.next();
+ QTreeWidgetItem *pIItem = iiter.next();
+ if (pOItem->type() == QJACKCTL_CLIENTITEM) {
+ qjackctlClientItem *pOClient
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // Each-to-each connections...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator oport(pOClient->ports());
+ QListIterator iport(pIClient->ports());
+ while (oport.hasNext() && iport.hasNext()) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort = iport.next();
+ if (pOPort->findConnectPtr(pIPort) != nullptr)
+ return true;
+ }
+ } else {
+ // Many(all)-to-one/many connection...
+ QListIterator oport(pOClient->ports());
+ while (oport.hasNext()
+ && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort
+ = static_cast (pIItem);
+ if (pOPort->findConnectPtr(pIPort) != nullptr)
+ return true;
+ pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
+ }
}
} else {
- // Many(all)-to-one/many connection...
- QListIterator oport(pOClient->ports());
- while (oport.hasNext()
- && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
- qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pOPort
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // One-to-many(all) connection...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator iport(pIClient->ports());
+ while (iport.hasNext()) {
+ qjackctlPortItem *pIPort = iport.next();
+ if (pOPort->findConnectPtr(pIPort) != nullptr)
+ return true;
+ }
+ } else {
+ // One-to-one connection...
qjackctlPortItem *pIPort
= static_cast (pIItem);
- if (pOPort->findConnectPtr(pIPort) != NULL)
- return true;
- pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
- }
- }
- } else {
- qjackctlPortItem *pOPort
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // One-to-many(all) connection...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator iport(pIClient->ports());
- while (iport.hasNext()) {
- qjackctlPortItem *pIPort = iport.next();
- if (pOPort->findConnectPtr(pIPort) != NULL)
- return true;
+ return (pOPort->findConnectPtr(pIPort) != nullptr);
}
- } else {
- // One-to-one connection...
- qjackctlPortItem *pIPort
- = static_cast (pIItem);
- return (pOPort->findConnectPtr(pIPort) != NULL);
}
}
@@ -1804,58 +1816,72 @@
bool qjackctlConnect::disconnectSelectedEx (void)
{
- QTreeWidgetItem *pOItem = (m_pOClientList->listView())->currentItem();
- if (pOItem == NULL)
- return false;
+ const QList oitems
+ = (m_pOClientList->listView())->selectedItems();
+ const QList iitems
+ = (m_pIClientList->listView())->selectedItems();
- QTreeWidgetItem *pIItem = (m_pIClientList->listView())->currentItem();
- if (pIItem == NULL)
+ if (oitems.isEmpty() || iitems.isEmpty())
return false;
- if (pOItem->type() == QJACKCTL_CLIENTITEM) {
- qjackctlClientItem *pOClient
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // Each-to-each connections...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator oport(pOClient->ports());
- QListIterator iport(pIClient->ports());
- while (oport.hasNext() && iport.hasNext()) {
- qjackctlPortItem *pOPort = oport.next();
- qjackctlPortItem *pIPort = iport.next();
- disconnectPortsEx(pOPort, pIPort);
+ QListIterator oiter(oitems);
+ QListIterator iiter(iitems);
+
+ const int iNumItems
+ = qMax(oitems.count(), iitems.count());
+
+ for (int i = 0; i < iNumItems; ++i) {
+ if (!oiter.hasNext())
+ oiter.toFront();
+ if (!iiter.hasNext())
+ iiter.toFront();
+ QTreeWidgetItem *pOItem = oiter.next();
+ QTreeWidgetItem *pIItem = iiter.next();
+ if (pOItem->type() == QJACKCTL_CLIENTITEM) {
+ qjackctlClientItem *pOClient
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // Each-to-each connections...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator oport(pOClient->ports());
+ QListIterator iport(pIClient->ports());
+ while (oport.hasNext() && iport.hasNext()) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort = iport.next();
+ disconnectPortsEx(pOPort, pIPort);
+ }
+ } else {
+ // Many(all)-to-one/many connection...
+ QListIterator oport(pOClient->ports());
+ while (oport.hasNext()
+ && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
+ qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pIPort
+ = static_cast (pIItem);
+ disconnectPortsEx(pOPort, pIPort);
+ pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
+ }
}
} else {
- // Many(all)-to-one/many connection...
- QListIterator oport(pOClient->ports());
- while (oport.hasNext()
- && pIItem && pIItem->type() == QJACKCTL_PORTITEM) {
- qjackctlPortItem *pOPort = oport.next();
+ qjackctlPortItem *pOPort
+ = static_cast (pOItem);
+ if (pIItem->type() == QJACKCTL_CLIENTITEM) {
+ // One-to-many(all) connection...
+ qjackctlClientItem *pIClient
+ = static_cast (pIItem);
+ QListIterator iport(pIClient->ports());
+ while (iport.hasNext()) {
+ qjackctlPortItem *pIPort = iport.next();
+ disconnectPortsEx(pOPort, pIPort);
+ }
+ } else {
+ // One-to-one connection...
qjackctlPortItem *pIPort
= static_cast (pIItem);
disconnectPortsEx(pOPort, pIPort);
- pIItem = (m_pIClientList->listView())->itemBelow(pIItem);
}
}
- } else {
- qjackctlPortItem *pOPort
- = static_cast (pOItem);
- if (pIItem->type() == QJACKCTL_CLIENTITEM) {
- // One-to-many(all) connection...
- qjackctlClientItem *pIClient
- = static_cast (pIItem);
- QListIterator iport(pIClient->ports());
- while (iport.hasNext()) {
- qjackctlPortItem *pIPort = iport.next();
- disconnectPortsEx(pOPort, pIPort);
- }
- } else {
- // One-to-one connection...
- qjackctlPortItem *pIPort
- = static_cast (pIItem);
- disconnectPortsEx(pOPort, pIPort);
- }
}
return true;
diff -Nru qjackctl-0.4.5/src/qjackctlConnect.h qjackctl-0.6.0/src/qjackctlConnect.h
--- qjackctl-0.4.5/src/qjackctlConnect.h 2017-04-27 14:44:14.553754974 +0000
+++ qjackctl-0.6.0/src/qjackctlConnect.h 2019-10-17 07:45:45.952673224 +0000
@@ -1,7 +1,7 @@
// qjackctlConnect.h
//
/****************************************************************************
- Copyright (C) 2003-2015, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -22,7 +22,7 @@
#ifndef __qjackctlConnect_h
#define __qjackctlConnect_h
-#include "qjackctlConnectAlias.h"
+#include "qjackctlAliases.h"
#include
#include
@@ -238,7 +238,8 @@
void refresh();
// Natural decimal sorting comparator.
- static bool lessThan(const QTreeWidgetItem& i1, const QTreeWidgetItem& i2);
+ static bool lessThan(
+ const QTreeWidgetItem& item1, const QTreeWidgetItem& item2);
private:
@@ -271,16 +272,15 @@
int autoOpenTimeout() const;
// Aliasing support methods.
- void setAliases(qjackctlConnectAlias *pAliases, bool bRenameEnabled);
- qjackctlConnectAlias *aliases() const;
+ void setAliasList(qjackctlAliasList *pAliasList, bool bRenameEnabled);
+ qjackctlAliasList *aliasList() const;
bool isRenameEnabled() const;
// Binding indirect accessor.
qjackctlConnect *binding() const;
- // Dirty flag accessors.
- void setDirty (bool bDirty);
- bool isDirty() const;
+ // Dirty aliases notification.
+ void emitAliasesChanged();
protected slots:
@@ -327,7 +327,7 @@
QPoint m_posDrag;
// Aliasing support.
- qjackctlConnectAlias *m_pAliases;
+ qjackctlAliasList *m_pAliasList;
bool m_bRenameEnabled;
};
@@ -403,22 +403,17 @@
qjackctlClientList *OClientList() const;
qjackctlClientList *IClientList() const;
- // Connector line style accessors.
- void setBezierLines(bool bBezierLines);
- bool isBezierLines() const;
-
// Common icon size pixmap accessors.
void setIconSize (int iIconSize);
int iconSize (void) const;
- // Dirty flag accessors.
- void setDirty (bool bDirty);
- bool isDirty() const;
+ // Dirty aliases notification.
+ void emitAliasesChanged();
signals:
// Contents change signal.
- void contentsChanged();
+ void aliasesChanged();
private:
@@ -430,9 +425,6 @@
// The main binding object.
qjackctlConnect *m_pConnect;
- // How we'll draw connector lines.
- bool m_bBezierLines;
-
// How large will be those icons.
// 0 = 16x16 (default), 1 = 32x32, 2 = 64x64.
int m_iIconSize;
diff -Nru qjackctl-0.4.5/src/qjackctlConnectionsForm.cpp qjackctl-0.6.0/src/qjackctlConnectionsForm.cpp
--- qjackctl-0.4.5/src/qjackctlConnectionsForm.cpp 2017-04-27 14:44:14.553754974 +0000
+++ qjackctl-0.6.0/src/qjackctlConnectionsForm.cpp 2019-10-17 07:45:45.952673224 +0000
@@ -1,7 +1,7 @@
// qjackctlConnectionsForm.cpp
//
/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -50,16 +50,16 @@
m_pMidiConnect = new qjackctlJackConnect(
m_ui.MidiConnectView, QJACKCTL_JACK_MIDI);
#else
- m_pMidiConnect = NULL;
+ m_pMidiConnect = nullptr;
#endif
#ifdef CONFIG_ALSA_SEQ
m_pAlsaConnect = new qjackctlAlsaConnect(m_ui.AlsaConnectView);
#else
- m_pAlsaConnect = NULL;
+ m_pAlsaConnect = nullptr;
#endif
- m_pSetup = NULL;
+ m_pSetup = nullptr;
// UI connections...
@@ -77,7 +77,7 @@
SLOT(audioExpandAll()));
QObject::connect(m_ui.AudioRefreshPushButton,
SIGNAL(clicked()),
- SLOT(audioRefreshClear()));
+ SLOT(audioRefresh()));
QObject::connect(m_ui.MidiConnectPushButton,
SIGNAL(clicked()),
@@ -93,7 +93,7 @@
SLOT(midiExpandAll()));
QObject::connect(m_ui.MidiRefreshPushButton,
SIGNAL(clicked()),
- SLOT(midiRefreshClear()));
+ SLOT(midiRefresh()));
QObject::connect(m_ui.AlsaConnectPushButton,
SIGNAL(clicked()),
@@ -109,10 +109,29 @@
SLOT(alsaExpandAll()));
QObject::connect(m_ui.AlsaRefreshPushButton,
SIGNAL(clicked()),
- SLOT(alsaRefreshClear()));
+ SLOT(alsaRefresh()));
// Connect it to some UI feedback slots.
QObject::connect(m_ui.AudioConnectView->OListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(audioStabilize()));
+ QObject::connect(m_ui.AudioConnectView->IListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(audioStabilize()));
+ QObject::connect(m_ui.MidiConnectView->OListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(midiStabilize()));
+ QObject::connect(m_ui.MidiConnectView->IListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(midiStabilize()));
+ QObject::connect(m_ui.AlsaConnectView->OListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(alsaStabilize()));
+ QObject::connect(m_ui.AlsaConnectView->IListView(),
+ SIGNAL(itemSelectionChanged()),
+ SLOT(alsaStabilize()));
+
+ QObject::connect(m_ui.AudioConnectView->OListView(),
SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
SLOT(audioStabilize()));
QObject::connect(m_ui.AudioConnectView->IListView(),
@@ -133,14 +152,14 @@
// Dirty dispatcher (refresh deferral).
QObject::connect(m_ui.AudioConnectView,
- SIGNAL(contentsChanged()),
- SLOT(audioRefresh()));
+ SIGNAL(aliasesChanged()),
+ SLOT(audioAliasesChanged()));
QObject::connect(m_ui.MidiConnectView,
- SIGNAL(contentsChanged()),
- SLOT(midiRefresh()));
+ SIGNAL(aliasesChanged()),
+ SLOT(midiAliasesChanged()));
QObject::connect(m_ui.AlsaConnectView,
- SIGNAL(contentsChanged()),
- SLOT(alsaRefresh()));
+ SIGNAL(aliasesChanged()),
+ SLOT(alsaAliasesChanged()));
// Actual connections...
QObject::connect(m_pAudioConnect,
@@ -204,6 +223,7 @@
QWidget::showEvent(pShowEvent);
}
+
// Notify our parent that we're closing.
void qjackctlConnectionsForm::hideEvent ( QHideEvent *pHideEvent )
{
@@ -214,9 +234,18 @@
pMainForm->stabilizeForm();
}
+
// Just about to notify main-window that we're closing.
void qjackctlConnectionsForm::closeEvent ( QCloseEvent * /*pCloseEvent*/ )
{
+ // Save current tab page and splitter sizes...
+ if (m_pSetup) {
+ m_pSetup->iConnectionsTabPage = tabPage();
+ m_pSetup->saveSplitterSizes(m_ui.AudioConnectView);
+ m_pSetup->saveSplitterSizes(m_ui.MidiConnectView);
+ m_pSetup->saveSplitterSizes(m_ui.AlsaConnectView);
+ }
+
QWidget::hide();
qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
@@ -285,79 +314,6 @@
}
-// Window close event handlers.
-bool qjackctlConnectionsForm::queryClose (void)
-{
- bool bQueryClose = true;
-
- if (m_pSetup
- && (m_ui.AudioConnectView->isDirty() ||
- m_ui.MidiConnectView->isDirty() ||
- m_ui.AlsaConnectView->isDirty())) {
- switch (QMessageBox::warning(this,
- tr("Warning") + " - " QJACKCTL_SUBTITLE1,
- tr("The preset aliases have been changed:\n\n"
- "\"%1\"\n\nDo you want to save the changes?")
- .arg(m_sPreset),
- QMessageBox::Save |
- QMessageBox::Discard |
- QMessageBox::Cancel)) {
- case QMessageBox::Save:
- saveAliases();
- // Fall thru....
- case QMessageBox::Discard:
- break;
- default: // Cancel.
- bQueryClose = false;
- }
- }
-
- // Save some splitter sizes...
- if (m_pSetup && bQueryClose) {
- m_pSetup->saveSplitterSizes(m_ui.AudioConnectView);
- m_pSetup->saveSplitterSizes(m_ui.MidiConnectView);
- m_pSetup->saveSplitterSizes(m_ui.AlsaConnectView);
- }
-
- return bQueryClose;
-}
-
-
-// Load aliases from current preset.
-bool qjackctlConnectionsForm::loadAliases (void)
-{
- bool bResult = false;
-
- if (m_pSetup && queryClose()) {
- m_sPreset = m_pSetup->sDefPreset;
- bResult = m_pSetup->loadAliases(m_sPreset);
- if (bResult) {
- m_ui.AudioConnectView->setDirty(false);
- m_ui.MidiConnectView->setDirty(false);
- m_ui.AlsaConnectView->setDirty(false);
- }
- }
-
- return bResult;
-}
-
-
-// Save aliases to current preset.
-bool qjackctlConnectionsForm::saveAliases (void)
-{
- bool bResult = false;
-
- if (m_pSetup) {
- bResult = m_pSetup->saveAliases(m_sPreset);
- if (bResult) {
- m_ui.AudioConnectView->setDirty(false);
- m_ui.MidiConnectView->setDirty(false);
- m_ui.AlsaConnectView->setDirty(false);
- }
- }
-
- return bResult;
-}
// Tab page accessors.
@@ -463,12 +419,17 @@
}
-// Refresh JACK audio form by notifying the parent form.
-void qjackctlConnectionsForm::audioRefreshClear (void)
+// JACK audio client/port aliases have changed.
+void qjackctlConnectionsForm::audioAliasesChanged (void)
{
- refreshAudio(true, true);
+ if (m_pSetup)
+ m_pSetup->aliases.dirty = true;
+
+ audioRefresh();
}
+
+// Refresh JACK audio form by notifying the parent form.
void qjackctlConnectionsForm::audioRefresh (void)
{
refreshAudio(false);
@@ -543,12 +504,17 @@
}
-// Refresh JACK MIDI form by notifying the parent form.
-void qjackctlConnectionsForm::midiRefreshClear (void)
+// JACK MIDI client/port aliases have changed.
+void qjackctlConnectionsForm::midiAliasesChanged (void)
{
- refreshMidi(true, true);
+ if (m_pSetup)
+ m_pSetup->aliases.dirty = true;
+
+ midiRefresh();
}
+
+// Refresh JACK MIDI form by notifying the parent form.
void qjackctlConnectionsForm::midiRefresh (void)
{
refreshMidi(false);
@@ -624,12 +590,17 @@
}
-// Refresh complete form by notifying the parent form.
-void qjackctlConnectionsForm::alsaRefreshClear (void)
+// ALSA MIDI client/port aliases have changed.
+void qjackctlConnectionsForm::alsaAliasesChanged (void)
{
- refreshAlsa(true, true);
+ if (m_pSetup)
+ m_pSetup->aliases.dirty = true;
+
+ alsaRefresh();
}
+
+// Refresh complete form by notifying the parent form.
void qjackctlConnectionsForm::alsaRefresh (void)
{
refreshAlsa(false);
@@ -647,7 +618,7 @@
// or notify main form for doing that later.
void qjackctlConnectionsForm::refreshAudio ( bool bEnabled, bool bClear )
{
- if (m_pAudioConnect == NULL)
+ if (m_pAudioConnect == nullptr)
return;
if (bEnabled) {
@@ -662,7 +633,7 @@
void qjackctlConnectionsForm::refreshMidi ( bool bEnabled, bool bClear )
{
- if (m_pMidiConnect == NULL)
+ if (m_pMidiConnect == nullptr)
return;
if (bEnabled) {
@@ -677,7 +648,7 @@
void qjackctlConnectionsForm::refreshAlsa ( bool bEnabled, bool bClear )
{
- if (m_pAlsaConnect == NULL)
+ if (m_pAlsaConnect == nullptr)
return;
if (bEnabled) {
@@ -768,25 +739,25 @@
// Set alias maps for all listviews...
if (m_pSetup && m_pSetup->bAliasesEnabled) {
const bool bRenameEnabled = m_pSetup->bAliasesEditing;
- m_ui.AudioConnectView->OListView()->setAliases(
- &(m_pSetup->aliasAudioOutputs), bRenameEnabled);
- m_ui.AudioConnectView->IListView()->setAliases(
- &(m_pSetup->aliasAudioInputs), bRenameEnabled);
- m_ui.MidiConnectView->OListView()->setAliases(
- &(m_pSetup->aliasMidiOutputs), bRenameEnabled);
- m_ui.MidiConnectView->IListView()->setAliases(
- &(m_pSetup->aliasMidiInputs), bRenameEnabled);
- m_ui.AlsaConnectView->OListView()->setAliases(
- &(m_pSetup->aliasAlsaOutputs), bRenameEnabled);
- m_ui.AlsaConnectView->IListView()->setAliases(
- &(m_pSetup->aliasAlsaInputs), bRenameEnabled);
+ m_ui.AudioConnectView->OListView()->setAliasList(
+ &(m_pSetup->aliases.audioOutputs), bRenameEnabled);
+ m_ui.AudioConnectView->IListView()->setAliasList(
+ &(m_pSetup->aliases.audioInputs), bRenameEnabled);
+ m_ui.MidiConnectView->OListView()->setAliasList(
+ &(m_pSetup->aliases.midiOutputs), bRenameEnabled);
+ m_ui.MidiConnectView->IListView()->setAliasList(
+ &(m_pSetup->aliases.midiInputs), bRenameEnabled);
+ m_ui.AlsaConnectView->OListView()->setAliasList(
+ &(m_pSetup->aliases.alsaOutputs), bRenameEnabled);
+ m_ui.AlsaConnectView->IListView()->setAliasList(
+ &(m_pSetup->aliases.alsaInputs), bRenameEnabled);
} else {
- m_ui.AudioConnectView->OListView()->setAliases(NULL, false);
- m_ui.AudioConnectView->IListView()->setAliases(NULL, false);
- m_ui.MidiConnectView->OListView()->setAliases(NULL, false);
- m_ui.MidiConnectView->IListView()->setAliases(NULL, false);
- m_ui.AlsaConnectView->OListView()->setAliases(NULL, false);
- m_ui.AlsaConnectView->IListView()->setAliases(NULL, false);
+ m_ui.AudioConnectView->OListView()->setAliasList(nullptr, false);
+ m_ui.AudioConnectView->IListView()->setAliasList(nullptr, false);
+ m_ui.MidiConnectView->OListView()->setAliasList(nullptr, false);
+ m_ui.MidiConnectView->IListView()->setAliasList(nullptr, false);
+ m_ui.AlsaConnectView->OListView()->setAliasList(nullptr, false);
+ m_ui.AlsaConnectView->IListView()->setAliasList(nullptr, false);
}
}
diff -Nru qjackctl-0.4.5/src/qjackctlConnectionsForm.h qjackctl-0.6.0/src/qjackctlConnectionsForm.h
--- qjackctl-0.4.5/src/qjackctlConnectionsForm.h 2017-04-27 14:44:14.553754974 +0000
+++ qjackctl-0.6.0/src/qjackctlConnectionsForm.h 2019-10-17 07:45:45.952673224 +0000
@@ -1,7 +1,7 @@
// qjackctlConnectionsForm.h
//
/****************************************************************************
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -51,8 +51,6 @@
qjackctlConnectView *midiConnectView() const;
qjackctlConnectView *alsaConnectView() const;
- bool queryClose();
-
enum TabPage { AudioTab = 0, MidiTab = 1, AlsaTab = 2 };
void setTabPage(int iTabPage);
@@ -75,10 +73,7 @@
void stabilizeMidi(bool bEnabled, bool bClear = false);
void stabilizeAlsa(bool bEnabled, bool bClear = false);
- void setupAliases(qjackctlSetup *pSetup);
void updateAliases();
- bool loadAliases();
- bool saveAliases();
public slots:
@@ -86,7 +81,7 @@
void audioDisconnectSelected();
void audioDisconnectAll();
void audioExpandAll();
- void audioRefreshClear();
+ void audioAliasesChanged();
void audioRefresh();
void audioStabilize();
@@ -94,7 +89,7 @@
void midiDisconnectSelected();
void midiDisconnectAll();
void midiExpandAll();
- void midiRefreshClear();
+ void midiAliasesChanged();
void midiRefresh();
void midiStabilize();
@@ -102,7 +97,7 @@
void alsaDisconnectSelected();
void alsaDisconnectAll();
void alsaExpandAll();
- void alsaRefreshClear();
+ void alsaAliasesChanged();
void alsaRefresh();
void alsaStabilize();
@@ -129,8 +124,8 @@
qjackctlJackConnect *m_pAudioConnect;
qjackctlJackConnect *m_pMidiConnect;
qjackctlAlsaConnect *m_pAlsaConnect;
+
qjackctlSetup *m_pSetup;
- QString m_sPreset;
};
diff -Nru qjackctl-0.4.5/src/qjackctlConnectionsForm.ui qjackctl-0.6.0/src/qjackctlConnectionsForm.ui
--- qjackctl-0.4.5/src/qjackctlConnectionsForm.ui 2017-04-27 14:44:14.554755474 +0000
+++ qjackctl-0.6.0/src/qjackctlConnectionsForm.ui 2019-10-17 07:45:45.952673224 +0000
@@ -2,7 +2,7 @@
rncbc aka Rui Nuno Capela
JACK Audio Connection Kit - Qt GUI Interface.
- Copyright (C) 2003-2014, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -41,7 +41,7 @@
- Connections - JACK Audio Connection Kit
+ Connections
:/images/connections1.png
diff -Nru qjackctl-0.4.5/src/qjackctl.cpp qjackctl-0.6.0/src/qjackctl.cpp
--- qjackctl-0.4.5/src/qjackctl.cpp 2017-04-27 14:44:14.551753974 +0000
+++ qjackctl-0.6.0/src/qjackctl.cpp 2019-10-17 07:45:45.950673224 +0000
@@ -1,7 +1,7 @@
// qjackctl.cpp
//
/****************************************************************************
- Copyright (C) 2003-2017, rncbc aka Rui Nuno Capela. All rights reserved.
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -19,18 +19,18 @@
*****************************************************************************/
-#include "qjackctlAbout.h"
+#include "qjackctl.h"
+
#include "qjackctlSetup.h"
#include "qjackctlMainForm.h"
-#include
#include
#include
#include
#include
-#if QT_VERSION < 0x040500
+#if QT_VERSION < QT_VERSION_CHECK(4, 5, 0)
namespace Qt {
const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);
}
@@ -49,81 +49,67 @@
// Singleton application instance stuff (Qt/X11 only atm.)
//
-#if QT_VERSION < 0x050000
-#if defined(Q_WS_X11)
-#define CONFIG_X11
-#endif
-#else
-#if defined(QT_X11EXTRAS_LIB)
-#define CONFIG_X11
-#endif
-#endif
+#ifdef CONFIG_XUNIQUE
+#define QJACKCTL_XUNIQUE "qjackctlApplication"
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef CONFIG_X11
-#ifdef CONFIG_XUNIQUE
-
#include /* for gethostname() */
-
-#include
-
#include
#include
-
-#define QJACKCTL_XUNIQUE "qjackctlApplication"
-
-#if QT_VERSION >= 0x050100
-
-#include
-#include
-
-#include
-
-class qjackctlApplication;
-
-class qjackctlXcbEventFilter : public QAbstractNativeEventFilter
-{
-public:
-
- // Constructor.
- qjackctlXcbEventFilter(qjackctlApplication *pApp)
- : QAbstractNativeEventFilter(), m_pApp(pApp) {}
-
- // XCB event filter (virtual processor).
- bool nativeEventFilter(const QByteArray& eventType, void *message, long *);
-
-private:
-
- // Instance variable.
- qjackctlApplication *m_pApp;
-};
-
+#endif // CONFIG_X11
+#else
+#include
+#include
+#include
+#include
#endif
#endif // CONFIG_XUNIQUE
-#endif // CONFIG_X11
-class qjackctlApplication : public QApplication
+// Constructor.
+qjackctlApplication::qjackctlApplication ( int& argc, char **argv )
+ : QApplication(argc, argv),
+ m_pQtTranslator(nullptr), m_pMyTranslator(nullptr), m_pWidget(nullptr)
{
-public:
-
- // Constructor.
- qjackctlApplication(int& argc, char **argv) : QApplication(argc, argv),
- m_pQtTranslator(0), m_pMyTranslator(0), m_pWidget(0)
- {
- // Load translation support.
- QLocale loc;
- if (loc.language() != QLocale::C) {
- // Try own Qt translation...
- m_pQtTranslator = new QTranslator(this);
- QString sLocName = "qt_" + loc.name();
- QString sLocPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
- if (m_pQtTranslator->load(sLocName, sLocPath)) {
- QApplication::installTranslator(m_pQtTranslator);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
+ QApplication::setApplicationName(QJACKCTL_TITLE);
+ QApplication::setApplicationDisplayName(QJACKCTL_TITLE);
+ // QJACKCTL_TITLE " - " + QObject::tr(QJACKCTL_SUBTITLE));
+#endif
+ // Load translation support.
+ QLocale loc;
+ if (loc.language() != QLocale::C) {
+ // Try own Qt translation...
+ m_pQtTranslator = new QTranslator(this);
+ QString sLocName = "qt_" + loc.name();
+ QString sLocPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
+ if (m_pQtTranslator->load(sLocName, sLocPath)) {
+ QApplication::installTranslator(m_pQtTranslator);
+ } else {
+ delete m_pQtTranslator;
+ m_pQtTranslator = 0;
+ #ifdef CONFIG_DEBUG
+ qWarning("Warning: no translation found for '%s' locale: %s/%s.qm",
+ loc.name().toUtf8().constData(),
+ sLocPath.toUtf8().constData(),
+ sLocName.toUtf8().constData());
+ #endif
+ }
+ // Try own application translation...
+ m_pMyTranslator = new QTranslator(this);
+ sLocName = "qjackctl_" + loc.name();
+ if (m_pMyTranslator->load(sLocName, sLocPath)) {
+ QApplication::installTranslator(m_pMyTranslator);
+ } else {
+ sLocPath = CONFIG_DATADIR "/qjackctl/translations";
+ if (m_pMyTranslator->load(sLocName, sLocPath)) {
+ QApplication::installTranslator(m_pMyTranslator);
} else {
- delete m_pQtTranslator;
- m_pQtTranslator = 0;
+ delete m_pMyTranslator;
+ m_pMyTranslator = 0;
#ifdef CONFIG_DEBUG
qWarning("Warning: no translation found for '%s' locale: %s/%s.qm",
loc.name().toUtf8().constData(),
@@ -131,85 +117,78 @@
sLocName.toUtf8().constData());
#endif
}
- // Try own application translation...
- m_pMyTranslator = new QTranslator(this);
- sLocName = "qjackctl_" + loc.name();
- if (m_pMyTranslator->load(sLocName, sLocPath)) {
- QApplication::installTranslator(m_pMyTranslator);
- } else {
- sLocPath = CONFIG_DATADIR "/qjackctl/translations";
- if (m_pMyTranslator->load(sLocName, sLocPath)) {
- QApplication::installTranslator(m_pMyTranslator);
- } else {
- delete m_pMyTranslator;
- m_pMyTranslator = 0;
- #ifdef CONFIG_DEBUG
- qWarning("Warning: no translation found for '%s' locale: %s/%s.qm",
- loc.name().toUtf8().constData(),
- sLocPath.toUtf8().constData(),
- sLocName.toUtf8().constData());
- #endif
- }
- }
}
- #ifdef CONFIG_X11
- #ifdef CONFIG_XUNIQUE
- m_pDisplay = NULL;
- m_wOwner = None;
- #if QT_VERSION >= 0x050100
- m_pXcbEventFilter = new qjackctlXcbEventFilter(this);
- installNativeEventFilter(m_pXcbEventFilter);
- #endif
- #endif // CONFIG_XUNIQUE
- #endif // CONFIG_X11
- }
-
- // Destructor.
- ~qjackctlApplication()
- {
- #ifdef CONFIG_X11
- #ifdef CONFIG_XUNIQUE
- #if QT_VERSION >= 0x050100
- removeNativeEventFilter(m_pXcbEventFilter);
- delete m_pXcbEventFilter;
- #endif
- #endif // CONFIG_XUNIQUE
- #endif // CONFIG_X11
- if (m_pMyTranslator) delete m_pMyTranslator;
- if (m_pQtTranslator) delete m_pQtTranslator;
- }
-
- // Main application widget accessors.
- void setMainWidget(QWidget *pWidget)
- {
- m_pWidget = pWidget;
- #ifdef CONFIG_X11
- #ifdef CONFIG_XUNIQUE
- m_wOwner = m_pWidget->winId();
- if (m_pDisplay && m_wOwner) {
- XGrabServer(m_pDisplay);
- XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime);
- XUngrabServer(m_pDisplay);
- }
- #endif // CONFIG_XUNIQUE
- #endif // CONFIG_X11
- }
-
- QWidget *mainWidget() const { return m_pWidget; }
-
- // Check if another instance is running,
- // and raise its proper main widget...
- bool setup(const QString& sServerName)
- {
- #ifdef CONFIG_X11
- #ifdef CONFIG_XUNIQUE
- m_pDisplay = QX11Info::display();
+ }
+#ifdef CONFIG_XUNIQUE
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#ifdef CONFIG_X11
+ m_pDisplay = nullptr;
+ m_aUnique = 0;
+ m_wOwner = 0;
+#endif // CONFIG_X11
+#else
+ m_pMemory = nullptr;
+ m_pServer = nullptr;
+#endif
+#endif // CONFIG_XUNIQUE
+}
+
+
+// Destructor.
+qjackctlApplication::~qjackctlApplication (void)
+{
+#ifdef CONFIG_XUNIQUE
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ if (m_pServer) {
+ m_pServer->close();
+ delete m_pServer;
+ m_pServer = nullptr;
+ }
+ if (m_pMemory) {
+ delete m_pMemory;
+ m_pMemory = nullptr;
+ }
+#endif
+#endif // CONFIG_XUNIQUE
+ if (m_pMyTranslator) delete m_pMyTranslator;
+ if (m_pQtTranslator) delete m_pQtTranslator;
+}
+
+
+// Main application widget accessors.
+void qjackctlApplication::setMainWidget ( QWidget *pWidget )
+{
+ m_pWidget = pWidget;
+#ifdef CONFIG_XUNIQUE
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#ifdef CONFIG_X11
+ m_wOwner = m_pWidget->winId();
+ if (m_pDisplay && m_wOwner) {
+ XGrabServer(m_pDisplay);
+ XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime);
+ XUngrabServer(m_pDisplay);
+ }
+#endif // CONFIG_X11
+#endif
+#endif // CONFIG_XUNIQUE
+}
+
+
+// Check if another instance is running,
+// and raise its proper main widget...
+bool qjackctlApplication::setup ( const QString& sServerName )
+{
+#ifdef CONFIG_XUNIQUE
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#ifdef CONFIG_X11
+ m_pDisplay = QX11Info::display();
+ if (m_pDisplay) {
QString sUnique = QJACKCTL_XUNIQUE;
if (sServerName.isEmpty()) {
const char *pszServerName = ::getenv("JACK_DEFAULT_SERVER");
- if (pszServerName) {
+ if (pszServerName && ::strcmp("default", pszServerName)) {
sUnique += '_';
- sUnique += pszServerName;
+ sUnique += QString::fromUtf8(pszServerName);
}
} else {
sUnique += '_';
@@ -260,105 +239,188 @@
// Done.
return true;
}
- #endif // CONFIG_XUNIQUE
- #endif // CONFIG_X11
- return false;
}
-
-#ifdef CONFIG_X11
-#ifdef CONFIG_XUNIQUE
- void x11PropertyNotify(Window w)
- {
- if (m_pDisplay && m_pWidget && m_wOwner == w) {
- // Always check whether our property-flag is still around...
- Atom aType;
- int iFormat = 0;
- unsigned long iItems = 0;
- unsigned long iAfter = 0;
- unsigned char *pData = 0;
- if (XGetWindowProperty(
- m_pDisplay,
- m_wOwner,
- m_aUnique,
- 0, 1024,
- false,
- m_aUnique,
- &aType,
- &iFormat,
- &iItems,
- &iAfter,
- &pData) == Success
- && aType == m_aUnique && iItems > 0 && iAfter == 0) {
- // Avoid repeating it-self...
- XDeleteProperty(m_pDisplay, m_wOwner, m_aUnique);
- // Just make it always shows up fine...
- m_pWidget->show();
- m_pWidget->raise();
- m_pWidget->activateWindow();
- // FIXME: Do our best speciality, although it should be
- // done iif configuration says so, we'll do it anyway!
- qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
- if (pMainForm)
- pMainForm->startJack();
- }
- // Free any left-overs...
- if (iItems > 0 && pData)
- XFree(pData);
+#endif // CONFIG_X11
+ return false;
+#else
+ m_sUnique = QCoreApplication::applicationName();
+ if (!sServerName.isEmpty()) {
+ m_sUnique += '-';
+ m_sUnique += sServerName;
+ }
+ m_sUnique += '@';
+ m_sUnique += QHostInfo::localHostName();
+#ifdef Q_OS_UNIX
+ m_pMemory = new QSharedMemory(m_sUnique);
+ m_pMemory->attach();
+ delete m_pMemory;
+#endif
+ m_pMemory = new QSharedMemory(m_sUnique);
+ bool bServer = false;
+ const qint64 pid = QCoreApplication::applicationPid();
+ struct Data { qint64 pid; };
+ if (m_pMemory->create(sizeof(Data))) {
+ m_pMemory->lock();
+ Data *pData = static_cast (m_pMemory->data());
+ if (pData) {
+ pData->pid = pid;
+ bServer = true;
}
+ m_pMemory->unlock();
}
-#if QT_VERSION < 0x050000
- bool x11EventFilter(XEvent *pEv)
- {
- if (pEv->type == PropertyNotify
- && pEv->xproperty.state == PropertyNewValue)
- x11PropertyNotify(pEv->xproperty.window);
- return QApplication::x11EventFilter(pEv);
+ else
+ if (m_pMemory->attach()) {
+ m_pMemory->lock(); // maybe not necessary?
+ Data *pData = static_cast (m_pMemory->data());
+ if (pData)
+ bServer = (pData->pid == pid);
+ m_pMemory->unlock();
+ }
+ if (bServer) {
+ QLocalServer::removeServer(m_sUnique);
+ m_pServer = new QLocalServer();
+ m_pServer->setSocketOptions(QLocalServer::UserAccessOption);
+ m_pServer->listen(m_sUnique);
+ QObject::connect(m_pServer,
+ SIGNAL(newConnection()),
+ SLOT(newConnectionSlot()));
+ } else {
+ QLocalSocket socket;
+ socket.connectToServer(m_sUnique);
+ if (socket.state() == QLocalSocket::ConnectingState)
+ socket.waitForConnected(200);
+ if (socket.state() == QLocalSocket::ConnectedState) {
+ socket.write(QCoreApplication::arguments().join(' ').toUtf8());
+ socket.flush();
+ socket.waitForBytesWritten(200);
+ }
}
+ return !bServer;
#endif
-#endif // CONFIG_XUNIQUE
-#endif // CONFIG_X11
+#else
+ return false;
+#endif // !CONFIG_XUNIQUE
+}
+
-private:
+#ifdef CONFIG_XUNIQUE
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+#ifdef CONFIG_X11
- // Translation support.
- QTranslator *m_pQtTranslator;
- QTranslator *m_pMyTranslator;
+void qjackctlApplication::x11PropertyNotify ( Window w )
+{
+ if (m_pDisplay && m_pWidget && m_wOwner == w) {
+ // Always check whether our property-flag is still around...
+ Atom aType;
+ int iFormat = 0;
+ unsigned long iItems = 0;
+ unsigned long iAfter = 0;
+ unsigned char *pData = 0;
+ if (XGetWindowProperty(
+ m_pDisplay,
+ m_wOwner,
+ m_aUnique,
+ 0, 1024,
+ false,
+ m_aUnique,
+ &aType,
+ &iFormat,
+ &iItems,
+ &iAfter,
+ &pData) == Success
+ && aType == m_aUnique && iItems > 0 && iAfter == 0) {
+ // Avoid repeating it-self...
+ XDeleteProperty(m_pDisplay, m_wOwner, m_aUnique);
+ // Just make it always shows up fine...
+ m_pWidget->show();
+ m_pWidget->raise();
+ m_pWidget->activateWindow();
+ // FIXME: Do our best speciality, although it should be
+ // done iif configuration says so, we'll do it anyway!
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm)
+ pMainForm->startJack();
+ }
+ // Free any left-overs...
+ if (iItems > 0 && pData)
+ XFree(pData);
+ }
+}
- // Instance variables.
- QWidget *m_pWidget;
+bool qjackctlApplication::x11EventFilter ( XEvent *pEv )
+{
+ if (pEv->type == PropertyNotify
+ && pEv->xproperty.state == PropertyNewValue)
+ x11PropertyNotify(pEv->xproperty.window);
+ return QApplication::x11EventFilter(pEv);
+}
-#ifdef CONFIG_X11
-#ifdef CONFIG_XUNIQUE
- Display *m_pDisplay;
- Atom m_aUnique;
- Window m_wOwner;
-#if QT_VERSION >= 0x050100
- qjackctlXcbEventFilter *m_pXcbEventFilter;
-#endif
-#endif // CONFIG_XUNIQUE
#endif // CONFIG_X11
-};
+#else
+// Local server conection slot.
+void qjackctlApplication::newConnectionSlot (void)
+{
+ QLocalSocket *pSocket = m_pServer->nextPendingConnection();
+ QObject::connect(pSocket,
+ SIGNAL(readyRead()),
+ SLOT(readyReadSlot()));
+}
-#ifdef CONFIG_X11
-#ifdef CONFIG_XUNIQUE
-#if QT_VERSION >= 0x050100
-// XCB Event filter (virtual processor).
-bool qjackctlXcbEventFilter::nativeEventFilter (
- const QByteArray& eventType, void *message, long * )
+// Local server data-ready slot.
+void qjackctlApplication::readyReadSlot (void)
{
- if (eventType == "xcb_generic_event_t") {
- xcb_property_notify_event_t *pEv
- = static_cast (message);
- if ((pEv->response_type & ~0x80) == XCB_PROPERTY_NOTIFY
- && pEv->state == XCB_PROPERTY_NEW_VALUE)
- m_pApp->x11PropertyNotify(pEv->window);
+ QLocalSocket *pSocket = qobject_cast (sender());
+ if (pSocket) {
+ const qint64 nread = pSocket->bytesAvailable();
+ if (nread > 0) {
+ const QByteArray data = pSocket->read(nread);
+ // Just make it always shows up fine...
+ m_pWidget->hide();
+ m_pWidget->show();
+ m_pWidget->raise();
+ m_pWidget->activateWindow();
+ // FIXME: Do our best speciality, although it should be
+ // done iif configuration says so, we'll do it anyway!
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm) {
+ // Parse the pass-through command line arguments...
+ const QStringList& args
+ = QString::fromUtf8(data).split(' ');
+ const int argc = args.count();
+ for (int i = 1; i < argc; ++i) {
+ QString sArg = args.at(i);
+ QString sVal;
+ const int iEqual = sArg.indexOf('=');
+ if (iEqual >= 0) {
+ sVal = sArg.right(sArg.length() - iEqual - 1);
+ sArg = sArg.left(iEqual);
+ }
+ else if (i < argc - 1)
+ sVal = args.at(i + 1);
+ if (sArg == "-s" || sArg == "--start") {
+ pMainForm->startJack();
+ }
+ else if (sArg == "-p" || sArg == "--preset") {
+ if (!sVal.isEmpty())
+ pMainForm->activatePreset(sVal);
+ if (iEqual < 0)
+ ++i;
+ }
+ else if (sArg == "-a" || sArg == "--active-patchbay") {
+ if (!sVal.isEmpty())
+ pMainForm->activatePatchbay(sVal);
+ if (iEqual < 0)
+ ++i;
+ }
+ }
+ }
+ }
}
- return false;
}
+
#endif
#endif // CONFIG_XUNIQUE
-#endif // CONFIG_X11
//-------------------------------------------------------------------------
@@ -382,7 +444,7 @@
char cmd[80];
// Reinstall default handler; prevent race conditions...
- signal(signo, SIG_DFL);
+ ::signal(signo, SIG_DFL);
static const char *shell = "/bin/sh";
static const char *format = "gdb -q --batch --pid=%d"
@@ -398,7 +460,7 @@
// Fork child...
if (pid == 0) {
- execl(shell, shell, "-c", cmd, NULL);
+ execl(shell, shell, "-c", cmd, nullptr);
_exit(1);
return;
}
@@ -428,12 +490,15 @@
Q_INIT_RESOURCE(qjackctl);
#ifdef CONFIG_STACKTRACE
#if defined(__GNUC__) && defined(Q_OS_LINUX)
- signal(SIGILL, stacktrace);
- signal(SIGFPE, stacktrace);
- signal(SIGSEGV, stacktrace);
- signal(SIGABRT, stacktrace);
- signal(SIGBUS, stacktrace);
+ ::signal(SIGILL, stacktrace);
+ ::signal(SIGFPE, stacktrace);
+ ::signal(SIGSEGV, stacktrace);
+ ::signal(SIGABRT, stacktrace);
+ ::signal(SIGBUS, stacktrace);
+#endif
#endif
+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
qjackctlApplication app(argc, argv);
@@ -447,10 +512,11 @@
// Check if we'll just start an external program...
if (!settings.sCmdLine.isEmpty()) {
jack_client_t *pJackClient
- = jack_client_open("qjackctl-start", JackNoStartServer, NULL);
+ = jack_client_open("qjackctl-start", JackNoStartServer, nullptr);
if (pJackClient) {
jack_client_close(pJackClient);
- int iExitStatus = ::system(settings.sCmdLine.toUtf8().constData());
+ const int iExitStatus
+ = ::system(settings.sCmdLine.toUtf8().constData());
app.quit();
return iExitStatus;
}
@@ -467,7 +533,7 @@
// Dark themes grayed/disabled color group fix...
QPalette pal(app.palette());
if (pal.base().color().value() < 0x7f) {
- #if QT_VERSION >= 0x050000
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
const QColor& color = pal.window().color();
const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1;
for (int i = 0; i < iGroups; ++i) {
diff -Nru qjackctl-0.4.5/src/qjackctl.desktop qjackctl-0.6.0/src/qjackctl.desktop
--- qjackctl-0.4.5/src/qjackctl.desktop 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctl.desktop 2019-10-17 07:45:45.950673224 +0000
@@ -0,0 +1,22 @@
+[Desktop Entry]
+Name=QjackCtl
+Version=1.0
+GenericName=JACK Control
+GenericName[de]=JACK-Steuerung
+GenericName[fr]=Contrôle JACK
+GenericName[it]=Interfaccia di controllo per JACK
+GenericName[ru]=Управление JACK
+Comment=QjackCtl is a JACK Audio Connection Kit Qt GUI Interface
+Comment[de]=Grafisches Werkzeug zur Steuerung des JACK-Audio-Systems
+Comment[fr]=QjackCtl est une interface graphique Qt pour le kit de connexion audio JACK
+Comment[it]=QjackCtl è un'interfaccia di controllo per JACK basata su Qt
+Comment[ru]=Программа для управления звуковым сервером JACK
+Exec=qjackctl
+Icon=qjackctl
+Categories=Audio;AudioVideo;Midi;X-Alsa;X-Jack;Qt;
+Keywords=Audio;MIDI;ALSA;JACK;LV2;Qt;
+Terminal=false
+Type=Application
+StartupWMClass=qjackctl
+X-Window-Icon=qjackctl
+X-SuSE-translate=true
diff -Nru qjackctl-0.4.5/src/qjackctl.desktop.in qjackctl-0.6.0/src/qjackctl.desktop.in
--- qjackctl-0.4.5/src/qjackctl.desktop.in 2017-04-27 14:44:14.551753974 +0000
+++ qjackctl-0.6.0/src/qjackctl.desktop.in 1970-01-01 00:00:00.000000000 +0000
@@ -1,20 +0,0 @@
-[Desktop Entry]
-Name=@PACKAGE_NAME@
-Version=1.0
-GenericName=JACK Control
-GenericName[de]=JACK-Steuerung
-GenericName[fr]=Contrôle JACK
-GenericName[it]=Interfaccia di controllo per JACK
-GenericName[ru]=Управление JACK
-Comment=QjackCtl is a JACK Audio Connection Kit Qt GUI Interface
-Comment[de]=Grafisches Werkzeug zur Steuerung des JACK-Audio-Systems
-Comment[fr]=QjackCtl est une interface graphique Qt pour le kit de connexion audio JACK
-Comment[it]=QjackCtl è un'interfaccia di controllo per JACK basata su Qt
-Comment[ru]=Программа для управления звуковым сервером JACK
-Exec=@ac_prefix@/bin/qjackctl
-Icon=qjackctl
-Categories=Audio;AudioVideo;Midi;X-Alsa;X-Jack;Qt;
-Keywords=Audio;MIDI;ALSA;JACK;LV2;Qt;
-Terminal=false
-Type=Application
-X-SuSE-translate=true
diff -Nru qjackctl-0.4.5/src/qjackctlGraphCommand.cpp qjackctl-0.6.0/src/qjackctlGraphCommand.cpp
--- qjackctl-0.4.5/src/qjackctlGraphCommand.cpp 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraphCommand.cpp 2019-10-17 07:45:45.952673224 +0000
@@ -0,0 +1,249 @@
+// qjackctlGraph.cpp
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#include "qjackctlAbout.h"
+#include "qjackctlGraphCommand.h"
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphCommand -- Generic graph command pattern
+
+// Constructor.
+qjackctlGraphCommand::qjackctlGraphCommand ( qjackctlGraphCanvas *canvas,
+ QUndoCommand *parent ) : QUndoCommand(parent),
+ m_canvas(canvas)
+{
+}
+
+
+// Command methods.
+void qjackctlGraphCommand::undo (void)
+{
+ execute(true);
+}
+
+
+void qjackctlGraphCommand::redo (void)
+{
+ execute(false);
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphConnectCommand -- Connect graph command pattern
+
+// Constructor.
+qjackctlGraphConnectCommand::qjackctlGraphConnectCommand ( qjackctlGraphCanvas *canvas,
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2, bool is_connect,
+ qjackctlGraphCommand *parent ) : qjackctlGraphCommand(canvas, parent),
+ m_item(port1, port2, is_connect)
+{
+}
+
+
+// Command executive
+bool qjackctlGraphConnectCommand::execute ( bool is_undo )
+{
+ qjackctlGraphCanvas *canvas = qjackctlGraphCommand::canvas();
+ if (canvas == nullptr)
+ return false;
+
+ qjackctlGraphNode *node1
+ = canvas->findNode(
+ m_item.addr1.node_name,
+ qjackctlGraphItem::Duplex,
+ m_item.addr1.node_type);
+ if (node1 == nullptr)
+ node1 = canvas->findNode(
+ m_item.addr1.node_name,
+ qjackctlGraphItem::Output,
+ m_item.addr1.node_type);
+ if (node1 == nullptr)
+ return false;
+
+ qjackctlGraphPort *port1
+ = node1->findPort(
+ m_item.addr1.port_name,
+ qjackctlGraphItem::Output,
+ m_item.addr1.port_type);
+ if (port1 == nullptr)
+ return false;
+
+ qjackctlGraphNode *node2
+ = canvas->findNode(
+ m_item.addr2.node_name,
+ qjackctlGraphItem::Duplex,
+ m_item.addr2.node_type);
+ if (node2 == nullptr)
+ node2 = canvas->findNode(
+ m_item.addr2.node_name,
+ qjackctlGraphItem::Input,
+ m_item.addr2.node_type);
+ if (node2 == nullptr)
+ return false;
+
+ qjackctlGraphPort *port2
+ = node2->findPort(
+ m_item.addr2.port_name,
+ qjackctlGraphItem::Input,
+ m_item.addr2.port_type);
+ if (port2 == nullptr)
+ return false;
+
+ const bool is_connect
+ = (m_item.is_connect() && !is_undo) || (!m_item.is_connect() && is_undo);
+ if (is_connect)
+ canvas->emitConnected(port1, port2);
+ else
+ canvas->emitDisconnected(port1, port2);
+
+ return true;
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphMoveCommand -- Move (node) graph command
+
+// Constructor.
+qjackctlGraphMoveCommand::qjackctlGraphMoveCommand ( qjackctlGraphCanvas *canvas,
+ const QList& nodes, const QPointF& pos1, const QPointF& pos2,
+ qjackctlGraphCommand *parent ) : qjackctlGraphCommand(canvas, parent),
+ m_pos1(pos1), m_pos2(pos2), m_nexec(0)
+{
+ qjackctlGraphCommand::setText(QObject::tr("Move"));
+
+ foreach (qjackctlGraphNode *node, nodes) {
+ Item *item = new Item;
+ item->node_name = node->nodeName();
+ item->node_mode = node->nodeMode();
+ item->node_type = node->nodeType();
+ m_items.append(item);
+ }
+}
+
+
+// Destructor.
+qjackctlGraphMoveCommand::~qjackctlGraphMoveCommand (void)
+{
+ qDeleteAll(m_items);
+ m_items.clear();
+}
+
+
+// Command executive method.
+bool qjackctlGraphMoveCommand::execute ( bool /* is_undo */ )
+{
+ qjackctlGraphCanvas *canvas = qjackctlGraphCommand::canvas();
+ if (canvas == nullptr)
+ return false;
+
+ if (++m_nexec > 1) {
+ const QPointF delta = (m_pos2 - m_pos1);
+ foreach (Item *item, m_items) {
+ qjackctlGraphNode *node = canvas->findNode(
+ item->node_name, item->node_mode, item->node_type);
+ if (node)
+ node->setPos(node->pos() + delta);
+ }
+ }
+
+ QPointF pos2 = m_pos2;
+ m_pos2 = m_pos1;
+ m_pos1 = pos2;
+
+ return true;
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphRenameCommand -- Rename (item) graph command
+
+// Constructor.
+qjackctlGraphRenameCommand::qjackctlGraphRenameCommand ( qjackctlGraphCanvas *canvas,
+ qjackctlGraphItem *item, const QString& name, qjackctlGraphCommand *parent )
+ : qjackctlGraphCommand(canvas, parent), m_name(name)
+{
+ qjackctlGraphCommand::setText(QObject::tr("Rename"));
+
+ m_item.item_type = item->type();
+
+ qjackctlGraphNode *node = nullptr;
+ qjackctlGraphPort *port = nullptr;
+
+ if (m_item.item_type == qjackctlGraphNode::Type)
+ node = static_cast (item);
+ else
+ if (m_item.item_type == qjackctlGraphPort::Type)
+ port = static_cast (item);
+
+ if (port)
+ node = port->portNode();
+
+ if (node) {
+ m_item.node_name = node->nodeName();
+ m_item.node_mode = node->nodeMode();
+ m_item.node_type = node->nodeType();
+ }
+
+ if (port) {
+ m_item.port_name = port->portName();
+ m_item.port_mode = port->portMode();
+ m_item.port_type = port->portType();
+ }
+}
+
+
+// Command executive method.
+bool qjackctlGraphRenameCommand::execute ( bool /*is_undo*/ )
+{
+ qjackctlGraphCanvas *canvas = qjackctlGraphCommand::canvas();
+ if (canvas == nullptr)
+ return false;
+
+ QString name = m_name;
+ qjackctlGraphItem *item = nullptr;
+
+ qjackctlGraphNode *node = canvas->findNode(
+ m_item.node_name, m_item.node_mode, m_item.node_type);
+
+ if (m_item.item_type == qjackctlGraphNode::Type && node) {
+ m_name = node->nodeTitle();
+ item = node;
+ }
+ else
+ if (m_item.item_type == qjackctlGraphPort::Type && node) {
+ qjackctlGraphPort *port = node->findPort(
+ m_item.port_name, m_item.port_mode, m_item.port_type);
+ if (port) {
+ m_name = port->portTitle();
+ item = port;
+ }
+ }
+
+ if (item == nullptr)
+ return false;
+
+ canvas->emitRenamed(item, name);
+ return true;
+}
+
+
+// end of qjackctlGraphCommand.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlGraphCommand.h qjackctl-0.6.0/src/qjackctlGraphCommand.h
--- qjackctl-0.4.5/src/qjackctlGraphCommand.h 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraphCommand.h 2019-10-17 07:45:45.952673224 +0000
@@ -0,0 +1,218 @@
+// qjackctlGraphCommand.h
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#ifndef __qjackctlGraphCommand_h
+#define __qjackctlGraphCommand_h
+
+#include "qjackctlGraph.h"
+
+#include
+
+#include
+#include
+
+
+//----------------------------------------------------------------------------
+// qgraph1_command -- Generic graph command pattern
+
+class qjackctlGraphCommand : public QUndoCommand
+{
+public:
+
+ // Constructor.
+ qjackctlGraphCommand(qjackctlGraphCanvas *canvas, QUndoCommand *parent = nullptr);
+
+ // Accessors.
+ qjackctlGraphCanvas *canvas() const
+ { return m_canvas; }
+
+ // Command methods.
+ void undo();
+ void redo();
+
+protected:
+
+ // Command executive method.
+ virtual bool execute(bool is_undo = false) = 0;
+
+private:
+
+ // Command arguments.
+ qjackctlGraphCanvas *m_canvas;
+};
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphConnectCommand -- Connect graph command
+
+class qjackctlGraphConnectCommand : public qjackctlGraphCommand
+{
+public:
+
+ // Constructor.
+ qjackctlGraphConnectCommand(qjackctlGraphCanvas *canvas,
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2,
+ bool is_connect, qjackctlGraphCommand *parent = nullptr);
+
+protected:
+
+ // Command item address
+ struct Addr
+ {
+ // Constructors.
+ Addr(qjackctlGraphPort *port)
+ {
+ qjackctlGraphNode *node = port->portNode();
+ node_name = node->nodeName();
+ node_type = node->nodeType();
+ port_name = port->portName();
+ port_type = port->portType();
+ }
+ // Copy constructor.
+ Addr(const Addr& addr)
+ {
+ node_name = addr.node_name;
+ node_type = addr.node_type;
+ port_name = addr.port_name;
+ port_type = addr.port_type;
+ }
+ // Member fields.
+ QString node_name;
+ uint node_type;
+ QString port_name;
+ uint port_type;
+ };
+
+ // Command item descriptor
+ struct Item
+ {
+ // Constructor.
+ Item(qjackctlGraphPort *port1, qjackctlGraphPort *port2, bool is_connect)
+ : addr1(port1), addr2(port2), m_connect(is_connect) {}
+ // Copy constructor.
+ Item(const Item& item) : addr1(item.addr1), addr2(item.addr2),
+ m_connect(item.is_connect()) {}
+
+ // Accessors.
+ bool is_connect() const
+ { return m_connect; }
+
+ // Public member fields.
+ Addr addr1;
+ Addr addr2;
+
+ private:
+
+ // Private member fields.
+ bool m_connect;
+ };
+
+ // Command executive method.
+ bool execute(bool is_undo);
+
+private:
+
+ // Command arguments.
+ Item m_item;
+};
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphMoveCommand -- Move (node) graph command
+
+class qjackctlGraphMoveCommand : public qjackctlGraphCommand
+{
+public:
+
+ // Constructor.
+ qjackctlGraphMoveCommand(qjackctlGraphCanvas *canvas,
+ const QList& nodes,
+ const QPointF& pos1, const QPointF& pos2,
+ qjackctlGraphCommand *parent = nullptr);
+
+ // Destructor.
+ ~qjackctlGraphMoveCommand();
+
+protected:
+
+ // Command item descriptor
+ struct Item
+ {
+ QString node_name;
+ qjackctlGraphItem::Mode node_mode;
+ uint node_type;
+ };
+
+ // Command executive method.
+ bool execute(bool is_undo);
+
+private:
+
+ // Command arguments.
+ QList- m_items;
+
+ QPointF m_pos1;
+ QPointF m_pos2;
+
+ int m_nexec;
+};
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphRenameCommand -- Rename (item) graph command
+
+class qjackctlGraphRenameCommand : public qjackctlGraphCommand
+{
+public:
+
+ // Constructor.
+ qjackctlGraphRenameCommand(qjackctlGraphCanvas *canvas,
+ qjackctlGraphItem *item, const QString& name,
+ qjackctlGraphCommand *parent = nullptr);
+
+protected:
+
+ // Command item descriptor
+ struct Item
+ {
+ int item_type;
+ QString node_name;
+ qjackctlGraphItem::Mode node_mode;
+ uint node_type;
+ QString port_name;
+ qjackctlGraphItem::Mode port_mode;
+ uint port_type;
+ };
+
+ // Command executive method.
+ bool execute(bool is_undo);
+
+private:
+
+ // Command arguments.
+ Item m_item;
+ QString m_name;
+};
+
+
+#endif // __qjackctlGraphCommand_h
+
+// end of qjackctlGraphCommand.h
diff -Nru qjackctl-0.4.5/src/qjackctlGraph.cpp qjackctl-0.6.0/src/qjackctlGraph.cpp
--- qjackctl-0.4.5/src/qjackctlGraph.cpp 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraph.cpp 2019-10-17 07:45:45.952673224 +0000
@@ -0,0 +1,2382 @@
+// qjackctlGraph.cpp
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#include "qjackctlAbout.h"
+#include "qjackctlGraph.h"
+
+#include "qjackctlGraphCommand.h"
+
+#include "qjackctlAliases.h"
+
+#include
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+
+#include
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphItem -- Base graphics item.
+
+// Constructor.
+qjackctlGraphItem::qjackctlGraphItem ( QGraphicsItem *parent )
+ : QGraphicsPathItem(parent), m_marked(false), m_hilite(false)
+{
+ const QPalette pal;
+ m_foreground = pal.buttonText().color();
+ m_background = pal.button().color();
+}
+
+
+// Basic color accessors.
+void qjackctlGraphItem::setForeground ( const QColor& color )
+{
+ m_foreground = color;
+}
+
+const QColor& qjackctlGraphItem::foreground (void) const
+{
+ return m_foreground;
+}
+
+
+void qjackctlGraphItem::setBackground ( const QColor& color )
+{
+ m_background = color;
+}
+
+const QColor& qjackctlGraphItem::background (void) const
+{
+ return m_background;
+}
+
+
+// Marking methods.
+void qjackctlGraphItem::setMarked ( bool marked )
+{
+ m_marked = marked;
+}
+
+
+bool qjackctlGraphItem::isMarked (void) const
+{
+ return m_marked;
+}
+
+
+// Highlighting methods.
+void qjackctlGraphItem::setHighlight ( bool hilite )
+{
+ m_hilite = hilite;
+
+ QGraphicsPathItem::update();
+}
+
+
+bool qjackctlGraphItem::isHighlight (void) const
+{
+ return m_hilite;
+}
+
+
+// Item-type hash (static)
+uint qjackctlGraphItem::itemType ( const QByteArray& type_name )
+{
+ return qHash(type_name);
+}
+
+
+// Rectangular editor extents (virtual)
+QRectF qjackctlGraphItem::editorRect (void) const
+{
+ return QRectF();
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphPort -- Port graphics item.
+
+// Constructor.
+qjackctlGraphPort::qjackctlGraphPort ( qjackctlGraphNode *node,
+ const QString& name, qjackctlGraphItem::Mode mode, uint type )
+ : qjackctlGraphItem(node), m_node(node),
+ m_name(name), m_mode(mode), m_type(type), m_index(0),
+ m_selectx(0), m_hilitex(0)
+{
+ QGraphicsPathItem::setZValue(+1);
+
+ const QPalette pal;
+ setForeground(pal.buttonText().color());
+ setBackground(pal.button().color());
+
+ m_text = new QGraphicsTextItem(this);
+
+ QGraphicsPathItem::setFlag(QGraphicsItem::ItemIsSelectable);
+ QGraphicsPathItem::setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
+
+ QGraphicsPathItem::setAcceptHoverEvents(true);
+
+ QGraphicsPathItem::setToolTip(m_name);
+
+ setPortTitle(m_name);
+}
+
+
+// Destructor.
+qjackctlGraphPort::~qjackctlGraphPort (void)
+{
+ removeConnects();
+
+ // No actual need to destroy any children here...
+ //
+ //delete m_text;
+}
+
+
+// Accessors.
+qjackctlGraphNode *qjackctlGraphPort::portNode (void) const
+{
+ return m_node;
+}
+
+
+void qjackctlGraphPort::setPortName ( const QString& name )
+{
+ m_name = name;
+
+ QGraphicsPathItem::setToolTip(m_name);
+}
+
+
+const QString& qjackctlGraphPort::portName (void) const
+{
+ return m_name;
+}
+
+
+void qjackctlGraphPort::setPortMode ( qjackctlGraphItem::Mode mode )
+{
+ m_mode = mode;
+}
+
+
+qjackctlGraphItem::Mode qjackctlGraphPort::portMode (void) const
+{
+ return m_mode;
+}
+
+
+bool qjackctlGraphPort::isInput (void) const
+{
+ return (m_mode & Input);
+}
+
+
+bool qjackctlGraphPort::isOutput (void) const
+{
+ return (m_mode & Output);
+}
+
+
+void qjackctlGraphPort::setPortType ( uint type )
+{
+ m_type = type;
+}
+
+
+uint qjackctlGraphPort::portType (void) const
+{
+ return m_type;
+}
+
+
+void qjackctlGraphPort::setPortTitle ( const QString& title )
+{
+ m_title = (title.isEmpty() ? m_name : title);
+
+ m_text->setPlainText(m_title);
+
+ QPainterPath path;
+ const QRectF& rect
+ = m_text->boundingRect().adjusted(0, +2, 0, -2);
+ path.addRoundedRect(rect, 5, 5);
+ QGraphicsPathItem::setPath(path);
+}
+
+
+const QString& qjackctlGraphPort::portTitle (void) const
+{
+ return m_title;
+}
+
+
+void qjackctlGraphPort::setPortIndex ( int index )
+{
+ m_index = index;
+}
+
+
+int qjackctlGraphPort::portIndex (void) const
+{
+ return m_index;
+}
+
+
+QPointF qjackctlGraphPort::portPos (void) const
+{
+ QPointF pos = QGraphicsPathItem::scenePos();
+
+ const QRectF& rect
+ = QGraphicsPathItem::boundingRect();
+ if (m_mode == Output)
+ pos.setX(pos.x() + rect.width());
+ pos.setY(pos.y() + rect.height() / 2);
+
+ return pos;
+}
+
+
+// Connection-list methods.
+void qjackctlGraphPort::appendConnect ( qjackctlGraphConnect *connect )
+{
+ m_connects.append(connect);
+}
+
+
+void qjackctlGraphPort::removeConnect ( qjackctlGraphConnect *connect )
+{
+ m_connects.removeAll(connect);
+}
+
+
+void qjackctlGraphPort::removeConnects (void)
+{
+ foreach (qjackctlGraphConnect *connect, m_connects) {
+ if (connect->port1() != this)
+ connect->setPort1(0);
+ if (connect->port2() != this)
+ connect->setPort2(0);
+ }
+
+ // Do not delete connects here as they are owned elsewhere...
+ //
+ // qDeleteAll(m_connects);
+ m_connects.clear();
+}
+
+
+qjackctlGraphConnect *qjackctlGraphPort::findConnect ( qjackctlGraphPort *port ) const
+{
+ foreach (qjackctlGraphConnect *connect, m_connects) {
+ if (connect->port1() == port || connect->port2() == port)
+ return connect;
+ }
+
+ return nullptr;
+}
+
+
+void qjackctlGraphPort::paint ( QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget */*widget*/ )
+{
+ const QPalette& pal = option->palette;
+
+ if (QGraphicsPathItem::isSelected()) {
+ m_text->setDefaultTextColor(pal.highlightedText().color());
+ painter->setPen(pal.highlightedText().color());
+ painter->setBrush(pal.highlight().color());
+ } else {
+ const QColor& foreground
+ = qjackctlGraphItem::foreground();
+ const QColor& background
+ = qjackctlGraphItem::background();
+ const bool is_dark
+ = (background.value() < 128);
+ m_text->setDefaultTextColor(is_dark
+ ? foreground.lighter()
+ : foreground.darker());
+ if (qjackctlGraphItem::isHighlight() || QGraphicsPathItem::isUnderMouse()) {
+ painter->setPen(foreground.lighter());
+ painter->setBrush(background.lighter());
+ } else {
+ painter->setPen(foreground);
+ painter->setBrush(background);
+ }
+ }
+
+ painter->drawPath(QGraphicsPathItem::path());
+}
+
+
+QVariant qjackctlGraphPort::itemChange (
+ GraphicsItemChange change, const QVariant& value )
+{
+ if (change == QGraphicsItem::ItemScenePositionHasChanged) {
+ foreach (qjackctlGraphConnect *connect, m_connects) {
+ connect->updatePath();
+ }
+ }
+ else
+ if (change == QGraphicsItem::ItemSelectedHasChanged && m_selectx < 1) {
+ const bool is_selected = value.toBool();
+ setHighlightEx(is_selected);
+ foreach (qjackctlGraphConnect *connect, m_connects)
+ connect->setSelectedEx(this, is_selected);
+ }
+
+ return value;
+}
+
+
+// Selection propagation method...
+void qjackctlGraphPort::setSelectedEx ( bool is_selected )
+{
+ if (!is_selected) {
+ foreach (qjackctlGraphConnect *connect, m_connects) {
+ if (connect->isSelected()) {
+ setHighlightEx(true);
+ return;
+ }
+ }
+ }
+
+ ++m_selectx;
+
+ setHighlightEx(is_selected);
+
+ if (QGraphicsPathItem::isSelected() != is_selected)
+ QGraphicsPathItem::setSelected(is_selected);
+
+ --m_selectx;
+}
+
+
+// Highlighting propagation method...
+void qjackctlGraphPort::setHighlightEx ( bool is_highlight )
+{
+ if (m_hilitex > 0)
+ return;
+
+ ++m_hilitex;
+
+ qjackctlGraphItem::setHighlight(is_highlight);
+
+ foreach (qjackctlGraphConnect *connect, m_connects)
+ connect->setHighlightEx(this, is_highlight);
+
+ --m_hilitex;
+}
+
+
+// Special port-type color business.
+void qjackctlGraphPort::updatePortTypeColors ( qjackctlGraphCanvas *canvas )
+{
+ if (canvas) {
+ const QColor& color = canvas->portTypeColor(m_type);
+ if (color.isValid()) {
+ const bool is_dark = (color.value() < 128);
+ qjackctlGraphItem::setForeground(is_dark
+ ? color.lighter(180)
+ : color.darker());
+ qjackctlGraphItem::setBackground(color);
+ if (m_mode & Output) {
+ foreach (qjackctlGraphConnect *connect, m_connects) {
+ connect->updatePortTypeColors();
+ connect->update();
+ }
+ }
+ }
+ }
+}
+
+
+
+// Port sorting type.
+qjackctlGraphPort::SortType qjackctlGraphPort::g_sort_type = qjackctlGraphPort::PortName;
+
+void qjackctlGraphPort::setSortType ( SortType sort_type )
+{
+ g_sort_type = sort_type;
+}
+
+qjackctlGraphPort::SortType qjackctlGraphPort::sortType (void)
+{
+ return g_sort_type;
+}
+
+
+// Port sorting order.
+qjackctlGraphPort::SortOrder qjackctlGraphPort::g_sort_order = qjackctlGraphPort::Ascending;
+
+void qjackctlGraphPort::setSortOrder( SortOrder sort_order )
+{
+ g_sort_order = sort_order;
+}
+
+qjackctlGraphPort::SortOrder qjackctlGraphPort::sortOrder (void)
+{
+ return g_sort_order;
+}
+
+
+// Natural decimal sorting comparator (static)
+bool qjackctlGraphPort::lessThan ( qjackctlGraphPort *port1, qjackctlGraphPort *port2 )
+{
+ const int port_type_diff
+ = int(port1->portType()) - int(port2->portType());
+ if (port_type_diff)
+ return (port_type_diff > 0);
+
+ if (g_sort_order == Descending) {
+ qjackctlGraphPort *port = port1;
+ port1 = port2;
+ port2 = port;
+ }
+
+ if (g_sort_type == PortIndex) {
+ const int port_index_diff
+ = port1->portIndex() - port2->portIndex();
+ if (port_index_diff)
+ return (port_index_diff < 0);
+ }
+
+ switch (g_sort_type) {
+ case PortTitle:
+ return qjackctlGraphPort::lessThan(port1->portTitle(), port2->portTitle());
+ case PortName:
+ default:
+ return qjackctlGraphPort::lessThan(port1->portName(), port2->portName());
+ }
+}
+
+bool qjackctlGraphPort::lessThan ( const QString& s1, const QString& s2 )
+{
+ const int n1 = s1.length();
+ const int n2 = s2.length();
+
+ int i1, i2;
+
+ for (i1 = i2 = 0; i1 < n1 && i2 < n2; ++i1, ++i2) {
+
+ // Skip (white)spaces...
+ while (s1.at(i1).isSpace())
+ ++i1;
+ while (s2.at(i2).isSpace())
+ ++i2;
+
+ // Normalize (to uppercase) the next characters...
+ QChar c1 = s1.at(i1).toUpper();
+ QChar c2 = s2.at(i2).toUpper();
+
+ if (c1.isDigit() && c2.isDigit()) {
+ // Find the whole length numbers...
+ int j1 = i1++;
+ while (i1 < n1 && s1.at(i1).isDigit())
+ ++i1;
+ int j2 = i2++;
+ while (i2 < n2 && s2.at(i2).isDigit())
+ ++i2;
+ // Compare as natural decimal-numbers...
+ j1 = s1.mid(j1, i1 - j1).toInt();
+ j2 = s2.mid(j2, i2 - j2).toInt();
+ if (j1 != j2)
+ return (j1 < j2);
+ // Never go out of bounds...
+ if (i1 >= n1 || i2 >= n2)
+ break;
+ // Go on with this next char...
+ c1 = s1.at(i1).toUpper();
+ c2 = s2.at(i2).toUpper();
+ }
+
+ // Compare this char...
+ if (c1 != c2)
+ return (c1 < c2);
+ }
+
+ // Probable exact match.
+ return false;
+}
+
+
+// Rectangular editor extents.
+QRectF qjackctlGraphPort::editorRect (void) const
+{
+ return QGraphicsPathItem::sceneBoundingRect();
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphNode -- Node graphics item.
+
+// Constructor.
+qjackctlGraphNode::qjackctlGraphNode (
+ const QString& name, qjackctlGraphItem::Mode mode, uint type )
+ : qjackctlGraphItem(nullptr),
+ m_name(name), m_mode(mode), m_type(type)
+{
+ QGraphicsPathItem::setZValue(0);
+
+ const QPalette pal;
+ const int base_value = pal.base().color().value();
+ const bool is_dark = (base_value < 128);
+
+ const QColor& text_color = pal.text().color();
+ QColor foreground_color(is_dark
+ ? text_color.darker()
+ : text_color);
+ qjackctlGraphItem::setForeground(foreground_color);
+
+ const QColor& window_color = pal.window().color();
+ QColor background_color(is_dark
+ ? window_color.lighter()
+ : window_color);
+ background_color.setAlpha(160);
+ qjackctlGraphItem::setBackground(background_color);
+
+ m_pixmap = new QGraphicsPixmapItem(this);
+ m_text = new QGraphicsTextItem(this);
+
+ QGraphicsPathItem::setFlag(QGraphicsItem::ItemIsMovable);
+ QGraphicsPathItem::setFlag(QGraphicsItem::ItemIsSelectable);
+
+ QGraphicsPathItem::setToolTip(m_name);
+ setNodeTitle(m_name);
+
+ const bool is_darkest = (base_value < 24);
+ QColor shadow_color = (is_darkest ? Qt::white : Qt::black);
+ shadow_color.setAlpha(180);
+
+ QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect();
+ effect->setColor(shadow_color);
+ effect->setBlurRadius(is_darkest ? 8 : 16);
+ effect->setOffset(is_darkest ? 0 : 2);
+ QGraphicsPathItem::setGraphicsEffect(effect);
+}
+
+
+// Destructor.
+qjackctlGraphNode::~qjackctlGraphNode (void)
+{
+ removePorts();
+
+ // No actual need to destroy any children here...
+ //
+ // QGraphicsPathItem::setGraphicsEffect(0);
+
+ // delete m_text;
+ // delete m_pixmap;
+}
+
+
+// accessors.
+void qjackctlGraphNode::setNodeName ( const QString& name )
+{
+ m_name = name;
+
+ QGraphicsPathItem::setToolTip(m_name);
+}
+
+
+const QString& qjackctlGraphNode::nodeName (void) const
+{
+ return m_name;
+}
+
+
+void qjackctlGraphNode::setNodeMode ( qjackctlGraphItem::Mode mode )
+{
+ m_mode = mode;
+}
+
+
+qjackctlGraphItem::Mode qjackctlGraphNode::nodeMode (void) const
+{
+ return m_mode;
+}
+
+
+void qjackctlGraphNode::setNodeType ( uint type )
+{
+ m_type = type;
+}
+
+
+uint qjackctlGraphNode::nodeType (void) const
+{
+ return m_type;
+}
+
+
+void qjackctlGraphNode::setNodeIcon ( const QIcon& icon )
+{
+ m_icon = icon;
+
+ m_pixmap->setPixmap(m_icon.pixmap(24, 24));
+}
+
+
+const QIcon& qjackctlGraphNode::nodeIcon (void) const
+{
+ return m_icon;
+}
+
+
+void qjackctlGraphNode::setNodeTitle ( const QString& title )
+{
+ const QFont& font = m_text->font();
+ m_text->setFont(QFont(font.family(), font.pointSize(), QFont::Bold));
+ m_text->setPlainText(title.isEmpty() ? m_name : title);
+}
+
+
+QString qjackctlGraphNode::nodeTitle (void) const
+{
+ return m_text->toPlainText();
+}
+
+
+// Port-list methods.
+qjackctlGraphPort *qjackctlGraphNode::addPort (
+ const QString& name, qjackctlGraphItem::Mode mode, int type )
+{
+ qjackctlGraphPort *port = new qjackctlGraphPort(this, name, mode, type);
+
+ m_ports.append(port);
+ m_portkeys.insert(qjackctlGraphPort::PortKey(port), port);
+
+ updatePath();
+
+ return port;
+}
+
+
+qjackctlGraphPort *qjackctlGraphNode::addInputPort ( const QString& name, int type )
+{
+ return addPort(name, qjackctlGraphItem::Input, type);
+}
+
+
+qjackctlGraphPort *qjackctlGraphNode::addOutputPort ( const QString& name, int type )
+{
+ return addPort(name, qjackctlGraphItem::Output, type);
+}
+
+
+void qjackctlGraphNode::removePort ( qjackctlGraphPort *port )
+{
+ m_portkeys.remove(qjackctlGraphPort::PortKey(port));
+ m_ports.removeAll(port);
+
+ updatePath();
+}
+
+
+void qjackctlGraphNode::removePorts (void)
+{
+ foreach (qjackctlGraphPort *port, m_ports)
+ port->removeConnects();
+
+ // Do not delete ports here as they are node's child items...
+ //
+ //qDeleteAll(m_ports);
+ m_ports.clear();
+ m_portkeys.clear();
+}
+
+
+// Port finder (by name, mode and type)
+qjackctlGraphPort *qjackctlGraphNode::findPort (
+ const QString& name, qjackctlGraphItem::Mode mode, uint type )
+{
+ return static_cast (
+ m_portkeys.value(qjackctlGraphPort::ItemKey(name, mode, type), nullptr));
+}
+
+
+// Reset port markings, destroy if unmarked.
+void qjackctlGraphNode::resetMarkedPorts (void)
+{
+ QList ports;
+
+ foreach (qjackctlGraphPort *port, m_ports) {
+ if (port->isMarked()) {
+ port->setMarked(false);
+ } else {
+ ports.append(port);
+ }
+ }
+
+ foreach (qjackctlGraphPort *port, ports) {
+ port->removeConnects();
+ removePort(port);
+ delete port;
+ }
+}
+
+
+// Path/shape updater.
+void qjackctlGraphNode::updatePath (void)
+{
+ const QRectF& rect = m_text->boundingRect();
+ int width = rect.width() / 2 + 24;
+ int wi, wo;
+ wi = wo = width;
+ foreach (qjackctlGraphPort *port, m_ports) {
+ const int w = port->boundingRect().width();
+ if (port->isOutput()) {
+ if (wo < w) wo = w;
+ } else {
+ if (wi < w) wi = w;
+ }
+ }
+ width = wi + wo;
+
+ std::sort(m_ports.begin(), m_ports.end(), qjackctlGraphPort::Compare());
+
+ int height = rect.height() + 2;
+ int type = 0;
+ int yi, yo;
+ yi = yo = height;
+ foreach (qjackctlGraphPort *port, m_ports) {
+ const QRectF& port_rect = port->boundingRect();
+ const int w = port_rect.width();
+ const int h = port_rect.height() + 1;
+ if (type - port->portType()) {
+ type = port->portType();
+ height += 2;
+ yi = yo = height;
+ }
+ if (port->isOutput()) {
+ port->setPos(+width / 2 + 6 - w, yo);
+ yo += h;
+ if (height < yo)
+ height = yo;
+ } else {
+ port->setPos(-width / 2 - 6, yi);
+ yi += h;
+ if (height < yi)
+ height = yi;
+ }
+ }
+
+ QPainterPath path;
+ path.addRoundedRect(-width / 2, 0, width, height + 6, 5, 5);
+ QGraphicsPathItem::setPath(path);
+}
+
+
+void qjackctlGraphNode::paint ( QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget */*widget*/ )
+{
+ const QPalette& pal = option->palette;
+
+ if (QGraphicsPathItem::isSelected()) {
+ const QColor& hilitetext_color = pal.highlightedText().color();
+ m_text->setDefaultTextColor(hilitetext_color);
+ painter->setPen(hilitetext_color);
+ QColor hilite_color(pal.highlight().color());
+ hilite_color.setAlpha(180);
+ painter->setBrush(hilite_color);
+ } else {
+ const QColor& foreground
+ = qjackctlGraphItem::foreground();
+ const QColor& background
+ = qjackctlGraphItem::background();
+ const bool is_dark
+ = (background.value() < 192);
+ m_text->setDefaultTextColor(is_dark
+ ? foreground.lighter()
+ : foreground.darker());
+ painter->setPen(foreground);
+ painter->setBrush(background);
+ }
+
+ painter->drawPath(QGraphicsPathItem::path());
+
+ const QRectF& node_rect = QGraphicsPathItem::boundingRect();
+ m_pixmap->setPos(node_rect.x() + 4, node_rect.y() + 4);
+
+ const QRectF& text_rect = m_text->boundingRect();
+ m_text->setPos(- text_rect.width() / 2, text_rect.y() + 2);
+}
+
+
+QVariant qjackctlGraphNode::itemChange (
+ GraphicsItemChange change, const QVariant& value )
+{
+ if (change == QGraphicsItem::ItemSelectedHasChanged) {
+ const bool is_selected = value.toBool();
+ foreach (qjackctlGraphPort *port, m_ports)
+ port->setSelected(is_selected);
+ }
+
+ return value;
+}
+
+
+// Rectangular editor extents.
+QRectF qjackctlGraphNode::editorRect (void) const
+{
+ return m_text->sceneBoundingRect();
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphConnect -- Connection-line graphics item.
+
+// Constructor.
+qjackctlGraphConnect::qjackctlGraphConnect (void)
+ : qjackctlGraphItem(nullptr), m_port1(nullptr), m_port2(nullptr)
+{
+ QGraphicsPathItem::setZValue(-1);
+
+ QGraphicsPathItem::setFlag(QGraphicsItem::ItemIsSelectable);
+
+ qjackctlGraphItem::setBackground(qjackctlGraphItem::foreground());
+
+ const QPalette pal;
+ const bool is_darkest = (pal.base().color().value() < 24);
+ QColor shadow_color = (is_darkest ? Qt::white : Qt::black);
+ shadow_color.setAlpha(220);
+
+ QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect();
+ effect->setColor(shadow_color);
+ effect->setBlurRadius(is_darkest ? 4 : 8);
+ effect->setOffset(is_darkest ? 0 : 1);
+ QGraphicsPathItem::setGraphicsEffect(effect);
+
+ QGraphicsPathItem::setAcceptHoverEvents(true);
+}
+
+
+// Destructor.
+qjackctlGraphConnect::~qjackctlGraphConnect (void)
+{
+ if (m_port1)
+ m_port1->removeConnect(this);
+ if (m_port2)
+ m_port2->removeConnect(this);
+
+ // No actual need to destroy any children here...
+ //
+ // QGraphicsPathItem::setGraphicsEffect(0);
+}
+
+
+// Accessors.
+void qjackctlGraphConnect::setPort1 ( qjackctlGraphPort *port )
+{
+ if (m_port1)
+ m_port1->removeConnect(this);
+
+ m_port1 = port;
+
+ if (m_port1)
+ m_port1->appendConnect(this);
+
+ if (m_port1 && m_port1->isSelected())
+ setSelectedEx(m_port1, true);
+}
+
+
+qjackctlGraphPort *qjackctlGraphConnect::port1 (void) const
+{
+ return m_port1;
+}
+
+
+void qjackctlGraphConnect::setPort2 ( qjackctlGraphPort *port )
+{
+ if (m_port2)
+ m_port2->removeConnect(this);
+
+ m_port2 = port;
+
+ if (m_port2)
+ m_port2->appendConnect(this);
+
+ if (m_port2 && m_port2->isSelected())
+ setSelectedEx(m_port2, true);
+}
+
+
+qjackctlGraphPort *qjackctlGraphConnect::port2 (void) const
+{
+ return m_port2;
+}
+
+
+// Path/shaper updaters.
+void qjackctlGraphConnect::updatePathTo ( const QPointF& pos )
+{
+ const bool is_out0 = m_port1->isOutput();
+ const QPointF pos0 = m_port1->portPos();
+ const QPointF pos1 = (is_out0 ? pos0 : pos);
+ const QPointF pos4 = (is_out0 ? pos : pos0);
+
+ qjackctlGraphNode *node1 = m_port1->portNode();
+ const QRectF& rect1 = node1->boundingRect();
+ const qreal dx = pos4.x() - pos1.x();
+ const qreal dy = pos0.y() - node1->scenePos().y() - 0.5 * rect1.height();
+ const qreal y_max = rect1.height() + rect1.width();
+ const qreal y_min = qMin(y_max, qAbs(dx));
+ const qreal x_offset = (dx > 0.0 ? 0.5 : 1.0) * y_min;
+ const qreal y_offset = (dx > 0.0 ? 0.0 : (dy > 0.0 ? +y_min : -y_min));
+
+ const QPointF pos2(pos1.x() + x_offset, pos1.y() + y_offset);
+ const QPointF pos3(pos4.x() - x_offset, pos4.y() + y_offset);
+
+ QPainterPath path;
+ path.moveTo(pos1);
+ path.cubicTo(pos2, pos3, pos4);
+ const qreal arrow_angle = path.angleAtPercent(0.5) * M_PI / 180.0;
+ const QPointF arrow_pos0 = path.pointAtPercent(0.5);
+ path.cubicTo(pos3, pos2, pos1);
+ const qreal arrow_size = 12.0;
+ QVector arrow;
+ arrow.append(arrow_pos0);
+ arrow.append(arrow_pos0 - QPointF(
+ ::sin(arrow_angle + M_PI / 2.3) * arrow_size,
+ ::cos(arrow_angle + M_PI / 2.3) * arrow_size));
+ arrow.append(arrow_pos0 - QPointF(
+ ::sin(arrow_angle + M_PI - M_PI / 2.3) * arrow_size,
+ ::cos(arrow_angle + M_PI - M_PI / 2.3) * arrow_size));
+ arrow.append(arrow_pos0);
+ path.addPolygon(QPolygonF(arrow));
+
+ QGraphicsPathItem::setPath(path);
+}
+
+
+void qjackctlGraphConnect::updatePath (void)
+{
+ updatePathTo(m_port2->portPos());
+}
+
+
+void qjackctlGraphConnect::paint ( QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget */*widget*/ )
+{
+ if (QGraphicsPathItem::isSelected()) {
+ const QPalette& pal
+ = option->palette;
+ const QColor& color
+ = pal.highlight().color();
+ painter->setPen(QPen(color, 2));
+ painter->setBrush(color);
+ } else {
+ const QColor& color
+ = qjackctlGraphItem::foreground();
+ if (qjackctlGraphItem::isHighlight() || QGraphicsPathItem::isUnderMouse())
+ painter->setPen(color.lighter());
+ else
+ painter->setPen(color);
+ painter->setBrush(qjackctlGraphItem::background());
+ }
+
+ painter->drawPath(QGraphicsPathItem::path());
+}
+
+
+QVariant qjackctlGraphConnect::itemChange (
+ GraphicsItemChange change, const QVariant& value )
+{
+ if (change == QGraphicsItem::ItemSelectedHasChanged) {
+ const bool is_selected = value.toBool();
+ qjackctlGraphItem::setHighlight(is_selected);
+ if (m_port1)
+ m_port1->setSelectedEx(is_selected);
+ if (m_port2)
+ m_port2->setSelectedEx(is_selected);
+ }
+
+ return value;
+}
+
+
+// Selection propagation method...
+void qjackctlGraphConnect::setSelectedEx ( qjackctlGraphPort *port, bool is_selected )
+{
+ setHighlightEx(port, is_selected);
+
+ if (QGraphicsPathItem::isSelected() != is_selected) {
+ #if 0//OLD_SELECT_BEHAVIOR
+ QGraphicsPathItem::setSelected(is_selected);
+ if (is_selected) {
+ if (m_port1 && m_port1 != port)
+ m_port1->setSelectedEx(is_selected);
+ if (m_port2 && m_port2 != port)
+ m_port2->setSelectedEx(is_selected);
+ }
+ #else
+ if (!is_selected || (m_port1 && m_port2
+ && m_port1->isSelected() && m_port2->isSelected())) {
+ QGraphicsPathItem::setSelected(is_selected);
+ }
+ #endif
+ }
+}
+
+// Highlighting propagation method...
+void qjackctlGraphConnect::setHighlightEx ( qjackctlGraphPort *port, bool is_highlight )
+{
+ qjackctlGraphItem::setHighlight(is_highlight);
+
+ if (m_port1 && m_port1 != port)
+ m_port1->setHighlight(is_highlight);
+ if (m_port2 && m_port2 != port)
+ m_port2->setHighlight(is_highlight);
+}
+
+
+// Special port-type color business.
+void qjackctlGraphConnect::updatePortTypeColors (void)
+{
+ if (m_port1) {
+ const QColor& color
+ = m_port1->background().lighter();
+ qjackctlGraphItem::setForeground(color);
+ qjackctlGraphItem::setBackground(color);
+ }
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphCanvas -- Canvas graphics scene/view.
+
+// Local constants.
+static const char *CanvasGroup = "/GraphCanvas";
+static const char *CanvasRectKey = "/CanvasRect";
+static const char *CanvasZoomKey = "/CanvasZoom";
+
+static const char *NodePosGroup = "/GraphNodePos";
+
+static const char *ColorsGroup = "/GraphColors";
+
+
+// Constructor.
+qjackctlGraphCanvas::qjackctlGraphCanvas ( QWidget *parent )
+ : QGraphicsView(parent), m_state(DragNone), m_item(nullptr),
+ m_connect(nullptr), m_rubberband(nullptr),
+ m_zoom(1.0), m_zoomrange(false),
+ m_commands(nullptr), m_settings(nullptr),
+ m_selected_nodes(0), m_edit_item(nullptr),
+ m_editor(nullptr), m_edited(0),
+ m_aliases(nullptr)
+{
+ m_scene = new QGraphicsScene();
+
+ m_commands = new QUndoStack();
+
+ QGraphicsView::setScene(m_scene);
+
+ QGraphicsView::setRenderHint(QPainter::Antialiasing);
+ QGraphicsView::setRenderHint(QPainter::SmoothPixmapTransform);
+
+ QGraphicsView::setResizeAnchor(QGraphicsView::NoAnchor);
+ QGraphicsView::setDragMode(QGraphicsView::NoDrag);
+
+ m_editor = new QLineEdit(this);
+ m_editor->setFrame(false);
+// m_editor->setAlignment(Qt::AlignCenter | Qt::AlignVCenter);
+
+ QObject::connect(m_editor,
+ SIGNAL(textChanged(const QString&)),
+ SLOT(textChanged(const QString&)));
+ QObject::connect(m_editor,
+ SIGNAL(editingFinished()),
+ SLOT(editingFinished()));
+
+ m_editor->setEnabled(false);
+ m_editor->hide();
+}
+
+
+// Destructor.
+qjackctlGraphCanvas::~qjackctlGraphCanvas (void)
+{
+ clear();
+
+ delete m_editor;
+ delete m_commands;
+ delete m_scene;
+}
+
+
+// Accessors.
+QGraphicsScene *qjackctlGraphCanvas::scene (void) const
+{
+ return m_scene;
+}
+
+
+QUndoStack *qjackctlGraphCanvas::commands (void) const
+{
+ return m_commands;
+}
+
+
+void qjackctlGraphCanvas::setSettings ( QSettings *settings )
+{
+ m_settings = settings;
+}
+
+
+QSettings *qjackctlGraphCanvas::settings (void) const
+{
+ return m_settings;
+}
+
+
+// Canvas methods.
+void qjackctlGraphCanvas::addItem ( qjackctlGraphItem *item )
+{
+ m_scene->addItem(item);
+
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node) {
+ m_nodes.append(node);
+ m_nodekeys.insert(qjackctlGraphNode::NodeKey(node), node);
+ if (!restoreNodePos(node))
+ emit added(node);
+ }
+ }
+}
+
+
+void qjackctlGraphCanvas::removeItem ( qjackctlGraphItem *item )
+{
+ clearSelection();
+
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node && saveNodePos(node)) {
+ emit removed(node);
+ node->removePorts();
+ m_nodekeys.remove(qjackctlGraphNode::NodeKey(node));
+ m_nodes.removeAll(node);
+ }
+ }
+
+ // Do not remove items from the scene
+ // as they shall be removed upon delete...
+ //
+ // m_scene->removeItem(item);
+}
+
+
+// Current item accessor.
+qjackctlGraphItem *qjackctlGraphCanvas::currentItem (void) const
+{
+ qjackctlGraphItem *item = m_item;
+
+ if (item == nullptr) {
+ const QList& list
+ = m_scene->selectedItems();
+ if (!list.isEmpty())
+ item = static_cast (list.first());
+ }
+
+ return item;
+}
+
+
+// Connection predicates.
+bool qjackctlGraphCanvas::canConnect (void) const
+{
+ int nins = 0;
+ int nouts = 0;
+
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node) {
+ if (node->nodeMode() & qjackctlGraphItem::Input)
+ ++nins;
+ else
+ // if (node->nodeMode() & qjackctlGraphItem::Output)
+ ++nouts;
+ }
+ }
+ else
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port) {
+ if (port->isInput())
+ ++nins;
+ else
+ // if (port->isOutput())
+ ++nouts;
+ }
+ }
+ if (nins > 0 && nouts > 0)
+ return true;
+ }
+
+ return false;
+}
+
+
+bool qjackctlGraphCanvas::canDisconnect (void) const
+{
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphConnect::Type)
+ return true;
+ }
+
+ return false;
+}
+
+
+// Edit predicates.
+bool qjackctlGraphCanvas::canRenameItem (void) const
+{
+ qjackctlGraphItem *item = currentItem();
+
+ return (item && (
+ item->type() == qjackctlGraphNode::Type ||
+ item->type() == qjackctlGraphPort::Type));
+}
+
+
+// Zooming methods.
+void qjackctlGraphCanvas::setZoom ( qreal zoom )
+{
+ if (zoom < 0.1)
+ zoom = 0.1;
+ else
+ if (zoom > 2.0)
+ zoom = 2.0;
+
+ const qreal scale = zoom / m_zoom;
+ QGraphicsView::scale(scale, scale);
+
+ QFont font = m_editor->font();
+ font.setPointSizeF(scale * font.pointSizeF());
+ m_editor->setFont(font);
+ updateEditorGeometry();
+
+ m_zoom = zoom;
+
+ emit changed();
+}
+
+
+qreal qjackctlGraphCanvas::zoom (void) const
+{
+ return m_zoom;
+}
+
+
+void qjackctlGraphCanvas::setZoomRange ( bool zoomrange )
+{
+ m_zoomrange = zoomrange;
+}
+
+
+bool qjackctlGraphCanvas::isZoomRange (void) const
+{
+ return m_zoomrange;
+}
+
+
+// Clean-up all un-marked nodes...
+void qjackctlGraphCanvas::resetNodes ( uint node_type )
+{
+ QList nodes;
+
+ foreach (qjackctlGraphNode *node, m_nodes) {
+ if (node->nodeType() == node_type) {
+ if (node->isMarked()) {
+ node->resetMarkedPorts();
+ node->setMarked(false);
+ } else {
+ removeItem(node);
+ nodes.append(node);
+ }
+ }
+ }
+
+ qDeleteAll(nodes);
+}
+
+
+void qjackctlGraphCanvas::clearNodes ( uint node_type )
+{
+ QList nodes;
+
+ foreach (qjackctlGraphNode *node, m_nodes) {
+ if (node->nodeType() == node_type) {
+ m_nodekeys.remove(qjackctlGraphNode::NodeKey(node));
+ m_nodes.removeAll(node);
+ nodes.append(node);
+ }
+ }
+
+ qDeleteAll(nodes);
+}
+
+
+// Special node finder.
+qjackctlGraphNode *qjackctlGraphCanvas::findNode (
+ const QString& name, qjackctlGraphItem::Mode mode, uint type ) const
+{
+ return static_cast (
+ m_nodekeys.value(qjackctlGraphNode::ItemKey(name, mode, type), nullptr));
+}
+
+
+
+// Port (dis)connections notifiers.
+void qjackctlGraphCanvas::emitConnected (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2 )
+{
+ emit connected(port1, port2);
+}
+
+
+void qjackctlGraphCanvas::emitDisconnected (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2 )
+{
+ emit disconnected(port1, port2);
+}
+
+
+// Rename notifiers.
+void qjackctlGraphCanvas::emitRenamed ( qjackctlGraphItem *item, const QString& name )
+{
+ emit renamed(item, name);
+}
+
+
+// Item finder (internal).
+qjackctlGraphItem *qjackctlGraphCanvas::itemAt ( const QPointF& pos ) const
+{
+ const QList& items
+ = m_scene->items(QRectF(pos - QPointF(2, 2), QSizeF(5, 5)));
+
+ foreach (QGraphicsItem *item, items) {
+ if (item->type() >= QGraphicsItem::UserType)
+ return static_cast (item);
+ }
+
+ return nullptr;
+}
+
+
+// Port (dis)connection command.
+void qjackctlGraphCanvas::connectPorts (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2, bool is_connect )
+{
+ const bool is_connected // already connected?
+ = (port1->findConnect(port2) != nullptr);
+ if (( is_connect && is_connected) ||
+ (!is_connect && !is_connected))
+ return;
+
+ if (port1->isOutput()) {
+ m_commands->push(
+ new qjackctlGraphConnectCommand(this, port1, port2, is_connect));
+ } else {
+ m_commands->push(
+ new qjackctlGraphConnectCommand(this, port2, port1, is_connect));
+ }
+}
+
+
+// Mouse event handlers.
+void qjackctlGraphCanvas::mousePressEvent ( QMouseEvent *event )
+{
+ m_state = DragNone;
+ m_item = nullptr;
+ m_pos = QGraphicsView::mapToScene(event->pos());
+
+ qjackctlGraphItem *item = itemAt(m_pos);
+ if (item && item->type() >= QGraphicsItem::UserType)
+ m_item = static_cast (item);
+
+ if (event->button() == Qt::LeftButton)
+ m_state = DragStart;
+
+ if (m_state == DragStart && m_item == nullptr
+ && (event->modifiers() & Qt::ControlModifier)
+ && m_scene->selectedItems().isEmpty()) {
+ QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);
+ QGraphicsView::mousePressEvent(event);
+ m_state = DragScroll;
+ }
+}
+
+
+void qjackctlGraphCanvas::mouseMoveEvent ( QMouseEvent *event )
+{
+ int nchanged = 0;
+
+ const QPointF& pos
+ = QGraphicsView::mapToScene(event->pos());
+
+ switch (m_state) {
+ case DragStart:
+ if ((pos - m_pos).manhattanLength() > 8.0) {
+ m_state = DragMove;
+ if (m_item) {
+ // Start new connection line...
+ if (m_item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (m_item);
+ if (port) {
+ QGraphicsView::setCursor(Qt::DragLinkCursor);
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+ m_connect = new qjackctlGraphConnect();
+ m_connect->setPort1(port);
+ m_connect->setSelected(true);
+ m_scene->addItem(m_connect);
+ m_item = nullptr;
+ ++m_selected_nodes;
+ ++nchanged;
+ }
+ }
+ else
+ // Start moving nodes around...
+ if (m_item->type() == qjackctlGraphNode::Type) {
+ QGraphicsView::setCursor(Qt::SizeAllCursor);
+ if (!m_item->isSelected()) {
+ if ((event->modifiers()
+ & (Qt::ShiftModifier | Qt::ControlModifier)) == 0) {
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+ }
+ m_item->setSelected(true);
+ ++nchanged;
+ }
+ // Original node position (for move command)...
+ QPointF pos1 = m_pos;
+ pos1.setX(4.0 * ::round(0.25 * pos1.x()));
+ pos1.setY(4.0 * ::round(0.25 * pos1.y()));
+ m_pos1 = pos1;
+ }
+ else m_item = nullptr;
+ }
+ // Otherwise start lasso rubber-banding...
+ if (m_rubberband == nullptr && m_item == nullptr && m_connect == nullptr) {
+ QGraphicsView::setCursor(Qt::CrossCursor);
+ m_rubberband = new QRubberBand(QRubberBand::Rectangle, this);
+ }
+ }
+ break;
+ case DragMove:
+ QGraphicsView::ensureVisible(QRectF(pos, QSizeF(2, 2)), 8, 8);
+ // Move new connection line...
+ if (m_connect)
+ m_connect->updatePathTo(pos);
+ // Move rubber-band lasso...
+ if (m_rubberband) {
+ const QRect rect(
+ QGraphicsView::mapFromScene(m_pos),
+ QGraphicsView::mapFromScene(pos));
+ m_rubberband->setGeometry(rect.normalized());
+ m_rubberband->show();
+ if (!m_zoomrange) {
+ if (event->modifiers()
+ & (Qt::ControlModifier | Qt::ShiftModifier)) {
+ foreach (QGraphicsItem *item, m_selected) {
+ item->setSelected(!item->isSelected());
+ ++nchanged;
+ }
+ m_selected.clear();
+ } else {
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+ ++nchanged;
+ }
+ const QRectF range_rect(m_pos, pos);
+ foreach (QGraphicsItem *item,
+ m_scene->items(range_rect.normalized())) {
+ if (item->type() >= QGraphicsItem::UserType) {
+ if (item->type() != qjackctlGraphNode::Type)
+ ++m_selected_nodes;
+ else
+ if (m_selected_nodes > 0)
+ continue;
+ const bool is_selected = item->isSelected();
+ if (event->modifiers() & Qt::ControlModifier) {
+ m_selected.append(item);
+ item->setSelected(!is_selected);
+ }
+ else
+ if (!is_selected) {
+ if (event->modifiers() & Qt::ShiftModifier)
+ m_selected.append(item);
+ item->setSelected(true);
+ }
+ ++nchanged;
+ }
+ }
+ }
+ }
+ // Move current selected nodes...
+ if (m_item && m_item->type() == qjackctlGraphNode::Type) {
+ QPointF pos2 = pos;
+ pos2.setX(4.0 * ::round(0.25 * pos2.x()));
+ pos2.setY(4.0 * ::round(0.25 * pos2.y()));
+ const QPointF delta = (pos2 - m_pos);
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node)
+ node->setPos(node->pos() + delta);
+ }
+ }
+ m_pos = pos2;
+ }
+ else
+ if (m_connect) {
+ // Hovering ports high-lighting...
+ QGraphicsItem *item = itemAt(pos);
+ if (item && item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port1 = m_connect->port1();
+ qjackctlGraphPort *port2 = static_cast (item);
+ if (port1 && port2 &&
+ port1->portType() == port2->portType() &&
+ port1->portMode() != port2->portMode()) {
+ port2->update();
+ }
+ }
+ }
+ break;
+ case DragScroll:
+ default:
+ QGraphicsView::mouseMoveEvent(event);
+ break;
+ }
+
+ if (nchanged > 0)
+ emit changed();
+}
+
+
+void qjackctlGraphCanvas::mouseReleaseEvent ( QMouseEvent *event )
+{
+ int nchanged = 0;
+
+ switch (m_state) {
+ case DragStart:
+ // Make individual item (de)selections...
+ if ((event->modifiers()
+ & (Qt::ShiftModifier | Qt::ControlModifier)) == 0) {
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+ ++nchanged;
+ }
+ if (m_item) {
+ bool is_selected = true;
+ if (event->modifiers() & Qt::ControlModifier)
+ is_selected = !m_item->isSelected();
+ m_item->setSelected(is_selected);
+ if (m_item->type() != qjackctlGraphNode::Type && is_selected)
+ ++m_selected_nodes;
+ m_item = nullptr; // Not needed anymore!
+ ++nchanged;
+ }
+ // Fall thru...
+ case DragMove:
+ // Close new connection line...
+ if (m_connect) {
+ const QPointF& pos
+ = QGraphicsView::mapToScene(event->pos());
+ qjackctlGraphItem *item = itemAt(pos);
+ if (item && item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port1 = m_connect->port1();
+ qjackctlGraphPort *port2 = static_cast (item);
+ if (port1 && port2
+ // && port1->portNode() != port2->portNode()
+ && port1->portMode() != port2->portMode()
+ && port1->portType() == port2->portType()
+ && port1->findConnect(port2) == nullptr) {
+ port2->setSelected(true);
+ #if 0 // Sure the sect will commit to this instead...
+ m_connect->setPort2(port2);
+ m_connect->updatePathTo(port2->portPos());
+ m_connect = nullptr;
+ ++m_selected_nodes;
+ #else
+ // m_selected_nodes = 0;
+ // m_scene->clearSelection();
+ #endif
+ // Submit command; notify eventual observers...
+ m_commands->beginMacro(tr("Connect"));
+ connectPorts(port1, port2, true);
+ m_commands->endMacro();
+ ++nchanged;
+ }
+ }
+ if (m_connect) {
+ delete m_connect;
+ m_connect = nullptr;
+ }
+ }
+ // Maybe some node(s) were moved...
+ if (m_item && m_item->type() == qjackctlGraphNode::Type) {
+ const QPointF& pos
+ = QGraphicsView::mapToScene(event->pos());
+ QList nodes;
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node)
+ nodes.append(node);
+ }
+ }
+ m_commands->push(
+ new qjackctlGraphMoveCommand(this, nodes, m_pos1, pos));
+ }
+ // Close rubber-band lasso...
+ if (m_rubberband) {
+ delete m_rubberband;
+ m_rubberband = nullptr;
+ m_selected.clear();
+ // Zooming in range?...
+ if (m_zoomrange) {
+ const QRectF range_rect(m_pos,
+ QGraphicsView::mapToScene(event->pos()));
+ zoomFitRange(range_rect);
+ nchanged = 0;
+ }
+ }
+ break;
+ case DragScroll:
+ default:
+ QGraphicsView::mouseReleaseEvent(event);
+ QGraphicsView::setDragMode(QGraphicsView::NoDrag);
+ break;
+ }
+
+ m_state = DragNone;
+ m_item = nullptr;
+
+ // Reset cursor...
+ QGraphicsView::setCursor(Qt::ArrowCursor);
+
+ if (nchanged > 0)
+ emit changed();
+}
+
+
+void qjackctlGraphCanvas::mouseDoubleClickEvent ( QMouseEvent *event )
+{
+ m_pos = QGraphicsView::mapToScene(event->pos());
+ m_item = itemAt(m_pos);
+
+ if (m_item && canRenameItem()) {
+ renameItem();
+ } else {
+ QGraphicsView::centerOn(m_pos);
+ }
+}
+
+
+void qjackctlGraphCanvas::wheelEvent ( QWheelEvent *event )
+{
+ if (event->modifiers() & Qt::ControlModifier) {
+ const int delta
+ #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ = event->delta();
+ #else
+ = event->angleDelta().y();
+ #endif
+ setZoom(zoom() + qreal(delta) / 1200.0);
+ }
+ else QGraphicsView::wheelEvent(event);
+}
+
+
+// Keyboard event handler.
+void qjackctlGraphCanvas::keyPressEvent ( QKeyEvent *event )
+{
+ if (event->key() == Qt::Key_Escape) {
+ m_scene->clearSelection();
+ clear();
+ emit changed();
+ }
+}
+
+
+// Connect selected items.
+void qjackctlGraphCanvas::connectItems (void)
+{
+ QList outs;
+ QList ins;
+
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port) {
+ if (port->isOutput())
+ outs.append(port);
+ else
+ ins.append(port);
+ }
+ }
+ }
+
+ if (outs.isEmpty() || ins.isEmpty())
+ return;
+
+// m_selected_nodes = 0;
+// m_scene->clearSelection();
+
+ std::sort(outs.begin(), outs.end(), qjackctlGraphPort::ComparePos());
+ std::sort(ins.begin(), ins.end(), qjackctlGraphPort::ComparePos());
+
+ QListIterator iter1(outs);
+ QListIterator iter2(ins);
+
+ m_commands->beginMacro(tr("Connect"));
+
+ const int nports = qMax(outs.count(), ins.count());
+ for (int n = 0; n < nports; ++n) {
+ // Wrap a'round...
+ if (!iter1.hasNext())
+ iter1.toFront();
+ if (!iter2.hasNext())
+ iter2.toFront();
+ qjackctlGraphPort *port1 = iter1.next();
+ qjackctlGraphPort *port2 = iter2.next();
+ // Skip over non-matching port-types...
+ bool wrapped = false;
+ while (port1 && port2 && port1->portType() != port2->portType()) {
+ if (!iter2.hasNext()) {
+ if (wrapped)
+ break;
+ iter2.toFront();
+ wrapped = true;
+ }
+ port2 = iter2.next();
+ }
+ // Submit command; notify eventual observers...
+ if (!wrapped && port1 && port2 && port1->portNode() != port2->portNode())
+ connectPorts(port1, port2, true);
+ }
+
+ m_commands->endMacro();
+}
+
+
+// Disconnect selected items.
+void qjackctlGraphCanvas::disconnectItems (void)
+{
+ QList connects;
+
+ foreach (QGraphicsItem *item, m_scene->selectedItems()) {
+ if (item->type() == qjackctlGraphConnect::Type) {
+ qjackctlGraphConnect *connect = static_cast (item);
+ if (connect)
+ connects.append(connect);
+ }
+ }
+
+// m_selected_nodes = 0;
+// m_scene->clearSelection();
+
+ m_commands->beginMacro(tr("Disconnect"));
+
+ foreach (qjackctlGraphConnect *connect, connects) {
+ // Submit command; notify eventual observers...
+ qjackctlGraphPort *port1 = connect->port1();
+ qjackctlGraphPort *port2 = connect->port2();
+ if (port1 && port2)
+ connectPorts(port1, port2, false);
+ }
+
+ m_commands->endMacro();
+}
+
+
+// Select actions.
+void qjackctlGraphCanvas::selectAll (void)
+{
+ foreach (QGraphicsItem *item, m_scene->items()) {
+ if (item->type() == qjackctlGraphNode::Type)
+ item->setSelected(true);
+ else
+ ++m_selected_nodes;
+ }
+
+ emit changed();
+}
+
+
+void qjackctlGraphCanvas::selectNone (void)
+{
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+
+ emit changed();
+}
+
+
+void qjackctlGraphCanvas::selectInvert (void)
+{
+ foreach (QGraphicsItem *item, m_scene->items()) {
+ if (item->type() == qjackctlGraphNode::Type)
+ item->setSelected(!item->isSelected());
+ else
+ ++m_selected_nodes;
+ }
+
+ emit changed();
+}
+
+
+// Edit actions.
+void qjackctlGraphCanvas::renameItem (void)
+{
+ qjackctlGraphItem *item = currentItem();
+
+ if (item && item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node) {
+ QPalette pal;
+ const QColor& foreground
+ = node->foreground();
+ QColor background = node->background();
+ const bool is_dark
+ = (background.value() < 192);
+ pal.setColor(QPalette::Text, is_dark
+ ? foreground.lighter()
+ : foreground.darker());
+ background.setAlpha(255);
+ pal.setColor(QPalette::Base, background);
+ m_editor->setPalette(pal);
+ QFont font = m_editor->font();
+ font.setBold(true);
+ m_editor->setFont(font);
+ m_editor->setPlaceholderText(node->nodeName());
+ m_editor->setText(node->nodeTitle());
+ }
+ }
+ else
+ if (item && item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port) {
+ QPalette pal;
+ const QColor& foreground
+ = port->foreground();
+ const QColor& background
+ = port->background();
+ const bool is_dark
+ = (background.value() < 128);
+ pal.setColor(QPalette::Text, is_dark
+ ? foreground.lighter()
+ : foreground.darker());
+ pal.setColor(QPalette::Base, background.lighter());
+ m_editor->setPalette(pal);
+ QFont font = m_editor->font();
+ font.setBold(false);
+ m_editor->setFont(font);
+ m_editor->setPlaceholderText(port->portName());
+ m_editor->setText(port->portTitle());
+ }
+ }
+ else return;
+
+ m_editor->show();
+ m_editor->setEnabled(true);
+ m_editor->selectAll();
+ m_editor->setFocus();
+ m_edited = 0;
+
+ m_edit_item = item;
+
+ updateEditorGeometry();
+}
+
+
+// Renaming editor position and size updater.
+void qjackctlGraphCanvas::updateEditorGeometry (void)
+{
+ if (m_edit_item && m_editor->isEnabled() && m_editor->isVisible()) {
+ const QRectF& rect
+ = m_edit_item->editorRect().adjusted(+2.0, +2.0, -2.0, -2.0);
+ const QPoint& pos1
+ = QGraphicsView::mapFromScene(rect.topLeft());
+ const QPoint& pos2
+ = QGraphicsView::mapFromScene(rect.bottomRight());
+ m_editor->setGeometry(
+ pos1.x(), pos1.y(),
+ pos2.x() - pos1.x(),
+ pos2.y() - pos1.y());
+ }
+}
+
+
+// Discrete zooming actions.
+void qjackctlGraphCanvas::zoomIn (void)
+{
+ setZoom(zoom() + 0.1);
+}
+
+
+void qjackctlGraphCanvas::zoomOut (void)
+{
+ setZoom(zoom() - 0.1);
+}
+
+
+void qjackctlGraphCanvas::zoomFit (void)
+{
+ zoomFitRange(m_scene->itemsBoundingRect());
+}
+
+
+void qjackctlGraphCanvas::zoomReset (void)
+{
+ setZoom(1.0);
+}
+
+
+// Update all nodes.
+void qjackctlGraphCanvas::updateNodes (void)
+{
+ foreach (QGraphicsItem *item, m_scene->items()) {
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node)
+ node->updatePath();
+ }
+ }
+}
+
+
+// Zoom in rectangle range.
+void qjackctlGraphCanvas::zoomFitRange ( const QRectF& range_rect )
+{
+ QGraphicsView::fitInView(
+ range_rect, Qt::KeepAspectRatio);
+
+ const QTransform& transform
+ = QGraphicsView::transform();
+ if (transform.isScaling()) {
+ qreal zoom = transform.m11();
+ if (zoom < 0.1) {
+ const qreal scale = 0.1 / zoom;
+ QGraphicsView::scale(scale, scale);
+ zoom = 0.1;
+ }
+ else
+ if (zoom > 2.0) {
+ const qreal scale = 2.0 / zoom;
+ QGraphicsView::scale(scale, scale);
+ zoom = 2.0;
+ }
+ m_zoom = zoom;
+ }
+
+ emit changed();
+}
+
+
+// Graph node position methods.
+bool qjackctlGraphCanvas::restoreNodePos ( qjackctlGraphNode *node )
+{
+ if (m_settings == nullptr || node == nullptr)
+ return false;
+
+ m_settings->beginGroup(NodePosGroup);
+ const QPointF& node_pos
+ = m_settings->value('/' + nodeKey(node)).toPointF();
+ m_settings->endGroup();
+
+ if (node_pos.isNull())
+ return false;
+
+ node->setPos(node_pos);
+ return true;
+}
+
+
+bool qjackctlGraphCanvas::saveNodePos ( qjackctlGraphNode *node ) const
+{
+ if (m_settings == nullptr || node == nullptr)
+ return false;
+
+ m_settings->beginGroup(NodePosGroup);
+ m_settings->setValue('/' + nodeKey(node), node->pos());
+ m_settings->endGroup();
+
+ return true;
+}
+
+
+bool qjackctlGraphCanvas::restoreState (void)
+{
+ if (m_settings == nullptr)
+ return false;
+
+ m_settings->beginGroup(ColorsGroup);
+ const QRegExp rx("^0x");
+ QStringListIterator key(m_settings->childKeys());
+ while (key.hasNext()) {
+ const QString& sKey = key.next();
+ const QColor& color = QString(m_settings->value(sKey).toString());
+ if (color.isValid()) {
+ QString sx(sKey);
+ bool ok = false;
+ const uint port_type = sx.remove(rx).toUInt(&ok, 16);
+ if (ok) m_port_colors.insert(port_type, color);
+ }
+ }
+ m_settings->endGroup();
+
+ m_settings->beginGroup(CanvasGroup);
+ m_settings->setValue(CanvasRectKey, QGraphicsView::sceneRect());
+ const QRectF& rect = m_settings->value(CanvasRectKey).toRectF();
+ const qreal zoom = m_settings->value(CanvasZoomKey, 1.0).toReal();
+ m_settings->endGroup();
+
+ if (rect.isValid())
+ QGraphicsView::setSceneRect(rect);
+
+ setZoom(zoom);
+
+ return true;
+}
+
+
+bool qjackctlGraphCanvas::saveState (void) const
+{
+ if (m_settings == nullptr)
+ return false;
+
+ m_settings->beginGroup(NodePosGroup);
+ const QList items(m_scene->items());
+ foreach (QGraphicsItem *item, items) {
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node)
+ m_settings->setValue('/' + nodeKey(node), node->pos());
+ }
+ }
+ m_settings->endGroup();
+
+ m_settings->beginGroup(CanvasGroup);
+ m_settings->setValue(CanvasZoomKey, zoom());
+ m_settings->setValue(CanvasRectKey, QGraphicsView::sceneRect());
+ m_settings->endGroup();
+
+ m_settings->beginGroup(ColorsGroup);
+ QStringListIterator key(m_settings->childKeys());
+ while (key.hasNext()) m_settings->remove(key.next());
+ QHash::ConstIterator iter = m_port_colors.constBegin();
+ const QHash::ConstIterator& iter_end = m_port_colors.constEnd();
+ for ( ; iter != iter_end; ++iter) {
+ const uint port_type = iter.key();
+ const QColor& color = iter.value();
+ m_settings->setValue("0x" + QString::number(port_type, 16), color.name());
+ }
+ m_settings->endGroup();
+
+ return true;
+}
+
+
+// Graph node key mangler.
+QString qjackctlGraphCanvas::nodeKey ( qjackctlGraphNode *node ) const
+{
+ QString node_key = node->nodeName();
+
+ switch (node->nodeMode()) {
+ case qjackctlGraphItem::Input:
+ node_key += ":Input";
+ break;
+ case qjackctlGraphItem::Output:
+ node_key += ":Output";
+ break;
+ default:
+ break;
+ }
+
+ return node_key;
+}
+
+
+// Graph port colors management.
+void qjackctlGraphCanvas::setPortTypeColor (
+ uint port_type, const QColor& port_color )
+{
+ m_port_colors.insert(port_type, port_color);
+}
+
+
+const QColor& qjackctlGraphCanvas::portTypeColor ( uint port_type )
+{
+ return m_port_colors[port_type];
+}
+
+
+void qjackctlGraphCanvas::updatePortTypeColors ( uint port_type )
+{
+ foreach (QGraphicsItem *item, m_scene->items()) {
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port && (0 >= port_type || port->portType() == port_type)) {
+ port->updatePortTypeColors(this);
+ port->update();
+ }
+ }
+ }
+}
+
+
+void qjackctlGraphCanvas::clearPortTypeColors (void)
+{
+ m_port_colors.clear();
+}
+
+
+// Clear all selection.
+void qjackctlGraphCanvas::clearSelection (void)
+{
+ m_item = nullptr;
+ m_selected_nodes = 0;
+ m_scene->clearSelection();
+
+ m_edit_item = nullptr;
+ m_editor->setEnabled(false);
+ m_editor->hide();
+ m_edited = 0;
+}
+
+
+// Clear all state.
+void qjackctlGraphCanvas::clear (void)
+{
+ m_selected_nodes = 0;
+ if (m_rubberband) {
+ delete m_rubberband;
+ m_rubberband = nullptr;
+ m_selected.clear();
+ }
+ if (m_connect) {
+ delete m_connect;
+ m_connect = nullptr;
+ }
+ if (m_state == DragScroll)
+ QGraphicsView::setDragMode(QGraphicsView::NoDrag);
+ m_state = DragNone;
+ m_item = nullptr;
+ m_edit_item = nullptr;
+ m_editor->setEnabled(false);
+ m_editor->hide();
+ m_edited = 0;
+
+ // Reset cursor...
+ QGraphicsView::setCursor(Qt::ArrowCursor);
+}
+
+
+// Rename item slots.
+void qjackctlGraphCanvas::textChanged ( const QString& /* text */)
+{
+ if (m_edit_item && m_editor->isEnabled() && m_editor->isVisible())
+ ++m_edited;
+}
+
+
+void qjackctlGraphCanvas::editingFinished (void)
+{
+ if (m_edit_item && m_editor->isEnabled() && m_editor->isVisible()) {
+ // If changed then notify...
+ if (m_edited > 0) {
+ m_commands->push(
+ new qjackctlGraphRenameCommand(this,
+ m_edit_item, m_editor->text()));
+ }
+ // Reset all renaming stuff...
+ m_edit_item = nullptr;
+ m_editor->setEnabled(false);
+ m_editor->hide();
+ m_edited = 0;
+ }
+}
+
+
+// Client/port aliases accessors.
+void qjackctlGraphCanvas::setAliases ( qjackctlAliases *aliases )
+{
+ m_aliases = aliases;
+}
+
+
+qjackctlAliases *qjackctlGraphCanvas::aliases (void) const
+{
+ return m_aliases;
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphSect -- Generic graph driver
+
+// Constructor.
+qjackctlGraphSect::qjackctlGraphSect ( qjackctlGraphCanvas *canvas )
+ : m_canvas(canvas)
+{
+}
+
+
+// Accessors.
+qjackctlGraphCanvas *qjackctlGraphSect::canvas (void) const
+{
+ return m_canvas;
+}
+
+
+// Generic sect/graph methods.
+void qjackctlGraphSect::addItem ( qjackctlGraphItem *item )
+{
+ m_canvas->addItem(item);
+
+ if (item->type() == qjackctlGraphConnect::Type) {
+ qjackctlGraphConnect *connect = static_cast (item);
+ if (connect)
+ m_connects.append(connect);
+ }
+}
+
+
+void qjackctlGraphSect::removeItem ( qjackctlGraphItem *item )
+{
+ if (item->type() == qjackctlGraphConnect::Type) {
+ qjackctlGraphConnect *connect = static_cast (item);
+ if (connect)
+ m_connects.removeAll(connect);
+ }
+
+ m_canvas->removeItem(item);
+}
+
+
+// Clean-up all un-marked items...
+void qjackctlGraphSect::resetItems ( uint node_type )
+{
+ const QList connects(m_connects);
+
+ foreach (qjackctlGraphConnect *connect, connects) {
+ if (connect->isMarked()) {
+ connect->setMarked(false);
+ } else {
+ removeItem(connect);
+ delete connect;
+ }
+ }
+
+ m_canvas->resetNodes(node_type);
+}
+
+
+void qjackctlGraphSect::clearItems ( uint node_type )
+{
+ qjackctlGraphSect::resetItems(node_type);
+
+// qDeleteAll(m_connects);
+ m_connects.clear();
+
+ m_canvas->clearNodes(node_type);
+}
+
+
+// Special node finder.
+qjackctlGraphNode *qjackctlGraphSect::findNode (
+ const QString& name, qjackctlGraphItem::Mode mode, int type ) const
+{
+ return m_canvas->findNode(name, mode, type);
+}
+
+
+// Client/port renaming method.
+void qjackctlGraphSect::renameItem (
+ qjackctlGraphItem *item, const QString& name )
+{
+ int nchanged = 0;
+
+ qjackctlGraphNode *node = nullptr;
+
+ if (item->type() == qjackctlGraphNode::Type) {
+ node = static_cast (item);
+ if (node) {
+ node->setNodeTitle(name);
+ const QString& node_title = node->nodeTitle();
+ foreach (qjackctlAliasList *node_aliases, item_aliases(item)) {
+ node_aliases->setClientAlias(node->nodeName(), node_title);
+ ++nchanged;
+ }
+ }
+ }
+ else
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port)
+ node = port->portNode();
+ if (port && node) {
+ port->setPortTitle(name);
+ foreach (qjackctlAliasList *port_aliases, item_aliases(item)) {
+ port_aliases->setPortAlias(
+ node->nodeName(), port->portName(), name);
+ ++nchanged;
+ }
+ }
+ }
+
+ if (node)
+ node->updatePath();
+
+ if (nchanged > 0) {
+ qjackctlAliases *aliases = nullptr;
+ if (m_canvas)
+ aliases = m_canvas->aliases();
+ if (aliases)
+ aliases->dirty = true;
+ }
+}
+
+
+// end of qjackctlGraph.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlGraphForm.cpp qjackctl-0.6.0/src/qjackctlGraphForm.cpp
--- qjackctl-0.4.5/src/qjackctlGraphForm.cpp 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraphForm.cpp 2019-10-17 07:45:45.953673224 +0000
@@ -0,0 +1,1038 @@
+// qjackctlGraphForm.cpp
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#include "qjackctlAbout.h"
+#include "qjackctlGraphForm.h"
+
+#include "qjackctlJackGraph.h"
+#include "qjackctlAlsaGraph.h"
+
+#include "qjackctlSetup.h"
+
+#include "qjackctlMainForm.h"
+
+#include "qjackctlSetup.h"
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphForm -- UI wrapper form.
+
+// Constructor.
+qjackctlGraphForm::qjackctlGraphForm (
+ QWidget *parent, Qt::WindowFlags wflags )
+ : QMainWindow(parent, wflags), m_config(nullptr), m_jack(nullptr), m_alsa(nullptr)
+{
+ // Setup UI struct...
+ m_ui.setupUi(this);
+
+ m_jack_changed = 0;
+ m_alsa_changed = 0;
+
+ m_ins = m_mids = m_outs = 0;
+
+ QUndoStack *commands = m_ui.graphCanvas->commands();
+
+ QAction *undo_action = commands->createUndoAction(this, tr("&Undo"));
+ undo_action->setIcon(QIcon(":/images/graphUndo.png"));
+ undo_action->setStatusTip(tr("Undo last edit action"));
+ undo_action->setShortcuts(QKeySequence::Undo);
+
+ QAction *redo_action = commands->createRedoAction(this, tr("&Redo"));
+ redo_action->setIcon(QIcon(":/images/graphRedo.png"));
+ redo_action->setStatusTip(tr("Redo last edit action"));
+ redo_action->setShortcuts(QKeySequence::Redo);
+
+ QAction *before_action = m_ui.editSelectAllAction;
+ m_ui.editMenu->insertAction(before_action, undo_action);
+ m_ui.editMenu->insertAction(before_action, redo_action);
+ m_ui.editMenu->insertSeparator(before_action);
+
+ before_action = m_ui.viewCenterAction;
+ m_ui.ToolBar->insertAction(before_action, undo_action);
+ m_ui.ToolBar->insertAction(before_action, redo_action);
+ m_ui.ToolBar->insertSeparator(before_action);
+
+ // Special zoom composite widget...
+ QWidget *zoom_widget = new QWidget();
+ zoom_widget->setMaximumWidth(240);
+ zoom_widget->setToolTip(tr("Zoom"));
+
+ QHBoxLayout *zoom_layout = new QHBoxLayout();
+ zoom_layout->setMargin(0);
+ zoom_layout->setSpacing(2);
+
+ QToolButton *zoom_out = new QToolButton();
+ zoom_out->setDefaultAction(m_ui.viewZoomOutAction);
+ zoom_out->setFixedSize(22, 22);
+ zoom_layout->addWidget(zoom_out);
+
+ m_zoom_slider = new QSlider(Qt::Horizontal);
+ m_zoom_slider->setFixedHeight(22);
+ m_zoom_slider->setMinimum(10);
+ m_zoom_slider->setMaximum(200);
+ m_zoom_slider->setTickInterval(100);
+ m_zoom_slider->setTickPosition(QSlider::TicksBothSides);
+ zoom_layout->addWidget(m_zoom_slider);
+
+ QToolButton *zoom_in = new QToolButton();
+ zoom_in->setDefaultAction(m_ui.viewZoomInAction);
+ zoom_in->setFixedSize(22, 22);
+ zoom_layout->addWidget(zoom_in);
+
+ m_zoom_spinbox = new QSpinBox();
+ m_zoom_spinbox->setFixedHeight(22);
+ m_zoom_spinbox->setAlignment(Qt::AlignCenter);
+ m_zoom_spinbox->setMinimum(10);
+ m_zoom_spinbox->setMaximum(200);
+ m_zoom_spinbox->setSuffix(" %");
+ zoom_layout->addWidget(m_zoom_spinbox);
+
+ zoom_widget->setLayout(zoom_layout);
+ m_ui.StatusBar->addPermanentWidget(zoom_widget);
+
+ QObject::connect(m_zoom_spinbox,
+ SIGNAL(valueChanged(int)),
+ SLOT(zoomValueChanged(int)));
+ QObject::connect(m_zoom_slider,
+ SIGNAL(valueChanged(int)),
+ SLOT(zoomValueChanged(int)));
+
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(added(qjackctlGraphNode *)),
+ SLOT(added(qjackctlGraphNode *)));
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(removed(qjackctlGraphNode *)),
+ SLOT(removed(qjackctlGraphNode *)));
+
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(connected(qjackctlGraphPort *, qjackctlGraphPort *)),
+ SLOT(connected(qjackctlGraphPort *, qjackctlGraphPort *)));
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(disconnected(qjackctlGraphPort *, qjackctlGraphPort *)),
+ SLOT(disconnected(qjackctlGraphPort *, qjackctlGraphPort *)));
+
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(renamed(qjackctlGraphItem *, const QString&)),
+ SLOT(renamed(qjackctlGraphItem *, const QString&)));
+
+ QObject::connect(m_ui.graphCanvas,
+ SIGNAL(changed()),
+ SLOT(stabilize()));
+
+ // Some actions surely need those
+ // shortcuts firmly attached...
+ addAction(m_ui.viewMenubarAction);
+
+ QObject::connect(m_ui.graphConnectAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(connectItems()));
+ QObject::connect(m_ui.graphDisconnectAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(disconnectItems()));
+
+ QObject::connect(m_ui.graphCloseAction,
+ SIGNAL(triggered(bool)),
+ SLOT(close()));
+
+ QObject::connect(m_ui.editSelectAllAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(selectAll()));
+ QObject::connect(m_ui.editSelectNoneAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(selectNone()));
+ QObject::connect(m_ui.editSelectInvertAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(selectInvert()));
+
+ QObject::connect(m_ui.editRenameItemAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(renameItem()));
+
+ QObject::connect(m_ui.viewMenubarAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewMenubar(bool)));
+ QObject::connect(m_ui.viewStatusbarAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewStatusbar(bool)));
+ QObject::connect(m_ui.viewToolbarAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewToolbar(bool)));
+
+ QObject::connect(m_ui.viewTextBesideIconsAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewTextBesideIcons(bool)));
+
+ QObject::connect(m_ui.viewCenterAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewCenter()));
+ QObject::connect(m_ui.viewRefreshAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewRefresh()));
+
+ QObject::connect(m_ui.viewZoomInAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(zoomIn()));
+ QObject::connect(m_ui.viewZoomOutAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(zoomOut()));
+ QObject::connect(m_ui.viewZoomFitAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(zoomFit()));
+ QObject::connect(m_ui.viewZoomResetAction,
+ SIGNAL(triggered(bool)),
+ m_ui.graphCanvas, SLOT(zoomReset()));
+
+ QObject::connect(m_ui.viewZoomRangeAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewZoomRange(bool)));
+
+ m_ui.viewColorsJackAudioAction->setData(qjackctlJackGraph::audioPortType());
+ m_ui.viewColorsJackMidiAction->setData(qjackctlJackGraph::midiPortType());
+#ifdef CONFIG_ALSA_SEQ
+ m_ui.viewColorsAlsaMidiAction->setData(qjackctlAlsaGraph::midiPortType());
+#endif
+
+ QObject::connect(m_ui.viewColorsJackAudioAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewColorsAction()));
+ QObject::connect(m_ui.viewColorsJackMidiAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewColorsAction()));
+ QObject::connect(m_ui.viewColorsAlsaMidiAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewColorsAction()));
+ QObject::connect(m_ui.viewColorsResetAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewColorsReset()));
+
+ m_sort_type = new QActionGroup(this);
+ m_sort_type->setExclusive(true);
+ m_sort_type->addAction(m_ui.viewSortPortNameAction);
+ m_sort_type->addAction(m_ui.viewSortPortTitleAction);
+ m_sort_type->addAction(m_ui.viewSortPortIndexAction);
+
+ m_ui.viewSortPortNameAction->setData(qjackctlGraphPort::PortName);
+ m_ui.viewSortPortTitleAction->setData(qjackctlGraphPort::PortTitle);
+ m_ui.viewSortPortIndexAction->setData(qjackctlGraphPort::PortIndex);
+
+ QObject::connect(m_ui.viewSortPortNameAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewSortTypeAction()));
+ QObject::connect(m_ui.viewSortPortTitleAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewSortTypeAction()));
+ QObject::connect(m_ui.viewSortPortIndexAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewSortTypeAction()));
+
+ m_sort_order = new QActionGroup(this);
+ m_sort_order->setExclusive(true);
+ m_sort_order->addAction(m_ui.viewSortAscendingAction);
+ m_sort_order->addAction(m_ui.viewSortDescendingAction);
+
+ m_ui.viewSortAscendingAction->setData(qjackctlGraphPort::Ascending);
+ m_ui.viewSortDescendingAction->setData(qjackctlGraphPort::Descending);
+
+ QObject::connect(m_ui.viewSortAscendingAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewSortOrderAction()));
+ QObject::connect(m_ui.viewSortDescendingAction,
+ SIGNAL(triggered(bool)),
+ SLOT(viewSortOrderAction()));
+
+ QObject::connect(m_ui.helpAboutAction,
+ SIGNAL(triggered(bool)),
+ SLOT(helpAbout()));
+ QObject::connect(m_ui.helpAboutQtAction,
+ SIGNAL(triggered(bool)),
+ SLOT(helpAboutQt()));
+
+ QObject::connect(m_ui.ToolBar,
+ SIGNAL(orientationChanged(Qt::Orientation)),
+ SLOT(orientationChanged(Qt::Orientation)));
+}
+
+
+// Destructor.
+qjackctlGraphForm::~qjackctlGraphForm (void)
+{
+ delete m_sort_order;
+ delete m_sort_type;
+
+ if (m_jack)
+ delete m_jack;
+#ifdef CONFIG_ALSA_SEQ
+ if (m_alsa)
+ delete m_alsa;
+#endif
+ if (m_config)
+ delete m_config;
+}
+
+
+// Set reference to global options, mostly needed for
+// the initial state of the main dockable views and
+// those client/port aliasing feature.
+void qjackctlGraphForm::setup ( qjackctlSetup *pSetup )
+{
+ m_config = new qjackctlGraphConfig(&pSetup->settings());
+
+ m_ui.graphCanvas->setSettings(m_config->settings());
+ m_ui.graphCanvas->setAliases(&(pSetup->aliases));
+
+ m_config->restoreState(this);
+
+ // Raise the operational sects...
+ m_jack = new qjackctlJackGraph(m_ui.graphCanvas);
+#ifdef CONFIG_ALSA_SEQ
+ if (pSetup->bAlsaSeqEnabled)
+ m_alsa = new qjackctlAlsaGraph(m_ui.graphCanvas);
+#endif
+
+ m_ui.viewMenubarAction->setChecked(m_config->isMenubar());
+ m_ui.viewToolbarAction->setChecked(m_config->isToolbar());
+ m_ui.viewStatusbarAction->setChecked(m_config->isStatusbar());
+
+ m_ui.viewTextBesideIconsAction->setChecked(m_config->isTextBesideIcons());
+ m_ui.viewZoomRangeAction->setChecked(m_config->isZoomRange());
+
+ const qjackctlGraphPort::SortType sort_type
+ = qjackctlGraphPort::SortType(m_config->sortType());
+ qjackctlGraphPort::setSortType(sort_type);
+ switch (sort_type) {
+ case qjackctlGraphPort::PortIndex:
+ m_ui.viewSortPortIndexAction->setChecked(true);
+ break;
+ case qjackctlGraphPort::PortTitle:
+ m_ui.viewSortPortTitleAction->setChecked(true);
+ break;
+ case qjackctlGraphPort::PortName:
+ default:
+ m_ui.viewSortPortNameAction->setChecked(true);
+ break;
+ }
+
+ const qjackctlGraphPort::SortOrder sort_order
+ = qjackctlGraphPort::SortOrder(m_config->sortOrder());
+ qjackctlGraphPort::setSortOrder(sort_order);
+ switch (sort_order) {
+ case qjackctlGraphPort::Descending:
+ m_ui.viewSortDescendingAction->setChecked(true);
+ break;
+ case qjackctlGraphPort::Ascending:
+ default:
+ m_ui.viewSortAscendingAction->setChecked(true);
+ break;
+ }
+
+ viewMenubar(m_config->isMenubar());
+ viewToolbar(m_config->isToolbar());
+ viewStatusbar(m_config->isStatusbar());
+
+ viewTextBesideIcons(m_config->isTextBesideIcons());
+ viewZoomRange(m_config->isZoomRange());
+
+ m_ui.graphCanvas->restoreState();
+
+ updateViewColors();
+
+ stabilize();
+
+ // Make it ready :-)
+ m_ui.StatusBar->showMessage(tr("Ready"), 3000);
+
+ // Trigger refresh cycle...
+ jack_changed();
+ alsa_changed();
+}
+
+
+// Main menu slots.
+void qjackctlGraphForm::viewMenubar ( bool on )
+{
+ m_ui.MenuBar->setVisible(on);
+}
+
+
+void qjackctlGraphForm::viewToolbar ( bool on )
+{
+ m_ui.ToolBar->setVisible(on);
+}
+
+
+void qjackctlGraphForm::viewStatusbar ( bool on )
+{
+ m_ui.StatusBar->setVisible(on);
+}
+
+
+void qjackctlGraphForm::viewTextBesideIcons ( bool on )
+{
+ if (on) {
+ m_ui.ToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ } else {
+ m_ui.ToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ }
+}
+
+
+void qjackctlGraphForm::viewCenter (void)
+{
+ const QRectF& scene_rect
+ = m_ui.graphCanvas->scene()->itemsBoundingRect();
+ m_ui.graphCanvas->centerOn(scene_rect.center());
+
+ stabilize();
+}
+
+
+void qjackctlGraphForm::viewRefresh (void)
+{
+ jack_changed();
+ alsa_changed();
+
+ refresh();
+}
+
+
+void qjackctlGraphForm::viewZoomRange ( bool on )
+{
+ m_ui.graphCanvas->setZoomRange(on);
+}
+
+
+void qjackctlGraphForm::viewColorsAction (void)
+{
+ QAction *action = qobject_cast (sender());
+ if (action == nullptr)
+ return;
+
+ const uint port_type = action->data().toUInt();
+ if (0 >= port_type)
+ return;
+
+ const QColor& color = QColorDialog::getColor(
+ m_ui.graphCanvas->portTypeColor(port_type), this,
+ tr("Colors - %1").arg(action->text().remove('&')));
+ if (color.isValid()) {
+ m_ui.graphCanvas->setPortTypeColor(port_type, color);
+ m_ui.graphCanvas->updatePortTypeColors(port_type);
+ updateViewColorsAction(action);
+ }
+}
+
+
+void qjackctlGraphForm::viewColorsReset (void)
+{
+ m_ui.graphCanvas->clearPortTypeColors();
+ if (m_jack)
+ m_jack->resetPortTypeColors();
+#ifdef CONFIG_ALSA_SEQ
+ if (m_alsa)
+ m_alsa->resetPortTypeColors();
+#endif
+ m_ui.graphCanvas->updatePortTypeColors();
+
+ updateViewColors();
+}
+
+
+void qjackctlGraphForm::viewSortTypeAction (void)
+{
+ QAction *action = qobject_cast (sender());
+ if (action == nullptr)
+ return;
+
+ const qjackctlGraphPort::SortType sort_type
+ = qjackctlGraphPort::SortType(action->data().toInt());
+ qjackctlGraphPort::setSortType(sort_type);
+
+ m_ui.graphCanvas->updateNodes();
+}
+
+
+void qjackctlGraphForm::viewSortOrderAction (void)
+{
+ QAction *action = qobject_cast (sender());
+ if (action == nullptr)
+ return;
+
+ const qjackctlGraphPort::SortOrder sort_order
+ = qjackctlGraphPort::SortOrder(action->data().toInt());
+ qjackctlGraphPort::setSortOrder(sort_order);
+
+ m_ui.graphCanvas->updateNodes();
+}
+
+
+void qjackctlGraphForm::helpAbout (void)
+{
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm)
+ pMainForm->showAboutForm();
+}
+
+
+void qjackctlGraphForm::helpAboutQt (void)
+{
+ QMessageBox::aboutQt(this);
+}
+
+
+void qjackctlGraphForm::zoomValueChanged ( int zoom_value )
+{
+ m_ui.graphCanvas->setZoom(0.01 * qreal(zoom_value));
+}
+
+
+// Node life-cycle slots.
+void qjackctlGraphForm::added ( qjackctlGraphNode *node )
+{
+ const qjackctlGraphCanvas *canvas
+ = m_ui.graphCanvas;
+ const QRectF& rect
+ = canvas->mapToScene(canvas->viewport()->rect()).boundingRect();
+ const QPointF& pos = rect.center();
+ const qreal w = 0.33 * qMax(rect.width(), 800.0);
+ const qreal h = 0.33 * qMax(rect.height(), 600.0);
+
+ qreal x = pos.x();
+ qreal y = pos.y();
+
+ switch (node->nodeMode()) {
+ case qjackctlGraphItem::Input:
+ ++m_ins;
+ x += w;
+ y += 0.33 * h * (m_ins & 1 ? +m_ins : -m_ins);
+ break;
+ case qjackctlGraphItem::Output:
+ ++m_outs;
+ x -= w;
+ y += 0.33 * h * (m_outs & 1 ? +m_outs : -m_outs);
+ break;
+ default: {
+ int dx = 0;
+ int dy = 0;
+ for (int i = 0; i < m_mids; ++i) {
+ if ((qAbs(dx) > qAbs(dy)) || (dx == dy && dx < 0))
+ dy += (dx < 0 ? +1 : -1);
+ else
+ dx += (dy < 0 ? -1 : +1);
+ }
+ x += 0.33 * w * qreal(dx);
+ y += 0.33 * h * qreal(dy);
+ ++m_mids;
+ break;
+ }}
+
+ x = 4.0 * ::round(0.25 * (x - qreal(::rand() & 0x1f)));
+ y = 4.0 * ::round(0.25 * (y - qreal(::rand() & 0x1f)));
+
+ node->setPos(x, y);
+
+ stabilize();
+}
+
+
+void qjackctlGraphForm::removed ( qjackctlGraphNode */*node*/ )
+{
+#if 0// FIXME: DANGEROUS! Node might have been deleted by now...
+ if (node) {
+ switch (node->nodeMode()) {
+ case qjackctlGraphItem::Input:
+ --m_ins;
+ break;
+ case qjackctlGraphItem::Output:
+ --m_outs;
+ break;
+ default:
+ --m_mids;
+ break;
+ }
+ }
+#endif
+}
+
+
+// Port (dis)connection slots.
+void qjackctlGraphForm::connected (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2 )
+{
+ if (qjackctlJackGraph::isPortType(port1->portType())) {
+ if (m_jack)
+ m_jack->connectPorts(port1, port2, true);
+ jack_changed();
+ }
+#ifdef CONFIG_ALSA_SEQ
+ else
+ if (qjackctlAlsaGraph::isPortType(port1->portType())) {
+ if (m_alsa)
+ m_alsa->connectPorts(port1, port2, true);
+ alsa_changed();
+ }
+#endif
+
+ stabilize();
+}
+
+
+void qjackctlGraphForm::disconnected (
+ qjackctlGraphPort *port1, qjackctlGraphPort *port2 )
+{
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm)
+ pMainForm->queryDisconnect(port1, port2);
+
+ if (qjackctlJackGraph::isPortType(port1->portType())) {
+ if (m_jack)
+ m_jack->connectPorts(port1, port2, false);
+ jack_changed();
+ }
+#ifdef CONFIG_ALSA_SEQ
+ else
+ if (qjackctlAlsaGraph::isPortType(port1->portType())) {
+ if (m_alsa)
+ m_alsa->connectPorts(port1, port2, false);
+ alsa_changed();
+ }
+#endif
+
+ stabilize();
+}
+
+
+// Item renaming slot.
+void qjackctlGraphForm::renamed ( qjackctlGraphItem *item, const QString& name )
+{
+ qjackctlGraphSect *sect = item_sect(item);
+ if (sect)
+ sect->renameItem(item, name);
+}
+
+
+// Graph section slots.
+void qjackctlGraphForm::jack_shutdown (void)
+{
+ m_ui.graphCanvas->clearSelection();
+
+ m_jack_changed = 0;
+
+ if (m_jack)
+ m_jack->clearItems();
+
+ stabilize();
+}
+
+
+void qjackctlGraphForm::jack_changed (void)
+{
+ ++m_jack_changed;
+}
+
+void qjackctlGraphForm::alsa_changed (void)
+{
+ ++m_alsa_changed;
+}
+
+
+// Graph refreshner.
+void qjackctlGraphForm::refresh (void)
+{
+ if (m_jack_changed > 0) {
+ m_jack_changed = 0;
+ if (m_jack)
+ m_jack->updateItems();
+ stabilize();
+ }
+#ifdef CONFIG_ALSA_SEQ
+ else
+ if (m_alsa_changed > 0) {
+ m_alsa_changed = 0;
+ if (m_alsa)
+ m_alsa->updateItems();
+ stabilize();
+ }
+#endif
+}
+
+
+// Graph selection change slot.
+void qjackctlGraphForm::stabilize (void)
+{
+ const qjackctlGraphCanvas *canvas = m_ui.graphCanvas;
+
+ m_ui.graphConnectAction->setEnabled(canvas->canConnect());
+ m_ui.graphDisconnectAction->setEnabled(canvas->canDisconnect());
+
+ m_ui.editSelectNoneAction->setEnabled(
+ !canvas->scene()->selectedItems().isEmpty());
+ m_ui.editRenameItemAction->setEnabled(
+ canvas->canRenameItem());
+
+#if 0
+ const QRectF& outter_rect
+ = canvas->scene()->sceneRect().adjusted(-2.0, -2.0, +2.0, +2.0);
+ const QRectF& inner_rect
+ = canvas->mapToScene(canvas->viewport()->rect()).boundingRect();
+ const bool is_contained
+ = outter_rect.contains(inner_rect) ||
+ canvas->horizontalScrollBar()->isVisible() ||
+ canvas->verticalScrollBar()->isVisible();
+#else
+ const bool is_contained = true;
+#endif
+ const qreal zoom = canvas->zoom();
+ m_ui.viewCenterAction->setEnabled(is_contained);
+ m_ui.viewZoomInAction->setEnabled(zoom < 2.0);
+ m_ui.viewZoomOutAction->setEnabled(zoom > 0.1);
+ m_ui.viewZoomFitAction->setEnabled(is_contained);
+ m_ui.viewZoomResetAction->setEnabled(zoom != 1.0);
+
+ const int zoom_value = int(100.0f * zoom);
+ const bool is_spinbox_blocked = m_zoom_spinbox->blockSignals(true);
+ const bool is_slider_blocked = m_zoom_slider->blockSignals(true);
+ m_zoom_spinbox->setValue(zoom_value);
+ m_zoom_slider->setValue(zoom_value);
+ m_zoom_spinbox->blockSignals(is_spinbox_blocked);
+ m_zoom_slider->blockSignals(is_slider_blocked);
+}
+
+
+// Tool-bar orientation change slot.
+void qjackctlGraphForm::orientationChanged ( Qt::Orientation orientation )
+{
+ if (m_config && m_config->isTextBesideIcons()
+ && orientation == Qt::Horizontal) {
+ m_ui.ToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
+ } else {
+ m_ui.ToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ }
+}
+
+
+// Context-menu event handler.
+void qjackctlGraphForm::contextMenuEvent ( QContextMenuEvent *pContextMenuEvent )
+{
+ m_ui.graphCanvas->clear();
+
+ stabilize();
+
+ QMenu menu(this);
+ menu.addAction(m_ui.graphConnectAction);
+ menu.addAction(m_ui.graphDisconnectAction);
+ menu.addSeparator();
+ menu.addActions(m_ui.editMenu->actions());
+ menu.addSeparator();
+ menu.addMenu(m_ui.viewZoomMenu);
+
+ menu.exec(pContextMenuEvent->globalPos());
+
+ stabilize();
+}
+
+
+// Widget resize event handler.
+void qjackctlGraphForm::resizeEvent ( QResizeEvent *pResizeEvent )
+{
+ QMainWindow::resizeEvent(pResizeEvent);
+
+ stabilize();
+}
+
+
+// Notify our parent that we're emerging.
+void qjackctlGraphForm::showEvent ( QShowEvent *pShowEvent )
+{
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm)
+ pMainForm->stabilizeForm();
+
+ QWidget::showEvent(pShowEvent);
+}
+
+
+// Notify our parent that we're closing.
+void qjackctlGraphForm::hideEvent ( QHideEvent *pHideEvent )
+{
+ QWidget::hideEvent(pHideEvent);
+
+ qjackctlMainForm *pMainForm = qjackctlMainForm::getInstance();
+ if (pMainForm)
+ pMainForm->stabilizeForm();
+}
+
+
+// Widget close event handler.
+void qjackctlGraphForm::closeEvent ( QCloseEvent *pCloseEvent )
+{
+ m_ui.graphCanvas->saveState();
+
+ if (m_config && QMainWindow::isVisible()) {
+ m_config->setSortOrder(int(qjackctlGraphPort::sortOrder()));
+ m_config->setSortType(int(qjackctlGraphPort::sortType()));
+ m_config->setTextBesideIcons(m_ui.viewTextBesideIconsAction->isChecked());
+ m_config->setZoomRange(m_ui.viewZoomRangeAction->isChecked());
+ m_config->setStatusbar(m_ui.StatusBar->isVisible());
+ m_config->setToolbar(m_ui.ToolBar->isVisible());
+ m_config->setMenubar(m_ui.MenuBar->isVisible());
+ m_config->saveState(this);
+ }
+
+ QMainWindow::closeEvent(pCloseEvent);
+}
+
+
+
+// Special port-type color methods.
+void qjackctlGraphForm::updateViewColorsAction ( QAction *action )
+{
+ const uint port_type = action->data().toUInt();
+ if (0 >= port_type)
+ return;
+
+ const QColor& color = m_ui.graphCanvas->portTypeColor(port_type);
+ if (!color.isValid())
+ return;
+
+ QPixmap pm(22, 22);
+ QPainter(&pm).fillRect(0, 0, pm.width(), pm.height(), color);
+ action->setIcon(QIcon(pm));
+}
+
+
+void qjackctlGraphForm::updateViewColors (void)
+{
+ updateViewColorsAction(m_ui.viewColorsJackAudioAction);
+ updateViewColorsAction(m_ui.viewColorsJackMidiAction);
+ updateViewColorsAction(m_ui.viewColorsAlsaMidiAction);
+}
+
+
+// Item sect predicate.
+qjackctlGraphSect *qjackctlGraphForm::item_sect ( qjackctlGraphItem *item ) const
+{
+ if (item->type() == qjackctlGraphNode::Type) {
+ qjackctlGraphNode *node = static_cast (item);
+ if (node && qjackctlJackGraph::isNodeType(node->nodeType()))
+ return m_jack;
+ #ifdef CONFIG_ALSA_SEQ
+ else
+ if (node && qjackctlAlsaGraph::isNodeType(node->nodeType()))
+ return m_alsa;
+ #endif
+ }
+ else
+ if (item->type() == qjackctlGraphPort::Type) {
+ qjackctlGraphPort *port = static_cast (item);
+ if (port && qjackctlJackGraph::isPortType(port->portType()))
+ return m_jack;
+ #ifdef CONFIG_ALSA_SEQ
+ else
+ if (port && qjackctlAlsaGraph::isPortType(port->portType()))
+ return m_alsa;
+ #endif
+ }
+
+ return nullptr; // No deal!
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphConfig -- Canvas state memento.
+
+// Local constants.
+static const char *LayoutGroup = "/GraphLayout";
+static const char *ViewGroup = "/GraphView";
+static const char *ViewMenubarKey = "/Menubar";
+static const char *ViewToolbarKey = "/Toolbar";
+static const char *ViewStatusbarKey = "/Statusbar";
+static const char *ViewTextBesideIconsKey = "/TextBesideIcons";
+static const char *ViewZoomRangeKey = "/ZoomRange";
+static const char *ViewSortTypeKey = "/SortType";
+static const char *ViewSortOrderKey = "/SortOrder";
+
+
+// Constructors.
+qjackctlGraphConfig::qjackctlGraphConfig ( QSettings *settings )
+ : m_settings(settings), m_menubar(false),
+ m_toolbar(false), m_statusbar(false),
+ m_texticons(false), m_zoomrange(false),
+ m_sorttype(0), m_sortorder(0)
+{
+}
+
+
+QSettings *qjackctlGraphConfig::settings (void) const
+{
+ return m_settings;
+}
+
+
+void qjackctlGraphConfig::setMenubar ( bool menubar )
+{
+ m_menubar = menubar;
+}
+
+bool qjackctlGraphConfig::isMenubar (void) const
+{
+ return m_menubar;
+}
+
+
+void qjackctlGraphConfig::setToolbar ( bool toolbar )
+{
+ m_toolbar = toolbar;
+}
+
+bool qjackctlGraphConfig::isToolbar (void) const
+{
+ return m_toolbar;
+}
+
+
+void qjackctlGraphConfig::setStatusbar ( bool statusbar )
+{
+ m_statusbar = statusbar;
+}
+
+bool qjackctlGraphConfig::isStatusbar (void) const
+{
+ return m_statusbar;
+}
+
+
+void qjackctlGraphConfig::setTextBesideIcons ( bool texticons )
+{
+ m_texticons = texticons;
+}
+
+bool qjackctlGraphConfig::isTextBesideIcons (void) const
+{
+ return m_texticons;
+}
+
+
+void qjackctlGraphConfig::setZoomRange ( bool zoomrange )
+{
+ m_zoomrange = zoomrange;
+}
+
+bool qjackctlGraphConfig::isZoomRange (void) const
+{
+ return m_zoomrange;
+}
+
+
+void qjackctlGraphConfig::setSortType ( int sorttype )
+{
+ m_sorttype = sorttype;
+}
+
+int qjackctlGraphConfig::sortType (void) const
+{
+ return m_sorttype;
+}
+
+
+void qjackctlGraphConfig::setSortOrder ( int sortorder )
+{
+ m_sortorder = sortorder;
+}
+
+int qjackctlGraphConfig::sortOrder (void) const
+{
+ return m_sortorder;
+}
+
+
+// Graph main-widget state methods.
+bool qjackctlGraphConfig::restoreState ( QMainWindow *widget )
+{
+ if (m_settings == nullptr || widget == nullptr)
+ return false;
+
+ m_settings->beginGroup(ViewGroup);
+ m_menubar = m_settings->value(ViewMenubarKey, true).toBool();
+ m_toolbar = m_settings->value(ViewToolbarKey, true).toBool();
+ m_statusbar = m_settings->value(ViewStatusbarKey, true).toBool();
+ m_texticons = m_settings->value(ViewTextBesideIconsKey, true).toBool();
+ m_zoomrange = m_settings->value(ViewZoomRangeKey, false).toBool();
+ m_sorttype = m_settings->value(ViewSortTypeKey, 0).toInt();
+ m_sortorder = m_settings->value(ViewSortOrderKey, 0).toInt();
+ m_settings->endGroup();
+
+ m_settings->beginGroup(LayoutGroup);
+ const QByteArray& layout_state
+ = m_settings->value('/' + widget->objectName()).toByteArray();
+ m_settings->endGroup();
+
+ if (!layout_state.isEmpty())
+ widget->restoreState(layout_state);
+
+ return true;
+}
+
+
+bool qjackctlGraphConfig::saveState ( QMainWindow *widget ) const
+{
+ if (m_settings == nullptr || widget == nullptr)
+ return false;
+
+ m_settings->beginGroup(ViewGroup);
+ m_settings->setValue(ViewMenubarKey, m_menubar);
+ m_settings->setValue(ViewToolbarKey, m_toolbar);
+ m_settings->setValue(ViewStatusbarKey, m_statusbar);
+ m_settings->setValue(ViewTextBesideIconsKey, m_texticons);
+ m_settings->setValue(ViewZoomRangeKey, m_zoomrange);
+ m_settings->setValue(ViewSortTypeKey, m_sorttype);
+ m_settings->setValue(ViewSortOrderKey, m_sortorder);
+ m_settings->endGroup();
+
+ m_settings->beginGroup(LayoutGroup);
+ const QByteArray& layout_state = widget->saveState();
+ m_settings->setValue('/' + widget->objectName(), layout_state);
+ m_settings->endGroup();
+
+ return true;
+}
+
+
+// end of qjackctlGraphForm.cpp
diff -Nru qjackctl-0.4.5/src/qjackctlGraphForm.h qjackctl-0.6.0/src/qjackctlGraphForm.h
--- qjackctl-0.4.5/src/qjackctlGraphForm.h 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraphForm.h 2019-10-17 07:45:45.953673224 +0000
@@ -0,0 +1,224 @@
+// qjackctlGraphForm.h
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#ifndef __qjackctlGraphForm_h
+#define __qjackctlGraphForm_h
+
+#include "ui_qjackctlGraphForm.h"
+
+
+// Forward decls.
+class qjackctlGraphConfig;
+
+class qjackctlGraphSect;
+class qjackctlAlsaGraph;
+class qjackctlJackGraph;
+
+class qjackctlGraphPort;
+
+class qjackctlSetup;
+
+class QResizeEvent;
+class QCloseEvent;
+
+class QSlider;
+class QSpinBox;
+
+class QActionGroup;
+
+
+// Forwards decls.
+class QSettings;
+class QMainWindow;
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphForm -- UI wrapper form.
+
+class qjackctlGraphForm : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+
+ // Constructor.
+ qjackctlGraphForm(QWidget *parent = 0, Qt::WindowFlags wflags = 0);
+
+ // Destructor.
+ ~qjackctlGraphForm();
+
+ // Initializer.
+ void setup(qjackctlSetup *pSetup);
+
+public slots:
+
+ // Graph section slots.
+ void jack_shutdown();
+ void jack_changed();
+ void alsa_changed();
+
+ // Graph refreshner.
+ void refresh();
+
+protected slots:
+
+ // Node life-cycle slots
+ void added(qjackctlGraphNode *node);
+ void removed(qjackctlGraphNode *node);
+
+ // Port (dis)connection slots.
+ void connected(qjackctlGraphPort *port1, qjackctlGraphPort *port2);
+ void disconnected(qjackctlGraphPort *port1, qjackctlGraphPort *port2);
+
+ // Item renaming slot.
+ void renamed(qjackctlGraphItem *item, const QString& name);
+
+ // Graph selection change slot.
+ void stabilize();
+
+ // Tool-bar orientation change slot.
+ void orientationChanged(Qt::Orientation orientation);
+
+ // Main menu slots.
+ void viewMenubar(bool on);
+ void viewToolbar(bool on);
+ void viewStatusbar(bool on);
+
+ void viewTextBesideIcons(bool on);
+
+ void viewCenter();
+ void viewRefresh();
+
+ void viewZoomRange(bool on);
+
+ void viewSortTypeAction();
+ void viewSortOrderAction();
+
+ void viewColorsAction();
+ void viewColorsReset();
+
+ void helpAbout();
+ void helpAboutQt();
+
+ void zoomValueChanged(int zoom_value);
+
+protected:
+
+ // Context-menu event handler.
+ void contextMenuEvent(QContextMenuEvent *pContextMenuEvent);
+
+ // Widget resize event handler.
+ void resizeEvent(QResizeEvent *pResizeEvent);
+
+ // Widget show/hide/close event handlers.
+ void showEvent(QShowEvent *pShowEvent);
+ void hideEvent(QHideEvent *pHideEvent);
+ void closeEvent(QCloseEvent *pCloseEvent);
+
+ // Special port-type color method.
+ void updateViewColorsAction(QAction *action);
+ void updateViewColors();
+
+ // Item sect predicate.
+ qjackctlGraphSect *item_sect(qjackctlGraphItem *item) const;
+
+private:
+
+ // The Qt-designer UI struct...
+ Ui::qjackctlGraphForm m_ui;
+
+ // Instance variables.
+ qjackctlGraphConfig *m_config;
+
+ // Instance variables.
+ qjackctlJackGraph *m_jack;
+ qjackctlAlsaGraph *m_alsa;
+
+ int m_jack_changed;
+ int m_alsa_changed;
+
+ int m_ins, m_mids, m_outs;
+
+ QSlider *m_zoom_slider;
+ QSpinBox *m_zoom_spinbox;
+
+ QActionGroup *m_sort_type;
+ QActionGroup *m_sort_order;
+};
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphConfig -- Canvas state memento.
+
+class qjackctlGraphConfig
+{
+public:
+
+ // Constructor.
+ qjackctlGraphConfig(QSettings *settings);
+
+ // Accessors.
+ QSettings *settings() const;
+
+ void setMenubar(bool menubar);
+ bool isMenubar() const;
+
+ void setToolbar(bool toolbar);
+ bool isToolbar() const;
+
+ void setStatusbar(bool statusbar);
+ bool isStatusbar() const;
+
+ void setTextBesideIcons(bool texticons);
+ bool isTextBesideIcons() const;
+
+ void setZoomRange(bool zoomrange);
+ bool isZoomRange() const;
+
+ void setSortType(int sorttype);
+ int sortType() const;
+
+ void setSortOrder(int sortorder);
+ int sortOrder() const;
+
+ // Graph main-widget state methods.
+ bool restoreState(QMainWindow *widget);
+ bool saveState(QMainWindow *widget) const;
+
+private:
+
+ // Instance variables.
+ QSettings *m_settings;
+
+ bool m_menubar;
+ bool m_toolbar;
+ bool m_statusbar;
+ bool m_texticons;
+ bool m_zoomrange;
+ int m_sorttype;
+ int m_sortorder;
+};
+
+
+#endif // __qjackctlGraphForm_h
+
+
+// end of qjackctlGraphForm.h
diff -Nru qjackctl-0.4.5/src/qjackctlGraphForm.ui qjackctl-0.6.0/src/qjackctlGraphForm.ui
--- qjackctl-0.4.5/src/qjackctlGraphForm.ui 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraphForm.ui 2019-10-17 07:45:45.953673224 +0000
@@ -0,0 +1,722 @@
+
+ rncbc aka Rui Nuno Capela
+ JACK Audio Connection Kit - Qt GUI Interface.
+
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+ qjackctlGraphForm
+
+
+
+ 0
+ 0
+ 800
+ 600
+
+
+
+ Graph
+
+
+ :/images/graph1.png
+
+
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+
+
+
+
+
+ Qt::AllToolBarAreas
+
+
+ Qt::Horizontal
+
+
+ Qt::ToolButtonTextBesideIcon
+
+
+ true
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ :/images/graphConnect.png
+
+
+ &Connect
+
+
+ Connect
+
+
+ Connect
+
+
+ Connect selected ports
+
+
+ Ins
+
+
+
+
+ :/images/graphDisconnect.png
+
+
+ &Disconnect
+
+
+ Disconnect
+
+
+ Disconnect
+
+
+ Disconnect selected ports
+
+
+ Del
+
+
+
+
+ Cl&ose
+
+
+ Close
+
+
+ Close
+
+
+ Close this application window
+
+
+
+
+
+
+
+ Select &All
+
+
+ Select All
+
+
+ Select All
+
+
+ Select All
+
+
+ Ctrl+A
+
+
+
+
+ Select &None
+
+
+ Select None
+
+
+ Select None
+
+
+ Select None
+
+
+ Ctrl+Shift+A
+
+
+
+
+ Select &Invert
+
+
+ Select Invert
+
+
+ Select Invert
+
+
+ Select Invert
+
+
+ Ctrl+I
+
+
+
+
+ :/images/graphRename.png
+
+
+ &Rename...
+
+
+ Rename item
+
+
+ Rename Item
+
+
+ Rename Item
+
+
+
+
+
+
+
+ true
+
+
+ &Menubar
+
+
+ Menubar
+
+
+ Menubar
+
+
+ Show/hide the main program window menubar
+
+
+ Ctrl+M
+
+
+
+
+ true
+
+
+ &Toolbar
+
+
+ Toolbar
+
+
+ Toolbar
+
+
+ Show/hide main program window file toolbar
+
+
+
+
+ true
+
+
+ &Statusbar
+
+
+ Statusbar
+
+
+ Statusbar
+
+
+ Show/hide the main program window statusbar
+
+
+
+
+
+
+
+ true
+
+
+ Text Beside &Icons
+
+
+ Text beside icons
+
+
+ Text beside icons
+
+
+ Show/hide text beside icons
+
+
+
+
+ :/images/graphCenter.png
+
+
+ &Center
+
+
+ Center
+
+
+ Center
+
+
+ Center view
+
+
+
+
+
+
+
+ &Refresh
+
+
+ Refresh
+
+
+ Refresh
+
+
+ Refresh view
+
+
+ F5
+
+
+
+
+ :/images/graphZoomIn.png
+
+
+ Zoom &In
+
+
+ Zoom In
+
+
+ Zoom In
+
+
+ Zoom In
+
+
+ Ctrl++
+
+
+
+
+ :/images/graphZoomOut.png
+
+
+ Zoom &Out
+
+
+ Zoom Out
+
+
+ Zoom Out
+
+
+ Zoom Out
+
+
+ Ctrl+-
+
+
+
+
+ :/images/graphZoomFit.png
+
+
+ Zoom &Fit
+
+
+ Zoom Fit
+
+
+ Zoom Fit
+
+
+ Zoom Fit
+
+
+ Ctrl+0
+
+
+
+
+ :/images/graphZoomReset.png
+
+
+ Zoom &Reset
+
+
+ Zoom Reset
+
+
+ Zoom Reset
+
+
+ Zoom Reset
+
+
+ Ctrl+1
+
+
+
+
+ true
+
+
+ :/images/graphZoomRange.png
+
+
+ &Zoom Range
+
+
+ Zoom Range
+
+
+ Zoom Range
+
+
+ Zoom Range
+
+
+
+
+
+
+
+ JACK &Audio...
+
+
+ JACK Audio color
+
+
+ JACK Audio color
+
+
+ JACK Audio color
+
+
+
+
+
+
+
+ JACK &MIDI...
+
+
+ JACK MIDI
+
+
+ JACK MIDI color
+
+
+ JACK MIDI color
+
+
+
+
+
+
+
+ &ALSA MIDI...
+
+
+ ALSA MIDI
+
+
+ ALSA MIDI color
+
+
+ ALSA MIDI color
+
+
+
+
+
+
+
+ &Reset
+
+
+ Reset colors
+
+
+ Reset colors
+
+
+ Reset colors
+
+
+
+
+
+
+
+ true
+
+
+ Port &Name
+
+
+ Port name
+
+
+ Sort by port name
+
+
+
+
+
+
+
+ true
+
+
+ Port &Title
+
+
+ Port title
+
+
+ Sort by port title
+
+
+
+
+
+
+
+ true
+
+
+ Port &Index
+
+
+ Port index
+
+
+ Sort by port index
+
+
+
+
+
+
+
+ true
+
+
+ &Ascending
+
+
+ Ascending
+
+
+ Ascending sort order
+
+
+
+
+
+
+
+ true
+
+
+ &Descending
+
+
+ Descending
+
+
+ Descending sort order
+
+
+
+
+
+
+
+ &About...
+
+
+ About...
+
+
+ About
+
+
+ Show information about this application program
+
+
+
+
+
+
+
+ About &Qt...
+
+
+ About Qt...
+
+
+ About Qt
+
+
+ Show information about the Qt toolkit
+
+
+
+
+
+
+
+
+
+ qjackctlGraphCanvas
+ QGraphicsView
+
+
+
+
+
+
+
+
diff -Nru qjackctl-0.4.5/src/qjackctlGraph.h qjackctl-0.6.0/src/qjackctlGraph.h
--- qjackctl-0.4.5/src/qjackctlGraph.h 1970-01-01 00:00:00.000000000 +0000
+++ qjackctl-0.6.0/src/qjackctlGraph.h 2019-10-17 07:45:45.952673224 +0000
@@ -0,0 +1,664 @@
+// qjackctlGraph.h
+//
+/****************************************************************************
+ Copyright (C) 2003-2019, rncbc aka Rui Nuno Capela. All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+*****************************************************************************/
+
+#ifndef __qjackctlGraph_h
+#define __qjackctlGraph_h
+
+#include
+
+#include
+
+#include
+#include
+
+#include
+#include
+
+
+// Forward decls.
+class qjackctlGraphCanvas;
+class qjackctlGraphNode;
+class qjackctlGraphPort;
+class qjackctlGraphConnect;
+class qjackctlGraphCommand;
+
+class qjackctlAliases;
+class qjackctlAliasList;
+
+class QStyleOptionGraphicsItem;
+
+class QRubberBand;
+class QUndoCommand;
+class QUndoStack;
+class QSettings;
+
+class QGraphicsProxyWidget;
+class QLineEdit;
+
+class QMouseEvent;
+class QWheelEvent;
+class QKeyEvent;
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphItem -- Base graphics item.
+
+class qjackctlGraphItem : public QGraphicsPathItem
+{
+public:
+
+ // Constructor.
+ qjackctlGraphItem(QGraphicsItem *parent = nullptr);
+
+ // Basic color accessors.
+ void setForeground(const QColor& color);
+ const QColor& foreground() const;
+
+ void setBackground(const QColor& color);
+ const QColor& background() const;
+
+ // Marking methods.
+ void setMarked(bool marked);
+ bool isMarked() const;
+
+ // Highlighting methods.
+ void setHighlight(bool hilite);
+ bool isHighlight() const;
+
+ // Item modes.
+ enum Mode { None = 0,
+ Input = 1, Output = 2,
+ Duplex = Input | Output };
+
+ // Item hash/map key.
+ class ItemKey
+ {
+ public:
+
+ // Constructors.
+ ItemKey (const QString& name, Mode mode, uint type = 0)
+ : m_name(name), m_mode(mode), m_type(type) {}
+ ItemKey (const ItemKey& key)
+ : m_name(key.name()), m_mode(key.mode()), m_type(key.type()) {}
+
+ // Key accessors.
+ const QString& name() const
+ { return m_name; }
+ Mode mode() const
+ { return m_mode; }
+ uint type() const
+ { return m_type; }
+
+ // Hash/map key comparators.
+ bool operator== (const ItemKey& key) const
+ {
+ return ItemKey::type() == key.type()
+ && ItemKey::mode() == key.mode()
+ && ItemKey::name() == key.name();
+ }
+
+ private:
+
+ // Key fields.
+ QString m_name;
+ Mode m_mode;
+ uint m_type;
+ };
+
+ typedef QHash ItemKeys;
+
+ // Item-type hash (static)
+ static uint itemType(const QByteArray& type_name);
+
+ // Rectangular editor extents.
+ virtual QRectF editorRect() const;
+
+private:
+
+ // Instance variables.
+ QColor m_foreground;
+ QColor m_background;
+
+ bool m_marked;
+ bool m_hilite;
+};
+
+
+// Item hash function.
+inline uint qHash ( const qjackctlGraphItem::ItemKey& key )
+{
+ return qHash(key.name()) ^ qHash(uint(key.mode())) ^ qHash(key.type());
+}
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphPort -- Port graphics item.
+
+class qjackctlGraphPort : public qjackctlGraphItem
+{
+public:
+
+ // Constructor.
+ qjackctlGraphPort(qjackctlGraphNode *node,
+ const QString& name, Mode mode, uint type = 0);
+
+ // Destructor.
+ ~qjackctlGraphPort();
+
+ // Graphics item type.
+ enum { Type = QGraphicsItem::UserType + 2 };
+
+ int type() const { return Type; }
+
+ // Accessors.
+ qjackctlGraphNode *portNode() const;
+
+ void setPortName(const QString& name);
+ const QString& portName() const;
+
+ void setPortMode(Mode mode);
+ Mode portMode() const;
+
+ bool isInput() const;
+ bool isOutput() const;
+
+ void setPortType(uint type);
+ uint portType() const;
+
+ void setPortTitle(const QString& title);
+ const QString& portTitle() const;
+
+ void setPortIndex(int index);
+ int portIndex() const;
+
+ QPointF portPos() const;
+
+ // Connection-list methods.
+ void appendConnect(qjackctlGraphConnect *connect);
+ void removeConnect(qjackctlGraphConnect *connect);
+ void removeConnects();
+
+ qjackctlGraphConnect *findConnect(qjackctlGraphPort *port) const;
+
+ // Selection propagation method...
+ void setSelectedEx(bool is_selected);
+
+ // Highlighting propagation method...
+ void setHighlightEx(bool is_highlight);
+
+ // Special port-type color business.
+ void updatePortTypeColors(qjackctlGraphCanvas *canvas);
+
+ // Port hash/map key.
+ class PortKey : public ItemKey
+ {
+ public:
+ // Constructors.
+ PortKey(qjackctlGraphPort *port)
+ : ItemKey(port->portName(), port->portMode(), port->portType()) {}
+ };
+
+ // Port sorting type.
+ enum SortType { PortName = 0, PortTitle, PortIndex };
+
+ static void setSortType(SortType sort_type);
+ static SortType sortType();
+
+ // Port sorting order.
+ enum SortOrder { Ascending = 0, Descending };
+
+ static void setSortOrder(SortOrder sort_order);
+ static SortOrder sortOrder();
+
+ // Port sorting comparators.
+ struct Compare {
+ bool operator()(qjackctlGraphPort *port1, qjackctlGraphPort *port2) const
+ { return qjackctlGraphPort::lessThan(port1, port2); }
+ };
+
+ struct ComparePos {
+ bool operator()(qjackctlGraphPort *port1, qjackctlGraphPort *port2) const
+ { return (port1->scenePos().y() < port2->scenePos().y()); }
+ };
+
+ // Rectangular editor extents.
+ QRectF editorRect() const;
+
+protected:
+
+ void paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ QVariant itemChange(GraphicsItemChange change, const QVariant& value);
+
+ // Natural decimal sorting comparators.
+ static bool lessThan(qjackctlGraphPort *port1, qjackctlGraphPort *port2);
+ static bool lessThan(const QString& s1, const QString& s2);
+
+private:
+
+ // instance variables.
+ qjackctlGraphNode *m_node;
+
+ QString m_name;
+ Mode m_mode;
+ uint m_type;
+
+ QString m_title;
+ int m_index;
+
+ QGraphicsTextItem *m_text;
+
+ QList m_connects;
+
+ int m_selectx;
+ int m_hilitex;
+
+ static SortType g_sort_type;
+ static SortOrder g_sort_order;
+};
+
+
+//----------------------------------------------------------------------------
+// qjackctlGraphNode -- Node graphics item.
+
+class qjackctlGraphNode : public qjackctlGraphItem
+{
+public:
+
+ // Constructor.
+ qjackctlGraphNode(const QString& name, Mode mode, uint type = 0);
+
+ // Destructor..
+ ~qjackctlGraphNode();
+ // Graphics item type.
+ enum { Type = QGraphicsItem::UserType + 1 };
+
+ int type() const { return Type; }
+
+ // Accessors.
+ void setNodeName(const QString& name);
+ const QString& nodeName() const;
+
+ void setNodeMode(Mode mode);
+ Mode nodeMode() const;
+
+ void setNodeType(uint type);
+ uint nodeType() const;
+
+ void setNodeIcon(const QIcon& icon);
+ const QIcon& nodeIcon() const;
+
+ void setNodeTitle(const QString& title);
+ QString nodeTitle() const;
+
+ // Port-list methods.
+ qjackctlGraphPort *addPort(const QString& name, Mode mode, int type = 0);
+
+ qjackctlGraphPort *addInputPort(const QString& name, int type = 0);
+ qjackctlGraphPort *addOutputPort(const QString& name, int type = 0);
+
+ void removePort(qjackctlGraphPort *port);
+ void removePorts();
+
+ // Port finder (by name, mode and type)
+ qjackctlGraphPort *findPort(const QString& name, Mode mode, uint type = 0);
+
+ // Reset port markings, destroy if unmarked.
+ void resetMarkedPorts();
+
+ // Path/shape updater.
+ void updatePath();
+
+ // Node hash key.
+ class NodeKey : public ItemKey
+ {
+ public:
+ // Constructors.
+ NodeKey(qjackctlGraphNode *node)
+ : ItemKey(node->nodeName(), node->nodeMode(), node->nodeType()) {}
+ };
+
+ // Rectangular editor extents.
+ QRectF editorRect() const;
+
+protected:
+
+ void paint(QPainter *painter,
+ const QStyleOptionGraphicsItem *option, QWidget *widget);
+
+ QVariant itemChange(GraphicsItemChange change, const QVariant& value);
+
+private:
+
+ // Instance variables.
+ QString m_name;
+ Mode m_mode;
+ uint m_type;
+
+ QIcon m_icon;
+
+ QGraphicsPixmapItem *m_pixmap;
+ QGraphicsTextItem *m_text;
+
+ qjackctlGraphPort::ItemKeys m_portkeys;
+ QList