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
========================

@ -1,40 +1,31 @@
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(qps)
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
# 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)
# 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(MINOR_VERSION 10)
set(PATCH_VERSION 18)
set(PATCH_VERSION 19)
set(QPS_VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION})
add_definitions(
-DQPS_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}"
-DQT_NO_FOREACH
)
# C++11 support
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
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)
# Minimum Versions
set(LXQTBT_MINIMUM_VERSION "0.6.0")
set(QT_MINIMUM_VERSION "5.7.1")
find_package(Qt5 ${QT_MINIMUM_VERSION} REQUIRED COMPONENTS Widgets X11Extras DBus LinguistTools)
find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
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(Qt5TranslationLoader)

@ -9,8 +9,9 @@
Qps is licensed under the terms of the
[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">
<img src="https://weblate.lxqt.org/widgets/qps/-/qps/287x66-grey.png" alt="Translation status" />
### Translation (Weblate)
<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>

@ -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
* 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>
Section: x11
Priority: optional
Build-Depends: debhelper (>= 11~),
Build-Depends: debhelper-compat (= 12),
cmake,
libxrender-dev,
libqt5x11extras5-dev,
lxqt-build-tools (>= 0.6.0~),
qttools5-dev,
qttools5-dev-tools
Standards-Version: 4.1.4
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/lxqt-team/qps
Vcs-Git: https://salsa.debian.org/lxqt-team/qps.git
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/
Upstream-Name: qps
Source: http://github.com/lxqt/qps
Source: https://github.com/lxqt/qps
Files: *
Copyright: 1997-1999 Mattias Engdegård
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
Copyright: Copyright 2005-2011 Kitware, Inc.
License: BSD-3-clause
@ -35,7 +30,7 @@ Copyright: 2003 Justin Karneges
License: LGPL-2.1+
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>
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
Name=qps
GenericName=Qt process manager
GenericName[ca]=Gestor de processos Qt
GenericName[da]=Qt-proceshåndtering
GenericName[lt]=Qt procesų tvarkytuvė
GenericName[pl]=Menedżer procesów Qt
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[lt]=Qt programa, skirta rodyti ir tvarkyti vykdomus procesus
Comment[pl]=Aplikacja Qt do wyświetlania i zarządzania uruchomionymi procesami
Icon=qps
Categories=System;

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

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

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

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

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

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

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

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

@ -31,7 +31,7 @@ FieldSelect::FieldSelect(Procview *pv)
int half = (nbuttons + 1) / 2;
updating = false;
setWindowTitle("Select Custom Fields ");
setWindowTitle(tr( "Select Custom Fields " ) );
QBoxLayout *v_layout = new QVBoxLayout;
setLayout(v_layout);
@ -65,7 +65,7 @@ FieldSelect::FieldSelect(Procview *pv)
}
update_boxes();
QPushButton *closebut = new QPushButton("Close", this);
QPushButton *closebut = new QPushButton( tr( "Close" ), this);
connect(closebut, SIGNAL(clicked()), SLOT(closed()));
closebut->setFocus();
@ -82,7 +82,7 @@ void FieldSelect::field_toggled(bool)
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))
{
@ -116,7 +116,7 @@ void FieldSelect::update_boxes()
updating = true;
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));
}
updating = false;

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

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

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

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

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

@ -90,7 +90,7 @@ int Category::compare(Procinfo *a, Procinfo *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)
: Category(heading, explain), int_member(member), field_width(w)
{
@ -111,7 +111,7 @@ int Cat_int::compare(Procinfo *a, Procinfo *b)
}
// 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)
: 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);
}
// 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)
: 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;
}
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)
: 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;
}
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)
: Cat_uintl(heading, explain, w, member)
{
@ -205,7 +205,7 @@ QString Cat_hex::string(Procinfo *p)
}
// COMMON,
Cat_swap::Cat_swap(const char *heading, const char *explain)
Cat_swap::Cat_swap(const QString &heading, const QString &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);
}
Cat_string::Cat_string(const char *heading, const char *explain,
Cat_string::Cat_string(const QString &heading, const QString &explain,
QString Procinfo::*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; }
Cat_user::Cat_user(const char *heading, const char *explain)
Cat_user::Cat_user(const QString &heading, const QString &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)
{
}
@ -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)
{
}
@ -292,7 +292,7 @@ QString Cat_wchan::string(Procinfo *p)
#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)
{
}
@ -329,7 +329,7 @@ QString Cat_cmdline::string(Procinfo *p)
}
// 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)
{
}
@ -799,21 +799,19 @@ int Procview::compare_backwards(Procinfo *const *a, Procinfo *const *b)
}
// COMMON
Category *Proc::cat_by_name(const char *s)
Category *Proc::cat_by_name( const QString &s )
{
if (s)
if ( ! s.isNull() )
{
// java style
QHashIterator<int, Category *> i(categories);
while (i.hasNext())
{
const char *p;
i.next();
p = i.value()->name;
if (*p == ' ')
p++;
if (strcmp(p, s) == 0)
const QString &p = i.value()->name;
int index = p.indexOf( QRegExp( "\\S" ) );
if ( p.indexOf( s, index ) == index )
return i.value();
// cout << i.key() << ": " << i.value() << endl;
}
@ -823,15 +821,15 @@ Category *Proc::cat_by_name(const char *s)
// COMMON
// 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
QHash<int, Category *>::iterator i = categories.begin();
while (i != categories.end())
{
if (strcmp(i.value()->name, s) == 0)
if ( i.value()->name == s )
return i.key(); // cout << i.key() << ": " <<
// i.value() << endl;
++i;

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

@ -23,13 +23,15 @@
#ifndef TABLEFIELD_H
#define TABLEFIELD_H
#include <QString>
struct TableField
{
const char *name;
QString name;
int width;
int gap;
int align;
const char *tooltip;
QString tooltip;
};
#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)
{
comboBox->clear();
comboBox->addItem("if process start");
comboBox->addItem("if process finish");
comboBox->addItem(tr( "if process start" ) );
comboBox->addItem(tr( "if process finish" ) );
return;
}
}
@ -214,7 +214,7 @@ void WatchdogDialog::_new()
command->clear();
message->clear();
comboBox->clear();
comboBox->addItem("select condition");
comboBox->addItem( tr( "select condition" ) );
}
void WatchdogDialog::add()

Loading…
Cancel
Save