Cherry-picking upstream-version 1.10.19.

* Bumped Standards to 4.3.0, no changes needed
* Dropped d/compat, use debhelper-compat = 12, no changes needed
* Fixed years in d/copyright
* Removed some deprecated files from d/copyright
* Added build dependency lxqt-build-tools (>= 0.6.0~)
* Added d/upstream/metadata
ubuntu/disco debian/1.10.19-1
Alf Gaida 5 years ago
parent 3f0560d302
commit e2e689345b

2
.gitignore vendored

@ -1,2 +0,0 @@
*kdev4
build

@ -0,0 +1 @@
translations='./src'

@ -1,4 +1,15 @@
qps-1.10.19 / 2019-01-25
========================
* Bumped version to 1.10.19
* Improved cmake scripting
- set cmake_minimum_required to 3.1.0
- removed locale compile definitons, use lxqt-build-tools instead
- use lxqt-build-tools translation scripts
* Added translation support and fixed some source strings
* Translations updated
* Added translation promo to README.md
qps-1.10.18 / 2018-05-21 qps-1.10.18 / 2018-05-21
======================== ========================

@ -1,40 +1,31 @@
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(qps) # CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
# CMakeLists.txt file even before calling the project() command.
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
# command to specify that the current project code is written for the given range of CMake
# versions.
Project(qps)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
# additional cmake files
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(MAJOR_VERSION 1) set(MAJOR_VERSION 1)
set(MINOR_VERSION 10) set(MINOR_VERSION 10)
set(PATCH_VERSION 18) set(PATCH_VERSION 19)
set(QPS_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}) set(QPS_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
add_definitions( add_definitions(
-DQPS_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}" -DQPS_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
-DQT_NO_FOREACH
) )
# C++11 support # Minimum Versions
include(CheckCXXCompilerFlag) set(LXQTBT_MINIMUM_VERSION "0.6.0")
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) set(QT_MINIMUM_VERSION "5.7.1")
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) find_package(Qt5 ${QT_MINIMUM_VERSION} REQUIRED COMPONENTS Widgets X11Extras DBus LinguistTools)
if(COMPILER_SUPPORTS_CXX11) find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. C++11 support is required")
endif()
find_package(Qt5 5.7.1 REQUIRED COMPONENTS Widgets X11Extras DBus LinguistTools)
include(GNUInstallDirs) include(GNUInstallDirs)
include(LXQtTranslateTs) # Although the name it doesn't depend on LXQt in any way include(LXQtPreventInSourceBuilds)
include(LXQtCompilerSettings)
include(LXQtTranslateTs)
include(LXQtTranslateDesktop) include(LXQtTranslateDesktop)
include(Qt5TranslationLoader) include(Qt5TranslationLoader)

@ -9,8 +9,9 @@
Qps is licensed under the terms of the Qps is licensed under the terms of the
[GPLv2](http://choosealicense.com/licenses/gpl-2.0/) or any later version. [GPLv2](http://choosealicense.com/licenses/gpl-2.0/) or any later version.
### Translation Status
<a href="https://weblate.lxqt.org/engage/qps/?utm_source=widget"> ### Translation (Weblate)
<img src="https://weblate.lxqt.org/widgets/qps/-/qps/287x66-grey.png" alt="Translation status" />
<a href="https://weblate.lxqt.org/projects/lxqt/qps/">
<img src="https://weblate.lxqt.org/widgets/lxqt/-/qps/multi-auto.svg" alt="Translation status" />
</a> </a>

@ -1,107 +0,0 @@
#=============================================================================
# The lxqt_translate_desktop() function was copied from the
# LXQt LxQtTranslate.cmake
#
# Original Author: Alexander Sokolov <sokoloff.a@gmail.com>
#
# funtion lxqt_translate_desktop(_RESULT
# SOURCES <sources>
# [TRANSLATION_DIR] translation_directory
# )
# Output:
# _RESULT The generated .desktop (.desktop) files
#
# Input:
#
# SOURCES List of input desktop files (.destktop.in) to be translated
# (merged), relative to the CMakeList.txt.
#
# TRANSLATION_DIR Optional path to the directory with the .ts files,
# relative to the CMakeList.txt. Defaults to
# "translations".
#
#=============================================================================
function(lxqt_translate_desktop _RESULT)
# Parse arguments ***************************************
set(oneValueArgs TRANSLATION_DIR)
set(multiValueArgs SOURCES)
cmake_parse_arguments(_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# check for unknown arguments
set(_UNPARSED_ARGS ${_ARGS_UNPARSED_ARGUMENTS})
if (NOT ${_UNPARSED_ARGS} STREQUAL "")
MESSAGE(FATAL_ERROR
"Unknown arguments '${_UNPARSED_ARGS}'.\n"
"See lxqt_translate_desktop() documentation for more information.\n"
)
endif()
if (NOT DEFINED _ARGS_SOURCES)
set(${_RESULT} "" PARENT_SCOPE)
return()
else()
set(_sources ${_ARGS_SOURCES})
endif()
if (NOT DEFINED _ARGS_TRANSLATION_DIR)
set(_translationDir "translations")
else()
set(_translationDir ${_ARGS_TRANSLATION_DIR})
endif()
get_filename_component (_translationDir ${_translationDir} ABSOLUTE)
foreach (_inFile ${_sources})
get_filename_component(_inFile ${_inFile} ABSOLUTE)
get_filename_component(_fileName ${_inFile} NAME_WE)
#Extract the real extension ............
get_filename_component(_fileExt ${_inFile} EXT)
string(REPLACE ".in" "" _fileExt ${_fileExt})
#.......................................
set(_outFile "${CMAKE_CURRENT_BINARY_DIR}/${_fileName}${_fileExt}")
file(GLOB _translations
${_translationDir}/${_fileName}_*${_fileExt}
)
set(_pattern "'\\[.*]\\s*='")
if (_translations)
list(SORT _translations)
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -v -a "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMAND grep -h -a ${_pattern} ${_translations} >> ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
else()
add_custom_command(OUTPUT ${_outFile}
COMMAND grep -v -a "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
COMMENT "Generating ${_fileName}${_fileExt}"
)
endif()
set(__result ${__result} ${_outFile})
# TX file ***********************************************
set(_txFile "${CMAKE_BINARY_DIR}/tx/${_fileName}${_fileExt}.tx.sh")
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_translationDir ${_translationDir})
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_inFile ${_inFile})
string(REPLACE "." "" _fileType ${_fileExt})
file(WRITE ${_txFile}
"[ -f ${_inFile} ] || exit 0\n"
"echo '[lxde-qt.${_fileName}_${_fileType}]'\n"
"echo 'type = DESKTOP'\n"
"echo 'source_lang = en'\n"
"echo 'source_file = ${_tx_inFile}'\n"
"echo 'file_filter = ${_tx_translationDir}/${_fileName}_<lang>${_fileExt}'\n"
"echo ''\n"
)
endforeach()
set(${_RESULT} ${__result} PARENT_SCOPE)
endfunction(lxqt_translate_desktop)

@ -1,140 +0,0 @@
#=============================================================================
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#
# funtion lxqt_translate_ts(qmFiles
# [USE_QT5 [Yes | No]]
# [UPDATE_TRANSLATIONS [Yes | No]]
# SOURCES <sources>
# [TEMPLATE] translation_template
# [TRANSLATION_DIR] translation_directory
# [INSTALL_DIR] install_directory
# [COMPONENT] component
# )
# Output:
# qmFiles The generated compiled translations (.qm) files
#
# Input:
# USE_QT5 Optional flag to choose between Qt4 and Qt5. Defaults to Qt5
#
# UPDATE_TRANSLATIONS Optional flag. Setting it to Yes, extracts and
# compiles the translations. Setting it No, only
# compiles them.
#
# TEMPLATE Optional translations files base name. Defaults to
# ${PROJECT_NAME}. An .ts extensions is added.
#
# TRANSLATION_DIR Optional path to the directory with the .ts files,
# relative to the CMakeList.txt. Defaults to
# "translations".
#
# INSTALL_DIR Optional destination of the file compiled files (qmFiles).
# If not present no installation is performed
#
# COMPONENT Optional install component. Only effective if INSTALL_DIR
# present. Defaults to "Runtime".
# CMake v2.8.3 needed to use the CMakeParseArguments module
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
# We use our patched version to round a annoying bug.
include(Qt5PatchedLinguistToolsMacros)
function(lxqt_translate_ts qmFiles)
set(oneValueArgs USE_QT5 UPDATE_TRANSLATIONS TEMPLATE TRANSLATION_DIR INSTALL_DIR COMPONENT)
set(multiValueArgs SOURCES)
cmake_parse_arguments(TR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if (NOT DEFINED TR_UPDATE_TRANSLATIONS)
set(TR_UPDATE_TRANSLATIONS "No")
endif()
if (NOT DEFINED TR_USE_QT5)
set(TR_USE_QT5 "Yes")
endif()
if(NOT DEFINED TR_TEMPLATE)
set(TR_TEMPLATE "${PROJECT_NAME}")
endif()
if (NOT DEFINED TR_TRANSLATION_DIR)
set(TR_TRANSLATION_DIR "translations")
endif()
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
if(TR_USE_QT5)
# Qt5
if (TR_UPDATE_TRANSLATIONS)
qt5_patched_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
)
qt5_patched_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
)
else()
qt5_patched_add_translation(QM ${tsFiles})
endif()
else()
# Qt4
if(TR_UPDATE_TRANSLATIONS)
qt4_create_translation(QMS
${TR_SOURCES}
${templateFile}
OPTIONS -locations absolute
)
qt4_create_translation(QM
${TR_SOURCES}
${tsFiles}
OPTIONS -locations absolute
)
else()
qt4_add_translation(QM ${tsFiles})
endif()
endif()
if(TR_UPDATE_TRANSLATIONS)
add_custom_target("update_${TR_TEMPLATE}_ts" ALL DEPENDS ${QMS})
endif()
if(DEFINED TR_INSTALL_DIR)
if(NOT DEFINED TR_COMPONENT)
set(TR_COMPONENT "Runtime")
endif()
install(FILES ${QM}
DESTINATION "${TR_INSTALL_DIR}"
COMPONENT "${TR_COMPONENT}"
)
endif()
set(${qmFiles} ${QM} PARENT_SCOPE)
endfunction()

@ -1,47 +0,0 @@
#=============================================================================
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
#
# These functions enables "automatic" translation loading in Qt5 apps
# and libs. They generate a .cpp file that takes care of everything. The
# user doesn't have to do anything in the source code.
#
# qt5_translation_loader(<source_files> <translations_dir> <catalog_name>)
#
# Output:
# <source_files> Appends the generated file to this variable.
#
# Input:
# <translations_dir> Full path name to the translations dir.
# <catalog_name> Translation catalog to be loaded.
function(qt5_translation_loader source_files translations_dir catalog_name)
configure_file(
"${CMAKE_SOURCE_DIR}/Qt5TranslationLoader.cpp.in"
Qt5TranslationLoader.cpp @ONLY
)
set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/Qt5TranslationLoader.cpp PARENT_SCOPE)
endfunction()

12
debian/changelog vendored

@ -1,3 +1,15 @@
qps (1.10.19-1) unstable; urgency=medium
* Cherry-picking upstream-version 1.10.19.
* Bumped Standards to 4.3.0, no changes needed
* Dropped d/compat, use debhelper-compat = 12, no changes needed
* Fixed years in d/copyright
* Removed some deprecated files from d/copyright
* Added build dependency lxqt-build-tools (>= 0.6.0~)
* Added d/upstream/metadata
-- Alf Gaida <agaida@siduction.org> Sun, 27 Jan 2019 14:05:17 +0100
qps (1.10.18-1) unstable; urgency=medium qps (1.10.18-1) unstable; urgency=medium
* Cherry-picking upstream-version 1.10.18. * Cherry-picking upstream-version 1.10.18.

1
debian/compat vendored

@ -1 +0,0 @@
11

5
debian/control vendored

@ -5,13 +5,14 @@ Uploaders: Alf Gaida <agaida@siduction.org>,
Andrew Lee (李健秋) <ajqlee@debian.org> Andrew Lee (李健秋) <ajqlee@debian.org>
Section: x11 Section: x11
Priority: optional Priority: optional
Build-Depends: debhelper (>= 11~), Build-Depends: debhelper-compat (= 12),
cmake, cmake,
libxrender-dev, libxrender-dev,
libqt5x11extras5-dev, libqt5x11extras5-dev,
lxqt-build-tools (>= 0.6.0~),
qttools5-dev, qttools5-dev,
qttools5-dev-tools qttools5-dev-tools
Standards-Version: 4.1.4 Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/lxqt-team/qps Vcs-Browser: https://salsa.debian.org/lxqt-team/qps
Vcs-Git: https://salsa.debian.org/lxqt-team/qps.git Vcs-Git: https://salsa.debian.org/lxqt-team/qps.git
Homepage: https://github.com/lxqt/qps Homepage: https://github.com/lxqt/qps

9
debian/copyright vendored

@ -1,16 +1,11 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qps Upstream-Name: qps
Source: http://github.com/lxqt/qps Source: https://github.com/lxqt/qps
Files: * Files: *
Copyright: 1997-1999 Mattias Engdegård Copyright: 1997-1999 Mattias Engdegård
License: GPL-2.0+ License: GPL-2.0+
Files: cmake/LXQtTranslateTs.cmake
cmake/Qt5TranslationLoader.cmake
Copyright: Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
License: BSD-3-clause
Files: cmake/Qt5PatchedLinguistToolsMacros.cmake Files: cmake/Qt5PatchedLinguistToolsMacros.cmake
Copyright: Copyright 2005-2011 Kitware, Inc. Copyright: Copyright 2005-2011 Kitware, Inc.
License: BSD-3-clause License: BSD-3-clause
@ -35,7 +30,7 @@ Copyright: 2003 Justin Karneges
License: LGPL-2.1+ License: LGPL-2.1+
Files: debian/* Files: debian/*
Copyright: 2015-2018 Alf Gaida <agaida@siduction.org> Copyright: 2015-2019 Alf Gaida <agaida@siduction.org>
2015-2016 ChangZhuo Chen (陳昌倬) <czchen@debian.org> 2015-2016 ChangZhuo Chen (陳昌倬) <czchen@debian.org>
License: GPL-2.0+ License: GPL-2.0+

@ -0,0 +1,7 @@
Name: qps
Bug-Database: https://github.com/lxqt/qps/issues
Bug-Submit: https://github.com/lxqt/qps/issues/new
Changelog: https://github.com/lxqt/qps/blob/master/CHANGELOG
Repository: https://github.com/lxqt/qps
Repository-Browser: https://github.com/lxqt/qps

@ -2,10 +2,14 @@
Type=Application Type=Application
Name=qps Name=qps
GenericName=Qt process manager GenericName=Qt process manager
GenericName[ca]=Gestor de processos Qt
GenericName[da]=Qt-proceshåndtering GenericName[da]=Qt-proceshåndtering
GenericName[lt]=Qt procesų tvarkytuvė
GenericName[pl]=Menedżer procesów Qt GenericName[pl]=Menedżer procesów Qt
Comment=Qt application to display and manage running processes Comment=Qt application to display and manage running processes
Comment[ca]=Aplicació Qt per visualitzar i gestionar els processos en execució
Comment[da]=Qt-program til at vise og håndtere kørende processer Comment[da]=Qt-program til at vise og håndtere kørende processer
Comment[lt]=Qt programa, skirta rodyti ir tvarkyti vykdomus procesus
Comment[pl]=Aplikacja Qt do wyświetlania i zarządzania uruchomionymi procesami Comment[pl]=Aplikacja Qt do wyświetlania i zarządzania uruchomionymi procesami
Icon=qps Icon=qps
Categories=System; Categories=System;

@ -71,7 +71,7 @@ set(RESOURCES "../qps.qrc")
lxqt_translate_ts(QM_FILES lxqt_translate_ts(QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS} UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES ${SOURCES} ${HEADERS} ${UIS} SOURCES ${SOURCES} ${HEADERS} ${UIS}
INSTALL_DIR "${QPS_TRANSLATIONS_DIR}/${PROJECT_NAME}" INSTALL_DIR "${QPS_TRANSLATIONS_DIR}"
) )
qt5_translation_loader( qt5_translation_loader(

@ -206,14 +206,17 @@ void Command::call(Procinfo *p)
if (ret) if (ret)
{ {
msg = "The command:\n\n"; msg = tr( "The command:\n\n" );
msg.append(s); msg.append(s);
if (ret == -1) if (ret == -1)
{ {
msg.append("\n\nfailed with the error:\n\n"); msg.append( tr( "\n\nfailed with the error:\n\n" ) );
const char *e = const char *e = static_cast< const char * >( 0 );
(errno == EAGAIN) ? "Too many processes" : strerror(errno); msg.append( ( errno == EAGAIN )
msg.append(e ? e : "Unknown error"); ? tr( "Too many processes" )
: ( ( e = strerror( errno ) ) )
? QString::fromLocal8Bit( e )
: tr( "Unknown error" ) );
} }
else if (ret & 0xff) else if (ret & 0xff)
{ {
@ -223,16 +226,16 @@ void Command::call(Procinfo *p)
} }
else if (ret == 0x7f00) else if (ret == 0x7f00)
{ {
msg.append("\n\ncould not be executed because it was not " msg.append( tr( "\n\ncould not be executed because it was not "
"found,\nor you did not have execute permission."); "found,\nor you did not have execute permission." ) );
} }
else else
{ {
msg.append("\n\nexited with status "); msg.append( tr( "\n\nexited with status " ) );
msg.append(QString().setNum(ret >> 8)); msg.append(QString().setNum(ret >> 8));
msg.append("."); msg.append(".");
} }
QMessageBox::warning(0, "Command Failed", msg); QMessageBox::warning(0, tr( "Command Failed" ), msg);
} }
} }

@ -39,6 +39,7 @@ class ListModel;
class Command class Command
{ {
Q_DECLARE_TR_FUNCTIONS(Command)
public: public:
Command(){}; Command(){};
Command(QString n, QString cmd, bool toolbar = false); Command(QString n, QString cmd, bool toolbar = false);

@ -44,7 +44,7 @@ extern QList<Command *> commands;
CommandDialog::CommandDialog() CommandDialog::CommandDialog()
{ {
setWindowTitle("Edit Commands 0.1 alpha"); setWindowTitle( tr( "Edit Commands 0.1 alpha" ) );
// setWindowFlags(Qt::WindowStaysOnTopHint); // setWindowFlags(Qt::WindowStaysOnTopHint);
QHBoxLayout *hbox = new QHBoxLayout(this); // TOP QHBoxLayout *hbox = new QHBoxLayout(this); // TOP
@ -60,7 +60,7 @@ CommandDialog::CommandDialog()
QHBoxLayout *h1 = new QHBoxLayout; QHBoxLayout *h1 = new QHBoxLayout;
vbox->addLayout(h1); vbox->addLayout(h1);
QLabel *l1 = new QLabel("Name:", this); QLabel *l1 = new QLabel( tr( "Name:" ), this);
h1->addWidget(l1); h1->addWidget(l1);
name = new QLineEdit(this); name = new QLineEdit(this);
name->setMinimumWidth(170); name->setMinimumWidth(170);
@ -76,12 +76,12 @@ CommandDialog::CommandDialog()
if (0) if (0)
{ {
qcheck2 = new QCheckBox(this); qcheck2 = new QCheckBox(this);
qcheck2->setText("Popup"); qcheck2->setText( tr( "Popup" ) );
qcheck2->setEnabled(false); qcheck2->setEnabled(false);
hbox2->addWidget(qcheck2); hbox2->addWidget(qcheck2);
} }
QLabel *l2 = new QLabel("Command Line:", this); QLabel *l2 = new QLabel( tr( "Command Line:" ), this);
l2->setFixedHeight(l2->sizeHint().height()); l2->setFixedHeight(l2->sizeHint().height());
l2->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); l2->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
vbox->addWidget(l2); vbox->addWidget(l2);
@ -92,11 +92,11 @@ CommandDialog::CommandDialog()
cmdline->setText(""); cmdline->setText("");
vbox->addWidget(cmdline); vbox->addWidget(cmdline);
QLabel *l3 = new QLabel("Substitutions:\n" QLabel *l3 = new QLabel( tr( "Substitutions:\n"
"%p\tPID\n" "%p\tPID\n"
"%c\tCOMMAND\n%C\tCMDLINE\n%u\tUSER\n" "%c\tCOMMAND\n%C\tCMDLINE\n%u\tUSER\n"
"%%\t%\n" "%%\t%\n"
"\n", "\n" ),
this); this);
l3->setFrameStyle(QFrame::Panel); l3->setFrameStyle(QFrame::Panel);
@ -106,13 +106,13 @@ CommandDialog::CommandDialog()
QHBoxLayout *hl = new QHBoxLayout; QHBoxLayout *hl = new QHBoxLayout;
vbox->addLayout(hl); vbox->addLayout(hl);
new0 = new QPushButton("New...", this); new0 = new QPushButton( tr( "New..." ), this);
hl->addWidget(new0); hl->addWidget(new0);
add = new QPushButton("Add...", this); add = new QPushButton( tr( "Add..." ), this);
hl->addWidget(add); hl->addWidget(add);
del = new QPushButton("Delete", this); del = new QPushButton( tr( "Delete" ), this);
hl->addWidget(del); hl->addWidget(del);
button_ok = new QPushButton("Close", this); button_ok = new QPushButton( tr( "Close" ), this);
hl->addWidget(button_ok); hl->addWidget(button_ok);
connect(listview, SIGNAL(clicked(const QModelIndex &)), connect(listview, SIGNAL(clicked(const QModelIndex &)),
@ -226,7 +226,7 @@ void CommandDialog::reset()
listview->reset(); listview->reset();
name->setText(""); name->setText("");
cmdline->setText(""); cmdline->setText("");
add->setText("Add..."); add->setText( tr( "Add..." ) );
add->setEnabled(0); add->setEnabled(0);
button_ok->setEnabled(1); button_ok->setEnabled(1);
listview->clearSelection(); listview->clearSelection();

@ -29,14 +29,12 @@
#include "qps.h" // static flag #include "qps.h" // static flag
Details::Details(Procinfo *p, Proc *proc) : QWidget(0) Details::Details(Procinfo *p, Proc *proc) : QWidget(0)
{ {
QString cap;
pi = p; pi = p;
pi->detail = this; pi->detail = this;
pr = proc; pr = proc;
// printf("pi=%x\n",pi); // printf("pi=%x\n",pi);
cap.sprintf("Process %d ( %s ) - details", pi->pid, setWindowTitle( tr( "Process %1 ( %2 ) - details" ).arg( pi->pid )
qPrintable(pi->command)); .arg( pi->command ) );
setWindowTitle(cap);
tbar = new QTabWidget(this); tbar = new QTabWidget(this);
// tbar->setMargin(5); // tbar->setMargin(5);
@ -44,7 +42,7 @@ Details::Details(Procinfo *p, Proc *proc) : QWidget(0)
// if(pi->fd_files) //if(pi->fd_files->size()) // if(pi->fd_files) //if(pi->fd_files->size())
if (pi->read_fds()) if (pi->read_fds())
{ {
tbar->addTab(new Files(this), "&Files"); tbar->addTab(new Files(this), tr( "Files" ) );
// if(pi->read_fds()) // create sock_inodes // if(pi->read_fds()) // create sock_inodes
#ifdef LINUX #ifdef LINUX
@ -53,15 +51,15 @@ Details::Details(Procinfo *p, Proc *proc) : QWidget(0)
// no socket pane show in Detail dialog. // no socket pane show in Detail dialog.
// Procinfo::read_sockets(); // Procinfo::read_sockets();
if (pi->sock_inodes.size() != 0) if (pi->sock_inodes.size() != 0)
tbar->addTab(new Sockets(this), "&Sockets"); tbar->addTab(new Sockets(this), tr( "Sockets" ) );
#endif #endif
} }
if (pi->read_maps()) if (pi->read_maps())
tbar->addTab(new Maps(this), "&Memory Maps"); tbar->addTab(new Maps(this), tr( "Memory Maps" ) );
if (pi->read_environ()) if (pi->read_environ())
tbar->addTab(new Environ(this), "&Environment"); tbar->addTab(new Environ(this), tr( "Environment" ) );
tbar->addTab(new AllFields(this), "&All Fields"); tbar->addTab(new AllFields(this), tr( "All Fields" ) );
tbar->adjustSize(); tbar->adjustSize();
QSize s0 = tbar->sizeHint(); QSize s0 = tbar->sizeHint();
@ -148,18 +146,21 @@ bool Sockets::have_services = false;
QHash<int, char *> Sockets::servdict; QHash<int, char *> Sockets::servdict;
Lookup *Sockets::lookup = 0; Lookup *Sockets::lookup = 0;
TableField Sockets::fields[] = { TableField *Sockets::fields()
{"Fd", 5, 8, Qt::AlignRight, "File descriptor"}, {
{"Proto", 4, 8, Qt::AlignLeft, "Protocol (TCP or UDP)"}, static QVector< TableField > fields( { { tr( "Fd" ), 5, 8, Qt::AlignRight, tr( "File descriptor" ) }
{"Recv-Q", 9, 8, Qt::AlignRight, "Bytes in receive queue"}, , { tr( "Proto" ), 4, 8, Qt::AlignLeft, tr( "Protocol (TCP or UDP)" ) }
{"Send-Q", 9, 8, Qt::AlignRight, "Bytes in send queue"}, , { tr( "Recv-Q" ), 9, 8, Qt::AlignRight, tr( "Bytes in receive queue" ) }
{"Local Addr", -1, 8, Qt::AlignLeft, "Local IP address"}, , { tr( "Send-Q" ), 9, 8, Qt::AlignRight, tr( "Bytes in send queue" ) }
{"Port", 6, 8, Qt::AlignLeft, "Local port"}, , { tr( "Local Addr" ), -1, 8, Qt::AlignLeft, tr( "Local IP address" ) }
{"Remote Addr", -1, 8, Qt::AlignLeft, "Remote IP address"}, , { tr( "Port" ), 6, 8, Qt::AlignLeft, tr( "Local port" ) }
{"Port", 6, 8, Qt::AlignLeft, "Remote port"}, , { tr( "Remote Addr" ), -1, 8, Qt::AlignLeft, tr( "Remote IP address" ) }
{"State", 18, 8, Qt::AlignLeft, "Connection state"}}; , { tr( "Port" ), 6, 8, Qt::AlignLeft, tr( "Remote port" ) }
, { tr( "State" ), 18, 8, Qt::AlignLeft, tr( "Connection state" ) } } );
return fields.data();
}
Sockets::Sockets(QWidget *parent) : SimpleTable(parent, SOCKFIELDS, fields) Sockets::Sockets(QWidget *parent) : SimpleTable(parent, SOCKFIELDS, fields() )
{ {
if (!lookup) if (!lookup)
lookup = new Lookup(); lookup = new Lookup();
@ -390,18 +391,20 @@ Sockets::~Sockets() {}
void Sockets::update_hostname(unsigned int) {} void Sockets::update_hostname(unsigned int) {}
#endif #endif
TableField *Maps::fields()
TableField Maps::fields[] = { {
{"Address Range", -1, 8, Qt::AlignLeft, "Mapped addresses (hex)"}, static QVector< TableField > fields( { { tr( "Address Range" ), -1, 8, Qt::AlignLeft, tr( "Mapped addresses (hex) )" ) }
{"Size", 8, 8, Qt::AlignRight, "Kbytes mapped (dec)"}, , { tr( "Size" ), 8, 8, Qt::AlignRight, tr( "Kbytes mapped (dec)" ) }
{"Perm", 5, 8, Qt::AlignLeft, "Permission flags"}, , { tr( "Perm" ), 5, 8, Qt::AlignLeft, tr( "Permission flags" ) }
{"Offset", -1, 8, Qt::AlignRight, "File offset at start of mapping (hex)"}, , { tr( "Offset" ), -1, 8, Qt::AlignRight, tr( "File offset at start of mapping (hex)" ) }
{"Device", 8, 8, Qt::AlignLeft, "Major,Minor device numbers (dec)"}, , { tr( "Device" ), 8, 8, Qt::AlignLeft, tr( "Major,Minor device numbers (dec)" ) }
{"Inode", 10, 8, Qt::AlignRight, "Inode number (dec)"}, , { tr( "Inode" ), 10, 8, Qt::AlignRight, tr( "Inode number (dec)" ) }
{"File", -9, 8, Qt::AlignLeft, "File name (if available)"}}; , { tr( "File" ), -9, 8, Qt::AlignLeft, tr( "File name (if available)" ) } } );
return fields.data();
}
// memory leak // memory leak
Maps::Maps(QWidget *parent) : SimpleTable(parent, MAPSFIELDS, fields) Maps::Maps(QWidget *parent) : SimpleTable(parent, MAPSFIELDS, fields() )
{ {
// monospaced font looks best in the table body since it contains // monospaced font looks best in the table body since it contains
// hex numerals and flag fields. Pick Courier (why not) // hex numerals and flag fields. Pick Courier (why not)
@ -517,14 +520,17 @@ void Maps::refresh()
bool Maps::refresh_maps() { return procinfo()->read_maps(); } bool Maps::refresh_maps() { return procinfo()->read_maps(); }
TableField Files::fields[] = { TableField *Files::fields()
{"Fd", 5, 8, Qt::AlignRight, "File descriptor"}, {
static QVector< TableField > fields( { { tr( "Fd" ), 5, 8, Qt::AlignRight, tr( "File descriptor" ) }
#ifdef LINUX #ifdef LINUX
{"Mode", 3, 8, Qt::AlignLeft, "Open mode"}, , { tr( "Mode" ), 3, 8, Qt::AlignLeft, tr( "Open mode" ) }
#endif #endif
{"Name", -1, 8, Qt::AlignLeft, "File name (if available)"}}; , { tr( "Name" ), -1, 8, Qt::AlignLeft, tr( "File name (if available)" )} } );
return fields.data();
}
Files::Files(QWidget *parent) : SimpleTable(parent, FILEFIELDS, fields) Files::Files(QWidget *parent) : SimpleTable(parent, FILEFIELDS, fields() )
{ {
// compute total width = window width // compute total width = window width
refresh_window(); refresh_window();
@ -598,13 +604,16 @@ QString Files::text(int row, int col)
return s; return s;
} }
TableField Environ::fields[] = { TableField *Environ::fields()
{"Variable", -1, 8, Qt::AlignLeft, "Variable name"}, {
{"Value", -1, 8, Qt::AlignLeft, "Variable value"}}; static QVector< TableField > fields( { { tr( "Variable" ), -1, 8, Qt::AlignLeft, tr( "Variable name" ) }
, { tr( "Value" ), -1, 8, Qt::AlignLeft, tr( "Variable value" ) } } );
return fields.data();
}
Environ *Environ::static_env = 0; Environ *Environ::static_env = 0;
Environ::Environ(QWidget *parent) Environ::Environ(QWidget *parent)
: SimpleTable(parent, ENVFIELDS, fields), rev(false) : SimpleTable(parent, ENVFIELDS, fields() ), rev(false)
{ {
connect(this, SIGNAL(titleClicked(int)), SLOT(sort_change(int))); connect(this, SIGNAL(titleClicked(int)), SLOT(sort_change(int)));
refresh(); refresh();
@ -684,13 +693,17 @@ int Environ::compare(const NameValue *a, const NameValue *b)
return e->rev ? -r : r; return e->rev ? -r : r;
} }
TableField AllFields::fields[] = { TableField *AllFields::fields()
{"Field", -1, 8, Qt::AlignLeft, "Field name"}, {
{"Description", -1, 8, Qt::AlignLeft, "Field description"}, static QVector< TableField > fields( { { tr( "Field" ), -1, 8, Qt::AlignLeft, tr( "Field name" ) }
{"Value", -1, 8, Qt::AlignLeft, "Field value"}}; , { tr( "Description" ), -1, 8, Qt::AlignLeft, tr( "Field description" ) }
, { tr( "Value" ), -1, 8, Qt::AlignLeft, tr( "Field value" ) } } );
return fields.data();
}
AllFields::AllFields(QWidget *parent) AllFields::AllFields(QWidget *parent)
: SimpleTable(parent, FIELDSFIELDS, fields) : SimpleTable(parent, FIELDSFIELDS, fields() )
{ {
refresh(); refresh();
// compute total width = window width // compute total width = window width

@ -125,7 +125,7 @@ class Sockets : public SimpleTable
STATE, STATE,
SOCKFIELDS SOCKFIELDS
}; };
static TableField fields[SOCKFIELDS]; static TableField *fields();
bool doing_lookup; // if table painted with host lookup bool doing_lookup; // if table painted with host lookup
@ -159,7 +159,7 @@ class Maps : public SimpleTable
FILENAME, FILENAME,
MAPSFIELDS MAPSFIELDS
}; };
static TableField fields[MAPSFIELDS]; static TableField *fields();
}; };
class Files : public SimpleTable class Files : public SimpleTable
@ -185,7 +185,7 @@ class Files : public SimpleTable
FILENAME, FILENAME,
FILEFIELDS FILEFIELDS
}; };
static TableField fields[FILEFIELDS]; static TableField *fields();
}; };
class Environ : public SimpleTable class Environ : public SimpleTable
@ -216,7 +216,7 @@ class Environ : public SimpleTable
}; };
bool rev; // sorting reversed bool rev; // sorting reversed
static Environ *static_env; // for sorting, must have static pointer static Environ *static_env; // for sorting, must have static pointer
static TableField fields[ENVFIELDS]; static TableField *fields();
}; };
class AllFields : public SimpleTable class AllFields : public SimpleTable
@ -239,7 +239,7 @@ class AllFields : public SimpleTable
FIELDVALUE, FIELDVALUE,
FIELDSFIELDS FIELDSFIELDS
}; };
static TableField fields[FIELDSFIELDS]; static TableField *fields();
}; };
#endif // DETAILS_H #endif // DETAILS_H

@ -48,13 +48,13 @@ static void fix_size(QWidget *w) { w->setFixedSize(w->sizeHint()); }
// Modal dialog // Modal dialog
IntervalDialog::IntervalDialog(const char *ed_txt, bool enabled) : QDialog() IntervalDialog::IntervalDialog(const char *ed_txt, bool enabled) : QDialog()
{ {
setWindowTitle("Change Update Period"); setWindowTitle( tr( "Change Update Period" ) );
QVBoxLayout *tl = new QVBoxLayout; QVBoxLayout *tl = new QVBoxLayout;
QHBoxLayout *h1 = new QHBoxLayout; QHBoxLayout *h1 = new QHBoxLayout;
setLayout(tl); setLayout(tl);
tl->addLayout(h1); tl->addLayout(h1);
QLabel *label1 = new QLabel("New Update Period", this); QLabel *label1 = new QLabel( tr( "New Update Period" ), this);
h1->addWidget(label1); h1->addWidget(label1);
h1->addStretch(1); h1->addStretch(1);
@ -91,9 +91,9 @@ IntervalDialog::IntervalDialog(const char *ed_txt, bool enabled) : QDialog()
*/ */
QHBoxLayout *h2 = new QHBoxLayout; QHBoxLayout *h2 = new QHBoxLayout;
// h2->addStretch(1); // h2->addStretch(1);
cancel = new QPushButton("Cancel", this); cancel = new QPushButton( tr( "Cancel" ), this);
h2->addWidget(cancel); h2->addWidget(cancel);
ok = new QPushButton("OK", this); ok = new QPushButton( tr( "OK" ), this);
// ok->setFocus(); // ok->setFocus();
h2->addWidget(ok); h2->addWidget(ok);
tl->addLayout(h2); tl->addLayout(h2);
@ -127,7 +127,7 @@ void IntervalDialog::event_label_changed()
QString s = ed_result; QString s = ed_result;
if (s.length() == 0) if (s.length() == 0)
{ {
label->setText("No UPDATE"); label->setText( tr( "No UPDATE" ) );
return; return;
} }
@ -145,7 +145,7 @@ void IntervalDialog::event_label_changed()
period = -1; period = -1;
if (period <= 0) if (period <= 0)
{ {
label->setText("Invalid value"); label->setText( tr( "Invalid value" ) );
return; return;
} }
@ -185,13 +185,13 @@ void IntervalDialog::done_dialog()
SliderDialog::SliderDialog(int defaultval, int minval, int maxval) : QDialog() SliderDialog::SliderDialog(int defaultval, int minval, int maxval) : QDialog()
{ {
setWindowTitle("Renice Process"); setWindowTitle( tr( "Renice Process" ) );
QVBoxLayout *tl = new QVBoxLayout; QVBoxLayout *tl = new QVBoxLayout;
QHBoxLayout *h1 = new QHBoxLayout; QHBoxLayout *h1 = new QHBoxLayout;
setLayout(tl); setLayout(tl);
tl->addLayout(h1); tl->addLayout(h1);
label = new QLabel("New nice value:", this); label = new QLabel( tr( "New nice value:" ), this);
h1->addWidget(label); h1->addWidget(label);
h1->addStretch(1); h1->addStretch(1);
@ -231,11 +231,11 @@ SliderDialog::SliderDialog(int defaultval, int minval, int maxval) : QDialog()
tl->addLayout(h3); tl->addLayout(h3);
h3->addStretch(1); h3->addStretch(1);
cancel = new QPushButton("Cancel", this); cancel = new QPushButton( tr( "Cancel" ), this);
// fix_size(cancel); // fix_size(cancel);
h3->addWidget(cancel); h3->addWidget(cancel);
ok = new QPushButton("OK", this); ok = new QPushButton( tr( "OK" ), this);
ok->setFixedSize(cancel->sizeHint()); ok->setFixedSize(cancel->sizeHint());
h3->addWidget(ok); h3->addWidget(ok);
@ -270,7 +270,7 @@ void SliderDialog::slider_change(int val)
// DRAFT CODE, // DRAFT CODE,
PermissionDialog::PermissionDialog(QString msg, QString passwd) : QDialog() PermissionDialog::PermissionDialog(QString msg, QString passwd) : QDialog()
{ {
setWindowTitle("Permission"); setWindowTitle( tr( "Permission" ) );
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
label = new QLabel(msg, this); label = new QLabel(msg, this);
vbox->addWidget(label); vbox->addWidget(label);
@ -279,17 +279,17 @@ PermissionDialog::PermissionDialog(QString msg, QString passwd) : QDialog()
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
vbox->addLayout(hbox); vbox->addLayout(hbox);
label = new QLabel("root password", this); label = new QLabel( tr( "Root password" ), this);
hbox->addWidget(label); hbox->addWidget(label);
lined = new QLineEdit(this); lined = new QLineEdit(this);
hbox->addWidget(lined); hbox->addWidget(lined);
hbox = new QHBoxLayout; hbox = new QHBoxLayout;
vbox->addLayout(hbox); vbox->addLayout(hbox);
QPushButton *cancel = new QPushButton("Cancel", this); QPushButton *cancel = new QPushButton( tr( "Cancel" ), this);
hbox->addWidget(cancel); hbox->addWidget(cancel);
QPushButton *ok = new QPushButton("OK", this); QPushButton *ok = new QPushButton( tr( "OK" ), this);
hbox->addWidget(ok); hbox->addWidget(ok);
connect(ok, SIGNAL(clicked()), SLOT(accept())); connect(ok, SIGNAL(clicked()), SLOT(accept()));
@ -298,15 +298,15 @@ PermissionDialog::PermissionDialog(QString msg, QString passwd) : QDialog()
SchedDialog::SchedDialog(int policy, int prio) : QDialog() SchedDialog::SchedDialog(int policy, int prio) : QDialog()
{ {
setWindowTitle("Change scheduling"); setWindowTitle( tr( "Change scheduling" ) );
QVBoxLayout *vl = new QVBoxLayout; QVBoxLayout *vl = new QVBoxLayout;
setLayout(vl); setLayout(vl);
bgrp = new QGroupBox("Scheduling Policy", this); bgrp = new QGroupBox( tr( "Scheduling Policy" ), this);
vl->addWidget(bgrp); // bgrp->setCheckable(1); vl->addWidget(bgrp); // bgrp->setCheckable(1);
rb_other = new QRadioButton("SCHED_OTHER (time-sharing)", bgrp); rb_other = new QRadioButton( tr( "SCHED_OTHER (time-sharing)" ), bgrp);
rb_fifo = new QRadioButton("SCHED_FIFO (real-time)", bgrp); rb_fifo = new QRadioButton( tr( "SCHED_FIFO (real-time)" ), bgrp);
rb_rr = new QRadioButton("SCHED_RR (real-time)", bgrp); rb_rr = new QRadioButton( tr( "SCHED_RR (real-time)" ), bgrp);
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
vbox->addWidget(rb_other); vbox->addWidget(rb_other);
@ -320,9 +320,9 @@ SchedDialog::SchedDialog(int policy, int prio) : QDialog()
QHBoxLayout *hbox1 = new QHBoxLayout; QHBoxLayout *hbox1 = new QHBoxLayout;
QPushButton *ok, *cancel; QPushButton *ok, *cancel;
ok = new QPushButton("OK", this); ok = new QPushButton( tr( "OK" ), this);
ok->setDefault(true); ok->setDefault(true);
cancel = new QPushButton("Cancel", this); cancel = new QPushButton( tr( "Cancel" ), this);
hbox1->addWidget(ok); hbox1->addWidget(ok);
hbox1->addWidget(cancel); hbox1->addWidget(cancel);
vl->addLayout(hbox1); vl->addLayout(hbox1);
@ -352,7 +352,7 @@ SchedDialog::SchedDialog(int policy, int prio) : QDialog()
out_prio = prio; out_prio = prio;
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
lbl = new QLabel("Priority (1-99):", this); lbl = new QLabel( tr( "Priority (1-99):" ), this);
lined = new QLineEdit(this); lined = new QLineEdit(this);
hbox->addWidget(lbl); hbox->addWidget(lbl);
hbox->addWidget(lined); hbox->addWidget(lined);
@ -384,8 +384,9 @@ void SchedDialog::done_dialog()
out_prio = s.toInt(&ok); out_prio = s.toInt(&ok);
if (out_policy != SCHED_OTHER && (!ok || out_prio < 1 || out_prio > 99)) if (out_policy != SCHED_OTHER && (!ok || out_prio < 1 || out_prio > 99))
{ {
QMessageBox::warning(this, "Invalid Input", QMessageBox::warning( this
"The priority must be in the range 1..99"); , tr( "Invalid Input" )
, tr( "The priority must be in the range 1..99" ) );
} }
else else
accept(); accept();

@ -39,7 +39,7 @@ ExecWindow::~ExecWindow() {}
ExecWindow::ExecWindow(watchCond *wc, int pid, QString cmd) ExecWindow::ExecWindow(watchCond *wc, int pid, QString cmd)
{ {
setupUi(this); setupUi(this);
setWindowTitle("Qps Watchdog"); setWindowTitle( tr( "Qps Watchdog" ) );
wcond = wc; wcond = wc;
@ -94,16 +94,16 @@ void ExecWindow::cmd_ok()
// slot : catch terminate signal. // slot : catch terminate signal.
void ExecWindow::cmd_finished(int exitCode, QProcess::ExitStatus exitStatus) void ExecWindow::cmd_finished(int exitCode, QProcess::ExitStatus exitStatus)
{ {
textEdit->append(wcond->command + " exit with code " + textEdit->append( tr( "%1 exit with code %2" ).arg( wcond->command )
QString::number(exitStatus)); .arg( exitStatus ) );
okButton->setText("Close"); okButton->setText( tr( "Close" ) );
delete pr; delete pr;
} }
void ExecWindow::cmd_started() void ExecWindow::cmd_started()
{ {
textEdit->append(wcond->command + " [running]"); textEdit->append( tr( "%1 [running]" ).arg( wcond->command ) );
okButton->setText("terminate command"); okButton->setText( tr( "terminate command" ) );
flag_started = true; flag_started = true;
} }
@ -112,11 +112,8 @@ void ExecWindow::cmd_error(QProcess::ProcessError e)
// not found command // not found command
// Error ? : // Error ? :
if (e == QProcess::FailedToStart) if (e == QProcess::FailedToStart)
// textEdit->append("Error : command not found [" + textEdit->append( tr( "Error %1 : [%2] Maybe command not found" ).arg( e )
// command + "]" + "(code .arg( wcond->command ) );
//" + QString::number(e) + ")" );
textEdit->append("Error " + QString::number(e) + " : [" +
wcond->command + "] Maybe command not found");
delete pr; delete pr;
} }

@ -31,7 +31,7 @@ FieldSelect::FieldSelect(Procview *pv)
int half = (nbuttons + 1) / 2; int half = (nbuttons + 1) / 2;
updating = false; updating = false;
setWindowTitle("Select Custom Fields "); setWindowTitle(tr( "Select Custom Fields " ) );
QBoxLayout *v_layout = new QVBoxLayout; QBoxLayout *v_layout = new QVBoxLayout;
setLayout(v_layout); setLayout(v_layout);
@ -65,7 +65,7 @@ FieldSelect::FieldSelect(Procview *pv)
} }
update_boxes(); update_boxes();
QPushButton *closebut = new QPushButton("Close", this); QPushButton *closebut = new QPushButton( tr( "Close" ), this);
connect(closebut, SIGNAL(clicked()), SLOT(closed())); connect(closebut, SIGNAL(clicked()), SLOT(closed()));
closebut->setFocus(); closebut->setFocus();
@ -82,7 +82,7 @@ void FieldSelect::field_toggled(bool)
for (int i = 0; i < nbuttons; i++) for (int i = 0; i < nbuttons; i++)
{ {
Category *cat = procview->cat_by_name(buts[i]->text().toLatin1()); Category *cat = procview->cat_by_name(buts[i]->text());
if (buts[i]->isChecked() != disp_fields.testBit(cat->id)) if (buts[i]->isChecked() != disp_fields.testBit(cat->id))
{ {
@ -116,7 +116,7 @@ void FieldSelect::update_boxes()
updating = true; updating = true;
for (int i = 0; i < nbuttons; i++) for (int i = 0; i < nbuttons; i++)
{ {
Category *cat = procview->cat_by_name(buts[i]->text().toLatin1()); Category *cat = procview->cat_by_name(buts[i]->text());
buts[i]->setChecked(disp_fields.testBit(cat->id)); buts[i]->setChecked(disp_fields.testBit(cat->id));
} }
updating = false; updating = false;

@ -63,9 +63,9 @@ QVariant ListModel::headerData(int section, Qt::Orientation orientation,
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
if (section == 0) if (section == 0)
return QString("Event Category"); return QString(tr( "Event Category" ) );
if (section == 1) if (section == 1)
return QString("Enable"); return QString( tr( "Enable" ) );
} }
/* /*
if (role == Qt::FontRole) if (role == Qt::FontRole)

@ -344,7 +344,7 @@ TBloon::TBloon(QWidget *parent) : QLabel(parent)
"rgb(255,120,60); }"); "rgb(255,120,60); }");
// COLOR orange FF5d00 // COLOR orange FF5d00
setText(" This is unstable Alpha feature\n You maybe see a SEGFAULT..."); setText( tr( " This is unstable Alpha feature\n You maybe see a SEGFAULT..." ) );
resize(sizeHint()); resize(sizeHint());
// parent->installEventFilter(this); // parent->installEventFilter(this);
// parent->setMouseTracking(true); // parent->setMouseTracking(true);
@ -423,7 +423,7 @@ void TBloon::paintEvent( QPaintEvent * event )
TFrame::TFrame(QWidget *parent) : QLabel(parent) TFrame::TFrame(QWidget *parent) : QLabel(parent)
// TFrame::TFrame(QWidget *parent):QFrame(parent) // TFrame::TFrame(QWidget *parent):QFrame(parent)
{ {
text = "this is Tframe widget"; text = tr( "this is Tframe widget" );
// setAutoFillBackground(false); // setAutoFillBackground(false);
// setGeometry(50,50,100,100); // setGeometry(50,50,100,100);
// setAttribute(Qt::WA_OpaquePaintEvent); // setAttribute(Qt::WA_OpaquePaintEvent);
@ -612,7 +612,7 @@ UFrame::UFrame(QWidget *parent) : QFrame(parent)
hide(); hide();
QVBoxLayout *vlayout = new QVBoxLayout; QVBoxLayout *vlayout = new QVBoxLayout;
QLabel *label = new QLabel("title"); QLabel *label = new QLabel( tr( "title" ) );
vlayout->addWidget(label); vlayout->addWidget(label);
setLayout(vlayout); setLayout(vlayout);
@ -803,7 +803,7 @@ void XButton::paintEvent(QPaintEvent *event)
SearchBox::SearchBox(QWidget *parent) : QLineEdit(parent) SearchBox::SearchBox(QWidget *parent) : QLineEdit(parent)
{ {
setToolTip("PID,COMMAND,USER..."); setToolTip( tr( "PID,COMMAND,USER..." ) );
left_time = 0; left_time = 0;
setMaximumWidth(300); setMaximumWidth(300);
setMinimumWidth(20); setMinimumWidth(20);
@ -892,9 +892,7 @@ void StatusBar::refresh() {}
extern int num_opened_files; extern int num_opened_files;
void StatusBar::update(int total_n) void StatusBar::update(int total_n)
{ {
QString str; label->setText(tr( "Process count: %1" ).arg( total_n ) );
int x = 0;
label->setText("Process count: " + str.setNum(total_n));
// button2->setTextLabel ("Network Process(testing): "+ // button2->setTextLabel ("Network Process(testing): "+
// str.setNum(Procinfo::num_network_process)); // str.setNum(Procinfo::num_network_process));
// button3->setText ("Opened files : "+ // button3->setText ("Opened files : "+
@ -924,10 +922,10 @@ ControlBar::ControlBar(QWidget *parent) : QFrame(parent)
min-width: 80px; */ min-width: 80px; */
/* image: url(:/icon/vista.png);*/ /* image: url(:/icon/vista.png);*/
b_linear = new QRadioButton("Linear", this); b_linear = new QRadioButton(tr( "Linear" ), this);
b_linear->setFocusPolicy(Qt::NoFocus); b_linear->setFocusPolicy(Qt::NoFocus);
b_tree = new QRadioButton("Tree", this); b_tree = new QRadioButton( tr( "Tree" ), this);
b_tree->setFocusPolicy(Qt::NoFocus); b_tree->setFocusPolicy(Qt::NoFocus);
search_box = new SearchBox(this); search_box = new SearchBox(this);
@ -941,17 +939,17 @@ ControlBar::ControlBar(QWidget *parent) : QFrame(parent)
if (flag_thread_ok) if (flag_thread_ok)
{ {
check_thread = new QCheckBox("Thread", this); check_thread = new QCheckBox( ( "Thread" ), this);
check_thread->setFocusPolicy(Qt::NoFocus); check_thread->setFocusPolicy(Qt::NoFocus);
connect(check_thread, SIGNAL(clicked()), SLOT(show_thread_clicked())); connect(check_thread, SIGNAL(clicked()), SLOT(show_thread_clicked()));
check_thread->setChecked(flag_show_thread); check_thread->setChecked(flag_show_thread);
} }
view = new QComboBox(this); view = new QComboBox(this);
view->insertItem(0, "All Processes", Procview::ALL); view->insertItem(0, tr( "All Processes" ), Procview::ALL);
view->insertItem(1, "Your Processes", Procview::OWNED); view->insertItem(1, tr( "Your Processes" ), Procview::OWNED);
view->insertItem(2, "Non-Root Processes", Procview::NROOT); view->insertItem(2, tr( "Non-Root Processes" ), Procview::NROOT);
view->insertItem(3, "Running Processes", Procview::RUNNING); view->insertItem(3, tr( "Running Processes" ), Procview::RUNNING);
connect(view, SIGNAL(activated(int)), SLOT(view_changed(int))); connect(view, SIGNAL(activated(int)), SLOT(view_changed(int)));
view->setFocusPolicy(Qt::NoFocus); view->setFocusPolicy(Qt::NoFocus);
// PAUSED view->insertItem("Hidden Processes", Procview::HIDDEN); // PAUSED view->insertItem("Hidden Processes", Procview::HIDDEN);

@ -46,60 +46,86 @@ class Swapvalid : public QValidator
struct Boxvar struct Boxvar
{ {
const char *text; Q_DECLARE_TR_FUNCTIONS(Boxvar)
public:
const QString text;
bool *variable; bool *variable;
// CrossBox *cb; // CrossBox *cb;
QCheckBox *cb; QCheckBox *cb;
};
static Boxvar general_boxes[] = { Boxvar() : text( QString() ), variable( static_cast< bool * >( 0 ) ), cb( static_cast< QCheckBox *>( 0 ) ) {}
// {"Graphic Load Display", &Qps::show_load_graph, 0}, Boxvar( const QString t, bool *v, QCheckBox *c ) : text( t ), variable( v ), cb( c ) {}
// {"Graphic CPU Display", &Qps::show_cpu_bar, 0},
//{"Minimized on Close Button", &Qps::flag_systray, 0},
{"Exit On Close Button", &Qps::flag_exit, 0},
// TEMPO
// {"Use Tab-View", &Qps::flag_useTabView, 0},
// {"Hide qps in Linear mode", &Qps::flag_qps_hide, 0},
// {"Load Graph in Icon", &Qps::load_in_icon, 0},
// {"Selection: Copy PIDs to Clipboard", &Qps::pids_to_selection, 0},
// {"show underdevelopment ", &Qps::flag_devel, 0},
// {"Vertical CPU Bar (under development)", &Qps::vertical_cpu_bar, 0},
{0, 0, 0}};
#ifdef LINUX static QVector< Boxvar > *general_boxes()
static Boxvar sockinfo_boxes[] = { {
{"Host Name Lookup", &Qps::hostname_lookup, 0}, static QVector< Boxvar > boxes( { { tr( "Exit On Close Button" ), &Qps::flag_exit, 0}
{"Service Name Lookup", &Qps::service_lookup, 0}, // , { tr( "Graphic Load Display" ), &Qps::show_load_graph, 0 }
{0, 0, 0}}; // , { tr( "Graphic CPU Display" ), &Qps::show_cpu_bar, 0}
#endif // , { tr( "Minimized on Close Button" ), &Qps::flag_systray, 0}
// TEMPO
// , { tr( "Use Tab-View" ), &Qps::flag_useTabView, 0}
// , { tr( "Hide qps in Linear mode" ), &Qps::flag_qps_hide, 0}
// , { tr( "Load Graph in Icon" ), &Qps::load_in_icon, 0}
// , { tr( "Selection: Copy PIDs to Clipboard" ), &Qps::pids_to_selection, 0}
// , { tr( "show underdevelopment" ), &Qps::flag_devel, 0}
// , { tr( "Vertical CPU Bar (under development)" ), &Qps::vertical_cpu_bar, 0}
} );
return &boxes;
}
static Boxvar tree_boxes[] = {{"Disclosure Triangles", &Qps::tree_gadgets, 0}, //#ifdef LINUX
{"Branch Lines", &Qps::tree_lines, 0}, static QVector< Boxvar > *sockinfo_boxes()
{0, 0, 0}}; {
static QVector< Boxvar > boxes( { { tr( "Host Name Lookup" ), &Qps::hostname_lookup, 0}
, { tr( "Service Name Lookup" ), &Qps::service_lookup, 0} } );
return &boxes;
}
//#endif
static QVector< Boxvar > *tree_boxes()
{
static QVector< Boxvar > boxes( { { tr( "Disclosure Triangles" ), &Qps::tree_gadgets, 0}
, { tr( "Branch Lines" ), &Qps::tree_lines, 0} } );
return &boxes;
}
static Boxvar misc_boxes[] = { static QVector< Boxvar > *misc_boxes()
{"Auto Save Settings on Exit", &Qps::auto_save_options, 0}, {
{"Selection: Copy PIDs to Clipboard", &Qps::pids_to_selection, 0}, static QVector< Boxvar > boxes( { { tr( "Auto Save Settings on Exit" ), &Qps::auto_save_options, 0}
, { tr( "Selection: Copy PIDs to Clipboard" ), &Qps::pids_to_selection, 0}
#ifdef SOLARIS #ifdef SOLARIS
{"Normalize NICE", &Qps::normalize_nice, 0}, , { tr( "Normalize NICE" ), &Qps::normalize_nice, 0}
{"Use pmap for Map Names", &Qps::use_pmap, 0}, , { tr( "Use pmap for Map Names" ), &Qps::use_pmap, 0}
#endif #endif
{0, 0, 0}}; } );
return &boxes;
}
};
struct Cbgroup struct Cbgroup
{ {
const char *caption; Q_DECLARE_TR_FUNCTIONS(Cbgroup)
Boxvar *boxvar; public:
}; const QString caption;
QVector< Boxvar > *boxvar;
static Cbgroup groups[] = {{"General", general_boxes}, Cbgroup() : caption( QString() ), boxvar( static_cast< QVector< Boxvar > * >( 0 ) ) {}
Cbgroup( const QString c, QVector< Boxvar > *b ) : caption( c ), boxvar( b ) {}
static QVector< Cbgroup > &groups()
{
static QVector< Cbgroup > groups( { { tr( "General" ), Boxvar::general_boxes() }
#ifdef LINUX #ifdef LINUX
// {"Socket Info Window", sockinfo_boxes}, // , { tr( "Socket Info Window" ), Boxvar::sockinfo_boxes() }
#endif #endif
// {"Tree View", tree_boxes}, // , { tr( "Tree View" ), Boxvar::tree_boxes() }
// {"Miscellaneous", misc_boxes}, // , { tr( "Miscellaneous" ), Boxvar::misc_boxes() }
{0, 0}}; } );
return groups;
}
};
void find_fontsets(); void find_fontsets();
// dual use function: both validate and apply changes // dual use function: both validate and apply changes
@ -137,14 +163,14 @@ QValidator::State Swapvalid::validate(QString &s, int &) const
Preferences::Preferences() : QDialog() Preferences::Preferences() : QDialog()
{ {
int flag_test = 0; int flag_test = 0;
setWindowTitle("Preferences"); setWindowTitle( tr( "Preferences" ) );
QVBoxLayout *v_layout = new QVBoxLayout; QVBoxLayout *v_layout = new QVBoxLayout;
if (flag_test) if (flag_test)
{ {
QTabWidget *tbar = new QTabWidget(this); QTabWidget *tbar = new QTabWidget(this);
QWidget *w = new QWidget(this); QWidget *w = new QWidget(this);
tbar->addTab(w, "&Setting"); tbar->addTab(w, tr( "Setting" ) );
w->setLayout(v_layout); w->setLayout(v_layout);
} }
else else
@ -155,20 +181,26 @@ Preferences::Preferences() : QDialog()
const int border_x = 10; const int border_x = 10;
int min_x = 0; int min_x = 0;
for (Cbgroup *g = groups; g->caption; g++) QVector< Cbgroup >::iterator endItG = Cbgroup::groups().end();
for( QVector< Cbgroup >::iterator itG = Cbgroup::groups().begin(); itG != endItG; ++ itG )
{ {
QGroupBox *grp = new QGroupBox(g->caption, this); QGroupBox *grp = new QGroupBox( itG->caption, this );
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
for (Boxvar *b = g->boxvar; b->text; b++) if ( itG->boxvar )
{ {
b->cb = new QCheckBox(b->text, grp); QVector< Boxvar >::iterator endItB = itG->boxvar->end();
vbox->addWidget(b->cb); for( QVector< Boxvar >::iterator itB = itG->boxvar->begin(); itB != endItB; ++ itB )
connect(b->cb, SIGNAL(clicked()), SLOT(update_reality())); {
// -> EMIT prefs_change() itB->cb = new QCheckBox( itB->text, grp );
vbox->addWidget( itB->cb );
connect( itB->cb, SIGNAL(clicked()), SLOT(update_reality()));
// -> EMIT prefs_change()
}
} }
grp->setLayout(vbox); grp->setLayout(vbox);
v_layout->addWidget(grp); v_layout->addWidget(grp);
} }
update_boxes(); update_boxes();
/* /*
@ -200,23 +232,22 @@ Preferences::Preferences() : QDialog()
if (QPS_PROCVIEW_CPU_NUM() > 1) if (QPS_PROCVIEW_CPU_NUM() > 1)
{ {
QGroupBox *grp_cpu = new QGroupBox("%CPU divided by", this); QGroupBox *grp_cpu = new QGroupBox( tr( "%CPU divided by" ), this);
QVBoxLayout *vboxlayout = new QVBoxLayout; QVBoxLayout *vboxlayout = new QVBoxLayout;
QHBoxLayout *hbox = new QHBoxLayout; QHBoxLayout *hbox = new QHBoxLayout;
vboxlayout->addLayout(hbox); vboxlayout->addLayout(hbox);
// num_cpus // num_cpus
QString str;
str.sprintf("Total cpu: %d", QPS_PROCVIEW_CPU_NUM()); rb_totalcpu = new QRadioButton( tr( "Total cpu: %1" ).arg( QPS_PROCVIEW_CPU_NUM() ), grp_cpu);
rb_totalcpu = new QRadioButton(str, grp_cpu); QRadioButton *rb2 = new QRadioButton( tr( "Single cpu: 1" ), grp_cpu);
QRadioButton *rb2 = new QRadioButton("Single cpu: 1", grp_cpu);
if (!Procview::flag_pcpu_single) if (!Procview::flag_pcpu_single)
rb_totalcpu->setChecked(true); rb_totalcpu->setChecked(true);
else else
rb2->setChecked(true); rb2->setChecked(true);
rb_totalcpu->setToolTip("default"); rb_totalcpu->setToolTip( tr( "default" ) );
rb2->setToolTip("for developer"); rb2->setToolTip( tr( "for developer" ) );
hbox->addWidget(rb_totalcpu); hbox->addWidget(rb_totalcpu);
hbox->addWidget(rb2); hbox->addWidget(rb2);
grp_cpu->setLayout(vboxlayout); grp_cpu->setLayout(vboxlayout);
@ -252,7 +283,7 @@ Preferences::Preferences() : QDialog()
{ {
font_cb->show(); font_cb->show();
QGroupBox *gbox = new QGroupBox("Appearance", this); QGroupBox *gbox = new QGroupBox( tr( "Appearance" ), this);
QVBoxLayout *vbox = new QVBoxLayout; QVBoxLayout *vbox = new QVBoxLayout;
QHBoxLayout *hbox = new QHBoxLayout(); QHBoxLayout *hbox = new QHBoxLayout();
@ -324,17 +355,37 @@ void Preferences::init_font_size()
// slot: update check boxes to reflect current status // slot: update check boxes to reflect current status
void Preferences::update_boxes() void Preferences::update_boxes()
{ {
for (Cbgroup *g = groups; g->caption; g++) QVector< Cbgroup >::iterator endItG = Cbgroup::groups().end();
for (Boxvar *b = g->boxvar; b->text; b++) for( QVector< Cbgroup >::iterator itG = Cbgroup::groups().begin(); itG != endItG; ++ itG )
b->cb->setChecked(*b->variable); {
if ( ! itG->boxvar )
{
continue;
}
QVector< Boxvar >::iterator endItB = itG->boxvar->end();
for( QVector< Boxvar >::iterator itB = itG->boxvar->begin(); itB != endItB; ++ itB )
{
itB->cb->setChecked( *( itB->variable ) );
}
}
} }
// slot: update flags and repaint to reflect state of check boxes // slot: update flags and repaint to reflect state of check boxes
void Preferences::update_reality() void Preferences::update_reality()
{ {
for (Cbgroup *g = groups; g->caption; g++) QVector< Cbgroup >::iterator endItG = Cbgroup::groups().end();
for (Boxvar *b = g->boxvar; b->text; b++) for( QVector< Cbgroup >::iterator itG = Cbgroup::groups().begin(); itG != endItG; ++ itG )
*b->variable = b->cb->isChecked(); {
if ( ! itG->boxvar )
{
continue;
}
QVector< Boxvar >::iterator endItB = itG->boxvar->end();
for( QVector< Boxvar >::iterator itB = itG->boxvar->begin(); itB != endItB; ++ itB )
{
*( itB->variable ) = itB->cb->isChecked();
}
}
emit prefs_change(); emit prefs_change();
} }

@ -1650,7 +1650,7 @@ bool Procinfo::read_environ()
} }
// CWD,ROOT only so... // CWD,ROOT only so...
Cat_dir::Cat_dir(const char *heading, const char *explain, const char *dirname, Cat_dir::Cat_dir(const QString &heading, const QString &explain, const char *dirname,
QString Procinfo::*member) QString Procinfo::*member)
: Cat_string(heading, explain), dir(dirname), cache(member) : Cat_string(heading, explain), dir(dirname), cache(member)
{ {
@ -1706,7 +1706,7 @@ QString Cat_dir::string(Procinfo *p)
return p->*cache; return p->*cache;
} }
Cat_state::Cat_state(const char *heading, const char *explain) Cat_state::Cat_state(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1723,7 +1723,7 @@ QString Cat_state::string(Procinfo *p)
} }
// LINUX // LINUX
Cat_policy::Cat_policy(const char *heading, const char *explain) Cat_policy::Cat_policy(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1754,7 +1754,7 @@ int Cat_policy::compare(Procinfo *a, Procinfo *b)
return b->get_policy() - a->get_policy(); return b->get_policy() - a->get_policy();
} }
Cat_rtprio::Cat_rtprio(const char *heading, const char *explain) Cat_rtprio::Cat_rtprio(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1772,7 +1772,7 @@ int Cat_rtprio::compare(Procinfo *a, Procinfo *b)
} }
// maybe tms COMMON // maybe tms COMMON
Cat_tms::Cat_tms(const char *heading, const char *explain) Cat_tms::Cat_tms(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1791,7 +1791,7 @@ int Cat_tms::compare(Procinfo *a, Procinfo *b)
return (int)((b->get_tms() - a->get_tms()) * 1000); return (int)((b->get_tms() - a->get_tms()) * 1000);
} }
Cat_affcpu::Cat_affcpu(const char *heading, const char *explain) Cat_affcpu::Cat_affcpu(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1811,7 +1811,7 @@ QString Cat_affcpu::string(Procinfo *p)
*/ */
// LINUX or COMMON? // LINUX or COMMON?
Cat_time::Cat_time(const char *heading, const char *explain) Cat_time::Cat_time(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -1880,7 +1880,7 @@ int Cat_time::compare(Procinfo *a, Procinfo *b)
} }
// LINUX ? // LINUX ?
Cat_tty::Cat_tty(const char *heading, const char *explain) Cat_tty::Cat_tty(const QString &heading, const QString &explain)
: Cat_string(heading, explain) : Cat_string(heading, explain)
{ {
} }
@ -1890,146 +1890,111 @@ QString Cat_tty::string(Procinfo *p) { return Ttystr::name(p->tty); }
Proc::Proc() Proc::Proc()
{ {
// Note: // Note:
categories.insert(F_PID, categories.insert( F_PID
new Cat_int("PID", "Process ID", 6, &Procinfo::pid)); , new Cat_int( tr( "PID" ), tr( "Process ID" ), 6, &Procinfo::pid) );
categories.insert(F_TGID, categories.insert( F_TGID
new Cat_int("TGID", "Task group ID ( parent of threads )", , new Cat_int( tr( "TGID" ), tr( "Task group ID ( parent of threads )" ),6, &Procinfo::tgid));
6, &Procinfo::tgid)); categories.insert( F_PPID
categories.insert( , new Cat_int( tr( "PPID" ), tr( "Parent process ID" ), 6, &Procinfo::ppid));
F_PPID, new Cat_int("PPID", "Parent process ID", 6, &Procinfo::ppid)); categories.insert( F_PGID
categories.insert( , new Cat_int( tr( "PGID" ), tr( "Process group ID" ), 6, &Procinfo::pgrp));
F_PGID, new Cat_int("PGID", "Process group ID", 6, &Procinfo::pgrp)); categories.insert( F_SID
categories.insert(F_SID, , new Cat_int( tr( "SID" ), tr( "Session ID" ), 6, &Procinfo::session));
new Cat_int("SID", "Session ID", 6, &Procinfo::session)); categories.insert( F_TTY
categories.insert(F_TTY, new Cat_tty("TTY", "Terminal")); , new Cat_tty( tr( "TTY" ), tr( "Terminal") ) );
categories.insert(F_TPGID, categories.insert( F_TPGID
new Cat_int("TPGID", "Process group ID of tty owner", 6, , new Cat_int( tr( "TPGID" ), tr( "Process group ID of tty owner" ), 6, &Procinfo::tpgid));
&Procinfo::tpgid)); categories.insert( F_USER
, new Cat_string( tr( "USER" ), tr( "Owner (*=suid root, +=suid a user)" ),&Procinfo::username));
categories.insert( categories.insert( F_GROUP
F_USER, new Cat_string("USER", "Owner (*=suid root, +=suid a user)", , new Cat_string( tr( "GROUP" ), tr( "Group name (*=sgid other)" ),&Procinfo::groupname));
&Procinfo::username)); categories.insert( F_UID
categories.insert(F_GROUP, , new Cat_int( tr( "UID" ), tr( "Real user ID" ), 6, &Procinfo::uid));
new Cat_string("GROUP", "Group name (*=sgid other)", categories.insert( F_EUID
&Procinfo::groupname)); , new Cat_int( tr( "EUID" ), tr( "Effective user ID" ), 6, &Procinfo::euid));
categories.insert( F_SUID
categories.insert(F_UID, , new Cat_int( tr( "SUID" ), tr( "Saved user ID (Posix)" ), 6,&Procinfo::suid));
new Cat_int("UID", "Real user ID", 6, &Procinfo::uid)); categories.insert( F_FSUID
categories.insert( , new Cat_int( tr( "FSUID" ), tr( "File system user ID" ), 6,&Procinfo::fsuid));
F_EUID, new Cat_int("EUID", "Effective user ID", 6, &Procinfo::euid)); categories.insert( F_GID
categories.insert(F_SUID, new Cat_int("SUID", "Saved user ID (Posix)", 6, , new Cat_int( tr( "GID" ), tr( "Real group ID" ), 6, &Procinfo::gid));
&Procinfo::suid)); categories.insert( F_EGID
categories.insert(F_FSUID, new Cat_int("FSUID", "File system user ID", 6, , new Cat_int( tr( "EGID" ), tr( "Effective group ID" ), 6, &Procinfo::egid));
&Procinfo::fsuid)); categories.insert( F_SGID
categories.insert(F_GID, , new Cat_int( tr( "SGID" ), tr( "Saved group ID (Posix)" ), 6,&Procinfo::sgid));
new Cat_int("GID", "Real group ID", 6, &Procinfo::gid)); categories.insert( F_FSGID
categories.insert( , new Cat_int( tr( "FSGID" ), tr( "File system group ID" ), 6,&Procinfo::fsgid));
F_EGID, new Cat_int("EGID", "Effective group ID", 6, &Procinfo::egid)); categories.insert( F_PRI
categories.insert(F_SGID, new Cat_int("SGID", "Saved group ID (Posix)", 6, , new Cat_int( tr( "PRI" ), tr( "Dynamic priority" ), 4, &Procinfo::priority));
&Procinfo::sgid)); categories.insert( F_NICE
categories.insert(F_FSGID, new Cat_int("FSGID", "File system group ID", 6, , new Cat_int( tr( "NICE" ), tr( "Scheduling favour (higher -> less cpu time)" ), 4, &Procinfo::nice));
&Procinfo::fsgid)); categories.insert( F_NLWP
categories.insert( , new Cat_int( tr( "NLWP" ), tr( "Number of tasks(threads) in task group" ), 5, &Procinfo::nthreads));
F_PRI, new Cat_int("PRI", "Dynamic priority", 4, &Procinfo::priority)); categories.insert( F_PLCY
categories.insert(F_NICE, , new Cat_policy( tr( "PLCY" ), tr( "Scheduling policy" ) ) );
new Cat_int("NICE", categories.insert( F_RPRI
"Scheduling favour (higher -> less cpu time)", , new Cat_rtprio( tr( "RPRI" ), tr( "Realtime priority (0-99, more is better)" ) ) );
4, &Procinfo::nice)); categories.insert( F_TMS
categories.insert( , new Cat_tms( tr( "TMS" ), tr( "Time slice in milliseconds" ) ) );
F_NLWP, new Cat_int("NLWP", "Number of tasks(threads) in task group", 5, categories.insert( F_SLPAVG
&Procinfo::nthreads)); , new Cat_int( tr( "%SAVG" ), tr( "Percentage average sleep time (-1 -> N/A)" ), 4, &Procinfo::slpavg));
categories.insert( F_AFFCPU
categories.insert(F_PLCY, new Cat_policy("PLCY", "Scheduling policy")); , new Cat_affcpu( tr( "CPUSET" ), tr( "Affinity CPU mask (0 -> API not supported)" ) ) ); // ???
categories.insert( categories.insert( F_MAJFLT
F_RPRI, , new Cat_uintl( tr( "MAJFLT" ), tr( "Number of major faults (disk access)" ), 8, &Procinfo::majflt));
new Cat_rtprio("RPRI", "Realtime priority (0-99, more is better)")); categories.insert( F_MINFLT
categories.insert(F_TMS, new Cat_tms("TMS", "Time slice in milliseconds")); , new Cat_uintl( tr( "MINFLT" ), tr( "Number of minor faults (no disk access)" ), 8, &Procinfo::minflt));
categories.insert(F_SLPAVG,
new Cat_int("%SAVG",
"Percentage average sleep time (-1 -> N/A)",
4, &Procinfo::slpavg));
categories.insert(
F_AFFCPU,
new Cat_affcpu("CPUSET",
"Affinity CPU mask (0 -> API not supported)")); // ???
categories.insert(F_MAJFLT,
new Cat_uintl("MAJFLT",
"Number of major faults (disk access)", 8,
&Procinfo::majflt));
categories.insert(F_MINFLT,
new Cat_uintl("MINFLT",
"Number of minor faults (no disk access)",
8, &Procinfo::minflt));
// Memory // Memory
categories.insert(F_SIZE, categories.insert( F_SIZE
new Cat_memory("VSIZE", "Virtual image size of process", , new Cat_memory( tr( "VSIZE" ), tr( "Virtual image size of process" ), 8, &Procinfo::size));
8, &Procinfo::size)); categories.insert( F_RSS
categories.insert(F_RSS, new Cat_memory("RSS", "Resident set size", 8, , new Cat_memory( tr( "RSS" ), tr( "Resident set size" ), 8, &Procinfo::resident));
&Procinfo::resident)); categories.insert( F_MEM
categories.insert(F_MEM, new Cat_memory("MEM", "memory usage (RSS-SHARE)", , new Cat_memory( tr( "MEM" ), tr( "memory usage (RSS-SHARE)" ), 8, &Procinfo::mem));
8, &Procinfo::mem)); categories.insert( F_TRS
categories.insert(F_TRS, , new Cat_memory( tr( "TRS" ), tr( "Text(code) resident set size" ), 8, &Procinfo::trs));
new Cat_memory("TRS", "Text(code) resident set size", 8, categories.insert( F_DRS
&Procinfo::trs)); , new Cat_memory( tr( "DRS" ), tr( "Data resident set size(malloc+global variable)" ), 8, &Procinfo::drs));
categories.insert( categories.insert( F_STACK
F_DRS, , new Cat_memory( tr( "STACK" ), tr( "Stack size" ), 8, &Procinfo::stack));
new Cat_memory("DRS", "Data resident set size(malloc+global variable)", categories.insert( F_SHARE
8, &Procinfo::drs)); , new Cat_memory( tr( "SHARE" ), tr( "Shared memory with other libs" ), 8, &Procinfo::share));
categories.insert( categories.insert( F_SWAP
F_STACK, new Cat_memory("STACK", "Stack size", 8, &Procinfo::stack)); , new Cat_swap( tr( "SWAP" ), tr( "Kbytes on swap device" ) ) );
categories.insert(F_SHARE, categories.insert( F_IOR
new Cat_memory("SHARE", "Shared memory with other libs", , new Cat_memory( tr( "IO_R" ), tr( "io read (file)" ), 8, &Procinfo::io_read));
8, &Procinfo::share)); categories.insert( F_IOW
categories.insert(F_SWAP, new Cat_swap("SWAP", "Kbytes on swap device")); , new Cat_memory( tr( "IO_W" ), tr( "io write (file)" ), 8, &Procinfo::io_write));
categories.insert( categories.insert( F_DT
F_IOR, new Cat_memory("IO_R", "io read (file)", 8, &Procinfo::io_read)); , new Cat_uintl( tr( "DT" ), tr( "Number of dirty (non-written) pages" ), 7, &Procinfo::dt));
categories.insert(F_IOW, new Cat_memory("IO_W", "io write (file)", 8, categories.insert( F_STAT
&Procinfo::io_write)); , new Cat_state( tr( "STAT" ), tr( "State of the process " ) ) );
categories.insert( F_FLAGS
categories.insert(F_DT, , new Cat_hex( tr( "FLAGS" ), tr( "Process flags (hex)" ), 9, &Procinfo::flags));
new Cat_uintl("DT", "Number of dirty (non-written) pages", categories.insert( F_WCHAN
7, &Procinfo::dt)); , new Cat_wchan( tr( "WCHAN" ), tr( "Kernel function where process is sleeping" ) ) );
categories.insert(F_STAT, new Cat_state("STAT", "State of the process ")); categories.insert( F_WCPU
categories.insert(F_FLAGS, new Cat_hex("FLAGS", "Process flags (hex)", 9, , new Cat_percent( tr( "%WCPU" ), tr( "Weighted percentage of CPU (30 s average)" ), 6, &Procinfo::wcpu));
&Procinfo::flags)); categories.insert( F_CPU
categories.insert( , new Cat_percent( tr( "%CPU" ), tr( "Percentage of CPU used since last update" ), 6, &Procinfo::pcpu));
F_WCHAN, categories.insert( F_PMEM
new Cat_wchan("WCHAN", "Kernel function where process is sleeping")); , new Cat_percent( tr( "%MEM" ), tr( "Percentage of memory used (RSS/total mem)" ), 6, &Procinfo::pmem));
categories.insert( categories.insert( F_START
F_WCPU, , new Cat_start( tr( "START" ), tr( "Time process started" ) ) );
new Cat_percent("%WCPU", "Weighted percentage of CPU (30 s average)", 6, categories.insert( F_TIME,
&Procinfo::wcpu)); new Cat_time( tr( "TIME" ), tr( "Total CPU time used since start" ) ) );
categories.insert( categories.insert( F_CPUNUM
F_CPU, , new Cat_int( tr( "CPU" ), tr( "CPU the process is executing on (SMP system)" ), 3, &Procinfo::which_cpu));
new Cat_percent("%CPU", "Percentage of CPU used since last update", 6, categories.insert( F_CMD
&Procinfo::pcpu)); , new Cat_string( tr( "Process Name" ), tr( "the process name" ), &Procinfo::command));
categories.insert( // categories.insert( F_PROCESSNAME
F_PMEM, // , new Cat_string( tr( "Process Name " ),tr( "the process name" ), &Procinfo::command));
new Cat_percent("%MEM", "Percentage of memory used (RSS/total mem)", 6, categories.insert( F_CWD
&Procinfo::pmem)); , new Cat_dir( tr( "CWD" ), tr( "Current working directory" ), "cwd", &Procinfo::cwd));
categories.insert(F_START, new Cat_start("START", "Time process started")); categories.insert( F_ROOT, new Cat_dir( tr( "ROOT" ), tr( "Root directory of process" ), "root", &Procinfo::root));
categories.insert(F_TIME,
new Cat_time("TIME", "Total CPU time used since start"));
categories.insert(
F_CPUNUM,
new Cat_int("CPU", "CPU the process is executing on (SMP system)", 3,
&Procinfo::which_cpu));
categories.insert(F_CMD, new Cat_string("Process Name", "the process name",
&Procinfo::command));
// categories.insert(F_PROCESSNAME, new Cat_string("Process Name",
//"the
// process name", &Procinfo::command));
categories.insert(F_CWD, new Cat_dir("CWD", "Current working directory",
"cwd", &Procinfo::cwd));
categories.insert(F_ROOT, new Cat_dir("ROOT", "Root directory of process",
"root", &Procinfo::root));
// command_line="COMMAND_LINE"; //reference to /proc/1234/cmdline // command_line="COMMAND_LINE"; //reference to /proc/1234/cmdline
categories.insert(F_CMDLINE, categories.insert( F_CMDLINE,
new Cat_cmdline("COMMAND_LINE", new Cat_cmdline( tr( "COMMAND_LINE" ), tr( "Command line that started the process") ) );
"Command line that started the process"));
commonPostInit(); commonPostInit();

@ -24,6 +24,7 @@
#define PROC_H #define PROC_H
#include "config.h" #include "config.h"
#include <QCoreApplication>
#ifdef SOLARIS #ifdef SOLARIS
#include <kstat.h> // kstat_ctl_t #include <kstat.h> // kstat_ctl_t
@ -214,9 +215,7 @@ class NameValue
class Category class Category
{ {
public: public:
Category(const char *heading, const char *explain) Category( const QString &heading, const QString &explain ) : name(heading), help(explain), reversed(false),flag_int_value(false){}
: name(heading), help(explain), reversed(false),
flag_int_value(false){};
virtual ~Category(); virtual ~Category();
virtual int alignment() = 0; virtual int alignment() = 0;
@ -224,8 +223,8 @@ class Category
virtual int width() = 0; virtual int width() = 0;
virtual int compare(Procinfo *a, Procinfo *b); virtual int compare(Procinfo *a, Procinfo *b);
const char *name; QString name;
const char *help; QString help;
int index; int index;
int id; int id;
bool reversed; // testing bool reversed; // testing
@ -236,7 +235,7 @@ class Category
class Cat_int : public Category class Cat_int : public Category
{ {
public: public:
Cat_int(const char *heading, const char *explain, int w, Cat_int(const QString &heading, const QString &explain, int w,
int Procinfo::*member); int Procinfo::*member);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -252,7 +251,7 @@ class Cat_int : public Category
class Cat_memory : public Category class Cat_memory : public Category
{ {
public: public:
Cat_memory(const char *heading, const char *explain, int w, Cat_memory(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member); unsigned long Procinfo::*member);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -267,7 +266,7 @@ class Cat_memory : public Category
class Cat_uintl : public Category class Cat_uintl : public Category
{ {
public: public:
Cat_uintl(const char *heading, const char *explain, int w, Cat_uintl(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member); unsigned long Procinfo::*member);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -282,7 +281,7 @@ class Cat_uintl : public Category
class Cat_hex : public Cat_uintl class Cat_hex : public Cat_uintl
{ {
public: public:
Cat_hex(const char *heading, const char *explain, int w, Cat_hex(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member); unsigned long Procinfo::*member);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
@ -290,7 +289,7 @@ class Cat_hex : public Cat_uintl
class Cat_swap : public Category class Cat_swap : public Category
{ {
public: public:
Cat_swap(const char *heading, const char *explain); Cat_swap(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 8; }; virtual int width() { return 8; };
@ -300,7 +299,7 @@ class Cat_swap : public Category
class Cat_string : public Category class Cat_string : public Category
{ {
public: public:
Cat_string(const char *heading, const char *explain, Cat_string(const QString &heading, const QString &explain,
QString Procinfo::*member = 0); QString Procinfo::*member = 0);
virtual int alignment() { return Qt::AlignLeft; }; virtual int alignment() { return Qt::AlignLeft; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -314,28 +313,28 @@ class Cat_string : public Category
class Cat_user : public Cat_string class Cat_user : public Cat_string
{ {
public: public:
Cat_user(const char *heading, const char *explain); Cat_user(const QString &heading, const QString &explain);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
class Cat_group : public Cat_string class Cat_group : public Cat_string
{ {
public: public:
Cat_group(const char *heading, const char *explain); Cat_group(const QString &heading, const QString &explain);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
class Cat_wchan : public Cat_string class Cat_wchan : public Cat_string
{ {
public: public:
Cat_wchan(const char *heading, const char *explain); Cat_wchan(const QString &heading, const QString &explain);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
class Cat_dir : public Cat_string class Cat_dir : public Cat_string
{ {
public: public:
Cat_dir(const char *heading, const char *explain, const char *dirname, Cat_dir(const QString &heading, const QString &explain, const char *dirname,
QString Procinfo::*member); QString Procinfo::*member);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -347,14 +346,14 @@ class Cat_dir : public Cat_string
class Cat_cmdline : public Cat_string class Cat_cmdline : public Cat_string
{ {
public: public:
Cat_cmdline(const char *heading, const char *explain); Cat_cmdline(const QString &heading, const QString &explain);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
class Cat_state : public Category class Cat_state : public Category
{ {
public: public:
Cat_state(const char *heading, const char *explain); Cat_state(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignLeft; }; virtual int alignment() { return Qt::AlignLeft; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 6; }; virtual int width() { return 6; };
@ -364,7 +363,7 @@ class Cat_state : public Category
class Cat_policy : public Category class Cat_policy : public Category
{ {
public: public:
Cat_policy(const char *heading, const char *explain); Cat_policy(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignLeft; }; virtual int alignment() { return Qt::AlignLeft; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 3; }; virtual int width() { return 3; };
@ -375,7 +374,7 @@ class Cat_policy : public Category
class Cat_rtprio : public Category class Cat_rtprio : public Category
{ {
public: public:
Cat_rtprio(const char *heading, const char *explain); Cat_rtprio(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 5; }; virtual int width() { return 5; };
@ -386,7 +385,7 @@ class Cat_rtprio : public Category
class Cat_tms : public Category class Cat_tms : public Category
{ {
public: public:
Cat_tms(const char *heading, const char *explain); Cat_tms(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 5; }; virtual int width() { return 5; };
@ -396,7 +395,7 @@ class Cat_tms : public Category
class Cat_affcpu : public Category class Cat_affcpu : public Category
{ {
public: public:
Cat_affcpu(const char *heading, const char *explain); Cat_affcpu(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 8; }; virtual int width() { return 8; };
@ -407,7 +406,7 @@ class Cat_affcpu : public Category
class Cat_time : public Category class Cat_time : public Category
{ {
public: public:
Cat_time(const char *heading, const char *explain); Cat_time(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 7; }; virtual int width() { return 7; };
@ -417,7 +416,7 @@ class Cat_time : public Category
class Cat_start : public Category class Cat_start : public Category
{ {
public: public:
Cat_start(const char *heading, const char *explain); Cat_start(const QString &heading, const QString &explain);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
virtual int width() { return 8; }; virtual int width() { return 8; };
@ -427,7 +426,7 @@ class Cat_start : public Category
class Cat_percent : public Category class Cat_percent : public Category
{ {
public: public:
Cat_percent(const char *heading, const char *explain, int w, Cat_percent(const QString &heading, const QString &explain, int w,
float Procinfo::*member); float Procinfo::*member);
virtual int alignment() { return Qt::AlignRight; }; virtual int alignment() { return Qt::AlignRight; };
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
@ -442,7 +441,7 @@ class Cat_percent : public Category
class Cat_tty : public Cat_string class Cat_tty : public Cat_string
{ {
public: public:
Cat_tty(const char *heading, const char *explain); Cat_tty(const QString &heading, const QString &explain);
virtual QString string(Procinfo *p); virtual QString string(Procinfo *p);
}; };
@ -655,11 +654,13 @@ class SysHistory
~SysHistory(); ~SysHistory();
}; };
// for A System // for A System
// cf. Procinfo is for a Process // cf. Procinfo is for a Process
// //
class Proc class Proc
{ {
Q_DECLARE_TR_FUNCTIONS(Proc)
public: public:
Proc(); Proc();
~Proc(); ~Proc();
@ -674,8 +675,8 @@ class Proc
int read_pid_tasks(int pid); int read_pid_tasks(int pid);
Category *cat_by_name(const char *s); Category *cat_by_name( const QString &s );
int field_id_by_name(const char *s); int field_id_by_name( const QString &s );
#ifdef LINUX #ifdef LINUX
/* from /proc/net/{tcp,udp,unix} */ /* from /proc/net/{tcp,udp,unix} */

@ -90,7 +90,7 @@ int Category::compare(Procinfo *a, Procinfo *b)
return string(a).compare(string(b)); return string(a).compare(string(b));
} }
Cat_int::Cat_int(const char *heading, const char *explain, int w, Cat_int::Cat_int(const QString &heading, const QString &explain, int w,
int Procinfo::*member) int Procinfo::*member)
: Category(heading, explain), int_member(member), field_width(w) : Category(heading, explain), int_member(member), field_width(w)
{ {
@ -111,7 +111,7 @@ int Cat_int::compare(Procinfo *a, Procinfo *b)
} }
// COMMON // COMMON
Cat_percent::Cat_percent(const char *heading, const char *explain, int w, Cat_percent::Cat_percent(const QString &heading, const QString &explain, int w,
float Procinfo::*member) float Procinfo::*member)
: Category(heading, explain), float_member(member), field_width(w) : Category(heading, explain), float_member(member), field_width(w)
{ {
@ -130,7 +130,7 @@ int Cat_percent::compare(Procinfo *a, Procinfo *b)
return at < bt ? 1 : (at > bt ? -1 : 0); return at < bt ? 1 : (at > bt ? -1 : 0);
} }
// added 2006/05/07 // added 2006/05/07
Cat_memory::Cat_memory(const char *heading, const char *explain, int w, Cat_memory::Cat_memory(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member) unsigned long Procinfo::*member)
: Category(heading, explain), uintl_member(member), field_width(w) : Category(heading, explain), uintl_member(member), field_width(w)
{ {
@ -170,7 +170,7 @@ int Cat_memory::compare(Procinfo *a, Procinfo *b)
return bu >= au ? (bu == au ? 0 : 1) : -1; return bu >= au ? (bu == au ? 0 : 1) : -1;
} }
Cat_uintl::Cat_uintl(const char *heading, const char *explain, int w, Cat_uintl::Cat_uintl(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member) unsigned long Procinfo::*member)
: Category(heading, explain), uintl_member(member), field_width(w) : Category(heading, explain), uintl_member(member), field_width(w)
{ {
@ -189,7 +189,7 @@ int Cat_uintl::compare(Procinfo *a, Procinfo *b)
return bu >= au ? (bu == au ? 0 : 1) : -1; return bu >= au ? (bu == au ? 0 : 1) : -1;
} }
Cat_hex::Cat_hex(const char *heading, const char *explain, int w, Cat_hex::Cat_hex(const QString &heading, const QString &explain, int w,
unsigned long Procinfo::*member) unsigned long Procinfo::*member)
: Cat_uintl(heading, explain, w, member) : Cat_uintl(heading, explain, w, member)
{ {
@ -205,7 +205,7 @@ QString Cat_hex::string(Procinfo *p)
} }
// COMMON, // COMMON,
Cat_swap::Cat_swap(const char *heading, const char *explain) Cat_swap::Cat_swap(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -236,7 +236,7 @@ int Cat_swap::compare(Procinfo *a, Procinfo *b)
return (b->size - b->resident) - (a->size - a->resident); return (b->size - b->resident) - (a->size - a->resident);
} }
Cat_string::Cat_string(const char *heading, const char *explain, Cat_string::Cat_string(const QString &heading, const QString &explain,
QString Procinfo::*member) QString Procinfo::*member)
: Category(heading, explain), str_member(member) : Category(heading, explain), str_member(member)
{ {
@ -244,7 +244,7 @@ Cat_string::Cat_string(const char *heading, const char *explain,
QString Cat_string::string(Procinfo *p) { return p->*str_member; } QString Cat_string::string(Procinfo *p) { return p->*str_member; }
Cat_user::Cat_user(const char *heading, const char *explain) Cat_user::Cat_user(const QString &heading, const QString &explain)
: Cat_string(heading, explain) : Cat_string(heading, explain)
{ {
} }
@ -261,7 +261,7 @@ QString Cat_user::string(Procinfo *p)
} }
} }
Cat_group::Cat_group(const char *heading, const char *explain) Cat_group::Cat_group(const QString &heading, const QString &explain)
: Cat_string(heading, explain) : Cat_string(heading, explain)
{ {
} }
@ -278,7 +278,7 @@ QString Cat_group::string(Procinfo *p)
} }
} }
Cat_wchan::Cat_wchan(const char *heading, const char *explain) Cat_wchan::Cat_wchan(const QString &heading, const QString &explain)
: Cat_string(heading, explain) : Cat_string(heading, explain)
{ {
} }
@ -292,7 +292,7 @@ QString Cat_wchan::string(Procinfo *p)
#endif #endif
} }
Cat_cmdline::Cat_cmdline(const char *heading, const char *explain) Cat_cmdline::Cat_cmdline(const QString &heading, const QString &explain)
: Cat_string(heading, explain) : Cat_string(heading, explain)
{ {
} }
@ -329,7 +329,7 @@ QString Cat_cmdline::string(Procinfo *p)
} }
// hmm COMMON? almost same...but Solaris's zombie process... // hmm COMMON? almost same...but Solaris's zombie process...
Cat_start::Cat_start(const char *heading, const char *explain) Cat_start::Cat_start(const QString &heading, const QString &explain)
: Category(heading, explain) : Category(heading, explain)
{ {
} }
@ -799,21 +799,19 @@ int Procview::compare_backwards(Procinfo *const *a, Procinfo *const *b)
} }
// COMMON // COMMON
Category *Proc::cat_by_name(const char *s) Category *Proc::cat_by_name( const QString &s )
{ {
if (s) if ( ! s.isNull() )
{ {
// java style // java style
QHashIterator<int, Category *> i(categories); QHashIterator<int, Category *> i(categories);
while (i.hasNext()) while (i.hasNext())
{ {
const char *p;
i.next(); i.next();
p = i.value()->name; const QString &p = i.value()->name;
if (*p == ' ') int index = p.indexOf( QRegExp( "\\S" ) );
p++; if ( p.indexOf( s, index ) == index )
if (strcmp(p, s) == 0)
return i.value(); return i.value();
// cout << i.key() << ": " << i.value() << endl; // cout << i.key() << ": " << i.value() << endl;
} }
@ -823,15 +821,15 @@ Category *Proc::cat_by_name(const char *s)
// COMMON // COMMON
// call by // call by
int Proc::field_id_by_name(const char *s) int Proc::field_id_by_name(const QString &s)
{ {
if (s) if ( ! s.isNull() )
{ {
// STL style // STL style
QHash<int, Category *>::iterator i = categories.begin(); QHash<int, Category *>::iterator i = categories.begin();
while (i != categories.end()) while (i != categories.end())
{ {
if (strcmp(i.value()->name, s) == 0) if ( i.value()->name == s )
return i.key(); // cout << i.key() << ": " << return i.key(); // cout << i.key() << ": " <<
// i.value() << endl; // i.value() << endl;
++i; ++i;

@ -186,41 +186,42 @@ Qps::Qps()
make_signal_popup_menu(); make_signal_popup_menu();
// MOVETO Pstable !! // MOVETO Pstable !!
m_headpopup = new QMenu("header_popup", this); m_headpopup = new QMenu( tr( "header_popup" ), this);
m_headpopup->addAction("Remove Field", this, SLOT(menu_remove_field())); m_headpopup->addAction( tr( "Remove Field" ), this, SLOT(menu_remove_field()));
m_fields = new QMenu("Add Field", this); m_fields = new QMenu( tr( "Add Field" ), this);
m_headpopup->addMenu(m_fields); m_headpopup->addMenu(m_fields);
// connect(m_fields, SIGNAL(activated(int)), // connect(m_fields, SIGNAL(activated(int)),
// SLOT(add_fields_menu(int))); // SLOT(add_fields_menu(int)));
// m_headpopup->addAction("Select Field", this, SLOT(menu_custom()) ); // m_headpopup->addAction("Select Field", this, SLOT(menu_custom()) );
m_command = new QMenu("Command", this); // filled in later m_command = new QMenu( tr( "Command" ), this); // filled in later
QAction *act; QAction *act;
m_view = new QMenu("View", this); m_view = new QMenu( tr( "View" ), this);
act = m_view->addAction("Process"); // act->setData(Procview::CUSTOM); act = m_view->addAction( tr( "Process" ) ); // act->setData(Procview::CUSTOM);
act = m_view->addAction("Log"); // act->setData(Procview::CUSTOM); act = m_view->addAction( tr( "Log" ) ); // act->setData(Procview::CUSTOM);
// m_view->hide(); // m_view->hide();
m_field = new QMenu("Field", this); m_field = new QMenu("Field", this);
act = m_field->addAction("Custom Fields"); act = m_field->addAction( tr( "Custom Fields" ) );
act->setData(Procview::CUSTOM); act->setData(Procview::CUSTOM);
act = m_field->addAction("Basic Fields "); act = m_field->addAction( tr( "Basic Fields " ) );
act->setData(Procview::USER); act->setData(Procview::USER);
act = m_field->addAction("Jobs Fields "); act = m_field->addAction( tr( "Jobs Fields " ) );
act->setData(Procview::JOBS); act->setData(Procview::JOBS);
act = m_field->addAction("Memory Fields "); act = m_field->addAction( tr( "Memory Fields " ) );
act->setData(Procview::MEM); act->setData(Procview::MEM);
#ifdef LINUX #ifdef LINUX
act = m_field->addAction("Scheduling Fields "); act = m_field->addAction( tr( "Scheduling Fields " ) );
act->setData(Procview::SCHED); act->setData(Procview::SCHED);
#endif #endif
m_field->addSeparator(); m_field->addSeparator();
act = m_field->addAction(QIcon::fromTheme(QStringLiteral("edit-find-replace")), act = m_field->addAction( QIcon::fromTheme(QStringLiteral("edit-find-replace"))
"Select Custom Fields...", this, , tr( "Select Custom Fields..." )
SLOT(menu_custom())); , this
, SLOT(menu_custom()));
act->setData(MENU_CUSTOM); act->setData(MENU_CUSTOM);
connect(m_field, SIGNAL(triggered(QAction *)), this, connect(m_field, SIGNAL(triggered(QAction *)), this,
@ -232,8 +233,8 @@ Qps::Qps()
/// *))); /// *)));
/// connect(m_view, SIGNAL(aboutToShow ()), SLOT(update_menu_status())); /// connect(m_view, SIGNAL(aboutToShow ()), SLOT(update_menu_status()));
m_options = new QMenu("Option", this); m_options = new QMenu( tr( "Option" ), this);
m_options->addAction("Update Period...", this, SLOT(menu_update())); m_options->addAction( tr( "Update Period..." ), this, SLOT(menu_update()));
m_options->addSeparator(); m_options->addSeparator();
act = m_options->addAction("", /* MENU_PATH */ this, act = m_options->addAction("", /* MENU_PATH */ this,
SLOT(menu_toggle_path())); SLOT(menu_toggle_path()));
@ -242,22 +243,24 @@ Qps::Qps()
act->setData(QVariant(MENU_INFOBAR)); act->setData(QVariant(MENU_INFOBAR));
act = m_options->addAction("", this, SLOT(menu_toggle_ctrlbar())); act = m_options->addAction("", this, SLOT(menu_toggle_ctrlbar()));
act->setData(QVariant(MENU_CTRLBAR)); act->setData(QVariant(MENU_CTRLBAR));
act = m_options->addAction("Show Status bar", this, act = m_options->addAction( tr( "Show Status bar" )
SLOT(menu_toggle_statusbar())); , this
,SLOT(menu_toggle_statusbar()));
act->setData(QVariant(MENU_STATUS)); act->setData(QVariant(MENU_STATUS));
act = m_options->addAction("", this, SLOT(menu_toggle_cumul())); act = m_options->addAction("", this, SLOT(menu_toggle_cumul()));
act->setData(QVariant(MENU_CUMUL)); act->setData(QVariant(MENU_CUMUL));
m_options->addSeparator(); m_options->addSeparator();
m_options->addAction(QIcon::fromTheme(QStringLiteral("preferences-system")), m_options->addAction( QIcon::fromTheme(QStringLiteral("preferences-system"))
"Preferences...", this, , tr( "Preferences..." )
SLOT(menu_prefs())); // MENU_PREFS , this
, SLOT(menu_prefs())); // MENU_PREFS
connect(m_options, SIGNAL(aboutToShow()), SLOT(update_menu_status())); connect(m_options, SIGNAL(aboutToShow()), SLOT(update_menu_status()));
QMenu *m_help = new QMenu("&Help", this); QMenu *m_help = new QMenu( tr( "Help" ), this);
// m_help->addAction("FAQ", this, SLOT(license())); // m_help->addAction("FAQ", this, SLOT(license()));
m_help->addAction(QIcon::fromTheme("help-about"), "&About", this, m_help->addAction(QIcon::fromTheme("help-about"), tr( "About" ), this,
SLOT(about())); SLOT(about()));
// menu = new QMenuBar(this); // menu = new QMenuBar(this);
@ -389,8 +392,8 @@ Qps::Qps()
bar_visibility(); // need bar_visibility(); // need
// testing // testing
popupx = new QMenu("test", this); popupx = new QMenu( tr( "test" ), this);
popupx->addAction("Copied to Clipboard"); popupx->addAction( tr( "Copied to Clipboard" ) );
} }
// explicit destructor needed for gcc // explicit destructor needed for gcc
@ -499,17 +502,17 @@ QMenu *Qps::make_signal_popup_menu()
// move to pstable? // move to pstable?
QAction *act; // show_popup_menu() callback QAction *act; // show_popup_menu() callback
m_popup = new QMenu("context popup", this); m_popup = new QMenu( tr( "context popup" ), this);
m_popup->addAction("Renice...", this, SLOT(menu_renice())); m_popup->addAction( tr( "Renice..." ), this, SLOT(menu_renice()));
m_popup->addAction("Scheduling...", this, SLOT(menu_sched())); m_popup->addAction( tr( "Scheduling..." ), this, SLOT(menu_sched()));
m_popup->addSeparator(); m_popup->addSeparator();
m_popup->addAction("Terminate", this, SLOT(sig_term()), m_popup->addAction( tr( "Terminate" ), this, SLOT(sig_term()),
Qt::Key_Delete); // better Qt::Key_Delete); // better
m_popup->addAction("Hangup", this, SLOT(sig_hup()), Qt::ALT + Qt::Key_H); m_popup->addAction( tr( "Hangup" ), this, SLOT(sig_hup()), Qt::ALT + Qt::Key_H);
m_popup->addAction("Kill", this, SLOT(sig_kill()), Qt::ALT + Qt::Key_K); m_popup->addAction( tr( "Kill" ), this, SLOT(sig_kill()), Qt::ALT + Qt::Key_K);
act = m_popup->addAction("Stop", this, SLOT(sig_stop())); act = m_popup->addAction( tr( "Stop" ), this, SLOT(sig_stop()));
act->setData(MENU_SIGSTOP); act->setData(MENU_SIGSTOP);
act = m_popup->addAction("Continue", this, SLOT(sig_cont())); act = m_popup->addAction( tr( "Continue" ), this, SLOT(sig_cont()));
act->setData(MENU_SIGCONT); act->setData(MENU_SIGCONT);
// connect(m_popup, SIGNAL(aboutToShow ()),this, // connect(m_popup, SIGNAL(aboutToShow ()),this,
@ -522,44 +525,44 @@ QMenu *Qps::make_signal_popup_menu()
/// SLOT(menu_dynasty()),0,MENU_DYNASTY); /// SLOT(menu_dynasty()),0,MENU_DYNASTY);
QMenu *m = new QMenu("Other Signals"); QMenu *m = new QMenu("Other Signals");
act = m->addAction("SIGINT (interrupt)"); act = m->addAction( tr( "SIGINT (interrupt)" ) );
act->setData(SIGINT); act->setData(SIGINT);
act = m->addAction("SIGCONT (continue)"); act = m->addAction( tr( "SIGCONT (continue)" ) );
act->setData(SIGCONT); act->setData(SIGCONT);
act = m->addAction("SIGSTOP (stop)"); act = m->addAction( tr( "SIGSTOP (stop)" ) );
act->setData(SIGSTOP); act->setData(SIGSTOP);
act = m->addAction("SIGQUIT (quit)"); act = m->addAction( tr( "SIGQUIT (quit)" ) );
act->setData(SIGQUIT); act->setData(SIGQUIT);
act = m->addAction("SIGILL (illegal instruction)"); act = m->addAction( tr( "SIGILL (illegal instruction)" ));
act->setData(SIGILL); act->setData(SIGILL);
act = m->addAction("SIGABRT (abort)"); act = m->addAction( tr( "SIGABRT (abort)" ) );
act->setData(SIGABRT); act->setData(SIGABRT);
act = m->addAction("SIGFPE (floating point exception)"); act = m->addAction( tr( "SIGFPE (floating point exception)" ) );
act->setData(SIGFPE); act->setData(SIGFPE);
act = m->addAction("SIGSEGV (segmentation violation)"); act = m->addAction( tr( "SIGSEGV (segmentation violation)" ) );
act->setData(SIGSEGV); act->setData(SIGSEGV);
act = m->addAction("SIGPIPE (broken pipe)"); act = m->addAction( tr( "SIGPIPE (broken pipe)" ) );
act->setData(SIGPIPE); act->setData(SIGPIPE);
act = m->addAction("SIGALRM (timer signal)"); act = m->addAction( tr( "SIGALRM (timer signal)" ) );
act->setData(SIGALRM); act->setData(SIGALRM);
act = m->addAction("SIGUSR1 (user-defined 1)"); act = m->addAction( tr( "SIGUSR1 (user-defined 1)" ) );
act->setData(SIGUSR1); act->setData(SIGUSR1);
act = m->addAction("SIGUSR2 (user-defined 2)"); act = m->addAction( tr( "SIGUSR2 (user-defined 2)" ) );
act->setData(SIGUSR2); act->setData(SIGUSR2);
act = m->addAction("SIGCHLD (child death)"); act = m->addAction( tr( "SIGCHLD (child death)" ) );
act->setData(SIGCHLD); act->setData(SIGCHLD);
act = m->addAction("SIGTSTP (stop from tty)"); act = m->addAction( tr( "SIGTSTP (stop from tty)" ) );
act->setData(SIGTSTP); act->setData(SIGTSTP);
act = m->addAction("SIGTTIN (tty input)"); act = m->addAction( tr( "SIGTTIN (tty input)" ) );
act->setData(SIGTTIN); act->setData(SIGTTIN);
act = m->addAction("SIGTTOU (tty output)"); act = m->addAction( tr( "SIGTTOU (tty output)" ) );
act->setData(SIGTTOU); act->setData(SIGTTOU);
connect(m, SIGNAL(triggered(QAction *)), SLOT(signal_menu(QAction *))); connect(m, SIGNAL(triggered(QAction *)), SLOT(signal_menu(QAction *)));
m_popup->addMenu(m); m_popup->addMenu(m);
m_popup->addSeparator(); m_popup->addSeparator();
m_popup->addAction("View Details", this, SLOT(Action_Detail())); m_popup->addAction( tr( "View Details" ), this, SLOT(Action_Detail()));
return m; return m;
} }
@ -1175,11 +1178,11 @@ void Qps::make_command_menu()
if (flag_devel) if (flag_devel)
{ {
m_command->addAction("WatchDog", watchdogDialog, m_command->addAction( tr( "WatchDog" ), watchdogDialog,
SLOT(show())); //, m_event); SLOT(show())); //, m_event);
// m_command->addAction("ScreenShot", screenshot, // m_command->addAction("ScreenShot", screenshot,
// SLOT(show()) ); // SLOT(show()) );
act = m_command->addAction("Edit Commands...", this, act = m_command->addAction( tr( "Edit Commands..." ), this,
SLOT(menu_edit_cmd())); SLOT(menu_edit_cmd()));
// act->setEnabled(false); // act->setEnabled(false);
} }
@ -1203,8 +1206,11 @@ void Qps::make_command_menu()
//#ifdef SOLARIS //#ifdef SOLARIS
/* Solaris CDE don't have a tray, so we need a method to terminate */ /* Solaris CDE don't have a tray, so we need a method to terminate */
m_command->addSeparator(); m_command->addSeparator();
m_command->addAction(QIcon::fromTheme(QStringLiteral("application-exit")), "&Quit", this, m_command->addAction(QIcon::fromTheme(QStringLiteral("application-exit"))
SLOT(save_quit()), Qt::ALT + Qt::Key_Q); , tr( "Quit" )
, this
, SLOT(save_quit())
, Qt::ALT + Qt::Key_Q);
//#endif //#endif
} }
@ -1580,13 +1586,9 @@ void Qps::menu_renice()
if (!possible) if (!possible)
{ {
QString s; QMessageBox::warning( this
s.sprintf("You do not have permission to renice the\n" , tr( "Permission denied" )
"selected process%s.\n" , tr( "You do not have permission to renice the selected processes. Only the process owner and the super-user are allowed to do that." ) );
"Only the process owner and the super-user\n"
"are allowed to do that.",
(pstable->hasSelection() == 1) ? "" : "es");
QMessageBox::warning(this, "Permission denied", s);
return; return;
} }
@ -1621,21 +1623,16 @@ void Qps::menu_renice()
case EPERM: case EPERM:
// this shouldn't happen, but (e)uid // this shouldn't happen, but (e)uid
// could be changed... // could be changed...
s.sprintf("You do not have permission " QMessageBox::warning( this
"to renice" , tr( "Permission denied" )
" process %d (", , tr( "You do not have permission to renice process %1 (%2).Only the process owner and the super-user are allowed to do that." )
p->pid); .arg( p->pid )
s.append(p->command); .arg( p->command ) );
s.append(").\n"
"Only the process owner and "
"the super-user are"
" allowed to do that.");
QMessageBox::warning(this, "Permission denied", s);
break; break;
case EACCES: case EACCES:
QMessageBox::warning(this, "Permission denied", QMessageBox::warning( this
"Only the super-user may lower" , tr( "Permission denied" )
" the nice value of a process."); , tr( "Only the super-user may lower the nice value of a process." ) );
return; return;
} }
} }
@ -1655,9 +1652,9 @@ void Qps::menu_sched()
// if(pstable->hasSelection()==false) return; // if(pstable->hasSelection()==false) return;
if (geteuid() != 0) if (geteuid() != 0)
{ {
QMessageBox::warning(this, "Permission denied", QMessageBox::warning( this
"Only the super-user may change the\n" , tr( "Permission denied" )
"scheduling policy and static priority."); , tr( "Only the super-user may change the scheduling policy and static priority." ) );
return; return;
} }
@ -1691,18 +1688,13 @@ void Qps::menu_sched()
sp.sched_priority = sd.out_prio; sp.sched_priority = sd.out_prio;
if (sched_setscheduler(p->pid, sd.out_policy, &sp) < 0) if (sched_setscheduler(p->pid, sd.out_policy, &sp) < 0)
{ {
QString s;
if (errno == EPERM) if (errno == EPERM)
{ {
s.sprintf("You do not have permission to " QMessageBox::warning( this
"change the\n" , tr( "Permission denied" )
"scheduling and/or priority of" , tr( "You do not have permission to change the scheduling and/or priority of process %1 (%2). Only the super-user may do that." )
" process %d (", .arg( p->pid )
p->pid); .arg( p->command ) );
s.append(p->command);
s.append(").\n"
"Only the super-user may do that.");
QMessageBox::warning(this, "Permission denied", s);
break; break;
} }
} }
@ -1777,15 +1769,11 @@ void Qps::sendsig(Procinfo *p, int sig)
// user // user
if (errno == EPERM) if (errno == EPERM)
{ {
QString s; QMessageBox::warning( this
s.sprintf("You do not have permission to send a signal to" , tr( "Permission denied" )
" process %d (", , tr( "You do not have permission to send a signal to process %1 (%2). Only the super-user and the owner of the process may send signals to it." )
p->pid); .arg( p->pid )
s.append(p->command); .arg( p->command ) );
s.append(").\n"
"Only the super-user and the owner of the process"
" may send signals to it.");
QMessageBox::warning(this, "Permission denied", s);
// PermissionDialog *pd = new // PermissionDialog *pd = new
// PermissionDialog(s,supasswd); // PermissionDialog(s,supasswd);
// pd->exec(); // pd->exec();
@ -1908,8 +1896,7 @@ bool Qps::read_settings()
procview->viewfields = Procview::CUSTOM; procview->viewfields = Procview::CUSTOM;
} }
QString str = set.value("sort/field").toString(); // procview->sortcat->name int fid = procview->field_id_by_name( set.value("sort/field").toString() ); // procview->sortcat->name
int fid = procview->field_id_by_name(str.toUtf8().data());
int col = procview->findCol(fid); int col = procview->findCol(fid);
if (col >= 0) if (col >= 0)
// pstable->setSortColumn(col); // Pstable::refresh() // pstable->setSortColumn(col); // Pstable::refresh()
@ -2216,10 +2203,8 @@ int main(int argc, char **argv, char **envp)
qps = new Qps(); qps = new Qps();
// sleep(20); // sleep(20);
QString caption = ""; QString caption( QString( "%1@%2").arg( getenv( "USER" ) )
caption.append(getenv("USER")); .arg( short_hostname() ) ); // geteuid()
caption.append("@");
caption.append(short_hostname()); // geteuid()
qps->setWindowTitle(UniString(caption)); qps->setWindowTitle(UniString(caption));
qps->setWindowIcon(QPixmap((const char **)icon_xpm)); qps->setWindowIcon(QPixmap((const char **)icon_xpm));
@ -2227,12 +2212,24 @@ int main(int argc, char **argv, char **envp)
// MOVETO Systray // MOVETO Systray
QMenu *menu = new QMenu(qps); QMenu *menu = new QMenu(qps);
/// menu->addAction( UniString("About"), qps, SLOT(about()) ); /// menu->addAction( UniString("About"), qps, SLOT(about()) );
menu->addAction("Show", qps, SLOT(showNormal())); menu->addAction( QObject::tr( "Show" )
menu->addAction("Hide", qps, SLOT(hide())); , qps
, SLOT( showNormal() ) );
menu->addAction( QObject::tr( "Hide" )
, qps
, SLOT( hide() ) );
menu->addSeparator(); menu->addSeparator();
if (flag_devel) if (flag_devel)
menu->addAction("ScreenShot", qps, SLOT(start_screenshot())); {
menu->addAction("&Quit", qps, SLOT(save_quit()), Qt::ALT + Qt::Key_Q); menu->addAction( QObject::tr( "ScreenShot" )
, qps
, SLOT(start_screenshot()));
}
menu->addAction( QObject::tr( "Quit" )
, qps
, SLOT(save_quit())
, Qt::ALT + Qt::Key_Q);
trayicon = new TrayIcon(QPixmap((const char **)icon_xpm /* init icon */), trayicon = new TrayIcon(QPixmap((const char **)icon_xpm /* init icon */),
"qps", menu); "qps", menu);
@ -2269,11 +2266,7 @@ int main(int argc, char **argv, char **envp)
// 4px ;" // 4px ;"
//"background-color : rgba(0,0,0); padding: 3px; color: rgb(0,255,150); //"background-color : rgba(0,0,0); padding: 3px; color: rgb(0,255,150);
//}"); //}");
QString str; AddLog( QString( "Qps %1 launched." ).arg( QPS_VERSION ) );
str.append("Qps ");
str.append(QPS_VERSION);
str.append(" launched.");
AddLog(str);
return app.exec(); return app.exec();
} }
@ -2295,7 +2288,7 @@ void Qps::test_popup(const QUrl &link)
void Qps::about() void Qps::about()
{ {
QDialog *diag = new QDialog(this); QDialog *diag = new QDialog(this);
diag->setWindowTitle("About"); diag->setWindowTitle( tr( "About" ) );
QVBoxLayout *lay = new QVBoxLayout(diag); QVBoxLayout *lay = new QVBoxLayout(diag);
QLabel *label = new QLabel(diag); QLabel *label = new QLabel(diag);
@ -2315,43 +2308,41 @@ void Qps::about()
// QDesktopServices::openUrl(QUrl("file:///", QUrl::TolerantMode)); // QDesktopServices::openUrl(QUrl("file:///", QUrl::TolerantMode));
// //
QString str("<h2> qps " QPS_VERSION " - A Visual Process Manager </h2> " QString str( tr( "<h2> Qps %1 - A Visual Process Manager </h2> %2 using Qt library %3"
"<br><br>"
"<b>Source: </b><a href=\"https://github.com/lxqt/qps\">https://github.com/lxqt/qps/</a>"
"<br>"
"<b>Bugtracker: </b><a href=\"https://github.com/lxqt/qps/issues\">https://github.com/lxqt/qps/issues</a>")
.arg( QPS_VERSION )
.arg(
#ifdef SOLARIS #ifdef SOLARIS
#ifdef _LP64 #ifdef _LP64
"64-bit " "64-bit "
#else #else
"32-bit " "32-bit "
#endif #endif
"Solaris version " "Solaris version "
#else
""
#endif // SOLARIS #endif // SOLARIS
"using Qt library "); )
.arg( qVersion() ) );
str.append(qVersion()); label->setText( str );
str.append("<br><br>" str.append( tr( "<b>Original Qps by</b><br>"
"<b>Source: </b><a href=\"https://github.com/lxqt/qps\">https://github.com/lxqt/qps/</a>" "Mattias Engdegård (f91-men@nada.kth.se)<br><br>"
"<br>" "<b>Contributors</b><br>"
"<b>Bugtracker: </b><a href=\"https://github.com/lxqt/qps/issues\">https://github.com/lxqt/qps/issues</a>" "Olivier.Daudel@u-paris10.fr<br>"
); "jsanchez@todounix.homeip.net <br>"
"daehyun.yang@gmail.com <br>"
label->setText(str); "Luís Pereira (luis.artur.pereira@gmail.com)<br>"
"Alf Gaida (agaida@siduction.org)<br>"
str = ""; "Paulo Lieuthier (paulolieuthier@gmail.com)<br>"
str.append("<b>Original Qps by</b><br>" "Jerome Leclanche (jerome@leclan.ch)<br>" ) );
"Mattias Engdegård (f91-men@nada.kth.se)<br><br>"
"<b>Contributors</b><br>"
"Olivier.Daudel@u-paris10.fr<br>"
"jsanchez@todounix.homeip.net <br>"
"daehyun.yang@gmail.com <br>"
"Luís Pereira (luis.artur.pereira@gmail.com)<br>"
"Alf Gaida (agaida@siduction.org)<br>"
"Paulo Lieuthier (paulolieuthier@gmail.com)<br>"
"Jerome Leclanche (jerome@leclan.ch)<br>"
);
browser->setText(str); browser->setText(str);
QDialogButtonBox *bbox = QDialogButtonBox *bbox = new QDialogButtonBox( QDialogButtonBox::Ok
new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, diag); , Qt::Horizontal
, diag );
lay->addWidget(bbox); lay->addWidget(bbox);
@ -2379,38 +2370,37 @@ void Qps::license() // -> help()
// QLabel::setOpenExternalLinks ( bool open ); // QLabel::setOpenExternalLinks ( bool open );
browser->setOpenExternalLinks(true); browser->setOpenExternalLinks(true);
browser->setOpenLinks(true); browser->setOpenLinks(true);
browser->setText( browser->setText( tr( "<H1>QPS Help</H1>"
"<H1>QPS Help</H1>" "Updated: May 24 2005<BR>"
"Updated: May 24 2005<BR>" "<A "
"<A " "HREF=\"http://kldp.net/projects/qps\">http://kldp.net/projects/"
"HREF=\"http://kldp.net/projects/qps\">http://kldp.net/projects/" "qps</"
"qps</" "A><HR>"
"A><HR>"
"<table style=\"text-align: center; width: 100%;\" border=\"1\""
"<table style=\"text-align: center; width: 100%;\" border=\"1\"" " cellpadding=\"1\" cellspacing=\"0\">"
" cellpadding=\"1\" cellspacing=\"0\">" " <tbody>"
" <tbody>" " <tr>"
" <tr>" " <td"
" <td" " style=\"vertical-align: top; background-color: rgb(204, 204, "
" style=\"vertical-align: top; background-color: rgb(204, 204, " "204);\">Quit"
"204);\">Quit" " </td>"
" </td>" " <td >&nbsp; CTRL + q , CTRL + x"
" <td >&nbsp; CTRL + q , CTRL + x" " </td>"
" </td>" " </tr>"
" </tr>" " <tr>"
" <tr>" " <td"
" <td" " style=\"vertical-align: top; background-color: rgb(204, 204, "
" style=\"vertical-align: top; background-color: rgb(204, 204, " "204);\">Update"
"204);\">Update" " </td>"
" </td>" " <td>&nbsp;Space , Enter "
" <td>&nbsp;Space , Enter " " </td>"
" </td>" " </tr>"
" </tr>" " <tr><td> process Terminate </td> <td> ALT + T , DELETE </td> "
" <tr><td> process Terminate </td> <td> ALT + T , DELETE </td> " "</tr>"
"</tr>" " <tr><td> process Kill </td> <td> ALT + K </td> </tr>"
" <tr><td> process Kill </td> <td> ALT + K </td> </tr>" " </tbody>"
" </tbody>" "</table>" ) );
"</table>");
diag->exec(); diag->exec();
} }

@ -23,13 +23,15 @@
#ifndef TABLEFIELD_H #ifndef TABLEFIELD_H
#define TABLEFIELD_H #define TABLEFIELD_H
#include <QString>
struct TableField struct TableField
{ {
const char *name; QString name;
int width; int width;
int gap; int gap;
int align; int align;
const char *tooltip; QString tooltip;
}; };
#endif // TABLEFIELD_H #endif // TABLEFIELD_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -190,8 +190,8 @@ void WatchdogDialog::checkCombo()
if (comboBox->count() == 1) if (comboBox->count() == 1)
{ {
comboBox->clear(); comboBox->clear();
comboBox->addItem("if process start"); comboBox->addItem(tr( "if process start" ) );
comboBox->addItem("if process finish"); comboBox->addItem(tr( "if process finish" ) );
return; return;
} }
} }
@ -214,7 +214,7 @@ void WatchdogDialog::_new()
command->clear(); command->clear();
message->clear(); message->clear();
comboBox->clear(); comboBox->clear();
comboBox->addItem("select condition"); comboBox->addItem( tr( "select condition" ) );
} }
void WatchdogDialog::add() void WatchdogDialog::add()

Loading…
Cancel
Save