%define __cmake_in_source_build 1
%bcond_with clang

Name:           qps
Version:        2.8.0
Release:        1%{dist}
Summary:        Visual Process Manager
License:        GPL-2.0-or-later AND LGPL-2.1-or-later
Group:          System/Monitoring
URL:            https://github.com/lxqt/qps/
Source0:        https://github.com/lxqt/qps/archive/%{version}.tar.gz#/%{name}-%{version}.tar.xz
BuildRequires:  cmake
%if %{with clang}
BuildRequires: clang >= 5.0
%else
BuildRequires: gcc-c++
%endif
BuildRequires:  glibc
BuildRequires:  glibc-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  lxqt-build-tools >= 0.13.0
BuildRequires:  pkgconfig
BuildRequires:  desktop-file-utils
BuildRequires:  cmake(Qt5LinguistTools)
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(Qt5Widgets)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(xrender)


%description
Qps is a visual process manager, an X11 version of "top" or "ps" that
displays processes in a window and lets you sort and manipulate them. It
displays some general system information, and many details about current
processes.

%lang_package

%prep
%setup -q

%build
%{__mkdir} -p %{_target_platform}

%if %{with clang}
export CC=clang
export CXX=clang++
%endif

pushd %{_target_platform}
%{cmake_lxqt} \
    -DPULL_TRANSLATIONS=NO \
    ..

%cmake_build
popd

%install
pushd %{_target_platform}
  %cmake_install
popd

%find_lang %{name} --with-qt

desktop-file-install \
    --remove-category="System Monitor" \
    --delete-original \
    --dir=%{buildroot}%{_datadir}/applications \
    %{buildroot}/%{_datadir}/applications/%{name}.desktop


%post
/usr/bin/update-desktop-database &> /dev/null || :

%postun
/usr/bin/update-desktop-database &> /dev/null || :


%files
%doc CHANGELOG README.md
%license COPYING
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_metainfodir}/org.lxqt.Qps.appdata.xml
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{_mandir}/man?/%{name}*
%dir %{_datadir}/qps/
%{_datadir}/qps/translations/

%changelog
* Mon Nov  6 2023 Raven <raven@sysadmins.ws> - 2.8.0-1
- update to 2.8.0
- clang support

* Thu May 18 2023 Raven <raven@sysadmins.ws> - 2.7.0-1
- update to 2.7.0

* Fri Nov 11 2022 Raven <raven@sysadmins.ws> - 2.6.0-1
- update to 2.6.0

* Mon Nov 08 2021 Raven <raven@sysadmins.ws> - 2.4.0-1
- update to 2.4.0
- drop RHEL7 support

* Wed Jan 27 2021 Raven <raven@sysadmins.ws> - 2.2.0-1
- version update

* Tue Jun 16 2020 Raven <raven@sysadmins.ws> - 2.1.0-1
- version update

* Thu Nov  7 2019 Michael Vetter <mvetter@suse.com>
- Don't require glibc >= 2.30, it works actually without it
* Wed Oct  9 2019 mvetter@suse.com
- Update to 2.0.0:
  * Several code cleanups:
  - Silenced compiler warnings about QtTableView
  - Do not detect systray on every refresh (this also fixes memory leak under some GTK DEs)
  - Removed the method `HeadedTable::sizeHintForColumn`
  - htable.cpp: remove unused define
  - qps.h: remove unused define
  - Cleaned up the classes SearchBox, ControlBar and StatusBar
  - Do not cast bool to integer on return
  - Removed no strings casts definitions
  - Removed unmanaged code
  - Remove some comments
  - Corrected sscanf format
  - Removed unused variable
  - Simplified groupName
  - Add missing "const"
  - Apply LXQtCompilerSettings to project
  * Fixed memory leaks:
  - Fixed memory leak in showing process details dialogs
  - Prevent a file descriptor leak
  - Fixed several memory leaks
  * UI and other improvements:
  - Properly save font info
  - Sort fields list alphabetically
  - Update sort indicator on adding columns
  - Use float for memory column if in megabytes
  - Support HDPI pixmaps
  - A better filter box with clear button and place holder
  - Don't allow an unsorted table
  - Fixed table size and scrollbars
  - Made column DND predictable
  - Fixes for the header, especially for its DND
  - Fixed painting of cells, branch lines and...
  - Fixed settings and preferences and added signal prompt
  - Fixed SWAP column
  - Use a smaller pixmap cache
  - Improved translations
* Fri Mar  1 2019 mvetter@suse.com
- Update to 1.10.20:
  * Only translations was changed
* Thu Jan 31 2019 Michael Vetter <mvetter@suse.com>
- Update to 1.10.19:
  * Improved localization support
- Move translation from lxqt-l10n into package
* Tue May 22 2018 mvetter@suse.com
- Update to 1.10.18:
  * Bumped patch version to 18 (#45)
  * Update from Weblate. (#41)
  * Added transltion state to README.md
  * Add da translation
  * translation update
  * Added translation using Weblate (German)
  * Create qps_da.ts
  * Update qps.desktop.in
  * i18n: Update Polish translation
  * Drop Qt foreach
  * Fix links QtDesktop --> lxqt
* Sun Feb 25 2018 aloisio@gmx.com
- Update to version 1.10.17
  * some whitespaces fixed
  * l10n: Polish translation
  * Remove obsolete cpack
  * Removed not needed ressource file
  * some small fixes
  * Fixed About page
  * Fixed outdated FSF address in license headers
  * Removed: It may be used, distributed and modified without
    limitation. - not exactly true.
  * Added license headers
  * Fix typo
  * Fix license headers for files with clearly known authorship
  * remove some empty files
  * fixed encoding and added a proper GPL2 file header
  * Renamed LICENSE -> COPYING
  * Another set of licenseheader fixes
  * Fixed some typos in comments (CMakeLists.txt)
    Fixed licenseheader: src/wchan.cpp UTF-8 and filename
    Fixed licenseheader: src/watchdogdialog.*  filetype and UTF-8
    Fixed licenseheader: src/watchcond.*  UTF-8
    Fixed licenseheader: src/ttystr.cpp filentype and UTF-8
  * Work around grep 2.23 new behaviour
  * Removes not needed file
  * Fixes CPack package version
  * Fixes misnaming of binary qps
  * Use CMAKE PROJECT_NAME instead of PROJECT
  * Removes Icon related commented code
  * Removes the custom QtIconLoader
  * Use QIcon::fromTheme() instead of the internal QtIconLoader
  * Adds the resources as an target dependency
  * Puts TableField sctruct on it's own file
  * Puts the QpsApp in it's own file
  * Splits the command file into several files
  * Puts Command utilities into it's own file
  * Updates translations sources
  * Removes toolTip, statusTip, whatsThis and accesibleName from
    watchdog.ui
  * Removes stylesheets commented stuff
  * Include a copy of the license
  * Install application icon
  * Updates translation sources
  * Adds desktop entry file
  * Adds application internationalization / localization
  * Set the minimum required CMake version to 3.0.2
  * Add install instruction in CMakeLists.txt
  * Add clang-format file and format all files
- Switch build to cmake and Qt5
- New source URL and homepage
- Dropped qps-1.10.12.1-nostrip.patch and
  qps-1.10.15-desktop.patch (no longer necessary)
- Spec cleanup
* Thu Nov 24 2011 lazy.kent@opensuse.org
- Spec clean up.
* Sun Aug 28 2011 lazy.kent@opensuse.org
- Update to 1.10.16
  + 3.0-ARCH problem fixed
* Mon Aug 22 2011 lazy.kent@opensuse.org
- Patch to fix typo in desktop file (bnc#631745)
* Sun Jul 17 2011 lazy.kent@opensuse.org
- Update to 1.10.15
  + Added IO monitoring
* Wed Jul  6 2011 lazy.kent@opensuse.org
- Update to 1.10.14
  + Fixed wrong process names
* Sat Jun 18 2011 lazy.kent@opensuse.org
- Update to 1.10.13
  + GNOME3 and Avant Window Navigator support
- Correct License tag according to SPDX Standard
* Fri Jun  3 2011 lazy.kent@opensuse.org
- Update to 1.10.12.3
  + Zero CPU bug fixed (thanks to "David Rosenstrauch")
  + SEGFAULT fixed (Google Chrome's very long cmdline bug fix)
- Dropped obsolete buffer_overflow patch
- Use full URL as a source
* Mon Apr 11 2011 lazy.kent@opensuse.org
- Added rpm optflags
- Added COPYING
- Marked man as doc
* Tue Jul  6 2010 lazy.kent.suse@gmail.com
- Fixed buffer overflow (bnc#613864). Patch from Bernhard Rotter
- Build debug packages
* Tue Oct 20 2009 lazy.kent.suse@gmail.com
- Update to 1.10.12.1
  + 0 (zero) Process bug fixed (David_Rosenstrauch@archlinux)
* Thu Sep 17 2009 lazy.kent.suse@gmail.com
- Update to 1.10.12
  + Not working problem on kernel-2.6.xx was fixed
  + MEM field added
  + Tab on-off switch added
* Fri Aug  7 2009 lazy.kent.suse@gmail.com
- Update to 1.10.11
  + Window raise problem was fixed
  + IO_RW was added
  + Bugs was fixed (WCHAN, kernel warning.... etc)
* Sat Aug  1 2009 lazy.kent.suse@gmail.com
- Initial package created - 1.10.10
